Index: fontbox/src/main/java/org/apache/fontbox/ttf/HeaderTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/HeaderTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/HeaderTable.java	(revision )
@@ -48,7 +48,12 @@
     private short fontDirectionHint;
     private short indexToLocFormat;
     private short glyphDataFormat;
-    
+
+    HeaderTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/CFFTable.java	(revision )
@@ -33,6 +33,11 @@
 
     private CFFFont cffFont;
 
+    CFFTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      *
Index: fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalMetricsTable.java	(revision )
@@ -34,7 +34,12 @@
     private short[] leftSideBearing;
     private short[] nonHorizontalLeftSideBearing;
     private int numHMetrics;
-    
+
+    HorizontalMetricsTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/TTFTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/TTFTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/TTFTable.java	(revision )
@@ -33,22 +33,39 @@
     /**
      * Indicates if the table is initialized or not.
      */
-    protected boolean initialized = false;
+    protected boolean initialized;
-    
+
     /**
+     * The font which contains this table.
+     */
+    protected final TrueTypeFont font;
+
+    /**
+     * Constructor.
+     * 
+     * @param font The font which contains this table.
+     */
+    TTFTable(TrueTypeFont font)
+    {
+        this.font = font;
+    }
+    
+    /**
      * @return Returns the checkSum.
      */
     public long getCheckSum() 
     {
         return checkSum;
     }
+    
     /**
      * @param checkSumValue The checkSum to set.
      */
-    public void setCheckSum(long checkSumValue) 
+    void setCheckSum(long checkSumValue) 
     {
         this.checkSum = checkSumValue;
     }
+    
     /**
      * @return Returns the length.
      */
@@ -56,13 +73,15 @@
     {
         return length;
     }
+    
     /**
      * @param lengthValue The length to set.
      */
-    public void setLength(long lengthValue) 
+    void setLength(long lengthValue) 
     {
         this.length = lengthValue;
     }
+    
     /**
      * @return Returns the offset.
      */
@@ -70,13 +89,15 @@
     {
         return offset;
     }
+    
     /**
      * @param offsetValue The offset to set.
      */
-    public void setOffset(long offsetValue) 
+    void setOffset(long offsetValue) 
     {
         this.offset = offsetValue;
     }
+    
     /**
      * @return Returns the tag.
      */
@@ -84,10 +105,11 @@
     {
         return tag;
     }
+    
     /**
      * @param tagValue The tag to set.
      */
-    public void setTag(String tagValue) 
+    void setTag(String tagValue) 
     {
         this.tag = tagValue;
     }
@@ -101,6 +123,7 @@
     {
         return initialized;
     }
+    
     /**
      * This will read the required data from the stream.
      * 
@@ -108,7 +131,7 @@
      * @param data The stream to read the data from.
      * @throws IOException If there is an error reading the data.
      */
-    public void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
+    void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
     {
     }
 }
Index: fontbox/src/main/java/org/apache/fontbox/ttf/OS2WindowsMetricsTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/OS2WindowsMetricsTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/OS2WindowsMetricsTable.java	(revision )
@@ -177,6 +177,11 @@
      */
     public static final short FSTYPE_BITMAP_ONLY = 0x0200;
 
+    OS2WindowsMetricsTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * @return Returns the achVendId.
      */
Index: fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/VerticalMetricsTable.java	(revision )
@@ -40,7 +40,12 @@
     private short[] topSideBearing;
     private short[] nonVerticalTopSideBearing;
     private int numVMetrics;
-    
+
+    VerticalMetricsTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/NamingTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/NamingTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/NamingTable.java	(revision )
@@ -44,6 +44,11 @@
     private String fontSubFamily = null;
     private String psName = null;
 
+    NamingTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/VerticalOriginTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/VerticalOriginTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/VerticalOriginTable.java	(revision )
@@ -46,6 +46,11 @@
     private int defaultVertOriginY;
     private Map<Integer, Integer> origins = new ConcurrentHashMap<Integer, Integer>();
 
+    VerticalOriginTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/CmapTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/CmapTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/CmapTable.java	(revision )
@@ -56,6 +56,11 @@
 
     private CmapSubtable[] cmaps;
 
+    CmapTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/KerningTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/KerningTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/KerningTable.java	(revision )
@@ -32,6 +32,11 @@
 
     private KerningSubtable[] subtables;
 
+    KerningTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/TTFParser.java	(revision )
@@ -126,7 +126,7 @@
         int rangeShift = raf.readUnsignedShort();
         for (int i = 0; i < numberOfTables; i++)
         {
-            TTFTable table = readTableDirectory(raf);
+            TTFTable table = readTableDirectory(font, raf);
             font.addTable(table);
         }
         // parse tables if wanted
@@ -211,73 +211,73 @@
         }
     }
 
-    private TTFTable readTableDirectory(TTFDataStream raf) throws IOException
+    private TTFTable readTableDirectory(TrueTypeFont font, TTFDataStream raf) throws IOException
     {
         TTFTable table = null;
         String tag = raf.readString(4);
         if (tag.equals(CmapTable.TAG))
         {
-            table = new CmapTable();
+            table = new CmapTable(font);
         }
         else if (tag.equals(GlyphTable.TAG))
         {
-            table = new GlyphTable();
+            table = new GlyphTable(font);
         }
         else if (tag.equals(HeaderTable.TAG))
         {
-            table = new HeaderTable();
+            table = new HeaderTable(font);
         }
         else if (tag.equals(HorizontalHeaderTable.TAG))
         {
-            table = new HorizontalHeaderTable();
+            table = new HorizontalHeaderTable(font);
         }
         else if (tag.equals(HorizontalMetricsTable.TAG))
         {
-            table = new HorizontalMetricsTable();
+            table = new HorizontalMetricsTable(font);
         }
         else if (tag.equals(IndexToLocationTable.TAG))
         {
-            table = new IndexToLocationTable();
+            table = new IndexToLocationTable(font);
         }
         else if (tag.equals(MaximumProfileTable.TAG))
         {
-            table = new MaximumProfileTable();
+            table = new MaximumProfileTable(font);
         }
         else if (tag.equals(NamingTable.TAG))
         {
-            table = new NamingTable();
+            table = new NamingTable(font);
         }
         else if (tag.equals(OS2WindowsMetricsTable.TAG))
         {
-            table = new OS2WindowsMetricsTable();
+            table = new OS2WindowsMetricsTable(font);
         }
         else if (tag.equals(PostScriptTable.TAG))
         {
-            table = new PostScriptTable();
+            table = new PostScriptTable(font);
         }
         else if (tag.equals(DigitalSignatureTable.TAG))
         {
-            table = new DigitalSignatureTable();
+            table = new DigitalSignatureTable(font);
         }
         else if (tag.equals(KerningTable.TAG))
         {
-            table = new KerningTable();
+            table = new KerningTable(font);
         }
         else if (tag.equals(VerticalHeaderTable.TAG))
         {
-            table = new VerticalHeaderTable();
+            table = new VerticalHeaderTable(font);
         }
         else if (tag.equals(VerticalMetricsTable.TAG))
         {
-            table = new VerticalMetricsTable();
+            table = new VerticalMetricsTable(font);
         }
         else if (tag.equals(VerticalOriginTable.TAG))
         {
-            table = new VerticalOriginTable();
+            table = new VerticalOriginTable(font);
         }
         else
         {
-            table = readTable(tag);
+            table = readTable(font, tag);
         }
         table.setTag(tag);
         table.setCheckSum(raf.readUnsignedInt());
@@ -286,9 +286,9 @@
         return table;
     }
 
-    protected TTFTable readTable(String tag)
+    protected TTFTable readTable(TrueTypeFont font, String tag)
     {
         // unknown table type but read it anyway.
-        return new TTFTable();
+        return new TTFTable(font);
     }
 }
Index: fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/IndexToLocationTable.java	(revision )
@@ -34,7 +34,12 @@
     public static final String TAG = "loca";
     
     private long[] offsets;
-    
+
+    IndexToLocationTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/MaximumProfileTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/MaximumProfileTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/MaximumProfileTable.java	(revision )
@@ -45,7 +45,12 @@
     private int maxSizeOfInstructions;
     private int maxComponentElements;
     private int maxComponentDepth;
-    
+
+    MaximumProfileTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * @return Returns the maxComponentDepth.
      */
Index: fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/PostScriptTable.java	(revision )
@@ -41,6 +41,11 @@
      */
     public static final String TAG = "post";
 
+    PostScriptTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/OTFParser.java	(revision )
@@ -86,22 +86,22 @@
     }
 
     @Override
-    protected TTFTable readTable(String tag)
+    protected TTFTable readTable(TrueTypeFont font, String tag)
     {
         // todo: this is a stub, a full implementation is needed
 
         if (tag.equals("BASE") || tag.equals("GDEF") || tag.equals("GPOS") ||
             tag.equals("GSUB") || tag.equals("JSTF"))
         {
-            return new OTLTable();
+            return new OTLTable(font);
         }
         else if (tag.equals("CFF "))
         {
-            return new CFFTable();
+            return new CFFTable(font);
         }
         else
         {
-            return super.readTable(tag);
+            return super.readTable(font, tag);
         }
     }
 }
Index: fontbox/src/main/java/org/apache/fontbox/ttf/VerticalHeaderTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/VerticalHeaderTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/VerticalHeaderTable.java	(revision )
@@ -57,7 +57,12 @@
     private short reserved4;
     private short metricDataFormat;
     private int numberOfVMetrics;
-    
+
+    VerticalHeaderTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/OTLTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/OTLTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/OTLTable.java	(revision )
@@ -23,4 +23,9 @@
 public class OTLTable extends TTFTable
 {
     // todo: this is a stub, a full implementation is needed
+    
+    OTLTable(TrueTypeFont font)
+    {
+        super(font);
+    }
 }
Index: fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java	(revision )
@@ -40,6 +40,11 @@
     private int numGlyphs;
     protected Map<Integer, GlyphData> cache = new ConcurrentHashMap<Integer, GlyphData>();
 
+    GlyphTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
@@ -105,12 +110,15 @@
     /**
      * Returns all glyphs. This method can be very slow.
      */
-    public synchronized GlyphData[] getGlyphs() throws IOException
+    public GlyphData[] getGlyphs() throws IOException
     {
         if (glyphs == null)
         {
+            synchronized (font)
+            {
-            readAll();
-        }
+                readAll();
+            }
+        }
         return glyphs;
     }
 
@@ -140,7 +148,7 @@
             return cache.get(gid);
         }
 
-        synchronized (this)
+        synchronized (font)
         {
             // save
             long currentPosition = data.getCurrentPosition();
Index: fontbox/src/main/java/org/apache/fontbox/ttf/DigitalSignatureTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/DigitalSignatureTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/DigitalSignatureTable.java	(revision )
@@ -27,4 +27,9 @@
      * Tag to identify this table.
      */
     public static final String TAG = "DSIG";
+
+    DigitalSignatureTable(TrueTypeFont font)
+    {
+        super(font);
+    }
 }
Index: fontbox/src/main/java/org/apache/fontbox/ttf/KerningSubtable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/KerningSubtable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/KerningSubtable.java	(revision )
@@ -25,7 +25,7 @@
  * 
  * @author Glenn Adams
  */
-public class KerningSubtable extends TTFTable
+public class KerningSubtable
 {
     // coverage field bit masks and values
     private static final int COVERAGE_HORIZONTAL = 0x0001;
@@ -45,15 +45,12 @@
     // true if cross-stream (block progression) kerning
     private boolean crossStream;
     // format specific pair data
-    private PairData pairs; 
+    private PairData pairs;
 
-    /**
-     * Constructor.
-     */
-    public KerningSubtable()
+    KerningSubtable()
     {
     }
-
+    
     /**
      * This will read the required data from the stream.
      * 
Index: fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalHeaderTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalHeaderTable.java	(revision 1684954)
+++ fontbox/src/main/java/org/apache/fontbox/ttf/HorizontalHeaderTable.java	(revision )
@@ -47,7 +47,12 @@
     private short reserved5;
     private short metricDataFormat;
     private int numberOfHMetrics;
-    
+
+    HorizontalHeaderTable(TrueTypeFont font)
+    {
+        super(font);
+    }
+
     /**
      * This will read the required data from the stream.
      * 
