diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2014-05-14 00:30:02 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2014-05-14 00:30:02 -0400 |
commit | 37b7bad5b1c39ccbe8b778ede4b8fe18138b1e25 (patch) | |
tree | 5d540aa9b8324ed2edc0755326a8de43f9515f26 | |
parent | d56eebfa96bd07ebc3e6d076b62f96d97d569c99 (diff) | |
download | fonttools-37b7bad5b1c39ccbe8b778ede4b8fe18138b1e25.tar.gz |
Micro-optimize hmtx/vmtx loading
-rw-r--r-- | Lib/fontTools/ttLib/tables/_h_m_t_x.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/fontTools/ttLib/tables/_h_m_t_x.py b/Lib/fontTools/ttLib/tables/_h_m_t_x.py index acb686b5..09569ef7 100644 --- a/Lib/fontTools/ttLib/tables/_h_m_t_x.py +++ b/Lib/fontTools/ttLib/tables/_h_m_t_x.py @@ -33,12 +33,13 @@ class table__h_m_t_x(DefaultTable.DefaultTable): if data: warnings.warn("too much 'hmtx'/'vmtx' table data") self.metrics = {} + glyphOrder = ttFont.getGlyphOrder() for i in range(numberOfMetrics): - glyphName = ttFont.getGlyphName(i) + glyphName = glyphOrder[i] self.metrics[glyphName] = list(metrics[i*2:i*2+2]) lastAdvance = metrics[-2] for i in range(numberOfSideBearings): - glyphName = ttFont.getGlyphName(i + numberOfMetrics) + glyphName = glyphOrder[i + numberOfMetrics] self.metrics[glyphName] = [lastAdvance, sideBearings[i]] def compile(self, ttFont): |