Package org.jnode.awt.font.truetype.tables

Examples of org.jnode.awt.font.truetype.tables.HorizontalHeaderTable


            final CMapTable.EncodingTable encTable = cmapTable
                .getEncodingTable(0);
            if (encTable.getTableFormat() == null) {
                throw new RuntimeException("The table is NUll!!");
            }
            final HorizontalHeaderTable hheadTable = fd
                .getHorizontalHeaderTable();
            final double ascent = hheadTable.getAscent();
            final HorizontalMetricsTable hmTable = fd
                .getHorizontalMetricsTable();
            final double scale = fontSize / ascent;

            final int textLength = text.length();
View Full Code Here


            final GeneralPath gp = new GeneralPath();
            gp.moveTo(x, y);

            final GlyphTable glyphTable = fontData.getGlyphTable();
            final CMapTable cmapTable = fontData.getCMapTable();
            final HorizontalHeaderTable hheadTable = fontData
                .getHorizontalHeaderTable();
            final HorizontalMetricsTable hmTable = fontData
                .getHorizontalMetricsTable();

            if (!(cmapTable.getNrEncodingTables() > 0)) {
                throw new RuntimeException("No Encoding is found!");
            }
            final CMapTable.EncodingTable encTable = cmapTable
                .getEncodingTable(0);
            if (encTable.getTableFormat() == null) {
                throw new RuntimeException("The table is NUll!!");
            }
            final double ascent = hheadTable.getAscent();

            final AffineTransform tx2 = new AffineTransform();           
            final double scale = fontSize / (-hheadTable.getDescent() + ascent);
           
            tx2.translate(x, y + fontSize);
            tx2.scale(scale, -scale);
            tx2.translate(0, ascent);
           
View Full Code Here

        throws IOException {
        final int idx = fdata.getCMapTable().getEncodingTable(0).getTableFormat().getGlyphIndex(ch);
        final ShapedGlyph g = (ShapedGlyph) fdata.getGlyphTable().getGlyph(idx);
        Shape shape = g.getShape();
//        System.out.println("shape.bounds " + shape.getBounds());
        final HorizontalHeaderTable hheadTable = fdata
            .getHorizontalHeaderTable();
        final double ascent = hheadTable.getAscent();

        Area area = new Area(shape);
        GlyphRenderer gr = new GlyphRenderer(new RenderContext(), area, ascent);
        final WritableRaster r = GlyphRenderer.createRaster(32, 32);
        gr.createGlyphRaster(r, 16);
View Full Code Here

    public static void drawString(Graphics g, String s, int x, int y, double fontSize) throws IOException {

        final GlyphTable glyphTable = ttf.getGlyphTable();
        final CMapTable cmapTable = ttf.getCMapTable();
        final HorizontalHeaderTable hheadTable = ttf.getHorizontalHeaderTable();
        final HorizontalMetricsTable hmTable = ttf.getHorizontalMetricsTable();

        if (!(cmapTable.getNrEncodingTables() > 0)) {
            throw new RuntimeException("No Encoding is found!");
        }
        final CMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0);
        if (encTable.getTableFormat() == null) {
            throw new RuntimeException("The table is NUll!!");
        }
        final int maxAdvance = hheadTable.getMaxAdvance();
        final double ascent = hheadTable.getAscent();
        final int descent = -hheadTable.getDescent();

        final AffineTransform tx = new AffineTransform();
        double scale = fontSize / ascent;

        tx.translate(x, y + fontSize);
View Full Code Here

    public static void testGetGlyph(String s, int x, int y, int fontSize) throws IOException {

        final GlyphTable glyphTable = ttf.getGlyphTable();
        final CMapTable cmapTable = ttf.getCMapTable();
        final HorizontalHeaderTable hheadTable = ttf.getHorizontalHeaderTable();

        if (!(cmapTable.getNrEncodingTables() > 0)) {
            throw new RuntimeException("No Encoding is found!");
        }
        final CMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0);
        if (encTable.getTableFormat() == null) {
            throw new RuntimeException("The table is NUll!!");
        }

        final double ascent = hheadTable.getAscent();
        final AffineTransform tx = new AffineTransform();
        double scale = fontSize / ascent;
        tx.translate(x, y + fontSize);
        System.out.println("Scale=" + scale + ", ascent=" + ascent);
        tx.scale(scale, -scale);
View Full Code Here

TOP

Related Classes of org.jnode.awt.font.truetype.tables.HorizontalHeaderTable

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.