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

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


    protected TTFFontData() {
    }

    public Glyph getGlyph(char c) throws IOException {
        final GlyphTable glyphTable = getGlyphTable();
        final CMapTable cmapTable = getCMapTable();

        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!!");
        }

        //get the index for the needed glyph
View Full Code Here


                       CharSequence text, int x, int y, Color color) {
        try {
            final TTFFontData fd = (TTFFontData) fontData;
            final int fontSize = fontMetrics.getFont().getSize();
            final GlyphTable glyphTable = fd.getGlyphTable();
            final CMapTable cmapTable = fd.getCMapTable();

            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 HorizontalHeaderTable hheadTable = fd
View Full Code Here

        try {
            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();
View Full Code Here

     * @return The width
     * @see java.awt.FontMetrics#charWidth(char)
     */
    public int charWidth(char ch) {
        try {
            final CMapTable cmapTable = fontData.getCMapTable();
            final CMapTable.EncodingTable encTable = cmapTable.getEncodingTable(0);
            final HorizontalMetricsTable hmTable = fontData.getHorizontalMetricsTable();
            final int index = encTable.getTableFormat().getGlyphIndex(ch);
            return (int) (hmTable.getAdvanceWidth(index) * scale);
        } catch (IOException ex) {
            return 0;
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();
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();
View Full Code Here

TOP

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

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.