summaryrefslogtreecommitdiff
path: root/scripts/adjust_vertical_metrics.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/adjust_vertical_metrics.py')
-rwxr-xr-xscripts/adjust_vertical_metrics.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/adjust_vertical_metrics.py b/scripts/adjust_vertical_metrics.py
new file mode 100755
index 0000000..0ede449
--- /dev/null
+++ b/scripts/adjust_vertical_metrics.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+#
+# Copyright 2016 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Adjust the vertical metrics of the fonts for Android."""
+
+import glob
+from fontTools import ttLib
+
+def main():
+ """Change the ascent and descent of Noto Serif fonts."""
+ for font_file in glob.glob('NotoSerif-*.ttf'):
+ font = ttLib.TTFont(font_file)
+ font['hhea'].ascent = 1900
+ font['hhea'].descent = -500
+ font.save('touched/'+font_file)
+
+if __name__ == '__main__':
+ main()
+