You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/11/05 18:16:22 UTC
svn commit: r1712823 -
/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java
Author: tilman
Date: Thu Nov 5 17:16:21 2015
New Revision: 1712823
URL: http://svn.apache.org/viewvc?rev=1712823&view=rev
Log:
PDFBOX-3088: cache glyph table, as proposed by ccouturi
Modified:
pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java
Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java?rev=1712823&r1=1712822&r2=1712823&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java Thu Nov 5 17:16:21 2015
@@ -53,6 +53,7 @@ public class GlyphTable extends TTFTable
{
loca = ttf.getIndexToLocation();
numGlyphs = ttf.getNumberOfGlyphs();
+ glyphs = new GlyphData[numGlyphs];
// we don't actually read the table yet because it can contain tens of thousands of glyphs
this.data = data;
@@ -143,6 +144,11 @@ public class GlyphTable extends TTFTable
{
return null;
}
+
+ if (glyphs[gid] != null)
+ {
+ return glyphs[gid];
+ }
synchronized (font)
{
@@ -177,6 +183,7 @@ public class GlyphTable extends TTFTable
// restore
data.seek(currentPosition);
+ glyphs[gid] = glyph;
return glyph;
}
}