Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Emscripten's FreeType fails to open NotoColorEmoji with "unknown file format" #3

Open
albertvaka opened this issue Jan 14, 2021 · 5 comments

Comments

@albertvaka
Copy link

Google Noto is a family of free fonts. Within it, NotoColorEmoji contains all emojis, but no regular characters. It can be downloaded from the official site: https://www.google.com/get/noto/

Emscripten's port of FreeType fails to read NotoColorEmoji, but the same code works compiled natively.

Test program:

#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_ERRORS_H
int main() {
	FT_Library ft;
	FT_Face ftface;
  	FT_Error fterr;
  	fterr = FT_Init_FreeType(&ft);
  	if (fterr) {
	    printf("FT_Init_FreeType: %s\n", GetErrorString(fterr));
	    return;
  	}
	fterr = FT_New_Face(ft, "data/NotoColorEmoji.ttf", 0, &ftface);
	if (fterr) {
		printf("FT_New_Face: %s\n", GetErrorString(fterr));
		return;
	}
}

Output:

FT_New_Face: unknown file format
@HinTak
Copy link

HinTak commented Jun 17, 2022

It is just that 2.6 is very old and before support for colour fonts (which emoji's are).

@albertvaka
Copy link
Author

albertvaka commented Jun 19, 2022

According to https://freetype.org/ "color embedded bitmaps" are supported since 2.5, though.

@HinTak
Copy link

HinTak commented Jun 24, 2022

Hmm, somehow my reply didn't make it - anyway, there are 4 colour font formats in total, one from each of Apple, Microsoft, Google, and Adobe + Mozilla . FreeType 2.5 was likely the first version when one of the four first appeared! As far as I know the last one was still being improved as of 2.12 .

@HinTak
Copy link

HinTak commented Oct 11, 2022 via email

@HinTak
Copy link

HinTak commented Oct 11, 2022

I thought I commented elsewhere - see also rougier/freetype-py#154 - some of the colour font formats requires libpng . It is an optional dependency of freetype: without it, a few font formats don't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants