diff options
| author | Deepanshu Gupta <deepanshu@google.com> | 2014-06-10 14:43:23 -0700 |
|---|---|---|
| committer | Deepanshu Gupta <deepanshu@google.com> | 2014-06-10 17:00:29 -0700 |
| commit | 125714173b5ef296f8d50191edcfceedcb19dbde (patch) | |
| tree | f55f852a958133c4c5d453a44005822464c4cace /tools/layoutlib/rename_font | |
| parent | 6d7a25f317be60ae8a4d8806e517052be2398753 (diff) | |
| download | frameworks_base-125714173b5ef296f8d50191edcfceedcb19dbde.zip frameworks_base-125714173b5ef296f8d50191edcfceedcb19dbde.tar.gz frameworks_base-125714173b5ef296f8d50191edcfceedcb19dbde.tar.bz2 | |
Remove lxml dependency.
The encoding for the .ttx file generated is now hard-coded to be utf-8.
Change-Id: I71c208327995651fcf44b6961510f84bafb05848
Diffstat (limited to 'tools/layoutlib/rename_font')
| -rwxr-xr-x | tools/layoutlib/rename_font/build_font.py | 5 | ||||
| -rwxr-xr-x | tools/layoutlib/rename_font/test.py | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/tools/layoutlib/rename_font/build_font.py b/tools/layoutlib/rename_font/build_font.py index aea3241..bd9b14c 100755 --- a/tools/layoutlib/rename_font/build_font.py +++ b/tools/layoutlib/rename_font/build_font.py @@ -27,7 +27,7 @@ import sys from fontTools import ttx import re import os -from lxml import etree +import xml.etree.ElementTree as etree import shutil import glob from multiprocessing import Pool @@ -84,14 +84,13 @@ def convert_font(input_path): ttx.main(ttx_args) # now parse the xml file to change its PS name. tree = etree.parse(ttx_path) - encoding = tree.docinfo.encoding root = tree.getroot() for name in root.iter('name'): [old_ps_name, version] = get_font_info(name) if old_ps_name is not None and version is not None: new_ps_name = old_ps_name + version update_name(name, new_ps_name) - tree.write(ttx_path, xml_declaration=True, encoding=encoding ) + tree.write(ttx_path, xml_declaration=True, encoding='utf-8' ) # generate the udpated font now. ttx_args = ['-q', '-d', dest_dir, ttx_path] ttx.main(ttx_args) diff --git a/tools/layoutlib/rename_font/test.py b/tools/layoutlib/rename_font/test.py index d4c86cb..b0b69d8 100755 --- a/tools/layoutlib/rename_font/test.py +++ b/tools/layoutlib/rename_font/test.py @@ -14,7 +14,7 @@ import build_font from fontTools import ttx import os -from lxml import etree +import xml.etree.ElementTree as etree import shutil import tempfile |
