Examples of Glyph


Examples of org.apache.harmony.awt.gl.font.Glyph

    /**
     * Returns default Glyph object of this WindowsFont.
     */
    @Override
    public Glyph getDefaultGlyph() {
        Glyph result;
        Integer defaultKey = Integer.valueOf(defaultChar);

        if (glyphs.containsKey(defaultKey)) {
            result = glyphs.get(defaultKey);
        } else {
View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

        if (((gv.getLayoutFlags() & GlyphVector.FLAG_HAS_TRANSFORMS) != 0)){

            for (int i=0; i < gv.getNumGlyphs(); i++){

                Glyph gl = ((CommonGlyphVector)gv).vector[i];

                if (gl.getPointWidth()==0) {
                    continue;
                }

                char chr = gl.getChar();

                AffineTransform glyphAT = gv.getGlyphTransform(i);
                if ((glyphAT == null) || glyphAT.isIdentity()){
                    chars[count] = chr;
                    int index = i * 2;
                    int ind = count * 2;
                    positions[ind] = ((CommonGlyphVector)gv).visualPositions[index];
                    positions[ind + 1] = ((CommonGlyphVector)gv).visualPositions[index+1];
                    count++;
                    continue;
                }
               
                if (glyphAT.getType() == AffineTransform.TYPE_TRANSLATION){
                    chars[count] = chr;
                    int index = i * 2;
                    int ind = count * 2;
                    positions[ind] = ((CommonGlyphVector)gv).visualPositions[index] +
                                glyphAT.getTranslateX();
                    positions[ind + 1] = ((CommonGlyphVector)gv).visualPositions[index+1] +
                                glyphAT.getTranslateY();
                    count++;
                    continue;
                }
               
                at.transform(positions, 0, positions, 0, count);
               
                status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        fontMatrix);
                if (status != 0 && debugOutput){
                    System.err.println("GDIPlus DrawDriverString error status = " +
                            status);
                }

                count = 0;
               
                AffineTransform at1 = new AffineTransform(glyphAT);

                at1.concatenate(fontAT);
                at1.getMatrix(matrix);

                Point2D pos = gv.getGlyphPosition(i);
               
                status = NativeFont.gdiPlusDrawDriverChar(graphicsInfo,
                        chr,
                        font,
                        (float)(x + pos.getX()),
                        (float)(y + pos.getY()),
                        NativeFont.DriverStringOptionsCmapLookup,
                        matrix);
                if (status != 0 && debugOutput){
                    System.err.println("GDIPlus DrawDriverString error status = " +
                            status);
                }

            }
            if (count != 0){
               
                at.transform(positions, 0, positions, 0, count);

                status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        fontMatrix);
                if (status != 0 && debugOutput){
                    System.err.println("GDIPlus DrawDriverString error status = " +
                            status);
                }

            }
        } else {
            for (int i=0; i < len ; i++){
                Glyph gl = ((CommonGlyphVector)gv).vector[i];
               
                if (gl.getPointWidth()==0) {
                    continue;
                }

                chars[count] = gl.getChar();
                int index = i * 2;
                int ind = count * 2;
                positions[ind] = ((CommonGlyphVector)gv).visualPositions[index];
                positions[ind + 1] = ((CommonGlyphVector)gv).visualPositions[index+1];
                count++;
View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

        AffineTransform at = new AffineTransform(fontAT);
        at.getMatrix(fontMatrix);
        at.preConcatenate(AffineTransform.getTranslateInstance(x, y));
       
        for (int i=0; i < len; i++){
            Glyph gl = ((CommonGlyphVector)gv).vector[i];

            if (gl.getPointWidth() ==0){
                continue;
            }
           
            char c = gl.getChar();
            AffineTransform glyphAT = gv.getGlyphTransform(i);
            Point2D pos = gv.getGlyphPosition(i);
           
            fontIndex = wcf.getCharFontIndex(c, 0);

            if ((glyphAT == null) ||
                    glyphAT.isIdentity() ||
                    glyphAT.getType() == AffineTransform.TYPE_TRANSLATION){
                if (fontIndex != charFontIndex) {
                    charFontIndex = fontIndex;

                    at.transform(positions, 0, positions, 0, count);

                    status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                            chars,
                            count,
                            font,
                            positions,
                            NativeFont.DriverStringOptionsCmapLookup,
                            fontMatrix);
                    if (status != 0 && debugOutput){
                        System.err.println("gdipDrawCompositeGlyphVector: " +
                                "GDIPlus DrawDriverString error status = " +
                                status);
                    }

                    count = 0;
                    font = gl.getPFont();
                    physFont = (WindowsFont)wcf.fPhysicalFonts[charFontIndex];
                }else {
                    chars[count] = c;
                    int ind = count * 2;
                    positions[ind] = pos.getX();
                    positions[ind + 1] = pos.getY();
                    count++;
                }
                continue;
            }

            charFontIndex = fontIndex;
            if (count > 0){

                at.transform(positions, 0, positions, 0, count);

                status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        fontMatrix);
                if (status != 0 && debugOutput){
                    System.err.println("gdipDrawCompositeGlyphVector: GDIPlus " +
                            "DrawDriverString error status = " + status);
                }
                count = 0;
            }
           
            font = gl.getPFont();

            AffineTransform at1 = new AffineTransform(glyphAT);
            at1.concatenate(fontAT);
            at1.getMatrix(matrix);

View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

        float yPos = 0;
      
        int count = 0;
        for (int i=0; i < len; i++){
            char c = str.charAt(i);
            Glyph gl = wf.getGlyph(c);

            // We compare Advances because Width
            // of a char can be 0 (e.g. "Space" char)
            float advance = gl.getGlyphPointMetrics().getAdvance();
            if ( advance != 0){
                chars[count] = gl.getChar();
                positions[count * 2] = xPos;
                positions[count * 2 + 1] = yPos;
                xPos += advance;
                count++;
            }
View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

        float yPos = 0;
      
        int count = 0;
        for (int i=0; i < len; i++){
            char c = str[i];
            Glyph gl = wf.getGlyph(c);

            // We compare advances because width
            // of a char can be 0 (e.g. "Space" char)
            float advance = gl.getGlyphPointMetrics().getAdvance();
            if ( advance != 0){
                chars[count] = gl.getChar();

                positions[count * 2] = xPos;
                positions[count * 2 + 1] = yPos;

                xPos += advance;
View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

        float xPos = 0;    // X position to draw
        int count = 0;

       
        for (int i=0; i < len; i++){
            Glyph gl = wcf.getGlyph(str.charAt(i));

            int advance = (int)(gl.getGlyphPointMetrics().getAdvance());
            if (advance ==0){
                continue;
            }
            char c = gl.getChar();

            fontIndex = wcf.getCharFontIndex(c, 0);
           
            if (fontIndex != charFontIndex) {
                charFontIndex = fontIndex;
               
                at.transform(positions, 0, positions, 0, count);

                int status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        matrix);
                if (status != 0 && debugOutput){
                    System.err.println("GDIPlus DrawDriverString error status = " +
                            status);
                }

                count = 0;
                font = gl.getPFont();
            }
            chars[count] = c;
            positions[count*2] = xPos;
            positions[count*2 + 1] = yPos;

View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

    public int getMissingGlyphCode() {
        return getDefaultGlyph().getGlyphCode();
    }

    public Glyph getGlyph(char index) {
        Glyph result = null;

        Object key = new Integer(index);
        if (glyphs.containsKey(key)) {
            result = (Glyph) glyphs.get(key);
        } else {
View Full Code Here

Examples of org.apache.harmony.awt.gl.font.Glyph

        return result;
    }

    public Glyph getDefaultGlyph() {
        Glyph result;
        Object key = new Integer(defaultChar);
        if (glyphs.containsKey(key)) {
            result = (Glyph) glyphs.get(key);
        } else {
            if (this.fontType == FontManager.FONT_TYPE_T1){
View Full Code Here

Examples of org.jfree.layouting.renderer.text.Glyph

    long minimumChunkWidth = 0;

    final int lastPos = Math.min(glyphs.length, offset + length);
    for (int i = offset; i < lastPos; i++)
    {
      final Glyph glyph = glyphs[i];
      final Spacing spacing = glyph.getSpacing();
    //      heightAbove = Math.max(glyph.getBaseLine(), heightAbove);
    //      heightBelow = Math.max(glyph.getHeight() - glyph.getBaseLine(), heightBelow);
      final int kerning = glyph.getKerning();
      final int width = glyph.getWidth();
      if (glyph.getBreakWeight() <= BreakOpportunityProducer.BREAK_CHAR)
      {
        // for the layouting, we avoid inner-word breaks
        // Later, when we have to force breaks, we may take inner-breaks into
        // account.
        wordMinChunkWidth += width + spacing.getMinimum() - kerning;
        wordMinWidth += width + spacing.getMinimum() - kerning;
        wordPrefWidth += width + spacing.getOptimum() - kerning;
        wordMaxWidth += width + spacing.getMaximum() - kerning;
      }
      else
      {
        wordMinChunkWidth += width + spacing.getMinimum() - kerning;
        wordMinWidth += width + spacing.getMinimum() - kerning;
        wordPrefWidth += width + spacing.getOptimum() - kerning;
        wordMaxWidth += width + spacing.getMaximum() - kerning;

        minimumChunkWidth = Math.max(minimumChunkWidth, wordMinChunkWidth);
        wordMinWidth = 0;

        // Paranoid sanity checks: The word- and linebreaks should have been
        // replaced by other definitions in the text factory.
        if (glyph.getBreakWeight() == BreakOpportunityProducer.BREAK_LINE)
        {
          throw new IllegalStateException("A renderable text cannot and must " +
                  "not contain linebreaks.");
        }
      }
View Full Code Here

Examples of org.jnode.awt.font.spi.Glyph

            for (int i = 0; i < textLength; i++) {
                // get the index for the needed glyph
                final char ch = text.charAt(i);
                final int index = encTable.getTableFormat().getGlyphIndex(ch);
                if (ch != ' ') {
                    final Glyph g = glyphTable.getGlyph(index);
                    final GlyphRenderer renderer = renderCache.getRenderer(g,
                        ascent);
                    final Dimension d;
                    d = renderer.createGlyphRaster(alphaRaster, fontSize);
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.