@Override public float getAverageFontWidth() { if (getStandard14AFM() != null) { return getStandard14AFM().getAverageCharacterWidth(); } else { return super.getAverageFontWidth(); } }
@Override public float getHeight(int code) throws IOException { String name = codeToName(code); if (getStandard14AFM() != null) { String afmName = getEncoding().getName(code); return getStandard14AFM().getCharacterHeight(afmName); // todo: isn't this the y-advance, not the height? } else { // todo: should be scaled by font matrix return (float) genericFont.getPath(name).getBounds().getHeight(); } }
@Override protected Encoding readEncodingFromFont() throws IOException { if (!isEmbedded() && getStandard14AFM() != null) { // read from AFM return new Type1Encoding(getStandard14AFM()); } else { // extract from Type1 font/substitute if (genericFont instanceof EncodedFont) { return Type1Encoding.fromFontBox(((EncodedFont) genericFont).getEncoding()); } else { // default (only happens with TTFs) return StandardEncoding.INSTANCE; } } }
@Override public float getAverageFontWidth() { if (getStandard14AFM() != null) { return getStandard14AFM().getAverageCharacterWidth(); } else { return super.getAverageFontWidth(); } }
@Override public float getAverageFontWidth() { if (getStandard14AFM() != null) { return getStandard14AFM().getAverageCharacterWidth(); } else { return super.getAverageFontWidth(); } }
@Override protected Encoding readEncodingFromFont() throws IOException { if (!isEmbedded() && getStandard14AFM() != null) { // read from AFM return new Type1Encoding(getStandard14AFM()); } else { // extract from Type1 font/substitute if (genericFont instanceof EncodedFont) { return Type1Encoding.fromFontBox(((EncodedFont) genericFont).getEncoding()); } else { // default (only happens with TTFs) return StandardEncoding.INSTANCE; } } }
@Override protected Encoding readEncodingFromFont() throws IOException { if (!isEmbedded() && getStandard14AFM() != null) { // read from AFM return new Type1Encoding(getStandard14AFM()); } else { // extract from Type1 font/substitute if (genericFont instanceof EncodedFont) { return Type1Encoding.fromFontBox(((EncodedFont) genericFont).getEncoding()); } else { // default (only happens with TTFs) return StandardEncoding.INSTANCE; } } }
@Override public float getHeight(int code) throws IOException { String name = codeToName(code); if (getStandard14AFM() != null) { String afmName = getEncoding().getName(code); return getStandard14AFM().getCharacterHeight(afmName); // todo: isn't this the y-advance, not the height? } else { // todo: should be scaled by font matrix return (float) genericFont.getPath(name).getBounds().getHeight(); } }
@Override public float getHeight(int code) throws IOException { String name = codeToName(code); if (getStandard14AFM() != null) { String afmName = getEncoding().getName(code); return getStandard14AFM().getCharacterHeight(afmName); // todo: isn't this the y-advance, not the height? } else { // todo: should be scaled by font matrix return (float) genericFont.getPath(name).getBounds().getHeight(); } }