Fixmore fontchain_lint issues
parent
f46188ee49
commit
d0bcf99532
|
@ -16,6 +16,6 @@ contains emojicompat metadata.
|
|||
|
||||
```shell
|
||||
# Assumed to be in a python3 environment with requirements.txt fulfilled
|
||||
python postproc.py build/NotoColorEmoji-noflags.ttf \
|
||||
python colrv1_postproc.py colrv1/build/NotoColorEmoji-noflags.ttf \
|
||||
PATH_TO/NotoColorEmojiCompat.ttf
|
||||
```
|
|
@ -1 +0,0 @@
|
|||
nanoemoji >= 0.9.12 # we need latest spec support
|
|
@ -5,6 +5,9 @@ For now substantially based on copying from a correct bitmap build.
|
|||
"""
|
||||
from absl import app
|
||||
from fontTools import ttLib
|
||||
import map_pua_emoji
|
||||
from nototools import add_vs_cmap
|
||||
from nototools import unicode_data
|
||||
|
||||
|
||||
def _is_colrv1(font):
|
||||
|
@ -46,6 +49,13 @@ def _copy_names(colr_font, cbdt_font):
|
|||
# Amendments
|
||||
_set_name(name_table, 10, "Color emoji font using COLRv1.")
|
||||
_set_name(name_table, 11, "https://github.com/googlefonts/noto-emoji")
|
||||
_set_name(name_table, 12, "https://github.com/googlefonts/noto-emoji")
|
||||
|
||||
|
||||
# CBDT build step: @$(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua"
|
||||
def _add_vs_cmap(colr_font):
|
||||
emoji_variants = unicode_data.get_unicode_emoji_variants() | {0x2640, 0x2642, 0x2695}
|
||||
add_vs_cmap.modify_font("COLRv1 Emoji", colr_font, "emoji", emoji_variants)
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
@ -63,7 +73,12 @@ def main(argv):
|
|||
_copy_emojicompat_data(colr_font, cbdt_font)
|
||||
_copy_names(colr_font, cbdt_font)
|
||||
|
||||
colr_font.save('../fonts/Noto-COLRv1-noflags.ttf')
|
||||
# CBDT build step: @$(PYTHON) $(PUA_ADDER) "$@" "$@-with-pua"
|
||||
map_pua_emoji.add_pua_cmap_to_font(colr_font)
|
||||
|
||||
_add_vs_cmap(colr_font)
|
||||
|
||||
colr_font.save('fonts/Noto-COLRv1-noflags.ttf')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
Binary file not shown.
|
@ -50,9 +50,7 @@ def get_glyph_name_from_gsub(char_seq, font):
|
|||
return None
|
||||
|
||||
|
||||
def add_pua_cmap(source_file, target_file):
|
||||
"""Add PUA characters to the cmap of the first font and save as second."""
|
||||
font = ttLib.TTFont(source_file)
|
||||
def add_pua_cmap_to_font(font):
|
||||
cmap = font_data.get_cmap(font)
|
||||
for pua, (ch1, ch2) in itertools.chain(
|
||||
add_emoji_gsub.EMOJI_KEYCAPS.items(), add_emoji_gsub.EMOJI_FLAGS.items()
|
||||
|
@ -61,6 +59,12 @@ def add_pua_cmap(source_file, target_file):
|
|||
glyph_name = get_glyph_name_from_gsub([ch1, ch2], font)
|
||||
if glyph_name is not None:
|
||||
cmap[pua] = glyph_name
|
||||
|
||||
|
||||
def add_pua_cmap(source_file, target_file):
|
||||
"""Add PUA characters to the cmap of the first font and save as second."""
|
||||
font = ttLib.TTFont(source_file)
|
||||
add_pua_cmap_to_font(font)
|
||||
font.save(target_file)
|
||||
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
fonttools>=4.7.0
|
||||
notofonttools>=0.2.16
|
||||
nanoemoji >= 0.9.12 # we need latest spec support
|
||||
|
|
Loading…
Reference in New Issue