Package org.apache.fop.fonts

Examples of org.apache.fop.fonts.Typeface


    private Typeface getTypeface(String fontName) {
        if (fontName == null) {
            throw new NullPointerException("fontName must not be null");
        }
        Typeface tf = getFontInfo().getFonts().get(fontName);
        if (tf instanceof LazyFont) {
            tf = ((LazyFont)tf).getRealFont();
        }
        return tf;
    }
View Full Code Here


        String fontKey = getFontInfo().getInternalFontKey(triplet);
        int sizeMillipoints = state.getFontSize();
        float fontSize = sizeMillipoints / 1000f;

        // This assumes that *all* CIDFonts use a /ToUnicode mapping
        Typeface tf = getTypeface(fontKey);
        SingleByteFont singleByteFont = null;
        if (tf instanceof SingleByteFont) {
            singleByteFont = (SingleByteFont)tf;
        }
        Font font = getFontInfo().getFontInstance(triplet, sizeMillipoints);
        String fontName = font.getFontName();

        PDFTextUtil textutil = generator.getTextUtil();
        textutil.updateTf(fontKey, fontSize, tf.isMultiByte());

        generator.updateCharacterSpacing(letterSpacing / 1000f);

        textutil.writeTextMatrix(new AffineTransform(1, 0, 0, -1, x / 1000f, y / 1000f));
        int l = text.length();
View Full Code Here

                                  int letterSpacing, int wordSpacing, int[][] dp ) {
        assert text != null;
        assert triplet != null;
        assert dp != null;
        String          fk              = getFontInfo().getInternalFontKey(triplet);
        Typeface        tf              = getTypeface(fk);
        if ( tf.isMultiByte() ) {
            int         fs              = state.getFontSize();
            float       fsPoints        = fs / 1000f;
            Font        f               = getFontInfo().getFontInstance(triplet, fs);
            // String      fn              = f.getFontName();
            PDFTextUtil tu              = generator.getTextUtil();
View Full Code Here

            warn = true;
        } else if (font.hasChar(MINUS_SIGN)) {
            effHyphChar = MINUS_SIGN;
            FontMetrics metrics = font.getFontMetrics();
            if (metrics instanceof Typeface) {
                Typeface typeface = (Typeface)metrics;
                if ("SymbolEncoding".equals(typeface.getEncodingName())) {
                    //SymbolEncoding doesn't have HYPHEN_MINUS, so replace by MINUS_SIGN
                } else {
                    //only warn if the encoding is not SymbolEncoding
                    warn = true;
                }
            }
        } else {
            effHyphChar = ' ';
            FontMetrics metrics = font.getFontMetrics();
            if (metrics instanceof Typeface) {
                Typeface typeface = (Typeface)metrics;
                if ("ZapfDingbatsEncoding".equals(typeface.getEncodingName())) {
                    //ZapfDingbatsEncoding doesn't have HYPHEN_MINUS, so replace by ' '
                } else {
                    //only warn if the encoding is not ZapfDingbatsEncoding
                    warn = true;
                }
View Full Code Here

       
        currentIPPosition = saveIP + text.getAllocIPD();
        //super.renderText(text);

        // rendering text decorations
        Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());
        int fontsize = text.getTraitAsInteger(Trait.FONT_SIZE);
        renderTextDecoration(tf, fontsize, text, bl, rx);
    }
View Full Code Here

        String fontName = getInternalFontNameForArea(text);
        int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
       
        // This assumes that *all* CIDFonts use a /ToUnicode mapping
        Typeface tf = (Typeface) fontInfo.getFonts().get(fontName);
        boolean useMultiByte = tf.isMultiByte();
       
        updateFont(fontName, size, pdf);
        Color ct = (Color) text.getTrait(Trait.COLOR);
        updateColor(ct, true, pdf);

View Full Code Here

    /**
     * @see org.apache.fop.render.AbstractRenderer#renderWord(WordArea)
     */
    public void renderWord(WordArea word) {
        Font font = getFontFromArea(word.getParentArea());
        Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());
        boolean useMultiByte = tf.isMultiByte();

        StringBuffer pdf = new StringBuffer();
       
        String s = word.getWord();
        escapeText(s, word.getLetterAdjustArray(),
View Full Code Here

    /**
     * @see org.apache.fop.render.AbstractRenderer#renderSpace(SpaceArea)
     */
    public void renderSpace(SpaceArea space) {
        Font font = getFontFromArea(space.getParentArea());
        Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());
        boolean useMultiByte = tf.isMultiByte();

        String s = space.getSpace();
       
        StringBuffer pdf = new StringBuffer();

View Full Code Here

        renderInlineAreaBackAndBorders(area);
        String fontname = getInternalFontNameForArea(area);
        int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE);

        // This assumes that *all* CIDFonts use a /ToUnicode mapping
        Typeface tf = (Typeface) fontInfo.getFonts().get(fontname);

        //Determine position
        int rx = currentIPPosition + area.getBorderAndPaddingWidthStart();
        int bl = currentBPPosition + area.getOffset() + area.getBaselineOffset();

View Full Code Here

        super.renderSpace(space);
    }

    private void renderText(AbstractTextArea area, String text, int[] letterAdjust) {
        Font font = getFontFromArea(area);
        Typeface tf = (Typeface) fontInfo.getFonts().get(font.getFontName());

        int initialSize = text.length();
        initialSize += initialSize / 2;
        StringBuffer sb = new StringBuffer(initialSize);
        int textLen = text.length();
        if (letterAdjust == null
                && area.getTextLetterSpaceAdjust() == 0
                && area.getTextWordSpaceAdjust() == 0) {
            sb.append("(");
            for (int i = 0; i < textLen; i++) {
                final char c = text.charAt(i);
                final char mapped = tf.mapChar(c);
                PSGenerator.escapeChar(mapped, sb);
            }
            sb.append(") t");
        } else {
            sb.append("(");
            int[] offsets = new int[textLen];
            for (int i = 0; i < textLen; i++) {
                final char c = text.charAt(i);
                final char mapped = tf.mapChar(c);
                int wordSpace;

                if (CharUtilities.isAdjustableSpace(mapped)) {
                    wordSpace = area.getTextWordSpaceAdjust();
                } else {
                    wordSpace = 0;
                }
                int cw = tf.getWidth(mapped, font.getFontSize()) / 1000;
                int ladj = (letterAdjust != null && i < textLen - 1 ? letterAdjust[i + 1] : 0);
                int tls = (i < textLen - 1 ? area.getTextLetterSpaceAdjust() : 0);
                offsets[i] = cw + ladj + tls + wordSpace;
                PSGenerator.escapeChar(mapped, sb);
            }
View Full Code Here

TOP

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

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.