org.apache.fontbox.cff.CFFFont Java Examples
The following examples show how to use
org.apache.fontbox.cff.CFFFont.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PDCIDFontType0.java From gcs with Mozilla Public License 2.0 | 6 votes |
/** * Returns the embedded CFF CIDFont, or null if the substitute is not a CFF font. */ public CFFFont getCFFFont() { if (cidFont != null) { return cidFont; } else if (t1Font instanceof CFFType1Font) { return (CFFType1Font)t1Font; } else { return null; } }
Example #2
Source File: FontState.java From ttt with BSD 2-Clause "Simplified" License | 6 votes |
private String getGlyphsPathContours(FontKey key, String glyphsAsText, double[] advances, CFFTable glyphs) { StringBuffer sb = new StringBuffer(); CFFFont cff = glyphs.getFont(); if ((cff != null) && (cff instanceof CFFCIDFont)) { CFFCharset charset = ((CFFCIDFont) cff).getCharset(); if (charset != null) { int[] retNext = new int[1]; for (int i = 0, n = glyphsAsText.length(); i < n; i = retNext[0]) { int gi = getGlyphId(glyphsAsText, i, false, null, retNext); if (gi > 0) { String p = getGlyphPath(key, gi, advances[i], cff, charset); if (p != null) sb.append(p); } } } } return sb.toString(); }
Example #3
Source File: PDCIDFontType0.java From sambox with Apache License 2.0 | 5 votes |
/** * Returns the embedded CFF CIDFont, or null if the substitute is not a CFF font. */ public CFFFont getCFFFont() { if (cidFont != null) { return cidFont; } else if (t1Font instanceof CFFType1Font) { return (CFFType1Font) t1Font; } return null; }
Example #4
Source File: FontState.java From ttt with BSD 2-Clause "Simplified" License | 5 votes |
private String getGlyphPath(FontKey key, int gi, double advance, CFFFont cff, CFFCharset charset) { PathCacheKey pck = new PathCacheKey(key, gi, advance); if (hasCachedGlyphPath(pck)) return getCachedGlyphPath(pck); else return putCachedGlyphPath(pck, getGlyphPath(pck, cff, charset)); }
Example #5
Source File: FontState.java From ttt with BSD 2-Clause "Simplified" License | 5 votes |
private String getGlyphPath(PathCacheKey pck, CFFFont cff, CFFCharset charset) { try { int cid = charset.getCIDForGID(pck.getGlyph()); Type1CharString cs = cff.getType2CharString(cid); if (cs != null) { GeneralPath p = cs.getPath(); if (p != null) return getGlyphPath(pck.getFontKey(), p, pck.getAdvance()); } } catch (IOException e) { } return null; }
Example #6
Source File: CFFTable.java From gcs with Mozilla Public License 2.0 | 4 votes |
/** * Returns the CFF font, which is a compact representation of a PostScript Type 1, or CIDFont */ public CFFFont getFont() { return cffFont; }