A Type 1-equivalent font program represented in a CFF file. Thread safe. @author Villu Ruusmann @author John Hewson
| 32 | * @author John Hewson |
| 33 | */ |
| 34 | public class CFFType1Font extends CFFFont implements EncodedFont |
| 35 | { |
| 36 | private final Map<String, Object> privateDict = new LinkedHashMap<>(); |
| 37 | private CFFEncoding encoding; |
| 38 | |
| 39 | private final Map<Integer, Type2CharString> charStringCache = |
| 40 | new ConcurrentHashMap<>(); |
| 41 | |
| 42 | private final PrivateType1CharStringReader reader = new PrivateType1CharStringReader(); |
| 43 | private Type2CharStringParser charStringParser = null; |
| 44 | |
| 45 | private int defaultWidthX = Integer.MIN_VALUE; |
| 46 | private int nominalWidthX = Integer.MIN_VALUE; |
| 47 | private byte[][] localSubrIndex; |
| 48 | |
| 49 | /** |
| 50 | * Private implementation of Type1CharStringReader, because only CFFType1Font can |
| 51 | * expose this publicly, as CIDFonts only support this for legacy 'seac' commands. |
| 52 | */ |
| 53 | private class PrivateType1CharStringReader implements Type1CharStringReader |
| 54 | { |
| 55 | @Override |
| 56 | public Type1CharString getType1CharString(String name) throws IOException |
| 57 | { |
| 58 | return CFFType1Font.this.getType1CharString(name); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public GeneralPath getPath(String name) throws IOException |
| 64 | { |
| 65 | return getType1CharString(name).getPath(); |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public float getWidth(String name) throws IOException |
| 70 | { |
| 71 | return getType1CharString(name).getWidth(); |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public boolean hasGlyph(String name) |
| 76 | { |
| 77 | return nameToGID(name) != 0; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Returns the Type 1 charstring for the given PostScript glyph name. |
| 82 | * |
| 83 | * @param name PostScript glyph name |
| 84 | * @return Type1 charstring of the given PostScript glyph name |
| 85 | * |
| 86 | * @throws IOException if the charstring could not be read |
| 87 | */ |
| 88 | public Type1CharString getType1CharString(String name) throws IOException |
| 89 | { |
| 90 | // lookup via charset |
| 91 | int gid = nameToGID(name); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…