A TrueType font file. @author Ben Litchfield
| 40 | * @author Ben Litchfield |
| 41 | */ |
| 42 | public class TrueTypeFont implements FontBoxFont, Closeable |
| 43 | { |
| 44 | |
| 45 | private static final Log LOG = LogFactory.getLog(TrueTypeFont.class); |
| 46 | |
| 47 | private float version; |
| 48 | private int numberOfGlyphs = -1; |
| 49 | private int unitsPerEm = -1; |
| 50 | private boolean enableGsub = true; |
| 51 | protected final Map<String,TTFTable> tables = new HashMap<>(); |
| 52 | private final TTFDataStream data; |
| 53 | private volatile Map<String, Integer> postScriptNames; |
| 54 | |
| 55 | private final Object lockReadtable = new Object(); |
| 56 | private final Object lockPSNames = new Object(); |
| 57 | private final List<String> enabledGsubFeatures = new ArrayList<>(); |
| 58 | |
| 59 | /** |
| 60 | * Constructor. Clients should use the TTFParser to create a new TrueTypeFont object. |
| 61 | * |
| 62 | * @param fontData The font data. |
| 63 | */ |
| 64 | TrueTypeFont(TTFDataStream fontData) |
| 65 | { |
| 66 | data = fontData; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public void close() throws IOException |
| 71 | { |
| 72 | data.close(); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @return Returns the version. |
| 77 | */ |
| 78 | public float getVersion() |
| 79 | { |
| 80 | return version; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Set the version. Package-private, used by TTFParser only. |
| 85 | * @param versionValue The version to set. |
| 86 | */ |
| 87 | void setVersion(float versionValue) |
| 88 | { |
| 89 | version = versionValue; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @return Returns true if the GSUB table can be used for this font |
| 94 | */ |
| 95 | public boolean isEnableGsub() |
| 96 | { |
| 97 | return enableGsub; |
| 98 | } |
| 99 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…