Examples of GlyphMetrics


Examples of java.awt.font.GlyphMetrics

  // iterate through the GlyphVector placing each glyph

  for (int i = 0; i < glyphs.getNumGlyphs(); i++) {
     
      GlyphMetrics gm = glyphs.getGlyphMetrics(i);

      float charAdvance = gm.getAdvance();

      Shape glyph = glyphs.getGlyphOutline(i);

      // if lengthAdjust was GLYPHS, then scale the glyph
      // by the lengthRatio in the X direction
View Full Code Here

Examples of java.awt.font.GlyphMetrics

            (AWTGlyphGeometryCache)fontCache.get(font.awtFont);

        AWTGlyphGeometryCache.Value v = glyphCache.get(c);
        if (v == null) {
            Shape outline = gv.getGlyphOutline(glyphIndex);
            GlyphMetrics metrics = gv.getGlyphMetrics(glyphIndex);
            Rectangle2D gmB = metrics.getBounds2D();
            if (AWTGVTGlyphVector.outlinesPositioned()) {
                AffineTransform tr = AffineTransform.getTranslateInstance
                    (-glyphPos.getX(), -glyphPos.getY());
                outline = tr.createTransformedShape(outline);
            }
View Full Code Here

Examples of java.awt.font.GlyphMetrics

     */
    public GVTGlyphMetrics(float horizontalAdvance,
                           float verticalAdvance,
                           Rectangle2D bounds,
                           byte glyphType) {
        this.gm = new GlyphMetrics(horizontalAdvance, bounds, glyphType);
        this.verticalAdvance = verticalAdvance;
    }
View Full Code Here

Examples of java.awt.font.GlyphMetrics

        // iterate through the GlyphVector placing each glyph

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

            GlyphMetrics gm = glyphs.getGlyphMetrics(i);

            float charAdvance = gm.getAdvance();

            Shape glyph = glyphs.getGlyphOutline(i);

            // if lengthAdjust was GLYPHS, then scale the glyph
            // by the lengthRatio in the X direction
View Full Code Here

Examples of java.awt.font.GlyphMetrics

     *
     * @return The glyph metrics.
     */
    public GlyphMetrics getGlyphMetrics() {
        if (metrics == null) {
            metrics = new GlyphMetrics(getHorizAdvX(),
                                       glyphNode.getOutline(null).getBounds2D(),
                                       GlyphMetrics.COMPONENT );
        }
        return metrics;
    }
View Full Code Here

Examples of java.awt.font.GlyphMetrics

     *
     * @param kern The kerning value to apply when calculating the glyph metrics.
     * @return The kerned glyph metics.
     */
    public GlyphMetrics getGlyphMetrics(float kern) {
        return new GlyphMetrics(getHorizAdvX() - (kern * kernScale),
                                glyphNode.getOutline(null).getBounds2D(),
                                GlyphMetrics.COMPONENT );

    }
View Full Code Here

Examples of java.awt.font.GlyphMetrics

     */
    public TextHit hitTestChar(float x, float y) {
        int begin = 0;
        int end = gv.getNumGlyphs();
        TextHit textHit = null;
        GlyphMetrics gm;
        float maxX = (float) gv.getVisualBounds().getX();
        if (transform != null) {
            try {
                Point2D p = new Point2D.Float(x, y);
                transform.inverseTransform(p, p);
View Full Code Here

Examples of java.awt.font.GlyphMetrics

        Rectangle2D.Double lbox = null;

        for (int i=0; i<c; ++i) {

            GlyphMetrics gm = gv.getGlyphMetrics(i);
            Rectangle2D gbounds2d = gm.getBounds2D();
            Point2D gpos = glyphPositions[i];
            lbox = new Rectangle2D.Double(
                                    gpos.getX()+gbounds2d.getX(),
                                    gpos.getY()+gbounds2d.getY(),
                                    gbounds2d.getWidth(),
View Full Code Here

Examples of java.awt.font.GlyphMetrics

                dy = (float)gpos.getY()-(float)prevPos.getY();
                boolean inWS = false;
                // while this is whitespace, increment
                int beginWS = i;
                int endWS = i;
                GlyphMetrics gm = gv.getGlyphMetrics(i);
                // BUG: gm.isWhitespace() fails for latin SPACE glyph!
                while ((gm.getBounds2D().getWidth()<0.01d) ||
                                                       gm.isWhitespace()) {
                    ++i;
                    ++endWS;
                    if (!inWS) inWS = true;
                    if (i>=numGlyphs) {
                        inWS = false;
View Full Code Here

Examples of java.awt.font.GlyphMetrics

            (AWTGlyphGeometryCache)fontCache.get(font.awtFont);

        AWTGlyphGeometryCache.Value v = glyphCache.get(c);
        if (v == null) {
            Shape outline = gv.getGlyphOutline(glyphIndex);
            GlyphMetrics metrics = gv.getGlyphMetrics(glyphIndex);
            Rectangle2D gmB = metrics.getBounds2D();
            if (AWTGVTGlyphVector.outlinesPositioned()) {
                AffineTransform tr = AffineTransform.getTranslateInstance
                    (-glyphPos.getX(), -glyphPos.getY());
                outline = tr.createTransformedShape(outline);
            }
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.