Package flash.swf.types

Examples of flash.swf.types.GlyphEntry


            advance = (int)Math.rint(metrics.getAdvance()); //Do not scale here, DefineText needs values unscaled

            java.awt.Shape scaledShape = scaleTransform.createTransformedShape(glyphOutline);
            swfShape = createGlyphShape(scaledShape);

            GlyphEntry ge = new GlyphEntry();
            ge = new GlyphEntry(); //Note: we will set the index on building DefineFont2 tag
            ge.advance = (int)(advance * emScale * (useTwips ? SwfConstants.TWIPS_PER_PIXEL : 1));
            ge.shape = swfShape;
          //Glyph bounds are not used by the Flash Player so no need to calculate
          //Rectangle2D bs = scaledShape.getBounds2D();
          //bounds = new Rect((int)StrictMath.rint(bs.getMinX() * (useTwips ? SwfConstants.TWIPS_PER_PIXEL : 1)),
View Full Code Here


        return style;
    }

    public static GlyphEntry createGlyphEntryFromDefineFont(char c, char index, DefineFont3 tag)
    {
        GlyphEntry ge = new GlyphEntry();
        ge.character = c;
        ge.setIndex(index);

        if (tag.glyphShapeTable != null)
            ge.shape = tag.glyphShapeTable[index];

        if (tag.advanceTable != null)
View Full Code Here

            index = cmapFmt.mapCharCode(index);
            Glyph glyph = getGlyph(index);

            Shape s = getShapeFromGlyph(glyph);

            GlyphEntry ge = new GlyphEntry();
            ge.advance = (int)(getAdvance(referenceChar) * emScale * (useTwips ? SwfConstants.TWIPS_PER_PIXEL : 1));
            ge.character = c;
            ge.shape = s;

            // Glyph bounds are not used by the Flash Player so no need to calculate
View Full Code Here

        GlyphEntry[] e = new GlyphEntry[count];

        r.syncBits();
        for (int i = 0; i < count; i++)
        {
            GlyphEntry ge = new GlyphEntry();

            ge.setIndex( r.readUBits(glyphBits) );
            ge.advance = r.readSBits(advanceBits);

            e[i] = ge;
        }
View Full Code Here

            {
                char c = chars[i];
                // preilly: According to Sherman Gong, we need to clone the font GlyphEntry, so
                // that the advance value can be mapped from the font's logical scale to the
                // text's physical scale.
                GlyphEntry ge = (GlyphEntry)fontBuilder.getGlyph(c).clone();
                ge.advance = (int)((ge.advance / 1024f) * tr.height);
                tr.entries[i] = ge;
                w += ge.advance;
            }
            if (w > t_width)
View Full Code Here

            chars = line.toCharArray();
            tr.entries = new GlyphEntry[chars.length];
            for (int i = 0; i < chars.length; i++)
            {
                char c = chars[i];
                GlyphEntry ge = (GlyphEntry)fontBuilder.getGlyph(c).clone();
                ge.advance = (int)((ge.advance / 1024f) * tr.height);
                tr.entries[i] = ge;
            }
            tag.records.add(tr);
            yCount++;
View Full Code Here

            index = cmapFmt.mapCharCode(index);
            Glyph glyph = getGlyph(index);

            Shape s = getShapeFromGlyph(glyph);

            GlyphEntry ge = new GlyphEntry();
            ge.advance = (int)(getAdvance(referenceChar) * emScale * (useTwips ? SwfConstants.TWIPS_PER_PIXEL : 1));
            ge.character = c;
            ge.shape = s;

            // Glyph bounds are not used by the Flash Player so no need to calculate
View Full Code Here

        return new TestSuite(GlyphEntryTest.class);
    }

    public void testClonePositive()
    {
        GlyphEntry glyphEntry1 = new GlyphEntry();
        glyphEntry1.setIndex(1);
        glyphEntry1.advance = 1;

        GlyphEntry glyphEntry2 = (GlyphEntry) glyphEntry1.clone();

        assertEquals("glyphEntry1 should be equal to glyphEntry2",
                     glyphEntry1, glyphEntry2);
    }
View Full Code Here

                     glyphEntry1, glyphEntry2);
    }

    public void testEqualsPositive()
    {
        GlyphEntry glyphEntry1 = new GlyphEntry();
        glyphEntry1.setIndex(1);
        glyphEntry1.advance = 1;

        GlyphEntry glyphEntry2 = new GlyphEntry();
        glyphEntry2.setIndex(1);
        glyphEntry2.advance = 1;

        assertEquals("glyphEntry1 should be equal to glyphEntry2",
                     glyphEntry1, glyphEntry2);
    }
View Full Code Here

                     glyphEntry1, glyphEntry2);
    }

    public void testEqualsNegative()
    {
        GlyphEntry glyphEntry1 = new GlyphEntry();
        glyphEntry1.setIndex(1);
        glyphEntry1.advance = 1;

        GlyphEntry glyphEntry2 = new GlyphEntry();
        glyphEntry2.setIndex(2);
        glyphEntry2.advance = 2;
        assertFalse("glyphEntry1 should not be equal to glyphEntry2",
                    glyphEntry1.equals(glyphEntry2));
    }
View Full Code Here

TOP

Related Classes of flash.swf.types.GlyphEntry

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.