Support subregion flags when building the emoji font.
- update Makefile to include approved GB subregion flags by default - update flag_glyph_name to generate sequence names for these - fix bug where the glyphorder table wasn't getting updated with components, which was causing ttx to fail when compiling the ttx to ttf in a later phase.pull/87/head
parent
763a0f5155
commit
57ec57dfd6
4
Makefile
4
Makefile
|
@ -70,7 +70,9 @@ SELECTED_FLAGS = AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ \
|
|||
VA VC VE VG VI VN VU \
|
||||
WS \
|
||||
YE \
|
||||
ZA ZM ZW
|
||||
ZA ZM ZW \
|
||||
GB-ENG GB-SCT GB-WLS
|
||||
|
||||
ALL_FLAGS = $(basename $(notdir $(wildcard $(FLAGS_SRC_DIR)/*.png)))
|
||||
|
||||
FLAGS = $(SELECTED_FLAGS)
|
||||
|
|
|
@ -18,18 +18,38 @@
|
|||
|
||||
__author__ = 'roozbeh@google.com (Roozbeh Pournader)'
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
import add_emoji_gsub
|
||||
|
||||
def two_letter_code_to_glyph_name(iso_code):
|
||||
def two_letter_code_to_glyph_name(region_code):
|
||||
return 'u%04x_%04x' % (
|
||||
add_emoji_gsub.reg_indicator(iso_code[0]),
|
||||
add_emoji_gsub.reg_indicator(iso_code[1]))
|
||||
add_emoji_gsub.reg_indicator(region_code[0]),
|
||||
add_emoji_gsub.reg_indicator(region_code[1]))
|
||||
|
||||
|
||||
subcode_re = re.compile(r'[0-9a-z]{2}-[0-9a-z]+$')
|
||||
def hyphenated_code_to_glyph_name(sub_code):
|
||||
# Hyphenated codes use tag sequences, not regional indicator symbol pairs.
|
||||
sub_code = sub_code.lower()
|
||||
if not subcode_re.match(sub_code):
|
||||
raise Exception('%s is not a valid flag subcode' % sub_code)
|
||||
cps = ['u1f3f3']
|
||||
cps.extend('e00%02x' % ord(cp) for cp in sub_code if cp != '-')
|
||||
cps.append('e007f')
|
||||
return '_'.join(cps)
|
||||
|
||||
|
||||
def flag_code_to_glyph_name(flag_code):
|
||||
if '-' in flag_code:
|
||||
return hyphenated_code_to_glyph_name(flag_code)
|
||||
return two_letter_code_to_glyph_name(flag_code)
|
||||
|
||||
|
||||
def main():
|
||||
print ' '.join([
|
||||
two_letter_code_to_glyph_name(iso_code) for iso_code in sys.argv[1:]])
|
||||
flag_code_to_glyph_name(flag_code) for flag_code in sys.argv[1:]])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -195,6 +195,7 @@ for (u, filename) in img_pairs:
|
|||
cp = ord(char)
|
||||
if cp not in c and not is_vs(cp):
|
||||
name = glyph_name (char)
|
||||
g.append(name)
|
||||
c[cp] = name
|
||||
if len (u) > 1:
|
||||
h[name] = [0, 0]
|
||||
|
|
Loading…
Reference in New Issue