1 public final class font {
2 Private font (INT face, int style, int size ){
3 This. Face = face;
4 This. Style = style;
5 This. size = size;
6
7 Init (face, style, size );
8}
9 Public native int charwidth (char ch );
10 public native int charswidth (char [] CH, int offset, int length );
11 Public native int stringwidth (Java. Lang. String Str );
12 public native int substringwidth (string STR, int offset, int Len );
13 private int face;
14 private int style;
15 private int size;
16 private int baseline;
17 private int height;
18 Private Static final font default_font = new font (face_system,
19 style_plain,
20 size_medium );
21
22 Private Static java. util. hashtable table = new java. util. hashtable (4 );
23 private native void Init (INT face, int style, int size );
24}
25
1. The key parameters of font are face, style, and size.
2. The font's readable attributes are the font height and baseline. The font height is usually certain, and the width is determined by different characters.
Because each word has a font glaph, and each font has its own width. Generally, the same series has the same width.
3. Font creation is implemented by the mobile phone system.
4. the font of each word needs to be implemented by the mobile phone system.
5. The font here is very simplified and limits some styles and sizes.
6. The default font is a flat font without a style.
7. Note: The system requires three fonts: system, monospace, and proportional. These are all classic fonts. We all use the system font.
8. Understand the font structure. You can pay attention to a lot of things when writing a program.