ttftable.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 77 行

JAVA
77
字号
// Copyright 2001, FreeHEP.
package org.jnode.awt.font.truetype;

import java.io.IOException;

/**
 *  Concrete instances derived from this class hold data stored in true type tables. 
 *  Right now the data is accessible as public attributes. 
 *  In some cases methods may return more convenient objects 
 *  (such as Shapes instead of point arrays).
 *
 *  @author Simon Fischer
 *  @version $Id: TTFTable.java,v 1.1 2003/11/25 11:51:38 epr Exp $
 */
public abstract class TTFTable {

	public static final String[] TT_TAGS = new String[] { "cmap", "glyf", "head", "hhea", "hmtx", "loca", "maxp", "name", "OS/2", "post" };

	public static final Class[] TABLE_CLASSES =
		new Class[] {
			TTFCMapTable.class,
			TTFGlyphTable.class,
			TTFHeadTable.class,
			TTFHorizontalHeaderTable.class,
			TTFHorizontalMetricsTable.class,
			TTFLocationsTable.class,
			TTFMaxPTable.class,
			TTFNameTable.class,
			TTFOS_2Table.class,
			TTFPostTable.class };

	private TTFFontData ttfFont;
	TTFInput ttf;
	private boolean isRead = false;

	public void init(TTFFontData font, TTFInput ttf) throws IOException {
		this.ttfFont = font;
		this.ttf = ttf;
	}

	public void read() throws IOException {
		ttf.pushPos();
		System.out.print("[" + getTag());
		ttf.seek(0);
		readTable();
		isRead = true;
		System.out.print("]");
		ttf.popPos();
	}

	public abstract void readTable() throws IOException;

	public abstract String getTag();

	public boolean isRead() {
		return isRead;
	}

	/*public TTFTable getTable(String tag) throws IOException {
		return ttfFont.getTable(tag);
	}*/

	// --------------------------------------------------------------------------------

	public String toString() {
		return ttf + ": [" + getTag() + "/" + getClass().getName() + "]";
	}

	/**
	 * @return The font data this table belongs to
	 */
	public TTFFontData getFont() {
		return this.ttfFont;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?