diff --git a/about_fonts.py b/about_fonts.py new file mode 100644 index 000000000..d1e5bb410 --- /dev/null +++ b/about_fonts.py @@ -0,0 +1,28 @@ +"""Prints info about emoji fonts.""" + +from fontTools import ttLib +from pathlib import Path +import sys + + +def main(): + font_files = sorted(p for p in (Path(__file__).parent / "fonts").iterdir() if p.suffix == ".ttf") + max_name_len = max(len(p.name) for p in font_files) + + for font_file in font_files: + font = ttLib.TTFont(font_file) + + font_type = [] + if "CBDT" in font: + font_type.append("CBDT") + if "COLR" in font: + font_type.append("COLR") + if "meta" in font and "Emji" in font["meta"].data: + font_type.append("EmojiCompat") + font_type = ",".join(font_type) + + print(f"{font_file.name:{max_name_len + 1}} {font_type}") + + +if __name__ == '__main__': + main() diff --git a/drop_flags.py b/drop_flags.py index 7209f2487..aaee55830 100644 --- a/drop_flags.py +++ b/drop_flags.py @@ -23,23 +23,17 @@ def main(argv): assert font_file.is_file(), font_file noflags_file = font_file.with_stem(font_file.stem + "-noflags") - font = ttLib.TTFont(font_file) if noflags_file.is_file(): - print(font_file, f"({font_type}) already has", noflags_file, "; nop") + print(font_file, "already has", noflags_file, "; nop") continue + font = ttLib.TTFont(font_file) + cps = codepoints(font) cps_without_flags = {cp for cp in cps if not is_regional_indicator(cp)} - font_type = [] - if "CBDT" in font: - font_type.append("CBDT") - if "COLR" in font: - font_type.append("COLR") - font_type = "_".join(font_type) - if cps == cps_without_flags: - print(font_file, f"({font_type}) has no regional indicators") + print(font_file, "has no regional indicators") continue subsetter = subset.Subsetter() @@ -47,7 +41,7 @@ def main(argv): subsetter.subset(font) font.save(noflags_file) - print(font_file, f"({font_type}) =>" , noflags_file) + print(font_file, "=>" , noflags_file) if __name__ == '__main__': diff --git a/fonts/Noto-COLRv1-emojicompat.ttf b/fonts/Noto-COLRv1-emojicompat.ttf new file mode 100644 index 000000000..c67132dfb Binary files /dev/null and b/fonts/Noto-COLRv1-emojicompat.ttf differ diff --git a/fonts/NotoColorEmoji-emojicompat.ttf b/fonts/NotoColorEmoji-emojicompat.ttf new file mode 100644 index 000000000..b1153b3a7 Binary files /dev/null and b/fonts/NotoColorEmoji-emojicompat.ttf differ