This source file includes following definitions.
- toString
- toString
- list
- match
- listFamilies
- openFont
- hasChar
- textExtents
- encodeChar
- draw
- createFontDriver
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.gnu.emacs;
21
22 import android.os.Build;
23
24
25
26
27 public abstract class EmacsFontDriver
28 {
29
30 public static final int THIN = 0;
31 public static final int ULTRA_LIGHT = 40;
32 public static final int LIGHT = 50;
33 public static final int SEMI_LIGHT = 55;
34 public static final int REGULAR = 80;
35 public static final int MEDIUM = 100;
36 public static final int SEMI_BOLD = 180;
37 public static final int BOLD = 200;
38 public static final int EXTRA_BOLD = 205;
39 public static final int BLACK = 210;
40 public static final int ULTRA_HEAVY = 250;
41
42
43 public static final int REVERSE_OBLIQUE = 0;
44 public static final int REVERSE_ITALIC = 10;
45 public static final int NORMAL = 100;
46 public static final int ITALIC = 200;
47 public static final int OBLIQUE = 210;
48
49
50 public static final int ULTRA_CONDENSED = 50;
51 public static final int EXTRA_CONDENSED = 63;
52 public static final int CONDENSED = 75;
53 public static final int SEMI_CONDENSED = 87;
54 public static final int UNSPECIFIED = 100;
55 public static final int SEMI_EXPANDED = 113;
56 public static final int EXPANDED = 125;
57 public static final int EXTRA_EXPANDED = 150;
58 public static final int ULTRA_EXPANDED = 200;
59
60
61 public static final int PROPORTIONAL = 0;
62 public static final int DUAL = 90;
63 public static final int MONO = 100;
64 public static final int CHARCELL = 110;
65
66 public static class FontSpec
67 {
68
69
70
71 public String foundry;
72 public String family;
73 public String adstyle;
74 public String registry;
75 public Integer width;
76 public Integer weight;
77 public Integer slant;
78 public Integer size;
79 public Integer spacing;
80 public Integer avgwidth;
81 public Integer dpi;
82
83 @Override
84 public String
85 toString ()
86 {
87 return ("foundry: " + foundry
88 + " family: " + family
89 + " adstyle: " + adstyle
90 + " registry: " + registry
91 + " width: " + width
92 + " weight: " + weight
93 + " slant: " + slant
94 + " spacing: " + spacing
95 + " avgwidth: " + avgwidth
96 + " dpi: " + dpi);
97 }
98 };
99
100 public static class FontMetrics
101 {
102 public short lbearing;
103 public short rbearing;
104 public short width;
105 public short ascent;
106 public short descent;
107
108 @Override
109 public String
110 toString ()
111 {
112 return ("lbearing " + lbearing
113 + " rbearing " + rbearing
114 + " width " + width
115 + " ascent " + ascent
116 + " descent " + descent);
117 }
118 }
119
120 public static class FontEntity extends FontSpec
121 {
122
123 };
124
125 public abstract class FontObject extends FontSpec
126 {
127 public int minWidth;
128 public int maxWidth;
129 public int pixelSize;
130 public int height;
131 public int spaceWidth;
132 public int averageWidth;
133 public int ascent;
134 public int descent;
135 public int underlineThickness;
136 public int underlinePosition;
137 public int baselineOffset;
138 public int relativeCompose;
139 public int defaultAscent;
140 public int encodingCharset;
141 public int repertoryCharset;
142
143 public
144 FontObject ()
145 {
146 encodingCharset = -1;
147 repertoryCharset = -1;
148 }
149 };
150
151
152 public abstract FontEntity[] list (FontSpec fontSpec);
153 public abstract FontEntity match (FontSpec fontSpec);
154 public abstract String[] listFamilies ();
155 public abstract FontObject openFont (FontEntity fontEntity, int pixelSize);
156 public abstract int hasChar (FontSpec font, char charCode);
157 public abstract void textExtents (FontObject font, int code[],
158 FontMetrics fontMetrics);
159 public abstract int encodeChar (FontObject fontObject, char charCode);
160 public abstract int draw (FontObject fontObject, EmacsGC gc,
161 EmacsDrawable drawable, int[] chars,
162 int x, int y, int backgroundWidth,
163 boolean withBackground);
164
165 public static EmacsFontDriver
166 createFontDriver ()
167 {
168 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
169 return new EmacsSdk23FontDriver ();
170
171 return new EmacsSdk7FontDriver ();
172 }
173 };