From e95ec27dd6a345d78225f502f109c3c4d98280ab Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Wed, 31 Mar 2021 20:36:20 +0000 Subject: Revert "Rename the font file with PostScript name based file name" Revert "Update ImageGenerator to match the latest font names." Revert "Rename font file with PostScript based names" Revert submission 1606485-rename_fonts Reason for revert: font file name requirement was removed. Reverted Changes: Iab8b9d65a:Update ImageGenerator to match the latest font nam... Ifbe99d68c:Rename the font file with PostScript name based fi... I307c21531:Rename font file with PostScript based names Change-Id: I95a52403590127f1762c7551edff9805096daf79 Merged-In: I6bd807ce0df6cd81e44bf89918ac4b7b01c27ae1 --- tools/fonts/fontchain_linter.py | 55 ----------------------------------------- 1 file changed, 55 deletions(-) (limited to 'tools') diff --git a/tools/fonts/fontchain_linter.py b/tools/fonts/fontchain_linter.py index 7de706502618..a4a315b7e371 100755 --- a/tools/fonts/fontchain_linter.py +++ b/tools/fonts/fontchain_linter.py @@ -11,12 +11,6 @@ from fontTools import ttLib EMOJI_VS = 0xFE0F -#TODO(179952916): Rename CutiveMono and DancingScript -CANONICAL_NAME_EXCEPTION_LIST = [ - 'CutiveMono.ttf', - 'DancingScript-Regular.ttf', -] - LANG_TO_SCRIPT = { 'as': 'Beng', 'be': 'Cyrl', @@ -664,53 +658,6 @@ def check_cjk_punctuation(): assert_font_supports_none_of_chars(record.font, cjk_punctuation, name) -def getPostScriptName(font): - ttf = open_font(font) - nameTable = ttf['name'] - for name in nameTable.names: - if name.nameID == 6 and name.platformID == 3 and name.platEncID == 1 and name.langID == 0x0409: - return str(name) - - -def getSuffix(font): - file_path, index = font - with open(path.join(_fonts_dir, file_path), 'rb') as f: - tag = f.read(4) - isCollection = tag == b'ttcf' - - ttf = open_font(font) - isType1 = ('CFF ' in ttf or 'CFF2' in ttf) - - if isType1: - if isCollection: - return '.otc' - else: - return '.otf' - else: - if isCollection: - return '.ttc' - else: - return '.ttf' - - -def check_canonical_name(): - for record in _all_fonts: - file_name, index = record.font - if file_name in CANONICAL_NAME_EXCEPTION_LIST: - continue - - if index and index != 0: - continue - - psName = getPostScriptName(record.font) - assert psName, 'PostScript must be defined' - - suffix = getSuffix(record.font) - canonicalName = '%s%s' % (psName, suffix) - - assert file_name == canonicalName, ( - '%s is not a canonical name. Must be %s' % (file_name, canonicalName)) - def main(): global _fonts_dir target_out = sys.argv[1] @@ -728,8 +675,6 @@ def main(): check_cjk_punctuation() - check_canonical_name() - check_emoji = sys.argv[2] if check_emoji == 'true': ucd_path = sys.argv[3] -- cgit v1.2.3-59-g8ed1b