summaryrefslogtreecommitdiff
path: root/platform/java/src/com/artifex/mupdf/fitz/Font.java
blob: f56a0a488cbf479c1a7a60b7fe97e8fe99516d53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.artifex.mupdf.fitz;

public class Font
{
	static {
		Context.init();
	}

	public static final int LATIN = 0;
	public static final int GREEK = 1;
	public static final int CYRILLIC = 2;

	public static final int ADOBE_CNS = 0;
	public static final int ADOBE_GB = 1;
	public static final int ADOBE_JAPAN = 2;
	public static final int ADOBE_KOREA = 3;

	private long pointer;

	protected native void finalize();

	public void destroy() {
		finalize();
		pointer = 0;
	}

	private native long newNative(String name, int index);

	private Font(long p) {
		pointer = p;
	}

	public Font(String name, int index) {
		pointer = newNative(name, index);
	}

	public Font(String name) {
		pointer = newNative(name, 0);
	}

	public native String getName();

	public native int encodeCharacter(int unicode);
	public native float advanceGlyph(int glyph, boolean wmode);

	public float advanceGlyph(int glyph) {
		return advanceGlyph(glyph, false);
	}

	public String toString() {
		return "Font(" + getName() + ")";
	}
}