def main(argv): """Subset the Noto Symbols font which is given as the argument.""" source_file_name = argv[1] target_coverage = { 0x20BA, # TURKISH LIRA SIGN 0x20BC, # MANAT SIGN 0x20BD, # RUBLE SIGN 0x22EE, # VERTICAL ELLIPSIS 0x25AB, # WHITE SMALL SQUARE 0x25FB, # WHITE MEDIUM SQUARE 0x25FC, # BLACK MEDIUM SQUARE 0x25FD, # WHITE MEDIUM SMALL SQUARE 0x25FE, # BLACK MEDIUM SMALL SQUARE 0x2600, # BLACK SUN WITH RAYS 0x266B, # BEAMED EIGHTH NOTES 0x26AA, # MEDIUM WHITE CIRCLE 0x26AB, # MEDIUM BLACK CIRCLE 0x2757, # HEAVY EXCLAMATION MARK SYMBOL 0x2934, # ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS 0x2935, # ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS 0x2B05, # LEFTWARDS BLACK ARROW 0x2B06, # UPWARDS BLACK ARROW 0x2B07, # DOWNWARDS BLACK ARROW 0x2B1B, # BLACK LARGE SQUARE 0x2B1C, # WHITE LARGE SQUARE 0x2B50, # WHITE MEDIUM STAR 0x2B55, # HEAVY LARGE CIRCLE } target_coverage.update(range(0x2800, 0x28FF + 1)) # Braille symbols subset.subset_font(source_file_name, 'NotoSansSymbols-Regular-Subsetted.ttf', include=target_coverage)
def main(argv): """Subset the Noto Symbols font. The first argument is the source file name, and the second argument is the target file name. """ target_coverage = set() # Add all characters in BLOCKS_TO_INCLUDE for first, last, _ in unicode_data._parse_code_ranges(BLOCKS_TO_INCLUDE): target_coverage.update(range(first, last + 1)) # Add one-off characters target_coverage |= ONE_OFF_ADDITIONS # Remove characters preferably coming from Roboto target_coverage -= LETTERLIKE_CHARS_IN_ROBOTO # Remove characters that are supposed to default to emoji target_coverage -= BMP_DEFAULT_EMOJI | ANDROID_EMOJI # Remove dentistry symbols, as their main use appears to be for CJK: # http://www.unicode.org/L2/L2000/00098-n2195.pdf target_coverage -= set(range(0x23BE, 0x23CC + 1)) # Remove COMBINING ENCLOSING KEYCAP. It's needed for Android's color emoji # mechanism to work properly target_coverage.remove(0x20E3) source_file_name = argv[1] target_file_name = argv[2] subset.subset_font(source_file_name, target_file_name, include=target_coverage)
def main(argv): """Subset a Noto Serif font. The first argument is the source file name, and the second argument is the target file name. """ source_file_name = argv[1] target_file_name = argv[2] subset.subset_font(source_file_name, target_file_name, exclude=ANDROID_EMOJI)
def main(argv): """Subset a Noto Serif font. The first argument is the source file name, and the second argument is the target file name. """ source_file_name = argv[1] target_file_name = argv[2] subset.subset_font( source_file_name, target_file_name, exclude=ANDROID_EMOJI)
def main(argv): """Subset the first argument to second, dropping unused parts of the font. """ charlist = read_charlist('res/charsets/web.txt') # Add private use characters for legacy reasons charlist += [0xEE01, 0xEE02, 0xF6C3] features_to_keep = [ 'c2sc', 'ccmp', 'cpsp', 'dlig', 'dnom', 'frac', 'kern', 'liga', 'lnum', 'locl', 'numr', 'onum', 'pnum', 'smcp', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'tnum'] source_filename = argv[1] target_filename = argv[2] subset.subset_font( source_filename, target_filename, include=charlist, options={'layout_features': features_to_keep})
def main(argv): """Subset the first argument to second, dropping unused parts of the font. """ charlist = read_charlist('res/charsets/web.txt') # Add private use characters for legacy reasons charlist += [0xEE01, 0xEE02, 0xF6C3] features_to_keep = [ 'c2sc', 'ccmp', 'cpsp', 'dlig', 'dnom', 'frac', 'kern', 'liga', 'lnum', 'locl', 'numr', 'onum', 'pnum', 'smcp', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'tnum' ] source_filename = argv[1] target_filename = argv[2] subset.subset_font(source_filename, target_filename, include=charlist, options={'layout_features': features_to_keep})
def main(argv): """Subset the Noto Symbols font. The first argument is the source file name, and the second argument is the target file name. """ target_coverage = set() # Add all characters in BLOCKS_TO_INCLUDE for first, last, _ in unicode_data._parse_code_ranges(BLOCKS_TO_INCLUDE): target_coverage.update(range(first, last+1)) # Add one-off characters target_coverage |= ONE_OFF_ADDITIONS # Remove characters preferably coming from Roboto target_coverage -= LETTERLIKE_CHARS_IN_ROBOTO # Remove characters that are supposed to default to emoji android_emoji = get_android_emoji() target_coverage -= DEFAULT_EMOJI | android_emoji # Remove dentistry symbols, as their main use appears to be for CJK: # http://www.unicode.org/L2/L2000/00098-n2195.pdf target_coverage -= set(range(0x23BE, 0x23CC+1)) # Remove COMBINING ENCLOSING KEYCAP. It's needed for Android's color emoji # mechanism to work properly. target_coverage.remove(0x20E3) source_file_name = argv[1] target_file_name = argv[2] subset.subset_font( source_file_name, target_file_name, include=target_coverage) second_subset_coverage = DEFAULT_EMOJI | android_emoji second_subset_file_name = argv[3] subset.subset_font( source_file_name, second_subset_file_name, include=second_subset_coverage)
def subset_symbols(srcdir, dstdir): """Subset Noto Sans Symbols in a curated way. Noto Sans Symbols is now subsetted in a curated way. Changes include: * Currency symbols now included in Roboto are removed. * All combining marks for symbols (except for combining keycap) are added, to combine with other symbols if needed. * Characters in symbol blocks that are also covered by Noto CJK fonts are added, for better harmony with the rest of the fonts in non-CJK settings. The dentistry characters at U+23BE..23CC are not added, since they appear to be Japan-only and full-width. * Characters that UTR #51 defines as default text are added, although they may also exist in the color emoji font, to make sure they get a default text style. * Characters that UTR #51 defines as default emoji are removed, to make sure they don't block the fallback to the color emoji font. * A few math symbols that are currently included in Roboto are added, to prepare for potentially removing them from Roboto when they are lower-quality in Roboto. Based on subset_noto_sans_symbols.py from AOSP external/noto-fonts.""" # TODO see if we need to change this subset based on Noto Serif coverage # (so the serif fallback chain would support them) target_coverage = set() # Add all characters in BLOCKS_TO_INCLUDE for first, last, _ in unicode_data._parse_code_ranges(BLOCKS_TO_INCLUDE): target_coverage.update(range(first, last + 1)) # Add one-off characters target_coverage |= ONE_OFF_ADDITIONS # Remove characters preferably coming from Roboto target_coverage -= LETTERLIKE_CHARS_IN_ROBOTO # Remove default emoji presentation (including ones Android prefers default) target_coverage -= EMOJI # Remove COMBINING ENCLOSING KEYCAP. It's needed for Android's color emoji # mechanism to work properly target_coverage.remove(0x20E3) # Remove dentistry symbols, as their main use appears to be for CJK: # http://www.unicode.org/L2/L2000/00098-n2195.pdf target_coverage -= set(range(0x23BE, 0x23CC + 1)) for font_file in glob.glob(path.join(srcdir, 'NotoSansSymbols-*.ttf')): print 'main subset', font_file out_file = path.join(dstdir, path.basename(font_file)[:-4] + '-Subsetted.ttf') subset.subset_font(font_file, out_file, include=target_coverage) # The second subset will be a fallback after the color emoji, for # explicit text presentation sequences. target_coverage = EMOJI | unicode_data.get_unicode_emoji_variants() for font_file in glob.glob(path.join(srcdir, 'NotoSansSymbols-*.ttf')): print 'secondary subset', font_file out_file = path.join(dstdir, path.basename(font_file)[:-4] + '-Subsetted2.ttf') subset.subset_font(font_file, out_file, include=target_coverage)
def subset_symbols(srcdir, dstdir): """Subset Noto Sans Symbols in a curated way. Noto Sans Symbols is now subsetted in a curated way. Changes include: * Currency symbols now included in Roboto are removed. * All combining marks for symbols (except for combining keycap) are added, to combine with other symbols if needed. * Characters in symbol blocks that are also covered by Noto CJK fonts are added, for better harmony with the rest of the fonts in non-CJK settings. The dentistry characters at U+23BE..23CC are not added, since they appear to be Japan-only and full-width. * Characters that UTR #51 defines as default text are added, although they may also exist in the color emoji font, to make sure they get a default text style. * Characters that UTR #51 defines as default emoji are removed, to make sure they don't block the fallback to the color emoji font. * A few math symbols that are currently included in Roboto are added, to prepare for potentially removing them from Roboto when they are lower-quality in Roboto. Based on subset_noto_sans_symbols.py from AOSP external/noto-fonts.""" # TODO see if we need to change this subset based on Noto Serif coverage # (so the serif fallback chain would support them) target_coverage = set() # Add all characters in BLOCKS_TO_INCLUDE for first, last, _ in unicode_data._parse_code_ranges(BLOCKS_TO_INCLUDE): target_coverage.update(range(first, last+1)) # Add one-off characters target_coverage |= ONE_OFF_ADDITIONS # Remove characters preferably coming from Roboto target_coverage -= LETTERLIKE_CHARS_IN_ROBOTO # Remove default emoji presentation (including ones Android prefers default) target_coverage -= EMOJI # Remove COMBINING ENCLOSING KEYCAP. It's needed for Android's color emoji # mechanism to work properly target_coverage.remove(0x20E3) # Remove dentistry symbols, as their main use appears to be for CJK: # http://www.unicode.org/L2/L2000/00098-n2195.pdf target_coverage -= set(range(0x23BE, 0x23CC+1)) for font_file in glob.glob(path.join(srcdir, 'NotoSansSymbols-*.ttf')): print 'main subset', font_file out_file = path.join( dstdir, path.basename(font_file)[:-4] + '-Subsetted.ttf') subset.subset_font(font_file, out_file, include=target_coverage) # The second subset will be a fallback after the color emoji, for # explicit text presentation sequences. target_coverage = EMOJI | unicode_data.get_unicode_emoji_variants() for font_file in glob.glob(path.join(srcdir, 'NotoSansSymbols-*.ttf')): print 'secondary subset', font_file out_file = path.join( dstdir, path.basename(font_file)[:-4] + '-Subsetted2.ttf') subset.subset_font(font_file, out_file, include=target_coverage)
0x2B746, # CJK UNIFIED IDEOGRAPH-2B746 0x2B751, # CJK UNIFIED IDEOGRAPH-2B751 0x2B753, # CJK UNIFIED IDEOGRAPH-2B753 0x2B75A, # CJK UNIFIED IDEOGRAPH-2B75A 0x2B75C, # CJK UNIFIED IDEOGRAPH-2B75C 0x2B765, # CJK UNIFIED IDEOGRAPH-2B765 0x2B776, # CJK UNIFIED IDEOGRAPH-2B776 0x2B777, # CJK UNIFIED IDEOGRAPH-2B777 0x2B77C, # CJK UNIFIED IDEOGRAPH-2B77C 0x2B782, # CJK UNIFIED IDEOGRAPH-2B782 0x2B789, # CJK UNIFIED IDEOGRAPH-2B789 0x2B78B, # CJK UNIFIED IDEOGRAPH-2B78B 0x2B78E, # CJK UNIFIED IDEOGRAPH-2B78E 0x2B794, # CJK UNIFIED IDEOGRAPH-2B794 0x2B7AC, # CJK UNIFIED IDEOGRAPH-2B7AC 0x2B7AF, # CJK UNIFIED IDEOGRAPH-2B7AF 0x2B7BD, # CJK UNIFIED IDEOGRAPH-2B7BD 0x2B7C9, # CJK UNIFIED IDEOGRAPH-2B7C9 0x2B7CF, # CJK UNIFIED IDEOGRAPH-2B7CF 0x2B7D2, # CJK UNIFIED IDEOGRAPH-2B7D2 0x2B7D8, # CJK UNIFIED IDEOGRAPH-2B7D8 0x2B7F0, # CJK UNIFIED IDEOGRAPH-2B7F0 0x2B80D, # CJK UNIFIED IDEOGRAPH-2B80D 0x2B817, # CJK UNIFIED IDEOGRAPH-2B817 0x2B81A, # CJK UNIFIED IDEOGRAPH-2B81A ] subset.subset_font('NotoSansJP-Regular.otf', 'NotoSansJP-Regular-Subsetted.otf', include=CHARSET)