summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoozbeh Pournader <roozbeh@google.com>2014-12-08 09:21:48 -0800
committerJames Godfrey-Kittle <jamesgk@google.com>2015-04-16 12:16:23 -0700
commit62764abc5eed32c1e319f19fd9737bbe7f81ed2e (patch)
tree9efe9643b5468cad88d5d896a5b5a465b34e6a94
parentda5be226f7a8a4704c7967acba311c6857f0cee3 (diff)
Add target for ChromeOS fonts.
-rw-r--r--.gitignore1
-rw-r--r--Makefile12
-rwxr-xr-xscripts/touchup_for_web.py9
3 files changed, 16 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index cd48646..b5436ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ _*.ignore
*~
out/android
+out/chromeos
out/crunched
out/glass
out/web
diff --git a/Makefile b/Makefile
index 05196fa..cde362b 100644
--- a/Makefile
+++ b/Makefile
@@ -60,11 +60,21 @@ web:
touched=$$(mktemp); \
final=out/web/$$(basename $$source); \
final="$${final/Roboto/RobotoDraft}"; \
- python scripts/touchup_for_web.py $$source $$touched && \
+ python scripts/touchup_for_web.py $$source $$touched RobotoDraft && \
python scripts/subset_for_web.py $$touched $$final && \
rm $$touched; \
done
+chromeos:
+ mkdir -p out/chromeos
+ for source in hinted/*.ttf; do \
+ touched=$$(mktemp); \
+ final=out/chromeos/$$(basename $$source); \
+ python scripts/touchup_for_web.py $$source $$touched Roboto && \
+ python $$HOME/noto/nototools/subset.py $$touched $$final && \
+ rm $$touched; \
+ done
+
test: test-android test-coverage test-general
test-general:
diff --git a/scripts/touchup_for_web.py b/scripts/touchup_for_web.py
index b055d89..39e7c19 100755
--- a/scripts/touchup_for_web.py
+++ b/scripts/touchup_for_web.py
@@ -24,7 +24,7 @@ def apply_temporary_fixes(font):
font_data.set_name_record(font, 5, version_record)
-def apply_web_specific_fixes(font):
+def apply_web_specific_fixes(font, family_name):
"""Apply fixes needed for web fonts."""
# Set ascent, descent, and lineGap values to Android K values
hhea = font['hhea']
@@ -39,7 +39,6 @@ def apply_web_specific_fixes(font):
os2.usWinAscent = 1946
os2.usWinDescent = 512
- family_name = 'RobotoDraft'
subfamily_name = font_data.get_name_records(font)[2].encode('ASCII')
assert(subfamily_name in
['Thin', 'Thin Italic',
@@ -69,17 +68,17 @@ def apply_web_specific_fixes(font):
font, 6, family_name+'-'+subfamily_name.replace(' ', ''))
-def correct_font(source_font_name, target_font_name):
+def correct_font(source_font_name, target_font_name, family_name):
"""Corrects metrics and other meta information."""
font = ttLib.TTFont(source_font_name)
apply_temporary_fixes(font)
- apply_web_specific_fixes(font)
+ apply_web_specific_fixes(font, family_name)
font.save(target_font_name)
def main(argv):
"""Correct the font specified in the command line."""
- correct_font(argv[1], argv[2])
+ correct_font(argv[1], argv[2], argv[3])
if __name__ == "__main__":