Remove lxml dependency.

The encoding for the .ttx file generated is now hard-coded to be utf-8.

Change-Id: I71c208327995651fcf44b6961510f84bafb05848
This commit is contained in:
Deepanshu Gupta
2014-06-10 14:43:23 -07:00
parent 6d7a25f317
commit 125714173b
2 changed files with 3 additions and 4 deletions

View File

@@ -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)

View File

@@ -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