org.apache.fontbox.cff.CFFCIDFont Java Examples

The following examples show how to use org.apache.fontbox.cff.CFFCIDFont. 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: FontState.java    From ttt with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}