Package org.apache.fop.fonts

Examples of org.apache.fop.fonts.SingleByteFont


     * @see FontLoader#read()
     */
    protected void read() throws IOException {
        pfm = new PFMFile();
        pfm.load(in);
        singleFont = new SingleByteFont();
        singleFont.setFontType(FontType.TYPE1);
        singleFont.setResolver(this.resolver);
        returnFont = singleFont;
        returnFont.setFontName(pfm.getPostscriptName());
        returnFont.setCapHeight(pfm.getCapHeight());
View Full Code Here


                ((PDFFontType0)font).setDescendantFonts(cidFont);
            } else {
                PDFFontNonBase14 nonBase14 = (PDFFontNonBase14)font;
                nonBase14.setDescriptor(pdfdesc);

                SingleByteFont singleByteFont;
                if (metrics instanceof LazyFont) {
                    singleByteFont = (SingleByteFont)((LazyFont)metrics).getRealFont();
                } else {
                    singleByteFont = (SingleByteFont)metrics;
                }
                int firstChar = singleByteFont.getFirstChar();
                int lastChar = singleByteFont.getLastChar();
                nonBase14.setWidthMetrics(firstChar,
                                     lastChar,
                                     makeArray(metrics.getWidths()));
               
                //Handle encoding
                CodePointMapping mapping = singleByteFont.getCodePointMapping();
                if (singleByteFont.isSymbolicFont()) {
                    //no encoding, use the font's encoding
                } else if (PDFEncoding.isPredefinedEncoding(mapping.getName())) {
                    font.setEncoding(mapping.getName());
                } else {
                    CodePointMapping winansi = CodePointMapping.getMapping(
View Full Code Here

    private void buildFont(AFMFile afm, PFMFile pfm) {
        if (afm == null && pfm == null) {
            throw new IllegalArgumentException("Need at least an AFM or a PFM!");
        }
        singleFont = new SingleByteFont();
        singleFont.setFontType(FontType.TYPE1);
        singleFont.setResolver(this.resolver);
        singleFont.setEmbedFileName(this.fontFileURI);
        returnFont = singleFont;
       
View Full Code Here

                ((PDFFontType0)font).setDescendantFonts(cidFont);
            } else {
                PDFFontNonBase14 nonBase14 = (PDFFontNonBase14)font;
                nonBase14.setDescriptor(pdfdesc);

                SingleByteFont singleByteFont;
                if (metrics instanceof LazyFont) {
                    singleByteFont = (SingleByteFont)((LazyFont)metrics).getRealFont();
                } else {
                    singleByteFont = (SingleByteFont)metrics;
                }
                int firstChar = singleByteFont.getFirstChar();
                int lastChar = singleByteFont.getLastChar();
                nonBase14.setWidthMetrics(firstChar,
                                     lastChar,
                                     makeArray(metrics.getWidths()));
               
                //Handle encoding
                CodePointMapping mapping = singleByteFont.getCodePointMapping();
                if (PDFEncoding.isPredefinedEncoding(mapping.getName())) {
                    font.setEncoding(mapping.getName());
                } else {
                    CodePointMapping winansi = CodePointMapping.getMapping(
                            CodePointMapping.WIN_ANSI_ENCODING);
View Full Code Here

    private void renderText(AbstractTextArea area, String text, int[] letterAdjust) {
        String fontkey = getInternalFontNameForArea(area);
        int fontSize = area.getTraitAsInteger(Trait.FONT_SIZE);
        Font font = getFontFromArea(area);
        Typeface tf = getTypeface(font.getFontName());
        SingleByteFont singleByteFont = null;
        if (tf instanceof SingleByteFont) {
            singleByteFont = (SingleByteFont)tf;
        }

        int textLen = text.length();
        if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) {
            int start = 0;
            int currentEncoding = -1;
            for (int i = 0; i < textLen; i++) {
                char c = text.charAt(i);
                char mapped = tf.mapChar(c);
View Full Code Here

                           int[] letterAdjust,
                           Font font, AbstractTextArea parentArea) {
        String fontName = font.getFontName();
        float fontSize = font.getFontSize() / 1000f;
        Typeface tf = getTypeface(fontName);
        SingleByteFont singleByteFont = null;
        if (tf instanceof SingleByteFont) {
            singleByteFont = (SingleByteFont)tf;
        }
        PDFTextUtil textutil = generator.getTextUtil();

        int l = s.length();

        for (int i = start; i < end; i++) {
            char orgChar = s.charAt(i);
            char ch;
            float glyphAdjust = 0;
            if (font.hasChar(orgChar)) {
                ch = font.mapChar(orgChar);
                if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) {
                    int encoding = ch / 256;
                    if (encoding == 0) {
                        textutil.updateTf(fontName, fontSize, tf.isMultiByte());
                    } else {
                        textutil.updateTf(fontName + "_" + Integer.toString(encoding),
View Full Code Here

    private void buildFont(AFMFile afm, PFMFile pfm) {
        if (afm == null && pfm == null) {
            throw new IllegalArgumentException("Need at least an AFM or a PFM!");
        }
        singleFont = new SingleByteFont();
        singleFont.setFontType(FontType.TYPE1);
        singleFont.setResolver(this.resolver);
        if (this.embedded) {
            singleFont.setEmbedFileName(this.fontFileURI);
        }
View Full Code Here

            PSResource fontRes = new PSResource(PSResource.TYPE_FONT, tf.getFontName());
            fontResources.put(key, fontRes);
            embedFont(gen, tf, fontRes);

            if (tf instanceof SingleByteFont) {
                SingleByteFont sbf = (SingleByteFont)tf;

                if (encodeAllCharacters) {
                    sbf.encodeAllUnencodedCharacters();
                }

                for (int i = 0, c = sbf.getAdditionalEncodingCount(); i < c; i++) {
                    SingleByteEncoding encoding = sbf.getAdditionalEncoding(i);
                    defineEncoding(gen, encoding);
                    String postFix = "_" + (i + 1);
                    PSResource derivedFontRes = defineDerivedFont(gen, tf.getFontName(),
                            tf.getFontName() + postFix, encoding.getName());
                    fontResources.put(key + postFix, derivedFontRes);
View Full Code Here

            } else {
                if (tf instanceof Base14Font) {
                    //Our Base 14 fonts don't use the default encoding
                    redefineFontEncoding(gen, tf.getFontName(), tf.getEncodingName());
                } else if (tf instanceof SingleByteFont) {
                    SingleByteFont sbf = (SingleByteFont)tf;
                    if (!sbf.isUsingNativeEncoding()) {
                        //Font has been configured to use an encoding other than the default one
                        redefineFontEncoding(gen, tf.getFontName(), tf.getEncodingName());
                    }
                }
            }
View Full Code Here

                    CustomFont cf = (CustomFont)tf;
                    if (isEmbeddable(cf)) {
                        resTracker.registerSuppliedResource(fontRes);
                    }
                    if (tf instanceof SingleByteFont) {
                        SingleByteFont sbf = (SingleByteFont)tf;
                        for (int i = 0, c = sbf.getAdditionalEncodingCount(); i < c; i++) {
                            SingleByteEncoding encoding = sbf.getAdditionalEncoding(i);
                            PSResource encodingRes = new PSResource(
                                    PSResource.TYPE_ENCODING, encoding.getName());
                            resTracker.registerSuppliedResource(encodingRes);
                            PSResource derivedFontRes = new PSResource(
                                    PSResource.TYPE_FONT, tf.getFontName() + "_" + (i + 1));
View Full Code Here

TOP

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

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.