Examples of FontTriplet


Examples of org.apache.fop.fonts.FontTriplet

                fontInfo.addMetrics(internalName, font);

                List triplets = configFontInfo.getFontTriplets();
                for (int c = 0; c < triplets.size(); c++) {
                    FontTriplet triplet = (FontTriplet) triplets.get(c);

                    if (log.isDebugEnabled()) {
                        log.debug("Registering: " + triplet + " under " + internalName);
                    }
                    fontInfo.addFontProperties(internalName, triplet);
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

                    PROXY_PAINTER.paint(node, g2d);
                    return;
                }*/
                fontFamily = fam.getFamilyName();
                if (fontInfo.hasFont(fontFamily, style, weight)) {
                    FontTriplet triplet = fontInfo.fontLookup(
                            fontFamily, style, weight);
                    int fsize = (int)(fontSize.floatValue() * 1000);
                    return fontInfo.getFontInstance(triplet, fsize);
                }
            }
        }
        FontTriplet triplet = fontInfo.fontLookup("any", style, Font.WEIGHT_NORMAL);
        int fsize = (int)(fontSize.floatValue() * 1000);
        return fontInfo.getFontInstance(triplet, fsize);
    }
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

     * Returns the internal font key for a font triplet coming from the area tree
     * @param area the area from which to retrieve the font triplet information
     * @return the internal font key (F1, F2 etc.) or null if not found
     */
    protected String getInternalFontNameForArea(Area area) {
        FontTriplet triplet = (FontTriplet)area.getTrait(Trait.FONT);
        String key = fontInfo.getInternalFontKey(triplet);
        if (key == null) {
            //Find a default fallback font as last resort
            triplet = new FontTriplet("any", Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
            key = fontInfo.getInternalFontKey(triplet);
        }
        return key;
    }
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

     * Returns a Font object constructed based on the font traits in an area
     * @param area the area from which to retrieve the font triplet information
     * @return the requested Font instance or null if not found
     */
    protected Font getFontFromArea(Area area) {
        FontTriplet triplet = (FontTriplet)area.getTrait(Trait.FONT);
        int size = ((Integer)area.getTrait(Trait.FONT_SIZE)).intValue();
        return fontInfo.getFontInstance(triplet, size);
    }
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

        }
        int fontSize = 1000 * f.getSize();
        String style = f.isItalic() ? "italic" : "normal";
        int weight = f.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;

        FontTriplet triplet = fontInfo.findAdjustWeight(fontFamily, style, weight);
        if (triplet == null) {
            triplet = fontInfo.findAdjustWeight("sans-serif", style, weight);
        }
        return fontInfo.getFontInstance(triplet, fontSize);
    }
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

        FontCollection[] fontCollections = new FontCollection[] {
                new Base14FontCollection(fontManager.isBase14KerningEnabled()),
                new CustomFontCollection(renderer.getFontResolver(), renderer.getFontList())
        };
        fontManager.setup(fontInfo, fontCollections);
        FontTriplet triplet = new FontTriplet("Times", "italic",
                Font.WEIGHT_NORMAL);
        String internalFontKey = fontInfo.getInternalFontKey(triplet);
        // Times italic should now be mapped to the 15th font (custom font)
        // not the original base 14 (F6)
        if (!"F15".equals(internalFontKey)) {
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

        try {
            //Note: dy is currently ignored
            PSGenerator generator = getGenerator();
            generator.useColor(state.getTextColor());
            beginTextObject();
            FontTriplet triplet = new FontTriplet(
                    state.getFontFamily(), state.getFontStyle(), state.getFontWeight());
            //TODO Ignored: state.getFontVariant()
            //TODO Opportunity for font caching if font state is more heavily used
            String fontKey = getFontInfo().getInternalFontKey(triplet);
            if (fontKey == null) {
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

            Map/*<FontTriplet>*/ triplets = (Map/*<FontTriplet>*/)fontInfo.getFontTriplets();
            if (triplets != null) {
                Set/*<FontTriplet>*/ tripletSet = triplets.keySet();
                for (Iterator/*<FontTriplet>*/ tripletIt = tripletSet.iterator();
                        tripletIt.hasNext();) {
                    FontTriplet triplet = (FontTriplet)tripletIt.next();
                    String fontName = triplet.getName();

                    // matched font family name
                    if (fontFamilyString.toLowerCase().equals(fontName.toLowerCase())) {

                        // try and match font weight
                        boolean weightMatched = false;
                        int fontWeight = triplet.getWeight();
                        for (Iterator weightIt = weightValue.iterator(); weightIt.hasNext();) {
                            Object weightObj = weightIt.next();
                            if (weightObj instanceof FontWeightRange) {
                                FontWeightRange intRange = (FontWeightRange)weightObj;
                                if (intRange.isWithinRange(fontWeight)) {
                                    weightMatched = true;
                                }
                            } else if (weightObj instanceof String) {
                                String fontWeightString = (String)weightObj;
                                int fontWeightValue = FontUtil.parseCSS2FontWeight(
                                        fontWeightString);
                                if (fontWeightValue == fontWeight) {
                                    weightMatched = true;
                                }
                            } else if (weightObj instanceof Integer) {
                                Integer fontWeightInteger = (Integer)weightObj;
                                int fontWeightValue = fontWeightInteger.intValue();
                                if (fontWeightValue == fontWeight) {
                                    weightMatched = true;
                                }
                            }
                        }

                        // try and match font style
                        boolean styleMatched = false;
                        String fontStyleString = triplet.getStyle();
                        for (Iterator styleIt = styleValue.iterator(); styleIt.hasNext();) {
                            String style = (String)styleIt.next();
                            if (fontStyleString.equals(style)) {
                                styleMatched = true;
                            }
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

     * @param fontInfo the font info
     * @return the highest priority matching font triplet
     */
    protected FontTriplet bestMatch(FontInfo fontInfo) {
        List/*<FontTriplet>*/ matchingTriplets = match(fontInfo);
        FontTriplet bestTriplet = null;
        if (matchingTriplets.size() == 1) {
            bestTriplet = (FontTriplet)matchingTriplets.get(0);
        } else {
            for (Iterator iterator = matchingTriplets.iterator(); iterator.hasNext();) {
                FontTriplet triplet = (FontTriplet)iterator.next();
                if (bestTriplet == null) {
                    bestTriplet = triplet;
                } else {
                    int priority = triplet.getPriority();
                    if (priority < bestTriplet.getPriority()) {
                        bestTriplet = triplet;
                    }
                }
            }
View Full Code Here

Examples of org.apache.fop.fonts.FontTriplet

                    if (weightObj instanceof FontWeightRange) {
                        FontWeightRange fontWeightRange = (FontWeightRange)weightObj;
                        int[] weightRange = fontWeightRange.toArray();
                        for (int i = 0; i < weightRange.length; i++) {
                            triplets.add(new FontTriplet(name, style, weightRange[i]));
                        }
                    } else if (weightObj instanceof String) {
                        String weightString = (String)weightObj;
                        int weight = FontUtil.parseCSS2FontWeight(weightString);
                        triplets.add(new FontTriplet(name, style, weight));
                    } else if (weightObj instanceof Integer) {
                        Integer weightInteger = (Integer)weightObj;
                        int weight = weightInteger.intValue();
                        triplets.add(new FontTriplet(name, style, weight));
                    }
                }
            }
        }
        return triplets;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.