From a66d29b00655b3638620c0c726a3ef7e97e46559 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Thu, 10 Dec 2015 18:56:52 -0800 Subject: Decompose U+2050 to avoid a backwards contour If we wait until the UFO glyph is drawn to a FontTools glyph, the contours (one of which is a reflected component) will have opposite directions. When decomposed in the build scripts, the glyph's contours both have the correct direction. --- res/roboto.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/res/roboto.cfg b/res/roboto.cfg index 205cd46..4531bd2 100644 --- a/res/roboto.cfg +++ b/res/roboto.cfg @@ -36,6 +36,7 @@ decompose: integral product florin Tbar tbar Hbar hbar Eng eng uogonek Uogonek.smcp Aogonek.smcp Eogonek.smcp uni0524 uni0525 uni0526 uni0527 uni052E uni052F Hdesc hdesc uni2C69 uni2C6A uni2C6B uni2C6C Ndesc ndesc uni0498.smcp uni04A2.smcp uni04AA.smcp uni04B6.smcp nbspace uni202F uni205F erev uni1AB5 + uni2050 predecompose: uni04B4 uni04B5 dcroat uni040F uni045F uni0490 uni0491 OE oe Oslash oslash uni04A6 uni04A7 uni0492 uni0493 uni04BC uni04BD gamma Ohorn -- cgit v1.2.3 From 5397958ba23710b7146b9351d06ce96da66a19bd Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 11:57:25 -0800 Subject: Update calls to cu2qu This is hopefully the last time we have to do this. In response to https://github.com/googlei18n/cu2qu/commit/56f36a1b2ab673c25ac81756d5c251909a7d41e2 --- scripts/lib/fontbuild/Build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/fontbuild/Build.py b/scripts/lib/fontbuild/Build.py index be0b79c..cf07d55 100644 --- a/scripts/lib/fontbuild/Build.py +++ b/scripts/lib/fontbuild/Build.py @@ -184,10 +184,10 @@ class FontProject: # fewer control points and look noticeably different max_err = 0.002 if self.compatible: - fonts_to_quadratic(*fonts, max_err_em=max_err, dump_report=True) + fonts_to_quadratic(fonts, max_err_em=max_err, dump_stats=True) else: for font in fonts: - fonts_to_quadratic(font, max_err_em=max_err, dump_report=True) + fonts_to_quadratic([font], max_err_em=max_err, dump_stats=True) log(">> Generating TTF files") for font in fonts: -- cgit v1.2.3 From a40611066facdeab2ba726411d8f1acbf907132b Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 12:00:22 -0800 Subject: Update use of nototools' unit tests Due to changes in https://github.com/jamesgk/nototools/commit/7c07e2b2485b29638d9141b809d7eadd547f1b01 https://github.com/jamesgk/nototools/commit/995fe3c706d1e9fb76d5506e36a6ef06f2ea2dfe --- scripts/run_general_tests.py | 18 ++++++++++++++++-- scripts/run_web_tests.py | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py index ddfae17..1a007d2 100755 --- a/scripts/run_general_tests.py +++ b/scripts/run_general_tests.py @@ -96,8 +96,22 @@ class TestVerticalMetrics(font_tests.TestVerticalMetrics): class TestGlyphAreas(font_tests.TestGlyphAreas): - loaded_fonts = UFOS - masters = UFO_MASTERS + master_weights_to_test = ['Thin', 'Bold'] + instance_weights_to_test = ['Thin', 'Regular', 'Bold'] + exclude = ['Condensed', 'Italic'] + + master_glyph_sets = [ + f.replace('_', '-') for f in UFO_MASTERS[0]], UFO_MASTERS[1] + instance_glyph_sets = FONTS[0], [f.getGlyphSet() for f in FONTS[1]] + + master_glyphs_to_test = UFO_MASTERS[1][0].keys() + instance_glyphs_to_test = FONTS[1][0].getGlyphOrder() + + #TODO maybe fix masters so that whitelisting isn't necessary + whitelist = [ + 'uni0488', # offset 20 units b/w masters, interpolated points are off + 'uni2050' # has flipped component, so contour is backwards in master + ] if __name__ == '__main__': diff --git a/scripts/run_web_tests.py b/scripts/run_web_tests.py index 4f051bf..5d3fd34 100755 --- a/scripts/run_web_tests.py +++ b/scripts/run_web_tests.py @@ -53,8 +53,8 @@ class TestNames(font_tests.TestNames): mark_heavier_as_bold = True expected_copyright = 'Copyright 2011 Google Inc. All Rights Reserved.' - def expected_unique_id(self, full_name): - return full_name + def expected_unique_id(self, family, style): + return family + ' ' + style class TestDigitWidths(font_tests.TestDigitWidths): -- cgit v1.2.3 From f9116ecf24f80e3c9161cd5189e8e9a90c03e908 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 12:04:37 -0800 Subject: Don't set Black weight as bold outside of Android There's no documented reason why we were doing this before, so let's output these fonts for now and see if they work on other platforms. Android can come next. --- scripts/build-v2.py | 4 ++-- scripts/run_general_tests.py | 3 ++- scripts/touchup_for_android.py | 11 +++++++++++ scripts/touchup_for_web.py | 6 ------ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/build-v2.py b/scripts/build-v2.py index 0ef86e9..6026939 100644 --- a/scripts/build-v2.py +++ b/scripts/build-v2.py @@ -101,7 +101,7 @@ proj.generateFont(Mix([rg, bd], 0.35), "%s/Medium/Regular/Lt"%FAMILYNAME) proj.generateFont(Mix([rg, bd], RPoint(0.73, 0.73)), "%s/Bold/Bold/Rg"%FAMILYNAME) proj.generateFont(Mix([rg, bd], RPoint(1.125, 1.0)), - "%s/Black/Bold/Bk"%FAMILYNAME) + "%s/Black/Regular/Bk"%FAMILYNAME) proj.generateFont(th.font, "%s/Thin Italic/Italic/Th"%FAMILYNAME, italic=True, stemWidth=80) @@ -115,7 +115,7 @@ proj.generateFont(Mix([rg, bd], RPoint(0.73, 0.73)), "%s/Bold Italic/Bold Italic/Rg"%FAMILYNAME, italic=True, stemWidth=290) proj.generateFont(Mix([rg, bd], RPoint(1.125, 1.0)), - "%s/Black Italic/Bold Italic/Bk"%FAMILYNAME, + "%s/Black Italic/Italic/Bk"%FAMILYNAME, italic=True, stemWidth=290) # unfortunately some condensed forms (*.cn) of glyphs are not compatible with diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py index 1a007d2..3321fa3 100755 --- a/scripts/run_general_tests.py +++ b/scripts/run_general_tests.py @@ -44,12 +44,13 @@ class TestItalicAngle(font_tests.TestItalicAngle): class TestMetaInfo(font_tests.TestMetaInfo): """Bugs: + https://github.com/google/roboto/issues/142 https://code.google.com/a/google.com/p/roboto/issues/detail?id=8 https://code.google.com/a/google.com/p/roboto/issues/detail?id=29 """ loaded_fonts = FONTS - mark_heavier_as_bold = True + mark_heavier_as_bold = False test_us_weight = None #expected_version = '2.' + roboto_data.get_build_number() diff --git a/scripts/touchup_for_android.py b/scripts/touchup_for_android.py index 187a432..4426bd0 100755 --- a/scripts/touchup_for_android.py +++ b/scripts/touchup_for_android.py @@ -68,6 +68,17 @@ def apply_android_specific_fixes(font): if table in font: del font[table] + # Set bold bits for Black (macStyle bit 0, fsSelection bit 5, subfamily) + name_records = font_data.get_name_records(font) + family_name = name_records[1] + subfam_name = name_records[2] + if family_name.endswith('Black'): + font['head'].macStyle |= (1 << 0) + font['OS/2'].fsSelection |= (1 << 5) + new_subfam_name = ( + ('Bold ' + subfam_name) if subfam_name != 'Regular' else 'Bold') + font_data.set_name_record(font, 2, new_subfam_name) + def correct_font(source_font_name, target_font_name): """Corrects metrics and other meta information.""" diff --git a/scripts/touchup_for_web.py b/scripts/touchup_for_web.py index 3e29e58..7879d9e 100755 --- a/scripts/touchup_for_web.py +++ b/scripts/touchup_for_web.py @@ -47,12 +47,6 @@ def apply_web_specific_fixes(font, family_name): family_name += ' Condensed' full_name = family_name + ' ' + subfamily_name - # macStyle - bold = subfamily_name.startswith(('Bold', 'Black')) - italic = subfamily_name.endswith('Italic') - macStyle = (italic << 1) | bold - font['head'].macStyle = macStyle - # Family, subfamily names font_data.set_name_record(font, 16, family_name) style_map = ['Regular', 'Bold', 'Italic', 'Bold Italic'] -- cgit v1.2.3 From 2b60cf910ae45ddc036d3e0ea5e2621b5f88f6e4 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 12:13:45 -0800 Subject: Add name, metadata tests for general and android There's no reason not to have these, and they're quite helpful for catching little issues. --- scripts/run_android_tests.py | 20 ++++++++++++++++++++ scripts/run_general_tests.py | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/scripts/run_android_tests.py b/scripts/run_android_tests.py index 3751670..f6a1f46 100755 --- a/scripts/run_android_tests.py +++ b/scripts/run_android_tests.py @@ -19,12 +19,32 @@ import unittest from nototools.unittests import font_tests +import run_general_tests + FONTS = font_tests.load_fonts( ['out/android/*.ttf'], expected_count=18) +class TestMetaInfo(run_general_tests.TestMetaInfo): + """Bugs: + https://github.com/google/roboto/issues/142 + """ + + loaded_fonts = FONTS + mark_heavier_as_bold = True + + +class TestNames(run_general_tests.TestNames): + """Bugs: + https://github.com/google/roboto/issues/37 + """ + + loaded_fonts = FONTS + mark_heavier_as_bold = True + + class TestVerticalMetrics(font_tests.TestVerticalMetrics): loaded_fonts = FONTS test_glyphs_ymin_ymax = None diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py index 3321fa3..78ba44c 100755 --- a/scripts/run_general_tests.py +++ b/scripts/run_general_tests.py @@ -61,6 +61,20 @@ class TestMetaInfo(font_tests.TestMetaInfo): expected_os2_achVendID = 'GOOG' +class TestNames(font_tests.TestNames): + """Bugs: + https://github.com/google/roboto/issues/37 + """ + + loaded_fonts = FONTS + family_name = 'Roboto' + mark_heavier_as_bold = False + expected_copyright = 'Font data copyright Google 2015' + + def expected_unique_id(self, family, style): + return 'Google:%s:2015' % family + + class TestDigitWidths(font_tests.TestDigitWidths): loaded_fonts = FONTS -- cgit v1.2.3 From c57250d04a3645583776a7f3c8d997780bcb0ea6 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 12:16:35 -0800 Subject: Update an outdated context link for keycaps test --- scripts/touchup_for_android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/touchup_for_android.py b/scripts/touchup_for_android.py index 4426bd0..9c896bc 100755 --- a/scripts/touchup_for_android.py +++ b/scripts/touchup_for_android.py @@ -56,7 +56,7 @@ def apply_android_specific_fixes(font): hhea.lineGap = 0 # Remove combining keycap and the arrows from the cmap table: - # https://code.google.com/a/google.com/p/roboto/issues/detail?id=52 + # https://github.com/google/roboto/issues/99 font_data.delete_from_cmap(font, [ 0x20E3, # COMBINING ENCLOSING KEYCAP 0x2191, # UPWARDS ARROW -- cgit v1.2.3 From 27233df647b182263c7176f3956574cd3a2947cc Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 12:19:02 -0800 Subject: Switch general tests to test unhinted fonts This was changed to test hinted fonts in a4ef18e29638cd1a0c814adb762177a342898eeb, but I think we want to go back to unhinted fonts by default. It can always be changed locally. --- scripts/run_general_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py index 78ba44c..a1a9a43 100755 --- a/scripts/run_general_tests.py +++ b/scripts/run_general_tests.py @@ -24,7 +24,7 @@ from nototools.unittests import font_tests import roboto_data FONTS = font_tests.load_fonts( - ['hinted/*.ttf'], + ['out/RobotoTTF/*.ttf', 'out/RobotoCondensedTTF/*.ttf'], expected_count=18) UFOS = font_tests.load_fonts( -- cgit v1.2.3 From db517c3b0639140ebd1516d2669a29d612da1c0b Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 11 Dec 2015 14:59:36 -0800 Subject: Update calls to ufo2ft Due to changes in https://github.com/jamesgk/ufo2ft/commit/6c46f7050bfdd346c33c1312f07830c48fcc07f2 --- scripts/lib/fontbuild/Build.py | 5 +++-- scripts/lib/fontbuild/markFeature.py | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/lib/fontbuild/Build.py b/scripts/lib/fontbuild/Build.py index cf07d55..a4e5bac 100644 --- a/scripts/lib/fontbuild/Build.py +++ b/scripts/lib/fontbuild/Build.py @@ -28,7 +28,7 @@ from fontbuild.features import readFeatureFile, writeFeatureFile from fontbuild.generateGlyph import generateGlyph from fontbuild.instanceNames import setNamesRF from fontbuild.italics import italicizeGlyph -from fontbuild.markFeature import RobotoFeatureCompiler +from fontbuild.markFeature import RobotoFeatureCompiler, RobotoKernWriter from fontbuild.mitreGlyph import mitreGlyph from fontbuild.mix import Mix,Master,narrowFLGlyph @@ -288,5 +288,6 @@ def saveOTF(font, destFile, truetype=False): compiler = compileTTF else: compiler = compileOTF - otf = compiler(font, featureCompilerClass=RobotoFeatureCompiler) + otf = compiler(font, featureCompilerClass=RobotoFeatureCompiler, + kernWriter=RobotoKernWriter) otf.save(destFile) diff --git a/scripts/lib/fontbuild/markFeature.py b/scripts/lib/fontbuild/markFeature.py index 945cef0..395e537 100755 --- a/scripts/lib/fontbuild/markFeature.py +++ b/scripts/lib/fontbuild/markFeature.py @@ -43,3 +43,8 @@ class RobotoFeatureCompiler(FeatureOTFCompiler): ["a", "uni0430"], ["e", "uni0435"], ["p", "uni0440"], ["c", "uni0441"], ["x", "uni0445"], ["s", "uni0455"], ["i", "uni0456"], ["psi", "uni0471"]] + + +class RobotoKernWriter(KernFeatureWriter): + leftFeaClassRe = r"@_(.+)_L$" + rightFeaClassRe = r"@_(.+)_R$" -- cgit v1.2.3 From 2a2800a5a6a80fa677cae12ca5272a1bb8c2f2b7 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Mon, 14 Dec 2015 17:10:38 -0800 Subject: Change copyright in sources to 2011 date --- src/v2/Roboto_Bold.ufo/fontinfo.plist | 2 +- src/v2/Roboto_Bold.vfb | Bin 415462 -> 415462 bytes src/v2/Roboto_Regular.ufo/fontinfo.plist | 2 +- src/v2/Roboto_Regular.vfb | Bin 471237 -> 471237 bytes src/v2/Roboto_Thin.ufo/fontinfo.plist | 2 +- src/v2/Roboto_Thin.vfb | Bin 405061 -> 405061 bytes 6 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/v2/Roboto_Bold.ufo/fontinfo.plist b/src/v2/Roboto_Bold.ufo/fontinfo.plist index cad5eeb..c0a6068 100644 --- a/src/v2/Roboto_Bold.ufo/fontinfo.plist +++ b/src/v2/Roboto_Bold.ufo/fontinfo.plist @@ -7,7 +7,7 @@ capHeight 1456 copyright - Copyright 2014 Google Inc. All Rights Reserved. + Copyright 2011 Google Inc. All Rights Reserved. descender -555 familyName diff --git a/src/v2/Roboto_Bold.vfb b/src/v2/Roboto_Bold.vfb index 7c54196..5f81153 100644 Binary files a/src/v2/Roboto_Bold.vfb and b/src/v2/Roboto_Bold.vfb differ diff --git a/src/v2/Roboto_Regular.ufo/fontinfo.plist b/src/v2/Roboto_Regular.ufo/fontinfo.plist index 58edbfa..8f7dd23 100644 --- a/src/v2/Roboto_Regular.ufo/fontinfo.plist +++ b/src/v2/Roboto_Regular.ufo/fontinfo.plist @@ -7,7 +7,7 @@ capHeight 1456 copyright - Copyright 2014 Google Inc. All Rights Reserved. + Copyright 2011 Google Inc. All Rights Reserved. descender -555 familyName diff --git a/src/v2/Roboto_Regular.vfb b/src/v2/Roboto_Regular.vfb index 252e7cb..8c9d12b 100644 Binary files a/src/v2/Roboto_Regular.vfb and b/src/v2/Roboto_Regular.vfb differ diff --git a/src/v2/Roboto_Thin.ufo/fontinfo.plist b/src/v2/Roboto_Thin.ufo/fontinfo.plist index 1aac006..e1ba393 100644 --- a/src/v2/Roboto_Thin.ufo/fontinfo.plist +++ b/src/v2/Roboto_Thin.ufo/fontinfo.plist @@ -7,7 +7,7 @@ capHeight 1456 copyright - Copyright 2014 Google Inc. All Rights Reserved. + Copyright 2011 Google Inc. All Rights Reserved. descender -555 familyName diff --git a/src/v2/Roboto_Thin.vfb b/src/v2/Roboto_Thin.vfb index d3cf141..ee8c2f6 100644 Binary files a/src/v2/Roboto_Thin.vfb and b/src/v2/Roboto_Thin.vfb differ -- cgit v1.2.3 From bd17627cd66730ba06b9a305d02266c886eb870a Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Mon, 14 Dec 2015 17:14:43 -0800 Subject: Don't change copyright in build scripts The copyright message now found in the source files is correct. --- scripts/lib/fontbuild/instanceNames.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/fontbuild/instanceNames.py b/scripts/lib/fontbuild/instanceNames.py index 281eb03..890b5a6 100644 --- a/scripts/lib/fontbuild/instanceNames.py +++ b/scripts/lib/fontbuild/instanceNames.py @@ -57,7 +57,7 @@ class InstanceNames: f.info.versionMajor = version f.info.versionMinor = versionMinor f.info.year = self.year - f.info.copyright = "Font data copyright %s %s" %(self.foundry, self.year) + #f.info.copyright = "Font data copyright %s %s" %(self.foundry, self.year) f.info.trademark = "%s is a trademark of %s." %(self.longfamily, self.foundry) f.info.openTypeNameDesigner = "Christian Robertson" -- cgit v1.2.3 From 6cc897c80ab9c515769dd9f7ea8c7341bafea567 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Mon, 14 Dec 2015 17:26:26 -0800 Subject: Test for correct copyright message --- scripts/run_general_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_general_tests.py b/scripts/run_general_tests.py index a1a9a43..494651d 100755 --- a/scripts/run_general_tests.py +++ b/scripts/run_general_tests.py @@ -69,7 +69,7 @@ class TestNames(font_tests.TestNames): loaded_fonts = FONTS family_name = 'Roboto' mark_heavier_as_bold = False - expected_copyright = 'Font data copyright Google 2015' + expected_copyright = 'Copyright 2011 Google Inc. All Rights Reserved.' def expected_unique_id(self, family, style): return 'Google:%s:2015' % family -- cgit v1.2.3 From 69467fac76d48280050a3e1770f6595dc6967b6a Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Thu, 17 Dec 2015 16:00:45 -0800 Subject: Clear fsSelection regular bit for Black --- scripts/touchup_for_android.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/touchup_for_android.py b/scripts/touchup_for_android.py index 9c896bc..e13adea 100755 --- a/scripts/touchup_for_android.py +++ b/scripts/touchup_for_android.py @@ -75,6 +75,7 @@ def apply_android_specific_fixes(font): if family_name.endswith('Black'): font['head'].macStyle |= (1 << 0) font['OS/2'].fsSelection |= (1 << 5) + font['OS/2'].fsSelection &= ~(1 << 6) new_subfam_name = ( ('Bold ' + subfam_name) if subfam_name != 'Regular' else 'Bold') font_data.set_name_record(font, 2, new_subfam_name) -- cgit v1.2.3