From 138922c7fbd301f8ce79863f9ea48ccfba04870f Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Wed, 23 Mar 2016 00:57:45 -0400 Subject: [PATCH] updated dev-versioner.py script to support uff16-big endian encoding of version name in name table ID 5, platform ID 3 --- .../posthinted_builds/dev-versioner.py | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/postbuild_processing/posthinted_builds/dev-versioner.py b/postbuild_processing/posthinted_builds/dev-versioner.py index 72914d1af..f84ff087b 100755 --- a/postbuild_processing/posthinted_builds/dev-versioner.py +++ b/postbuild_processing/posthinted_builds/dev-versioner.py @@ -17,20 +17,29 @@ def main(argv): for font_variant_path in argv: tt = ttLib.TTFont(font_variant_path) namerecord_list = tt['name'].__dict__['names'] + + path_list = font_variant_path.split(".") + outfile_path = path_list[0] + "-DEV." + path_list[1] + for record in namerecord_list: - if record.__dict__['langID'] == 0: - if record.__dict__['nameID'] == 5: - record.__dict__['string'] = VERSION_STRING + if record.__dict__['langID'] == 0 and record.__dict__['nameID'] == 5: + record.__dict__['string'] = VERSION_STRING - path_list = font_variant_path.split(".") - outfile_path = path_list[0] + "-DEV." + path_list[1] - tt.save(outfile_path) - SUCCESS_INDICATOR = 1 + tt.save(outfile_path) + SUCCESS_INDICATOR += 1 - print("Updated '" + font_variant_path + "' version string to " + VERSION_STRING) + elif record.__dict__['langID'] == 1033 and record.__dict__['nameID'] == 5: + record.__dict__['string'] = VERSION_STRING.encode('utf_16_be') # UTF-16 big endian encoding for the Microsoft tables + + tt.save(outfile_path) + SUCCESS_INDICATOR += 1 if SUCCESS_INDICATOR == 0: - print("Unable to complete the name table update for " + font_variant_path) + print("[ERROR] Unable to complete the name table update for " + font_variant_path) + elif SUCCESS_INDICATOR == 1: + print("[ERROR] Incomplete name table update for " + font_variant_path) + + SUCCESS_INDICATOR = 0 # reset success indicator if __name__ == '__main__':