Package org.apache.fop.fonts

Examples of org.apache.fop.fonts.NamedCharacter


        public NamedCharacterSetter(String variable) {
            super(variable);
        }

        public void parse(String line, int startpos, Stack stack) throws IOException {
            NamedCharacter ch = new NamedCharacter(getStringValue(line, startpos));
            Object obj = stack.peek();
            setValue(obj, ch);
        }
View Full Code Here


     */
    public void overridePrimaryEncoding(SingleByteEncoding encoding) {
        Iterator iter = this.charMetrics.iterator();
        while (iter.hasNext()) {
            AFMCharMetrics cm = (AFMCharMetrics)iter.next();
            NamedCharacter nc = cm.getCharacter();
            if (nc.hasSingleUnicodeValue()) {
                int mapped = encoding.mapChar(nc.getSingleUnicodeValue());
                if (mapped > 0) {
                    cm.setCharCode(mapped);
                } else {
                    cm.setCharCode(-1);
                }
View Full Code Here

     * Sets the named character represented by this instance.
     * @param charName the character name (as defined in the Adobe glyph list)
     * @param unicodeSequence the Unicode sequence
     */
    public void setCharacter(String charName, String unicodeSequence) {
        setCharacter(new NamedCharacter(charName, unicodeSequence));
    }
View Full Code Here

                    int codePoint = singleFont.getEncoding().mapChar(u);
                    if (codePoint <= 0) {
                        String unicode = Character.toString(u);
                        String charName = Glyphs.stringToGlyph(unicode);
                        if (charName.length() > 0) {
                            NamedCharacter nc = new NamedCharacter(charName, unicode);
                            int glyphIndex = ce.getGlyphStartIndex() + u - ce.getUnicodeStart();
                            singleFont.addUnencodedCharacter(nc, wx[glyphIndex]);
                        }
                    }
                }
View Full Code Here

        public NamedCharacterSetter(String variable) {
            super(variable);
        }

        public void parse(String line, int startpos, Stack<Object> stack) throws IOException {
            NamedCharacter ch = new NamedCharacter(getStringValue(line, startpos));
            Object obj = stack.peek();
            setValue(obj, NamedCharacter.class, ch);
        }
View Full Code Here

        }

        AFMCharMetrics parse(String line, Stack<Object> stack, String afmFileName)
                throws IOException {
            AFMCharMetrics chm = defaultHandler.parse(line, stack, afmFileName);
            NamedCharacter namedChar = chm.getCharacter();
            if (namedChar != null) {
                int codePoint = AdobeStandardEncoding.getAdobeCodePoint(namedChar.getName());
                if (chm.getCharCode() != codePoint) {
                    LOG.info(afmFileName + ": named character '" + namedChar.getName() + "'"
                            + " has an incorrect code point: " + chm.getCharCode()
                            + ". Changed to " + codePoint);
                    chm.setCharCode(codePoint);
                }
            }
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Overriding primary encoding of " + getFontName() + " with: " + encoding);
        }
        AFMCharMetrics[] mapped = new AFMCharMetrics[256];
        for (AFMCharMetrics cm : this.charMetrics) {
            NamedCharacter nc = cm.getCharacter();
            if (nc.hasSingleUnicodeValue()) {
                int codePoint = encoding.mapChar(nc.getSingleUnicodeValue());
                if (codePoint > 0) {
                    if (mapped[codePoint] != null) {
                        if (LOG.isDebugEnabled()) {
                            AFMCharMetrics other = mapped[codePoint];
                            String msg = "Not mapping character " + nc + " to code point "
                                + codePoint + " (" + Integer.toHexString(codePoint) + ") in "
                                + encoding + ". "
                                + other + " has already been assigned that code point.";
                            if (other.getUnicodeSequence()
                                    .equals(nc.getUnicodeSequence())) {
                                msg += " This is a specialized glyph for the"
                                    + " same Unicode character.";
                                //TODO should these be mapped to a private Unicode area to make
                                //them accessible?
                            } else {
View Full Code Here

                        if (glyphName.length() == 0 && ttf.getPostScriptVersion() != PostScriptVersion.V2) {
                            glyphName = "u" + HexEncoder.encode(u);
                        }
                        if (glyphName.length() > 0) {
                            String unicode = Character.toString(u);
                            NamedCharacter nc = new NamedCharacter(glyphName, unicode);
                            singleFont.addUnencodedCharacter(nc, wx[glyphIndex]);
                        }
                    }
                }
            }
View Full Code Here

                        if (glyphName.length() == 0 && ttf.getPostScriptVersion() != PostScriptVersion.V2) {
                            glyphName = "u" + HexEncoder.encode(u);
                        }
                        if (glyphName.length() > 0) {
                            String unicode = Character.toString(u);
                            NamedCharacter nc = new NamedCharacter(glyphName, unicode);
                            singleFont.addUnencodedCharacter(nc, wx[glyphIndex]);
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.fop.fonts.NamedCharacter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.