ApwFreetypeLibrary

Check-in [20edf1a0f3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:initial version.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:20edf1a0f3b4342d9c34984d264bc112848b3d6b
User & Date: arnulf 2014-12-30 13:02:25
Context
2014-12-30
13:28
fixes and renaming check-in: 7db930fc07 user: arnulf tags: trunk
13:02
initial version. check-in: 20edf1a0f3 user: arnulf tags: trunk
13:01
fixes and renaming. check-in: 325bb5cc57 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added ftbase/FTUtil.java.



















































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;

  /* ===================================================================== */
  /*    FTUtil                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTUtil extends FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "FTUtil";

    /* ==================== FTUtil ================================== */
    public FTUtil() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * FT_RENEW_ARRAY
     * =====================================================================
     */
    public static Object FT_RENEW_ARRAY(Object obj, String type, int curCount, int newCount) {
      int i;
      int j;
      int k;

      if (curCount < 0 || newCount < 0) {
        Log.e(TAG, String.format("curCount < 0 || newCount < 0, curCount: %d, newCount: %d", curCount, newCount));
	  return null;
      }
      if (curCount == 0) {
        if (obj != null) {
          Log.e(TAG, String.format("curCount == 0 obj != null"));
	  return null;
	}
      }
      switch (type) {
        case "FTUnitVector": 
          FTVectorRec[] vec_array = (FTVectorRec[]) obj;
          if (vec_array == null) {
            // easy just allocate
            vec_array = new FTVectorRec[newCount];
            for (i = 0; i < newCount; i++) {
              vec_array[i] = new FTVectorRec();
            }
            obj = (Object)vec_array;
          } else {
            if (vec_array.length >= newCount) {
              // nothing to do
            } else {
              if (curCount == 0) {
                vec_array = new FTVectorRec[newCount];
                for (j = 0; j < newCount; j++) {
                  vec_array[j] = new FTVectorRec();
                }
                obj = (Object)vec_array;
              } else {
                FTVectorRec[] tmp1 = new FTVectorRec[curCount];
                tmp1 = java.util.Arrays.copyOf(vec_array, curCount);
                vec_array = new FTVectorRec[newCount];
                for (k = 0; k < curCount; k++) {
                  vec_array[k] = tmp1[k];
                }
                for (k = curCount; k < newCount; k++) {
                  vec_array[k] = new FTVectorRec();
                }
                obj = (Object)vec_array;
              }
            }
          }
          break;
        case "byte": 
          byte[] byte_array = (byte[]) obj;
          if (byte_array == null) {
            // easy just allocate
            byte_array = new byte[newCount];
            for (i = 0; i < newCount; i++) {
              byte_array[i] = 0;
            }
            obj = (Object)byte_array;
          } else {
            if (byte_array.length >= newCount) {
              // nothing to do
            } else {
              if (curCount == 0) {
                byte_array = new byte[newCount];
                for (j = 0; j < newCount; j++) {
                  byte_array[j] = 0;
                }
                obj = (Object)byte_array;
              } else {
                byte[] tmp2 = new byte[curCount];
                tmp2 = java.util.Arrays.copyOf(byte_array, curCount);
                byte_array = new byte[newCount];
                for (k = 0; k < curCount; k++) {
                  byte_array[k] = tmp2[k];
                }
                for (k = curCount; k < newCount; k++) {
                  byte_array[k] = 0;
                }
                obj = (Object)byte_array;
              }
            }
          }
          break;
        case "short": 
          short[] short_array = (short[]) obj;
          if (short_array == null) {
            // easy just allocate
            short_array = new short[newCount];
            for (i = 0; i < newCount; i++) {
              short_array[i] = 0;
            }
            obj = (Object)short_array;
          } else {
            if (short_array.length >= newCount) {
              // nothing to do
            } else {
              if (curCount == 0) {
                short_array = new short[newCount];
                for (j = 0; j < newCount; j++) {
                  short_array[j] = 0;
                }
                obj = (Object)short_array;
              } else {
                short[] tmp3 = new short[curCount];
                tmp3 = java.util.Arrays.copyOf(short_array, curCount);
                short_array = new short[newCount];
                for (k = 0; k < curCount; k++) {
                  short_array[k] = tmp3[k];
                }
                for (k = curCount; k < newCount; k++) {
                  short_array[k] = 0;
                }
                obj = (Object)short_array;
              }
            }
          }
          break;
        case "long": 
          obj = null;
          Log.e(TAG, "bad type: "+type+" in FT_RENEW_ARRAY (not yet implemented)");
          break;
        case "charmaps": 
          FTCharMapRec[] charmaps_array = (FTCharMapRec[]) obj;
          if (charmaps_array == null) {
            // easy just allocate
            charmaps_array = new FTCharMapRec[newCount];
            for (i = 0; i < newCount; i++) {
              charmaps_array[i] = new FTCharMapRec();
            }
            obj = (Object)charmaps_array;
          } else {
            if (charmaps_array.length >= newCount) {
              // nothing to do
            } else {
              if (curCount == 0) {
                charmaps_array = new FTCharMapRec[newCount];
                for (j = 0; j < newCount; j++) {
                  charmaps_array[j] = new FTCharMapRec();
                }
                obj = (Object)charmaps_array;
              } else {
                FTCharMapRec[] tmp3 = new FTCharMapRec[curCount];
                tmp3 = java.util.Arrays.copyOf(charmaps_array, curCount);
                charmaps_array = new FTCharMapRec[newCount];
                for (k = 0; k < curCount; k++) {
                  charmaps_array[k] = tmp3[k];
                }
                for (k = curCount; k < newCount; k++) {
                  charmaps_array[k] = new FTCharMapRec();
                }
                obj = (Object)charmaps_array;
              }
            }
          }
          break;
        default:
          Log.e(TAG, "bad type: "+type+" in FT_RENEW_ARRAY");
          return null;
      }
      return obj;
    }

    /* =====================================================================
     * FT_BYTE
     * =====================================================================
     */
    public static int FT_BYTE(byte[] p, int idx) {
      return p[idx] & 0xFF;
    }

    /* =====================================================================
     * FT_BYTE_U16
     * =====================================================================
     */
    public static int FT_BYTE_U16(byte[] p, int idx, int shift) {
      return (FT_BYTE(p, idx) << shift) & 0xFFFF;
    }

    /* =====================================================================
     * FT_BYTE_U32
     * =====================================================================
     */
    public static Long FT_BYTE_U32(byte[] p, int idx, int shift) {
      return (long)(FT_BYTE(p, idx) << shift) & 0xFFFFFFFF;
    }


    /* =====================================================================
     * FT_PEEK_SHORT
     * =====================================================================
     */
    public static int FT_PEEK_SHORT(byte[] p, int idx) {
      return FT_BYTE_U16(p, idx+0, 8) | FT_BYTE_U16(p, idx+1, 0);
    }

    /* =====================================================================
     * FT_PEEK_USHORT
     * =====================================================================
     */
    public static int FT_PEEK_USHORT(byte[] p, int idx) {
      return (FT_BYTE_U16(p, idx+0, 8) | FT_BYTE_U16(p, idx+1, 0)) & 0xFFFF;
    }

    /* =====================================================================
     * FT_NEXT_ULONG
     * =====================================================================
     */
    public static long FT_NEXT_ULONG(byte[] array, FTReference<Integer> offset_ref, int limit) {
      int offset = offset_ref.Get();
      if (offset + 4 > limit) {
        Log.e(TAG, "FT_NEXT_ULONG offset > limit!!");
        return 0L;
      } else {
//Debug(0, DBG_LOAD_GLYPH, TAG, String.format("LL!%d, %d, %d, %d", (array[offset] & 0xFF) << 24, (array[offset + 1] & 0xFF) << 16, (array[offset + 2] & 0xFF) << 8, (array[offset + 3] & 0xFF)));
        long val = ((array[offset] & 0xFF) << 24) | ((array[offset + 1] & 0xFF) << 16) | ((array[offset + 2] & 0xFF) << 8) | (array[offset + 3] & 0xFF);
        offset += 4;
        offset_ref.Set(offset);
        return val;
      }
    }

    /* =====================================================================
     * FT_NEXT_USHORT
     * =====================================================================
     */
    public static int FT_NEXT_USHORT(byte[] array, FTReference<Integer> offset_ref, int limit) {
      int offset = offset_ref.Get();
      if (offset + 2 > limit) {
        Log.e(TAG, "FT_NEXT_USHORT offset > limit!!");
        return 0;
      } else {
Debug(0, DBG_LOAD_GLYPH, TAG, String.format("sh: offset: %d b0: %d b1: %d bb0: %d bb1: %d", offset, array[offset], array[offset + 1], array[offset] & 0xFF << 8, array[offset + 1] % 0xFF));
        int val = ((((array[offset] & 0xFF) << 8) + ((array[offset + 1] & 0xFF))) & 0xFFFF);
        offset += 2;
        offset_ref.Set(offset);
        return val;
      }
    }

    /* =====================================================================
     * FT_NEXT_SHORT
     * =====================================================================
     */
    public static short FT_NEXT_SHORT(byte[] array, FTReference<Integer> offset_ref, int limit) {
      int offset = offset_ref.Get();
      if (offset + 2 > limit) {
        Log.e(TAG, "FT_NEXT_USHORT offset > limit!!");
        return 0;
      } else {
Debug(0, DBG_LOAD_GLYPH, TAG, String.format("sh: offset: %d b0: %d b1: %d bb0: %d bb1: %d", offset, array[offset], array[offset + 1], array[offset] & 0xFF << 8, array[offset + 1] % 0xFF));
        short val = (short)((array[offset] << 8) + ((array[offset + 1] & 0xFF)));
        offset += 2;
        offset_ref.Set(offset);
        return val;
      }
    }

}

Added ftbase/FTValidatorRec.java.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    FTValidatorRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTValidatorRec extends ftbase.FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "FTValidatorRec";

    public final static int FT_VALIDATE_DEFAULT = 0;
    public final static int FT_VALIDATE_TIGHT = 1;
    public final static int FT_VALIDATE_PARANOID = 2;

    public byte[] base = null;
    public int base_idx = 0;
    public int limit = 0;
    public int level = FT_VALIDATE_DEFAULT;
    public int error = 0;

    /* ==================== FTValidatorRec ================================== */
    public FTValidatorRec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* ==================== ft_validator_init ============================== */
    public static void ft_validator_init(FTValidatorRec valid, byte[] base, int base_idx, int limit, int level) {
      valid.base = base;
      valid.base_idx = base_idx;
      valid.limit = limit;
      valid.level = level;
      valid.error = ftbase.FTError.INTERP_ERR_OK;
    }

}

Added fttruetype/TTCMap0Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap0Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap0Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap0Class";

    /* ==================== TTCMap0Class ================================== */
    public TTCMap0Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap0Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap0_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap0_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 0;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap0_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap0_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap10Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap10Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap10Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap10Class";

    /* ==================== TTCMap10Class ================================== */
    public TTCMap10Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap10Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap10_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap10_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 10;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap10_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap10_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap12Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap12Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap12Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap12Class";

    /* ==================== TTCMap12Class ================================== */
    public TTCMap12Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap12Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap12_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap12_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 12;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap12_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap12_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap12Rec.java.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap12Rec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap12Rec extends TTCMapRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap12Rec";

    public boolean valid = false;
    public long cur_charcode = 0;
    public int cur_gindex = 0;
    public long cur_group = 0;
    public long num_groups = 0;

    /* ==================== TTCMap12Rec ================================== */
    public TTCMap12Rec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

}

Added fttruetype/TTCMap13Class.java.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;
  /* ===================================================================== */
  /*    TTCMap13Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap13Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap13Class";

    /* ==================== TTCMap13Class ================================== */
    public TTCMap13Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap13Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap13_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap13_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 13;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap13_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap13_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap13Rec.java.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap13Rec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap13Rec extends TTCMapRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap13Rec";

    public boolean valid = false;
    public long cur_charcode = 0;
    public int cur_gindex = 0;
    public long cur_group = 0;
    public long num_groups = 0;

    /* ==================== TTCMap13Rec ================================== */
    public TTCMap13Rec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

}

Added fttruetype/TTCMap14Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap14Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap14Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap14Class";

    /* ==================== TTCMap14Class ================================== */
    public TTCMap14Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap14Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_init", 1);
      done = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_done", 1);
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_char_next", 1);

      char_var_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_char_var_index", 1);
      char_var_default = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_char_var_isdefault", 1);
      variant_list = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_variants", 1);
      charvariant_list = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_char_variants", 1);
      variantchar_list = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_variant_chars", 1);

      format = 14;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap14_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap14Rec.java.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap14Rec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap14Rec extends TTCMapRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap14Rec";

    public long num_selectors = 0;
    /* This array is used to store the results of various
     * cmap 14 query functions.  The data is overwritten
     * on each call to these functions.
     */
    int max_results = 0;
    int[] results = null;

    /* ==================== TTCMap14Rec ================================== */
    public TTCMap14Rec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

}

Added fttruetype/TTCMap2Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap2Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap2Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap2Class";

    /* ==================== TTCMap2Class ================================== */
    public TTCMap2Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap2Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap2_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap2_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 2;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap2_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap2_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap4Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap4Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap4Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap4Class";

    /* ==================== TTCMap4Class ================================== */
    public TTCMap4Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap4Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap4_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap4_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap4_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 4;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap4_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap4_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap4Rec.java.





















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap4Rec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap4Rec extends TTCMapRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap4Rec";

    public int cur_charcode = 0;   /* current charcode */
    public int cur_gindex = 0;     /* current glyph index */
    public int num_ranges = 0;
    public int cur_range = 0;
    public int cur_start = 0;
    public int cur_end = 0;
    public int cur_delta = 0;
    public byte[] cur_values = null;
    public int cur_values_idx = 0;


    /* ==================== TTCMap4Rec ================================== */
    public TTCMap4Rec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

}

Added fttruetype/TTCMap6Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap6Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap6Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap6Class";

    /* ==================== TTCMap6Class ================================== */
    public TTCMap6Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap6Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap6_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap6_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 6;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap6_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap6_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMap8Class.java.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMap8Class                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMap8Class extends TTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMap8Class";

    /* ==================== TTCMap8Class ================================== */
    public TTCMap8Class() {
      super();
      oid++;
      id = oid;

      String class_name = "org.apwtcl.gles20.truetype.TTCMapFuncs";
      cmap_class_type = TTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap8Class;
      init = new ftbase.FTInstanceMethod(class_name, "tt_cmap_init", 1);
      done = null;
      char_index = new ftbase.FTInstanceMethod(class_name, "tt_cmap8_char_index", 1);
      char_next = new ftbase.FTInstanceMethod(class_name, "tt_cmap8_char_next", 1);

      char_var_index = null;
      char_var_default = null;
      variant_list = null;
      charvariant_list = null;
      variantchar_list = null;

      format = 8;
      validate = new ftbase.FTInstanceMethod(class_name, "tt_cmap8_validate", 1);
      get_cmap_info = new ftbase.FTInstanceMethod(class_name, "tt_cmap8_get_info", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMapClassRec.java.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMapClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMapClassRec extends ftbase.FTCMapClassRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMapClassRec";

    public int format = 0;
    public ftbase.FTInstanceMethod validate = null;
    public ftbase.FTInstanceMethod get_cmap_info = null;

    /* ==================== TTCMapClassRec ================================== */
    public TTCMapClassRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
    
}

Added fttruetype/TTCMapClassesClass.java.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMapClassesClass                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMapClassesClass extends Object {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMapClassesClass";

    public final static int NUM_CMAP_CLASSES = 10;

    public TTCMapClassRec[] cmap_classes = null;

    /* ==================== TTCMapClassesClass ================================== */
    public TTCMapClassesClass() {
      super();
      oid++;
      id = oid;

      cmap_classes = new TTCMapClassRec[NUM_CMAP_CLASSES];
      cmap_classes[0] = new TTCMap0Class();
      cmap_classes[1] = new TTCMap2Class();
      cmap_classes[2] = new TTCMap4Class();
      cmap_classes[3] = new TTCMap6Class();
      cmap_classes[4] = new TTCMap8Class();
      cmap_classes[5] = new TTCMap10Class();
      cmap_classes[6] = new TTCMap12Class();
      cmap_classes[7] = new TTCMap13Class();
      cmap_classes[8] = new TTCMap14Class();
      cmap_classes[9] = null;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMapFuncs.java.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import android.util.Log;

import ftbase.FTValidatorRec;

  /* ===================================================================== */
  /*    FTCMapFuncs                                                        */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMapFuncs extends ftbase.FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "FTCMapFuncs";
    
    /* ==================== FTCMapFuncs ================================== */
    public TTCMapFuncs() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     *    tt_cmap_init
     *
     * =====================================================================
     */
    public static int tt_cmap_init(Object ... args) {
      TTCMapRec cmap = (TTCMapRec)args[0];
      byte[] table = (byte[])args[1];
      int error = 0;

      cmap.data = table;
      return error;
    }

    /* =====================================================================
     *    tt_cmap0_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap0_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap0_char_index: not yet implemented");      
Debug(0, DBG_LOAD_GLYPH, TAG, "FTCMapFuncs  tt_cmap0_char_index: not yet implemented");
      return error;
    }

    /* =====================================================================
     *    tt_cmap0_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap0_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap0_char_next: not yet implemented");
Debug(0, DBG_LOAD_GLYPH, TAG, "FTCMapFuncs  tt_cmap0_char_next: not yet implemented");
      return error;
    }

    /* =====================================================================
     *    tt_cmap0_validate
     *
     * =====================================================================
     */
    public static int tt_cmap0_validate(Object ... args) {
      byte[] table = (byte[])args[0];
      int table_start_idx = (int)args[1];
      FTValidatorRec valid = (FTValidatorRec)args[2];
      int error = ftbase.FTError.INTERP_ERR_OK;
      int table_idx = table_start_idx + 2;
      int limit = valid.limit;
      int length = 0;

      ftbase.FTReference<Integer> offset_ref = new ftbase.FTReference<Integer>();
      offset_ref.Set(table_idx);
      length = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, limit);
      table_idx = offset_ref.Get(); 
      if (length > valid.limit || length < 262) {
        return ftbase.FTError.VALID_INVALID_TOO_SHORT;
      } 
      /* check glyph indices whenever necessary */
      if (valid.level >= FTValidatorRec.FT_VALIDATE_TIGHT) {
        int n;
        int idx;
  
        table_idx = table_start_idx + 6;
        for (n = 0; n < 256; n++) {
          idx = table[table_idx++];
          if (idx >= ((TTValidatorRec)valid).num_glyphs) {
            return ftbase.FTError.VALID_INVALID_GLYPH_ID;
          }
        }
      }
      return error;
    }

    /* =====================================================================
     *    tt_cmap0_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap0_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap0_get_info: not yet implemented");
Debug(0, DBG_LOAD_GLYPH, TAG, "FTCMapFuncs  tt_cmap0_get_info: not yet implemented");
      return error;
    }

    /* =====================================================================
     *    tt_cmap2_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap2_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap2_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap2_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap2_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap2_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap2_validate
     *
     * =====================================================================
     */
    public static int tt_cmap2_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap2_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap2_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap2_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap2_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap4_init
     *
     * =====================================================================
     */
    public static int tt_cmap4_init(Object ... args) {
      TTCMap4Rec cmap = (TTCMap4Rec)args[0];
      byte[] table = (byte[])args[1];
      int cmap_idx = (int)args[2];
      int error = 0;
      int table_idx = 0;

      cmap.data = table;
      cmap.data_idx = cmap_idx;
      table_idx = cmap.data_idx + 6;
      cmap.num_ranges = ftbase.FTUtil.FT_PEEK_USHORT(table, table_idx) >> 1;
      cmap.cur_charcode = 0xFFFFFFFF;
      cmap.cur_gindex = 0;
      return error;
    }


    /* =====================================================================
     *    tt_cmap4_set_range
     *
     * =====================================================================
     */
    public static int tt_cmap4_set_range(TTCMap4Rec cmap, int range_index) {
      byte [] table = cmap.data;
      int table_idx = cmap.data_idx;
      int num_ranges = cmap.num_ranges;
  
  
      while (range_index < num_ranges) {
        int offset;
  
        table_idx = 14 + range_index * 2;
        cmap.cur_end = ftbase.FTUtil.FT_PEEK_USHORT(table, table_idx);
        table_idx += 2 + num_ranges * 2;
        cmap.cur_start = ftbase.FTUtil.FT_PEEK_USHORT(table, table_idx);
        table_idx += num_ranges * 2;
        cmap.cur_delta = ftbase.FTUtil.FT_PEEK_USHORT(table, table_idx);
        table_idx += num_ranges * 2;
        offset = ftbase.FTUtil.FT_PEEK_USHORT(table, table_idx);
        /* some fonts have an incorrect last segment; */
        /* we have to catch it                        */
        if (range_index>= num_ranges - 1 && cmap.cur_start == 0xFFFF &&
             cmap.cur_end == 0xFFFF) {
          TTFaceRec face  = (TTFaceRec)cmap.face;
          int limit = (int)face.cmap_size;
  
          if (offset != 0 && offset + 2 > limit) {
            cmap.cur_delta = 1;
            offset = 0;
          }
          if (offset != 0xFFFF) {
            if (offset == 0) {
              cmap.cur_values = face.cmap_table;
              cmap.cur_values_idx = offset + cmap.data_idx;
            } else {
              cmap.cur_values = null;
              cmap.cur_values_idx = -1;
            }
            cmap.cur_range = range_index;
            return 0;
          }
        }
        /* we skip empty segments */
        range_index++;
      }
      return -1;
    }

    /* =====================================================================
     *    tt_cmap4_next
     *
     * =====================================================================
     */
    public static void tt_cmap4_next(TTCMap4Rec cmap) {
      int charcode;
  
      if (cmap.cur_charcode >= 0xFFFF) {
        cmap.cur_charcode = (int)0xFFFFFFFF;
        cmap.cur_gindex = 0;
        return;
      } 
      charcode = (int)cmap.cur_charcode + 1;
  
      if (charcode < cmap.cur_start) {
        charcode = cmap.cur_start;
      } 
      for ( ;; )
      {
        byte[] values = cmap.cur_values;
        int end = cmap.cur_end;
        int delta  = cmap.cur_delta;
  
        if (charcode <= end) {
          if (values != null) {
            int table_idx = 2 * (charcode - cmap.cur_start);
  
            do {
              int gindex = ftbase.FTUtil.FT_PEEK_USHORT(values, table_idx);
  
              table_idx += 2;
              if (gindex != 0) {
                gindex = (int)((gindex + delta) & 0xFFFF);
                if (gindex != 0) {
                  cmap.cur_charcode = charcode;
                  cmap.cur_gindex = gindex;
                  return;
                }
              }
            } while (++charcode <= end);
          } else {
            do {
              int gindex = (int)((charcode + delta) & 0xFFFF);
  
              if (gindex != 0) {
                cmap.cur_charcode = charcode;
                cmap.cur_gindex   = gindex;
                return;
              }
            } while (++charcode <= end);
          }
        }
        /* we need to find another range */
        if (tt_cmap4_set_range(cmap, cmap.cur_range + 1) < 0) {
          break;
        } 
        if (charcode < cmap.cur_start) {
          charcode = cmap.cur_start;
	}
      }
      cmap.cur_charcode = (int)0xFFFFFFFF;
      cmap.cur_gindex = 0;
    }

    /* =====================================================================
     *    tt_cmap4_char_map_linear
     *
     * =====================================================================
     */
    public static int tt_cmap4_char_map_linear(TTCMapRec cmap, ftbase.FTReference<Integer> charcode_ref, boolean next) {
      int num_segs2;
      int start;
      int end;
      int offset;
      int delta;
      int i;
      int num_segs;
      int charcode = charcode_ref.Get();;
      int gindex = 0;
      int tableIdx;
  
  
      tableIdx = 6;
      num_segs2 = (int)ftbase.FTCalc.FT_PAD_FLOOR(ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, tableIdx), 2);
      num_segs = num_segs2 >> 1;
      if (num_segs == 0)  {
        return 0;
      } 
      if (next) {
        charcode++;
      } 
      /* linear search */
      for (; charcode <= 0xFFFF; charcode++) {
        int tableIdx2;
  
  
        tableIdx = 14;               /* ends table   */
        tableIdx2 = 16 + num_segs2;   /* starts table */
        for (i = 0; i < num_segs; i++) {
          end = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, tableIdx);
          tableIdx += 2;
          start = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, tableIdx2);
          tableIdx2 += 2;
          if (charcode >= start && charcode <= end) {
            tableIdx = tableIdx2 - 2 + num_segs2;
            delta = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, tableIdx);
            tableIdx += num_segs2;
            offset = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, tableIdx);
            /* some fonts have an incorrect last segment; */
            /* we have to catch it                        */
            if (i >= num_segs - 1 && start == 0xFFFF && end == 0xFFFF) {
                TTFaceRec face = (TTFaceRec)cmap.face;
              int limit = (int)face.cmap_size;
  
              if (offset != 0 && tableIdx + offset + 2 > limit) {
                delta  = 1;
                offset = 0;
              }
            }
            if (offset == 0xFFFF) {
              continue;
            } 
            if (offset != 0) {
              tableIdx += offset + (charcode - start) * 2;
              gindex = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, tableIdx);
              if (gindex != 0) {
                gindex = (int)(gindex + delta) & 0xFFFF;
	      }
            } else {
              gindex = (int)(charcode + delta) & 0xFFFF;
            } 
            break;
          }
        }
        if (next || gindex == 0) {
          break;
        }
      }
      if (next && gindex != 0) {
        charcode_ref.Set(charcode);
      } 
      return gindex;
    }

    /* =====================================================================
     *    tt_cmap4_char_map_binary
     *
     * =====================================================================
     */
    public static int tt_cmap4_char_map_binary(TTCMapRec cmap, ftbase.FTReference<Integer> charcode_ref, boolean next) {
      int num_segs2;
      int start;
      int end;
      int offset;
      int delta;
      int max;
      int min;
      int mid;
      int num_segs;
      int charcode = charcode_ref.Get();
      int gindex   = 0;
      int table_idx;
  
  
      table_idx = cmap.data_idx + 6;
      num_segs2 = (int)ftbase.FTCalc.FT_PAD_FLOOR(ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx), 2);
  
      if (num_segs2 == 0) {
        return 0;
      } 
      num_segs = num_segs2 >> 1;
      /* make compiler happy */
      mid = num_segs;
      end = 0xFFFF;
      if (next) {
        charcode++;
      } 
      min = 0;
      max = num_segs;
      /* binary search */
      while (min < max) {
        mid = (min + max) >> 1;
        table_idx = cmap.data_idx + 14 + mid * 2;
        end = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
        table_idx += 2 + num_segs2;
        start = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
        if (charcode < start) {
          max = mid;
        } else {
          if (charcode > end) {
            min = mid + 1;
          } else {
            table_idx += num_segs2;
            delta = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
            table_idx += num_segs2;
            offset = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
            /* some fonts have an incorrect last segment; */
            /* we have to catch it                        */
            if (mid >= num_segs - 1 && start == 0xFFFF && end == 0xFFFF) {
                TTFaceRec face  = (TTFaceRec)cmap.face;
              int limit = (int)face.cmap_size;
  
              if (offset != 0 && (table_idx + offset + 2) > limit) {
                delta  = 1;
                offset = 0;
              }
            }
            /* search the first segment containing `charcode' */
            if ((cmap.flags & TTCMapRec.TT_CMAP_FLAG_OVERLAPPING) != 0) {
              int i;
  
              /* call the current segment `max' */
              max = mid;
              if (offset == 0xFFFF) {
                mid = max + 1;
              } 
              /* search in segments before the current segment */
              for (i = max ; i > 0; i--) {
                int prev_end;
                int  oldIdx;
  
                oldIdx = table_idx;
                table_idx = cmap.data_idx + 14 + ( i - 1 ) * 2;
                prev_end = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                if (charcode > prev_end) {
                  table_idx = oldIdx;
                  break;
                }
                end = prev_end;
                table_idx += 2 + num_segs2;
                start = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                table_idx += num_segs2;
                delta = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                table_idx += num_segs2;
                offset = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                if (offset != 0xFFFF) {
                  mid = i - 1;
                }
              }
              /* no luck */
              if (mid == max + 1) {
                if (i != max) {
                  table_idx = cmap.data_idx + 14 + max * 2;
                  end = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  table_idx += 2 + num_segs2;
                  start = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  table_idx += num_segs2;
                  delta = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  table_idx += num_segs2;
                  offset = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                }
                mid = max;
                /* search in segments after the current segment */
                for (i = max + 1; i < num_segs; i++) {
                  int next_end;
                  int next_start;
  
                  table_idx = cmap.data_idx + 14 + i * 2;
                  next_end = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  table_idx += 2 + num_segs2;
                  next_start = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  if (charcode < next_start) {
                    break;
                  } 
                  end = next_end;
                  start = next_start;
                  table_idx += num_segs2;
                  delta  = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  table_idx += num_segs2;
                  offset = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                  if (offset != 0xFFFF) {
                    mid = i;
                  }
                }
                i--;
                /* still no luck */
                if (mid == max) {
                  mid = i;
                  break;
                }
              }
              /* end, start, delta, and offset are for the i'th segment */
              if (mid != i) {
                table_idx = cmap.data_idx + 14 + mid * 2;
                end = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                table_idx += 2 + num_segs2;
                start = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                table_idx += num_segs2;
                delta = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
                table_idx += num_segs2;
                offset = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
              }
            } else {
              if (offset == 0xFFFF) {
                break;
              }
            }
            if (offset != 0) {
              table_idx += offset + (charcode - start) * 2;
              gindex = ftbase.FTUtil.FT_PEEK_USHORT(cmap.data, table_idx);
              if (gindex != 0) {
                gindex = (int)(gindex + delta) & 0xFFFF;
              }
            } else {
              gindex = (int)(charcode + delta) & 0xFFFF;
            } 
            break;
          }
        }
        if (next) {
          TTCMap4Rec cmap4 = (TTCMap4Rec)cmap;
          /* if `charcode' is not in any segment, then `mid' is */
          /* the segment nearest to `charcode'                  */
          /*                                                    */
          if (charcode > end) {
            mid++;
            if (mid == num_segs) {
              return 0;
            }
          }
          if (tt_cmap4_set_range(cmap4, mid) != 0) {
            if (gindex != 0) {
              charcode_ref.Set(charcode);
            }
          } else {
            cmap4.cur_charcode = charcode;
            if (gindex != 0) {
              cmap4.cur_gindex = gindex;
            } else {
              cmap4.cur_charcode = charcode;
              tt_cmap4_next(cmap4);
              gindex = cmap4.cur_gindex;
            }
            if (gindex != 0) {
              charcode_ref.Set(cmap4.cur_charcode);
            }
          }
        }
      }
      return gindex;
    }

    /* =====================================================================
     *    tt_cmap4_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap4_char_index(Object ... args) {
      TTCMapRec cmap = (TTCMapRec)args[0];
      int charcode = (int)args[1];
        ftbase.FTReference<Integer> charcode_ref = new ftbase.FTReference<Integer>();
      if (charcode >= 0x10000L) {
        return 0;
      }
      charcode_ref.Set(charcode);
      if ((cmap.flags & TTCMapRec.TT_CMAP_FLAG_UNSORTED) != 0) {
        return tt_cmap4_char_map_linear(cmap, charcode_ref, false);
      } else {
        return tt_cmap4_char_map_binary(cmap, charcode_ref, false);
      }
    }

    /* =====================================================================
     *    tt_cmap4_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap4_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap4_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap4_validate
     *
     * =====================================================================
     */
    public static int tt_cmap4_validate(Object ... args) {
      byte[] table = (byte[])args[0];
      int table_start_idx = (int)args[1];
      int table_idx = table_start_idx;
      FTValidatorRec valid = (FTValidatorRec)args[2];
      int error = ftbase.FTError.INTERP_ERR_OK;
        ftbase.FTReference<Integer> offset_ref = new ftbase.FTReference<Integer>();
      table_idx += 2;               /* skip format */
      offset_ref.Set(table_idx);
      int length = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, table_idx + 2);
      int ends;
      int starts;
      int offsets;
      int deltas;
      int glyph_ids;
      int num_segs;
  
  
      if (length < 16) {
        valid.error = ftbase.FTError.LOAD_INVALID_TABLE;
        return ftbase.FTError.LOAD_INVALID_TABLE;
      } 
      /* in certain fonts, the `length' field is invalid and goes */
      /* out of bound.  We try to correct this here...            */
      if (length > valid.limit) {
        if (valid.level >= FTValidatorRec.FT_VALIDATE_TIGHT) {
          valid.error = ftbase.FTError.LOAD_INVALID_TABLE;
          return ftbase.FTError.LOAD_INVALID_TABLE;
        } 
        length = (int)(valid.limit);
      }
      table_idx = table_start_idx + 6;
      offset_ref.Set(table_idx);
      num_segs = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);   /* read segCountX2 */
      table_idx = offset_ref.Get();
//System.out.println(String.format("length: %d num_segs: %d", length, num_segs));
      if (valid.level >= FTValidatorRec.FT_VALIDATE_PARANOID) {
        /* check that we have an even value here */
        if ((num_segs & 1) != 0) {
          valid.error = ftbase.FTError.LOAD_INVALID_DATA;
          return ftbase.FTError.LOAD_INVALID_DATA;
        }
      }
      num_segs /= 2;
      if (length < 16 + num_segs * 2 * 4) {
          valid.error = ftbase.FTError.LOAD_INVALID_TABLE;
        return ftbase.FTError.LOAD_INVALID_TABLE;
      } 
      /* check the search parameters - even though we never use them */
      /*                                                             */
      if (valid.level >= FTValidatorRec.FT_VALIDATE_PARANOID) {
        /* check the values of `searchRange', `entrySelector', `rangeShift' */
        int search_range = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
        int entry_selector = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
        int range_shift = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
        table_idx = offset_ref.Get();
  
        if (((search_range | range_shift) & 1) != 0) { /* must be even values */
          return ftbase.FTError.LOAD_INVALID_DATA;
        } 
        search_range /= 2;
        range_shift  /= 2;
        /* `search range' is the greatest power of 2 that is <= num_segs */
        if (search_range > num_segs ||
            search_range * 2 < num_segs ||
            search_range + range_shift != num_segs ||
            search_range != (1 << entry_selector)) {
          valid.error = ftbase.FTError.LOAD_INVALID_DATA;
          return ftbase.FTError.LOAD_INVALID_DATA;
        }
      }
      ends = table_start_idx + 14;
      starts = table_start_idx + 16 + num_segs * 2;
      deltas = starts + num_segs * 2;
      offsets = deltas + num_segs * 2;
      glyph_ids = offsets + num_segs * 2;
//System.out.println(String.format("ends: %d, starts: %d, deltas: %d, offsets: %d, glyph_ids: %d", ends-valid.base_idx, starts-valid.base_idx, deltas-valid.base_idx, offsets-valid.base_idx, glyph_ids-valid.base_idx));
      /* check last segment; its end count value must be 0xFFFF */
      if (valid.level >= FTValidatorRec.FT_VALIDATE_PARANOID) {
        table_idx = ends + (num_segs - 1) * 2;
        if (ftbase.FTUtil.FT_PEEK_USHORT(table, table_idx) != 0xFFFF) {
          valid.error = ftbase.FTError.LOAD_INVALID_DATA;
          return ftbase.FTError.LOAD_INVALID_DATA;
        }
      }
      {
        int start;
        int end;
        int offset;
        int n;
        int last_start = 0;
        int last_end = 0;
        int delta;
        int p_start   = starts;
        int p_end     = ends;
        int p_delta   = deltas;
        int p_offset  = offsets;
  
  
        for (n = 0; n < num_segs; n++) {
          table_idx = p_offset;
          offset_ref.Set(p_start);
          start = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
          p_start = offset_ref.Get();
          offset_ref.Set(p_end);
          end = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
          p_end = offset_ref.Get();
          offset_ref.Set(p_delta);
          delta = ftbase.FTUtil.FT_NEXT_SHORT(table, offset_ref, length);
          p_delta = offset_ref.Get();
          offset_ref.Set(p_offset);
          offset = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
          p_offset = offset_ref.Get();
//System.out.println(String.format("start: %d, end: %d, delta: %d, offset: %d", start, end, delta, offset));
//System.out.println(String.format("pstart: %d, pend: %d, pdelta: %d, poffset: %d", p_start-valid.base_idx, p_end-valid.base_idx, p_delta-valid.base_idx, p_offset-valid.base_idx));
          if (start > end) {
            valid.error = ftbase.FTError.LOAD_INVALID_DATA;
            return ftbase.FTError.LOAD_INVALID_DATA;
          } 
          /* this test should be performed at default validation level; */
          /* unfortunately, some popular Asian fonts have overlapping   */
          /* ranges in their charmaps                                   */
          /*                                                            */
          if (start <= last_end && n > 0) {
            if (valid.level >= FTValidatorRec.FT_VALIDATE_TIGHT) {
              valid.error = ftbase.FTError.LOAD_INVALID_DATA;
              return ftbase.FTError.LOAD_INVALID_DATA;
            } else {
              /* allow overlapping segments, provided their start points */
              /* and end points, respectively, are in ascending order    */
              /*                                                         */
              if (last_start > start || last_end > end) {
                error |= TTCMapRec.TT_CMAP_FLAG_UNSORTED;
              } else {
                error |= TTCMapRec.TT_CMAP_FLAG_OVERLAPPING;
              }
            }
          }
          if (offset != 0 && offset != 0xFFFF) {
            table_idx += offset;  /* start of glyph ID array */
            /* check that we point within the glyph IDs table only */
            if (valid.level >= FTValidatorRec.FT_VALIDATE_TIGHT) {
              if (table_idx < glyph_ids || table_idx + (end - start + 1) * 2 > length) {
                valid.error = ftbase.FTError.LOAD_INVALID_DATA;
                return ftbase.FTError.LOAD_INVALID_DATA;
              }
            /* Some fonts handle the last segment incorrectly.  In */
            /* theory, 0xFFFF might point to an ordinary glyph --  */
            /* a cmap 4 is versatile and could be used for any     */
            /* encoding, not only Unicode.  However, reality shows */
            /* that far too many fonts are sloppy and incorrectly  */
            /* set all fields but `start' and `end' for the last   */
            /* segment if it contains only a single character.     */
            /*                                                     */
            /* We thus omit the test here, delaying it to the      */
            /* routines which actually access the cmap.            */
            } else {
              if (n != num_segs - 1 || !(start == 0xFFFF && end == 0xFFFF)) {
                if (table_idx < glyph_ids || table_idx + (end - start + 1) * 2 > valid.limit) {
                  valid.error = ftbase.FTError.LOAD_INVALID_DATA;
                  return ftbase.FTError.LOAD_INVALID_DATA;
                }
              }
            }
            /* check glyph indices within the segment range */
            if (valid.level >= FTValidatorRec.FT_VALIDATE_TIGHT) {
              int i;
              int idx;
  
              for (i = start; i < end; i++) {
                offset_ref.Set(table_idx);
                idx = ftbase.FTUtil.FT_NEXT_USHORT(table, offset_ref, length);
                table_idx = offset_ref.Get();
                if (idx != 0) {
                  idx = (int)(idx + delta) & 0xFFFF;
                  if (idx >= ((TTValidatorRec)valid).num_glyphs) {
                    valid.error = ftbase.FTError.LOAD_INVALID_GLYPH_ID;
                    return ftbase.FTError.LOAD_INVALID_GLYPH_ID;
                  }
                }
              }
            } else {
              if (offset == 0xFFFF) {
                /* some fonts (erroneously?) use a range offset of 0xFFFF */
                /* to mean missing glyph in cmap table                    */
                /*                                                        */
                if (valid.level >= FTValidatorRec.FT_VALIDATE_PARANOID || n != num_segs - 1 ||
                    !(start == 0xFFFF && end == 0xFFFF)) {
                  valid.error = ftbase.FTError.LOAD_INVALID_DATA;
                  return ftbase.FTError.LOAD_INVALID_DATA;
                }
              }
            }
            last_start = start;
            last_end = end;
          }
        }
      }
      return error;
    }

    /* =====================================================================
     *    tt_cmap4_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap4_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap4_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap6_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap6_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap6_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap6_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap6_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap6_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap6_validate
     *
     * =====================================================================
     */
    public static int tt_cmap6_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap6_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap6_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap6_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap6_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap8_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap8_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap8_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap8_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap8_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap8_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap8_validate
     *
     * =====================================================================
     */
    public static int tt_cmap8_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap8_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap8_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap8_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap8_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap10_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap10_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap10_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap10_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap10_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap10_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap10_validate
     *
     * =====================================================================
     */
    public static int tt_cmap10_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap10_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap10_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap10_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap10_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap11_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap11_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap11_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap11_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap11_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap11_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap11_validate
     *
     * =====================================================================
     */
    public static int tt_cmap11_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap11_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap11_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap11_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap11_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap12_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap12_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap12_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap12_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap12_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap12_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap12_validate
     *
     * =====================================================================
     */
    public static int tt_cmap12_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap12_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap12_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap12_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap12_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap13_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap13_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap13_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap13_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap13_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap13_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap13_validate
     *
     * =====================================================================
     */
    public static int tt_cmap13_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap13_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap13_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap13_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap13_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_init
     *
     * =====================================================================
     */
    public static int tt_cmap14_init(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_init: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_char_index
     *
     * =====================================================================
     */
    public static int tt_cmap14_char_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_char_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_char_next
     *
     * =====================================================================
     */
    public static int tt_cmap14_char_next(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_char_next: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_validate
     *
     * =====================================================================
     */
    public static int tt_cmap14_validate(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_validate: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_get_info
     *
     * =====================================================================
     */
    public static int tt_cmap14_get_info(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_get_info: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_done
     *
     * =====================================================================
     */
    public static int tt_cmap14_done(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_done: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_char_var_index
     *
     * =====================================================================
     */
    public static int tt_cmap14_char_var_index(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_char_var_index: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_char_var_isdefault
     *
     * =====================================================================
     */
    public static int tt_cmap14_char_var_isdefault(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_char_var_isdefault: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_variants
     *
     * =====================================================================
     */
    public static int tt_cmap14_variants(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_variants: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_char_variants
     *
     * =====================================================================
     */
    public static int tt_cmap14_char_variants(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_char_variants: not yet implemented");      
      return error;
    }

    /* =====================================================================
     *    tt_cmap14_variant_chars
     *
     * =====================================================================
     */
    public static int tt_cmap14_variant_chars(Object ... args) {
      int error = 0;

Log.e(TAG, "FTCMapFuncs  tt_cmap14_variant_chars: not yet implemented");      
      return error;
    }

}

Added fttruetype/TTCMapInfoRec.java.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMapInfoRec                                                      */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMapInfoRec extends ftcache.FTCNodeRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMapInfoRec";

    public final static int FTC_CMAP_INDICES_MAX = 128;
    public final static int FTC_CMAP_UNKNOWN = ~0;

    public long language = 0L;
    public long format = 0L;

    /* ==================== TTCMapInfoRec ================================== */
    public TTCMapInfoRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}

Added fttruetype/TTCMapRec.java.













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCMapRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCMapRec extends ftbase.FTCMapRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTCMapRec";

    public final static int TT_CMAP_FLAG_UNSORTED = 1;
    public final static int TT_CMAP_FLAG_OVERLAPPING = 2;

    public byte[] data = null;
    public int data_idx = 0;
    public int flags = 0;

    /* ==================== TTCMapRec ================================== */
    public TTCMapRec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }

}

Added fttruetype/TTSfntLoad.java.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTSfntLoad                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTSfntLoad extends ftbase.FTDebug {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTSfntLoad";

    public final static Long TTAG_avar  = (long)( 'a' << 24 | 'v' << 16 | 'a' << 8 | 'r' );
    public final static Long TTAG_BASE  = (long)( 'B' << 24 | 'A' << 16 | 'S' << 8 | 'E' );
    public final static Long TTAG_bdat  = (long)( 'b' << 24 | 'd' << 16 | 'a' << 8 | 't' );
    public final static Long TTAG_BDF   = (long)( 'B' << 24 | 'D' << 16 | 'F' << 8 | ' ' );
    public final static Long TTAG_bhed  = (long)( 'b' << 24 | 'h' << 16 | 'e' << 8 | 'd' );
    public final static Long TTAG_bloc  = (long)( 'b' << 24 | 'l' << 16 | 'o' << 8 | 'c' );
    public final static Long TTAG_bsln  = (long)( 'b' << 24 | 's' << 16 | 'l' << 8 | 'n' );
    public final static Long TTAG_CBDT  = (long)( 'C' << 24 | 'B' << 16 | 'D' << 8 | 'T' );
    public final static Long TTAG_CBLC  = (long)( 'C' << 24 | 'B' << 16 | 'L' << 8 | 'C' );
    public final static Long TTAG_CFF   = (long)( 'C' << 24 | 'F' << 16 | 'F' << 8 | ' ' );
    public final static Long TTAG_CID   = (long)( 'C' << 24 | 'I' << 16 | 'D' << 8 | ' ' );
    public final static Long TTAG_cmap  = (long)( 'c' << 24 | 'm' << 16 | 'a' << 8 | 'p' );
    public final static Long TTAG_cvar  = (long)( 'c' << 24 | 'v' << 16 | 'a' << 8 | 'r' );
    public final static Long TTAG_cvt   = (long)( 'c' << 24 | 'v' << 16 | 't' << 8 | ' ' );
    public final static Long TTAG_DSIG  = (long)( 'D' << 24 | 'S' << 16 | 'I' << 8 | 'G' );
    public final static Long TTAG_EBDT  = (long)( 'E' << 24 | 'B' << 16 | 'D' << 8 | 'T' );
    public final static Long TTAG_EBLC  = (long)( 'E' << 24 | 'B' << 16 | 'L' << 8 | 'C' );
    public final static Long TTAG_EBSC  = (long)( 'E' << 24 | 'B' << 16 | 'S' << 8 | 'C' );
    public final static Long TTAG_feat  = (long)( 'f' << 24 | 'e' << 16 | 'a' << 8 | 't' );
    public final static Long TTAG_FOND  = (long)( 'F' << 24 | 'O' << 16 | 'N' << 8 | 'D' );
    public final static Long TTAG_fpgm  = (long)( 'f' << 24 | 'p' << 16 | 'g' << 8 | 'm' );
    public final static Long TTAG_fvar  = (long)( 'f' << 24 | 'v' << 16 | 'a' << 8 | 'r' );
    public final static Long TTAG_gasp  = (long)( 'g' << 24 | 'a' << 16 | 's' << 8 | 'p' );
    public final static Long TTAG_GDEF  = (long)( 'G' << 24 | 'D' << 16 | 'E' << 8 | 'F' );
    public final static Long TTAG_glyf  = (long)( 'g' << 24 | 'l' << 16 | 'y' << 8 | 'f' );
    public final static Long TTAG_GPOS  = (long)( 'G' << 24 | 'P' << 16 | 'O' << 8 | 'S' );
    public final static Long TTAG_GSUB  = (long)( 'G' << 24 | 'S' << 16 | 'U' << 8 | 'B' );
    public final static Long TTAG_gvar  = (long)( 'g' << 24 | 'v' << 16 | 'a' << 8 | 'r' );
    public final static Long TTAG_hdmx  = (long)( 'h' << 24 | 'd' << 16 | 'm' << 8 | 'x' );
    public final static Long TTAG_head  = (long)( 'h' << 24 | 'e' << 16 | 'a' << 8 | 'd' );
    public final static Long TTAG_hhea  = (long)( 'h' << 24 | 'h' << 16 | 'e' << 8 | 'a' );
    public final static Long TTAG_hmtx  = (long)( 'h' << 24 | 'm' << 16 | 't' << 8 | 'x' );
    public final static Long TTAG_JSTF  = (long)( 'J' << 24 | 'S' << 16 | 'T' << 8 | 'F' );
    public final static Long TTAG_just  = (long)( 'j' << 24 | 'u' << 16 | 's' << 8 | 't' );
    public final static Long TTAG_kern  = (long)( 'k' << 24 | 'e' << 16 | 'r' << 8 | 'n' );
    public final static Long TTAG_lcar  = (long)( 'l' << 24 | 'c' << 16 | 'a' << 8 | 'r' );
    public final static Long TTAG_loca  = (long)( 'l' << 24 | 'o' << 16 | 'c' << 8 | 'a' );
    public final static Long TTAG_LTSH  = (long)( 'L' << 24 | 'T' << 16 | 'S' << 8 | 'H' );
    public final static Long TTAG_LWFN  = (long)( 'L' << 24 | 'W' << 16 | 'F' << 8 | 'N' );
    public final static Long TTAG_MATH  = (long)( 'M' << 24 | 'A' << 16 | 'T' << 8 | 'H' );
    public final static Long TTAG_maxp  = (long)( 'm' << 24 | 'a' << 16 | 'x' << 8 | 'p' );
    public final static Long TTAG_META  = (long)( 'M' << 24 | 'E' << 16 | 'T' << 8 | 'A' );
    public final static Long TTAG_MMFX  = (long)( 'M' << 24 | 'M' << 16 | 'F' << 8 | 'X' );
    public final static Long TTAG_MMSD  = (long)( 'M' << 24 | 'M' << 16 | 'S' << 8 | 'D' );
    public final static Long TTAG_mort  = (long)( 'm' << 24 | 'o' << 16 | 'r' << 8 | 't' );
    public final static Long TTAG_morx  = (long)( 'm' << 24 | 'o' << 16 | 'r' << 8 | 'x' );
    public final static Long TTAG_name  = (long)( 'n' << 24 | 'a' << 16 | 'm' << 8 | 'e' );
    public final static Long TTAG_opbd  = (long)( 'o' << 24 | 'p' << 16 | 'b' << 8 | 'd' );
    public final static Long TTAG_OS2   = (long)( 'O' << 24 | 'S' << 16 | '/' << 8 | '2' );
    public final static Long TTAG_OTTO  = (long)( 'O' << 24 | 'T' << 16 | 'T' << 8 | 'O' );
    public final static Long TTAG_PCLT  = (long)( 'P' << 24 | 'C' << 16 | 'L' << 8 | 'T' );
    public final static Long TTAG_POST  = (long)( 'P' << 24 | 'O' << 16 | 'S' << 8 | 'T' );
    public final static Long TTAG_post  = (long)( 'p' << 24 | 'o' << 16 | 's' << 8 | 't' );
    public final static Long TTAG_prep  = (long)( 'p' << 24 | 'r' << 16 | 'e' << 8 | 'p' );
    public final static Long TTAG_prop  = (long)( 'p' << 24 | 'r' << 16 | 'o' << 8 | 'p' );
    public final static Long TTAG_sfnt  = (long)( 's' << 24 | 'f' << 16 | 'n' << 8 | 't' );
    public final static Long TTAG_SING  = (long)( 'S' << 24 | 'I' << 16 | 'N' << 8 | 'G' );
    public final static Long TTAG_trak  = (long)( 't' << 24 | 'r' << 16 | 'a' << 8 | 'k' );
    public final static Long TTAG_true  = (long)( 't' << 24 | 'r' << 16 | 'u' << 8 | 'e' );
    public final static Long TTAG_ttc   = (long)( 't' << 24 | 't' << 16 | 'c' << 8 | ' ' );
    public final static Long TTAG_ttcf  = (long)( 't' << 24 | 't' << 16 | 'c' << 8 | 'f' );
    public final static Long TTAG_TYP1  = (long)( 'T' << 24 | 'Y' << 16 | 'P' << 8 | '1' );
    public final static Long TTAG_typ1  = (long)( 't' << 24 | 'y' << 16 | 'p' << 8 | '1' );
    public final static Long TTAG_VDMX  = (long)( 'V' << 24 | 'D' << 16 | 'M' << 8 | 'X' );
    public final static Long TTAG_vhea  = (long)( 'v' << 24 | 'h' << 16 | 'e' << 8 | 'a' );
    public final static Long TTAG_vmtx  = (long)( 'v' << 24 | 'm' << 16 | 't' << 8 | 'x' );

    /* ==================== TTSfntLoad ================================== */
    public TTSfntLoad() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * sfnt_init_face
     * =====================================================================
     */
    public static int sfnt_init_face(Object ... args) {
      // FTStreamRec stream,
      // TTFaceRec face,
      // Integer face_index,
      // Integer num_params,
      // FTParameter[]  params

      ftbase.FTStreamRec stream = (ftbase.FTStreamRec)args[0];
      TTFaceRec face = (TTFaceRec)args[1];
      Long val1 = (Long)args[2];
      int face_index = val1.intValue();
      val1 = (Long)args[3];
      int num_params = val1.intValue();
        ftbase.FTParameter params = (ftbase.FTParameter)args[4];
      int error = 0;
      ftbase.FTLibraryRec library = face.driver.library;
      FTSfntInterfaceClass sfnt;

      if (num_params != 0) ; // unused
      if (params == null) ;  // unused
Debug(0, DBG_INIT, TAG, "sfnt_init_face called: "+face_index+"!"+face.sfnt+"!");
      sfnt = (FTSfntInterfaceClass)face.sfnt;
      if (sfnt == null) {
        sfnt = (FTSfntInterfaceClass)ftbase.FTModuleRec.FTGetModuleInterface(library, "sfnt");
        if (sfnt == null) {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_init_face: cannot access `sfnt' module");
          return ftbase.FTError.INTERP_MISSING_MODULE;
        }
        face.sfnt = sfnt;
        face.goto_table = sfnt.goto_table;
      }
//      FT_FACE_FIND_GLOBAL_SERVICE(face, face.psnames, POSTSCRIPT_CMAPS);
        ftbase.FTTrace.Trace(7, TAG, "SFNT driver" );
      error = sfnt_open_font(stream, face);
      if (error != 0) {
        return error;
      }
      ftbase.FTTrace.Trace(7, TAG, "sfnt_init_face: "+face+"!"+face_index);
      if (face_index < 0) {
        face_index = 0;
      }
      if (face_index >= face.ttc_header.count) {
        return ftbase.FTError.INTERP_INVALID_ARGUMENT;
      }
Debug(0, DBG_INIT, TAG, "offsets: "+face_index+"!"+face.ttc_header.count+"!"+face.ttc_header.offsets[face_index]+"!");
      error = (int)stream.seek(face.ttc_header.offsets[face_index]);
      if (error != 0) {
        return error;
      }
      /* check that we have a valid TrueType file */
      error = (int)sfnt.load_font_dir.callClassMethod(face, stream);
      if (error != 0) {
        return error;
      }
      face.num_faces = (int)face.ttc_header.count;
      face.face_index = face_index;
Debug(0, DBG_INIT, TAG, "sfnt_init_face done");
      return error;
    }

    /* =====================================================================
     * sfnt_load_face
     * =====================================================================
     */
    public static int sfnt_load_face(Object ... args) {
          // FT_Stream      stream,
          // TT_Face        face,
          // FT_Int         face_index,
          // FT_Int         num_params,
          // FT_Parameter*  params

      ftbase.FTStreamRec stream = (ftbase.FTStreamRec)args[0];
      TTFaceRec face = (TTFaceRec)args[1];
      Integer val1 = (int)args[2];
      int face_index = val1.intValue();
      val1 = (int)args[3];
      int num_params = val1.intValue();
      Object obj = args[4];
      Object[] obj_lst = (Object[])obj;
      ftbase.FTParameter params[] = (ftbase.FTParameter[])obj_lst;
      int  error = 0;
      boolean has_outline = false;
      boolean is_apple_sbit = false;
      boolean ignore_preferred_family  = false;
      boolean ignore_preferred_subfamily  = false;

      if (face_index == 0) ; // unused
      FTSfntInterfaceClass sfnt = (FTSfntInterfaceClass)face.sfnt;
      /* Check parameters */
      {
        int i;

        for (i = 0; i < num_params; i++) {
          if (params[i].tag == ftbase.FTParameter.FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY) {
            ignore_preferred_family = true;
          } else {
            if (params[i].tag == ftbase.FTParameter.FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY) {
              ignore_preferred_subfamily = true;
            }
          }
        }
      }
      /* Load tables */
      /* We now support two SFNT-based bitmapped font formats.  They */
      /* are recognized easily as they do not include a `glyf'       */
      /* table.                                                      */
      /*                                                             */
      /* The first format comes from Apple, and uses a table named   */
      /* `bhed' instead of `head' to store the font header (using    */
      /* the same format).  It also doesn't include horizontal and   */
      /* vertical metrics tables (i.e. `hhea' and `vhea' tables are  */
      /* missing).                                                   */
      /*                                                             */
      /* The other format comes from Microsoft, and is used with     */
      /* WinCE/PocketPC.  It looks like a standard TTF, except that  */
      /* it doesn't contain outlines.                                */
      /*                                                             */
      ftbase.FTTrace.Trace(7, TAG, String.format("sfnt_load_face: %s", face));
      /* do we have outlines in there? */
      has_outline = ((TTLoad.tt_face_lookup_table(face, TTAG_glyf) != null) ||
    		  (TTLoad.tt_face_lookup_table(face, TTAG_CFF) != null));
      is_apple_sbit = false;
      /* if this font doesn't contain outlines, we try to load */
      /* a `bhed' table                                        */
      if (!has_outline && sfnt.load_bhed != null) {
        ftbase.FTTrace.Trace(7, TAG, "`bhed' -->");
        ftbase.FTReference<TTFaceRec> face_ref = new ftbase.FTReference<TTFaceRec>();
        face_ref.Set(face);
        error = (int)sfnt.load_bhed.callClassMethod(face_ref, stream);
        face = face_ref.Get();
        ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
              error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
        is_apple_sbit = (error != 0);
      }
      /* load the font header (`head' table) if this isn't an Apple */
      /* sbit font file                                             */
      if (!is_apple_sbit) {
        ftbase.FTTrace.Trace(7, TAG, "`head' -->");
        ftbase.FTReference<TTFaceRec> face_ref = new ftbase.FTReference<TTFaceRec>();
        face_ref.Set(face);
        error = (int)sfnt.load_head.callClassMethod(face_ref, stream);
        face = face_ref.Get();
        ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
              error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
        if (error != 0) {
          ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done1");
          return error;
        }
      }
      if (face.header.Units_Per_EM == 0) {
        error = ftbase.FTError.INTERP_INVALID_TABLE;
        ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done2");
        return error;
      }
      /* the following tables are often not present in embedded TrueType */
      /* fonts within PDF documents, so don't check for them.            */
      ftbase.FTTrace.Trace(7, TAG, "`maxp' -->");
      ftbase.FTReference<TTFaceRec> face_ref = new ftbase.FTReference<TTFaceRec>();
      face_ref.Set(face);
      error = (int)sfnt.load_maxp.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
      ftbase.FTTrace.Trace(7, TAG, "`cmap' -->");
      face_ref.Set(face);
      error = (int)sfnt.load_cmap.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
      /* the following tables are optional in PCL fonts -- */
      /* don't check for errors                            */
      ftbase.FTTrace.Trace(7, TAG, "`name' -->");
      face_ref.Set(face);
      error = (int)sfnt.load_name.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));

      ftbase.FTTrace.Trace(7, TAG, "`post' -->");
      face_ref.Set(face);
      error = (int)sfnt.load_post.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
      /* do not load the metrics headers and tables if this is an Apple */
      /* sbit font file                                                 */
      if (!is_apple_sbit) {
        /* load the `hhea' and `hmtx' tables */
        ftbase.FTTrace.Trace(7, TAG, "`hhea' -->");
        face_ref.Set(face);
        error = (int)sfnt.load_hhea.callClassMethod(face_ref, stream, false);
        face = face_ref.Get();
        ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
              error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
        if (error == 0) {
          ftbase.FTTrace.Trace(7, TAG, "`hmtx' -->");
          face_ref.Set(face);
          error = (int)sfnt.load_hmtx.callClassMethod(face_ref, stream, false);
          face = face_ref.Get();
          ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
                error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
          if (error == ftbase.FTError.LOAD_TABLE_MISSING) {
            error = ftbase.FTError.LOAD_HMTX_TABLE_MISSING;
          }
        } else {
          if (error == ftbase.FTError.LOAD_TABLE_MISSING) {
          /* No `hhea' table necessary for SFNT Mac fonts. */
            if (face.format_tag == TTAG_true) {
              ftbase.FTTrace.Trace(7, TAG, "This is an SFNT Mac font.");
              has_outline = false;
              error = ftbase.FTError.INTERP_ERR_OK;
            } else {
              error = ftbase.FTError.LOAD_HORIZ_HEADER_MISSING;
            }
          }
        }
        if (error != 0) {
          error = ftbase.FTError.INTERP_INVALID_TABLE;
          ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done3");
        }
        /* try to load the `vhea' and `vmtx' tables */
        ftbase.FTTrace.Trace(7, TAG, "`hhea' --> vertical");
        face_ref.Set(face);
        error = (int)sfnt.load_hhea.callClassMethod(face_ref, stream, true);
        face = face_ref.Get();
        ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
              error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
        if (error == 0) {
          ftbase.FTTrace.Trace(7, TAG, "`hmtx' --> vertical");
          face_ref.Set(face);
          error = (int)sfnt.load_hmtx.callClassMethod(face_ref, stream, true);
          face = face_ref.Get();
          ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
                error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
          if (error == 0) {
            face.vertical_info = true;
          }
        }
        if (error != 0 && error != ftbase.FTError.LOAD_TABLE_MISSING) {
          error = ftbase.FTError.INTERP_INVALID_TABLE;
          ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done4");
        }
        ftbase.FTTrace.Trace(7, TAG, "`os2' -->");
        face_ref.Set(face);
        error = (int)sfnt.load_os2.callClassMethod(face_ref, stream);
        face = face_ref.Get();
        ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
              error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
        if (error != 0) {
          /* we treat the table as missing if there are any errors */
          face.os2.version = (short)0xFFFF;
        }
      }
      /* the optional tables */
      /* embedded bitmap support */
      if (sfnt.load_eblc != null) {
        ftbase.FTTrace.Trace(7, TAG, "`eblc' -->");
        face_ref.Set(face);
        error = (int)sfnt.load_eblc.callClassMethod(face_ref, stream);
        face = face_ref.Get();
        ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
              error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
        if (error != 0) {
          /* a font which contains neither bitmaps nor outlines is */
          /* still valid (although rather useless in most cases);  */
          /* however, you can find such stripped fonts in PDFs     */
          if (error == ftbase.FTError.LOAD_TABLE_MISSING) {
            error = ftbase.FTError.INTERP_ERR_OK;
          } else {
            error = ftbase.FTError.INTERP_INVALID_TABLE;
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done5");
          }
        }
      }
      ftbase.FTTrace.Trace(7, TAG, "`pclt' -->");
      face_ref.Set(face);
      error = (int)sfnt.load_pclt.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
      if (error != 0) {
        if (error != ftbase.FTError.LOAD_TABLE_MISSING) {
          error = ftbase.FTError.INTERP_INVALID_TABLE;
          ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done6");
        }
        face.pclt.Version = 0L;
      }
      /* consider the kerning and gasp tables as optional */
      ftbase.FTTrace.Trace(7, TAG, "`gasp' -->");
      face_ref.Set(face);
      error = (int)sfnt.load_gasp.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));

      ftbase.FTTrace.Trace(7, TAG, "`kern' -->");
      face_ref.Set(face);
      error = (int)sfnt.load_kern.callClassMethod(face_ref, stream);
      face = face_ref.Get();
      ftbase.FTTrace.Trace(7, TAG, String.format("%s", (error == 0) ? "loaded" :
            error == ftbase.FTError.LOAD_TABLE_MISSING ? "missing" : "failed to load"));
      face.num_glyphs = face.max_profile.numGlyphs;
      /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes  */
      /* a WWS-only font face.  `WWS' stands for `weight', width', and */
      /* `slope', a term used by Microsoft's Windows Presentation      */
      /* Foundation (WPF).  This flag has been introduced in version   */
      /* 1.5 of the OpenType specification (May 2008).                 */
      face.family_name = null;
      face.style_name = null;
      ftbase.FTReference<String> str_ref = new ftbase.FTReference<String>();
      str_ref.Set(null);
      if (face.os2.version != 0xFFFF && (face.os2.fsSelection & 256) != 0) {
        if (!ignore_preferred_family) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_PREFERRED_FAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_PREFERRED_FAMILY");
            return error;
          }
          face.family_name = str_ref.Get();
        }
        if (face.family_name != null) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_FONT_FAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_FONT_FAMILY");
            return error;
          }
          face.family_name = str_ref.Get();
        }
        if (!ignore_preferred_subfamily) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_PREFERRED_SUBFAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_PREFERRED_SUB_FAMILY");
            return error;
          }
          face.style_name = str_ref.Get();
        }
        if (face.style_name == null) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_FONT_SUBFAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_FONT_SUBFAMILY");
            return error;
          }
          face.style_name = str_ref.Get();
        }
      } else {
        error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_WWS_FAMILY, str_ref);
        if (error != 0)  {
          ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_WWS_FAMILY");
          return error;
        }
        face.family_name = str_ref.Get();
        if (face.family_name == null && !ignore_preferred_family) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_PREFERRED_FAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_PREFERRED_FAMILY");
            return error;
          }
          face.family_name = str_ref.Get();
        }
        if (face.family_name == null) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_FONT_FAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_FONT_FAMILY");
            return error;
          }
          face.family_name = str_ref.Get();
        }
        error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_WWS_SUBFAMILY, str_ref);
        if (error != 0)  {
          ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_WAS_SUBFAMILY");
          return error;
        }
        face.style_name = str_ref.Get();
        if (face.style_name != null && !ignore_preferred_subfamily) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_PREFERRED_SUBFAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_PREFERRED_SUBFAMILY");
            return error;
          }
          face.style_name = str_ref.Get();
        }
        if (face.style_name == null) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_FONT_SUBFAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_FONT_SUBFAMILY");
            return error;
          }
          face.style_name = str_ref.Get();
        }
      }
      /* now set up root fields */
      {
        ftbase.FTFaceRec root = (ftbase.FTFaceRec)face;
        long flags = root.face_flags;

        /* =================================================================
         * Compute face flags.
         * =================================================================
         */
        if (has_outline == true) {
          flags |= FTFaceRec.FT_FACE_FLAG_SCALABLE;   /* scalable outlines */
        }
        /* The sfnt driver only supports bitmap fonts natively, thus we */
        /* don't set FT_FACE_FLAG_HINTER.                               */
        flags |= FTFaceRec.FT_FACE_FLAG_SFNT | /* SFNT file format  */
        		FTFaceRec.FT_FACE_FLAG_HORIZONTAL; /* horizontal data   */
        /* fixed width font? */
        if (face.postscript.isFixedPitch != 0) {
          flags |= FTFaceRec.FT_FACE_FLAG_FIXED_WIDTH;
        }
        /* vertical information? */
        if (face.vertical_info) {
          flags |= FTFaceRec.FT_FACE_FLAG_VERTICAL;
        }
        /* kerning available ? */
        if ((face.face_flags & FTFaceRec.FT_FACE_FLAG_KERNING) != 0) {
          flags |= FTFaceRec.FT_FACE_FLAG_KERNING;
        }
        root.face_flags = flags;
        /* =================================================================
         * Compute style flags.
         * =================================================================
         */
        flags = 0;
        if (has_outline == true && face.os2.version != 0xFFFF) {
          /* We have an OS/2 table; use the `fsSelection' field.  Bit 9 */
          /* indicates an oblique font face.  This flag has been        */
          /* introduced in version 1.5 of the OpenType specification.   */
          if ((face.os2.fsSelection & 512) != 0) {      /* bit 9 */
            flags |= TTNameTableRec.FT_STYLE_FLAG_ITALIC;
          } else {
            if ((face.os2.fsSelection & 1) != 0) {   /* bit 0 */
              flags |= TTNameTableRec.FT_STYLE_FLAG_ITALIC;
            }
          }
          if ((face.os2.fsSelection & 32) != 0) {    /* bit 5 */
            flags |= TTNameTableRec.FT_STYLE_FLAG_BOLD;
          }
        } else {
          /* this is an old Mac font, use the header field */
          if ((face.header.Mac_Style & 1) != 0) {
            flags |= TTNameTableRec.FT_STYLE_FLAG_BOLD;
          }
          if ((face.header.Mac_Style & 2) != 0) {
            flags |= TTNameTableRec.FT_STYLE_FLAG_ITALIC;
          }
        }
        root.style_flags = flags;
        /* =================================================================
         * Polish the charmaps.
         *
         *   Try to set the charmap encoding according to the platform &
         *   encoding ID of each charmap.
         *
         * =================================================================
         */
        TTLoad.tt_face_build_cmaps(face);  /* ignore errors */
        /* set the encoding fields */
        {
          int  m;

          for (m = 0; m < root.num_charmaps; m++) {
            FTCharMapRec charmap = root.charmaps[m];

            charmap.encoding = FTEncoding.sfnt_find_encoding(charmap.platform_id, charmap.encoding_id);
          }
        }
        /* a font with no bitmaps and no outlines is scalable; */
        /* it has only empty glyphs then                       */
        if ((root.face_flags & FTFaceRec.FT_FACE_FLAG_FIXED_SIZES) != 0 &&
                (root.face_flags & FTFaceRec.FT_FACE_FLAG_SCALABLE) == 0) {
          root.face_flags |= FTFaceRec.FT_FACE_FLAG_SCALABLE;
        }
        /* =================================================================
         *  Set up metrics.
         * =================================================================
         */
        if ((root.face_flags & FTFaceRec.FT_FACE_FLAG_SCALABLE) != 0) {
          /* XXX What about if outline header is missing */
          /*     (e.g. sfnt wrapped bitmap)?             */
          root.bbox.xMin    = (long)face.header.xMin;
          root.bbox.yMin    = (long)face.header.yMin;
          root.bbox.xMax    = (long)face.header.xMax;
          root.bbox.yMax    = (long)face.header.yMax;
          root.units_per_EM = face.header.Units_Per_EM;
          /* XXX: Computing the ascender/descender/height is very different */
          /*      from what the specification tells you.  Apparently, we    */
          /*      must be careful because                                   */
          /*                                                                */
          /*      - not all fonts have an OS/2 table; in this case, we take */
          /*        the values in the horizontal header.  However, these    */
          /*        values very often are not reliable.                     */
          /*                                                                */
          /*      - otherwise, the correct typographic values are in the    */
          /*        sTypoAscender, sTypoDescender & sTypoLineGap fields.    */
          /*                                                                */
          /*        However, certain fonts have these fields set to 0.      */
          /*        Rather, they have usWinAscent & usWinDescent correctly  */
          /*        set (but with different values).                        */
          /*                                                                */
          /*      As an example, Arial Narrow is implemented through four   */
          /*      files ARIALN.TTF, ARIALNI.TTF, ARIALNB.TTF & ARIALNBI.TTF */
          /*                                                                */
          /*      Strangely, all fonts have the same values in their        */
          /*      sTypoXXX fields, except ARIALNB which sets them to 0.     */
          /*                                                                */
          /*      On the other hand, they all have different                */
          /*      usWinAscent/Descent values -- as a conclusion, the OS/2   */
          /*      table cannot be used to compute the text height reliably! */
          /*                                                                */
          /* The ascender and descender are taken from the `hhea' table. */
          /* If zero, they are taken from the `OS/2' table.              */
          root.ascender  = face.horizontal.Ascender;
          root.descender = face.horizontal.Descender;
          root.height = (short)(root.ascender - root.descender + face.horizontal.Line_Gap);
          if (!(root.ascender != 0 || root.descender != 0)) {
            if (face.os2.version != 0xFFFF) {
              if (face.os2.sTypoAscender != 0 || face.os2.sTypoDescender != 0) {
                root.ascender  = face.os2.sTypoAscender;
                root.descender = face.os2.sTypoDescender;
                root.height = (short)(root.ascender - root.descender + face.os2.sTypoLineGap);
              } else {
                root.ascender  =  (short)face.os2.usWinAscent;
                root.descender = (short)-face.os2.usWinDescent;
                root.height = (short)(root.ascender - root.descender );
              }
            }
          }
          root.max_advance_width  = face.horizontal.advance_Width_Max;
          root.max_advance_height = (short)(face.vertical_info
                                       ? face.vertical.advance_Height_Max
                                       : root.height);
          /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */
          /* Adjust underline position from top edge to centre of     */
          /* stroke to convert TrueType meaning to FreeType meaning.  */
          root.underline_position  = (short)(face.postscript.underlinePosition -
                                     face.postscript.underlineThickness / 2);
          root.underline_thickness = face.postscript.underlineThickness;
        }
      }
      ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: done7 OK");
      return error;
    }

    /* =====================================================================
     * sfnt_done_face
     * =====================================================================
     */
    public static int sfnt_done_face(Object ... arg1) {
      Log.w(TAG, "WARNING: sfnt_done_face not yet implemented");
Debug(0, DBG_INIT, TAG, "WARNING! sfnt_done_face not yet implemented");
      return 1; 
    }

    /* =====================================================================
     * sfnt_get_interface
     * =====================================================================
     */
    public static int sfnt_get_interface(Object ... arg) {
      Log.w(TAG, "WARNING: sfnt_get_interface not yet implemented");
Debug(0, DBG_INIT, TAG, "WARNING! sfnt_get_interface not yet implemented");
      return 1; 
    }

    /* =====================================================================
     * sfnt_open_font
     * =====================================================================
     */
    public static int sfnt_open_font(ftbase.FTStreamRec stream, TTFaceRec face) {
      int error = 0;
      Long tag;
      Long offset;

Debug(0, DBG_INIT, TAG, "STREAM: "+stream+"!");
      face.ttc_header.tag = 0L;
      face.ttc_header.version = 0L;
      face.ttc_header.count = 0;
      offset = stream.pos();
      tag = ((Integer)stream.readInt(stream)).longValue();
//      if (FT_READ_ULONG(tag)) {
//        return error;
//      }
Debug(0, DBG_INIT, TAG, "Tag: "+String.format("0x%08x", tag));
      if (tag != 0x00010000L &&
          tag != TTAG_ttcf    &&
          tag != TTAG_OTTO    &&
          tag != TTAG_true    &&
          tag != TTAG_typ1    &&
          tag != 0x00020000L) {
        ftbase.FTTrace.Trace(7, TAG, "  not a font using the SFNT container format");
        return ftbase.FTError.INTERP_UNKNOWN_FILE_FORMAT;
      }
      face.ttc_header.tag = TTAG_ttcf;
      if (tag == TTAG_ttcf) {
        int  n;

        ftbase.FTTrace.Trace(7, TAG, "sfnt_open_font: file is a collection");
        face.ttc_header.version = stream.readLong(stream);
        face.ttc_header.count = (int)stream.readLong(stream);
        
//        if (FT_STREAM_READ_FIELDS(ttc_header_fields, &face.ttc_header)) {
//          return error;
//        }
        if (face.ttc_header.count == 0) {
          return ftbase.FTError.INTERP_INVALID_TABLE;
        }
        /* a rough size estimate: let's conservatively assume that there   */
        /* is just a single table info in each subfont header (12 + 16*1 = */
        /* 28 bytes), thus we have (at least) `12 + 4*count' bytes for the */
        /* size of the TTC header plus `28*count' bytes for all subfont    */
        /* headers                                                         */
        if ((long)face.ttc_header.count > stream.size / (28 + 4)) {
          return ftbase.FTError.INTERP_ARRAY_TOO_LARGE;
        }
        /* now read the offsets of each font in the file */
        face.ttc_header.offsets = new long[(int)face.ttc_header.count];
//        if (FT_FRAME_ENTER(face.ttc_header.count * 4L)) {
//          return error;
//        }
        for (n = 0; n < face.ttc_header.count; n++) {
          face.ttc_header.offsets[n] = stream.readLong(stream);
        }
//        FT_FRAME_EXIT();
      } else {
        ftbase.FTTrace.Trace(7, TAG, "sfnt_open_font: synthesize TTC");
        face.ttc_header.version = (long)(1 << 16);
        face.ttc_header.count = 1;
//        if ( FT_NEW( face->ttc_header.offsets ) )
//          return error;
        face.ttc_header.offsets = new long[1];
        face.ttc_header.offsets[0] = offset;
      }
      return error;
    }

}

Added fttruetype/TTValidatorRec.java.







































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/* =====================================================================
 *  This Java implementation is derived from FreeType code
 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTValidatorRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTValidatorRec;

public class TTValidatorRec extends FTValidatorRec {
    private static int oid = 0;

    private int id;
    private static String TAG = "TTValidatorRec";

    public int num_glyphs = 0;

    /* ==================== TTValidatorRec ================================== */
    public TTValidatorRec() {
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
    /* ==================== toString ===================================== */
    public String toString() {
      return mySelf()+"!";
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
}