ApwFreetypeLibrary

Check-in [bb1dc76dfa]
Login

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

Overview
Comment:fixes.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:bb1dc76dfa1132006bd14ab0c2d2fe624606c325
User & Date: arnulf 2014-12-30 23:00:33
Context
2014-12-30
23:01
initial version. check-in: 170c896db0 user: arnulf tags: trunk
23:00
fixes. check-in: bb1dc76dfa user: arnulf tags: trunk
15:55
initial version. check-in: f71f0b18c4 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ftbase/FTDebug.java.

32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
..
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
    
    public static final int DBG_LIBRARY = 1;
    public static final int DBG_INIT = 2;
    public static final int DBG_RENDER = 3;
    public static final int DBG_LOAD_GLYPH = 4;
    public static final int DBG_INTERP = 5;
    public static final int DBG_CACHE = 6;

    public static final int DBG_MAX_TYPES = 10;
    
    /* ==================== constructor ================================== */
    public FTDebug() {
    	oid++;
    	id = oid;
    	
    	debug_types = new boolean[DBG_MAX_TYPES];
................................................................................
        	debug_types[i] = false;
        }
        debug_types[DBG_LIBRARY] = true;
        debug_types[DBG_INIT] = true;
        debug_types[DBG_RENDER] = true;
        debug_types[DBG_LOAD_GLYPH] = true;
        debug_types[DBG_INTERP] = true;



    	debug_levels = new int[DBG_MAX_TYPES];
        for (int i = 0; i < DBG_MAX_TYPES; i++) {
        	debug_levels[i] = 10;
        }
        debug_levels[DBG_LIBRARY] = 0;
        debug_levels[DBG_INIT] = 0;
        debug_levels[DBG_RENDER] = 0;
        debug_levels[DBG_LOAD_GLYPH] = 0;
        debug_levels[DBG_INTERP] = 0;



        debug_type_strs = new String[DBG_MAX_TYPES];
    	for (int i = 0; i < DBG_MAX_TYPES; i++) {
        	debug_type_strs[i] = "UNKNOWN";
        }
        debug_type_strs[DBG_LIBRARY] = "DBG_LIBRARY";
        debug_type_strs[DBG_INIT] = "DBG_INIT";
        debug_type_strs[DBG_RENDER] = "DBG_RENDER";
        debug_type_strs[DBG_LOAD_GLYPH] = "DBG_LOAD_GLYPH";
        debug_type_strs[DBG_INTERP] = "DBG_INTERP";


    }

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







>
|







 







>
>










>
>










>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
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
    
    public static final int DBG_LIBRARY = 1;
    public static final int DBG_INIT = 2;
    public static final int DBG_RENDER = 3;
    public static final int DBG_LOAD_GLYPH = 4;
    public static final int DBG_INTERP = 5;
    public static final int DBG_CACHE = 6;
    public static final int DBG_CMAP = 7;
    public static final int DBG_MAX_TYPES = 20;
    
    /* ==================== constructor ================================== */
    public FTDebug() {
    	oid++;
    	id = oid;
    	
    	debug_types = new boolean[DBG_MAX_TYPES];
................................................................................
        	debug_types[i] = false;
        }
        debug_types[DBG_LIBRARY] = true;
        debug_types[DBG_INIT] = true;
        debug_types[DBG_RENDER] = true;
        debug_types[DBG_LOAD_GLYPH] = true;
        debug_types[DBG_INTERP] = true;
        debug_types[DBG_CACHE] = true;
        debug_types[DBG_CMAP] = true;

    	debug_levels = new int[DBG_MAX_TYPES];
        for (int i = 0; i < DBG_MAX_TYPES; i++) {
        	debug_levels[i] = 10;
        }
        debug_levels[DBG_LIBRARY] = 0;
        debug_levels[DBG_INIT] = 0;
        debug_levels[DBG_RENDER] = 0;
        debug_levels[DBG_LOAD_GLYPH] = 0;
        debug_levels[DBG_INTERP] = 0;
        debug_levels[DBG_CACHE] = 0;
        debug_levels[DBG_CMAP] = 0;

        debug_type_strs = new String[DBG_MAX_TYPES];
    	for (int i = 0; i < DBG_MAX_TYPES; i++) {
        	debug_type_strs[i] = "UNKNOWN";
        }
        debug_type_strs[DBG_LIBRARY] = "DBG_LIBRARY";
        debug_type_strs[DBG_INIT] = "DBG_INIT";
        debug_type_strs[DBG_RENDER] = "DBG_RENDER";
        debug_type_strs[DBG_LOAD_GLYPH] = "DBG_LOAD_GLYPH";
        debug_type_strs[DBG_INTERP] = "DBG_INTERP";
        debug_type_strs[DBG_CACHE] = "DBG_CACHE";
        debug_type_strs[DBG_CMAP] = "DBG_CMAP";
    }

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

Changes to ftbase/FTInit.java.

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
     * =====================================================================
     */

    public int FTInitFreeType(FTReference<FTLibraryRec> library_ref) {
      int error;
      FTLibraryRec library;

       error = FTError.INTERP_ERR_OK;
      FTTrace.Trace(7, TAG, "FTInitFreeType");
Debug(0, DBG_INIT, TAG, "FT_Init_FreeType call FT_New_Library");
      library = new FTLibraryRec();
Debug(0, DBG_INIT, TAG, "FT_Init_FreeType call FT_Add_Default_Modules");
      ft_modules.FTAddDefaultModules(library);
      library_ref.Set(library);
Debug(0, DBG_INIT, TAG, "FT_Init_FreeType done");
      return error;
    }


}







|












59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
     * =====================================================================
     */

    public int FTInitFreeType(FTReference<FTLibraryRec> library_ref) {
      int error;
      FTLibraryRec library;

      error = FTError.INTERP_ERR_OK;
      FTTrace.Trace(7, TAG, "FTInitFreeType");
Debug(0, DBG_INIT, TAG, "FT_Init_FreeType call FT_New_Library");
      library = new FTLibraryRec();
Debug(0, DBG_INIT, TAG, "FT_Init_FreeType call FT_Add_Default_Modules");
      ft_modules.FTAddDefaultModules(library);
      library_ref.Set(library);
Debug(0, DBG_INIT, TAG, "FT_Init_FreeType done");
      return error;
    }


}

Changes to ftbase/FTModules.java.

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
...
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
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
...
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
     *   FTAddDefaultModules
     * =====================================================================
     */
    public int FTAddDefaultModules(FTLibraryRec library) {
      int error = 0;
      int i;

/*
      TTDriverClass tt_driver_class = new TTDriverClass();
      default_modules[DRIVER_TT_DRIVER_CLASS] = (FTModuleClassRec)tt_driver_class;
      num_modules++;

      FTRaster1RendererClass ft_raster1_renderer_class = new FTRaster1RendererClass();
      default_modules[RENDERER_FT_RASTER1_RENDERER_CLASS] = (FTModuleClassRec)ft_raster1_renderer_class;
      num_modules++;

      SfntModuleClass sfnt_module_class = new SfntModuleClass();
      default_modules[MODULE_SFNT_MODULE_CLASS] = sfnt_module_class;
      num_modules++;

      FTSmoothRendererClass ft_smooth_renderer_class = new FTSmoothRendererClass();
      default_modules[RENDERER_FT_SMOOTH_RENDERER_CLASS] = (FTModuleClassRec)ft_smooth_renderer_class;
      num_modules++;
*/
      
      for (i = 0; i < FT_MAX_MODULES; i++) {
        if (used_modules[i] != 0) {
FTDebug.Debug(0,  FTDebug.DBG_INIT, TAG, String.format("add module: %d %s %c %c %c %c", i,
          default_modules[i].module_name,
          (char)((default_modules[i].module_type >> 24) & 0xFF), 
          (char)((default_modules[i].module_type >> 16) & 0xFF),
          (char)((default_modules[i].module_type >> 8) & 0xFF),
................................................................................
      if (module_clazz.module_type == FTModuleClassRec.FT_MODULE_TYPE_FT_MODULE_REC) {
        module = new FTModuleRec();
      }
      if (module_clazz.module_type == FTModuleClassRec.FT_MODULE_TYPE_FT_RENDERER_REC) {
        module = new FTRendererRec();
        ((FTRendererRec)module).clazz = (FTRendererClassRec)module_clazz;
      }
/*
      if (module_clazz.module_type == FTModuleClassRec.FT_MODULE_TYPE_TT_DRIVER_REC) {
        module = new TTDriverRec();
      }
*/
      // base initialization
      module.library = library;
      module.module_clazz = module_clazz;
      /* check whether the module is a renderer - this must be performed */
      /* before the normal module initialization                         */
/*      
      if ((module.module_clazz.module_flags &  FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
FTDebug.Debug(0, FTDebug.DBG_INIT,  TAG, "FTAddModule is renderer: "+module.module_clazz.module_name);
        // add to the renderers list
FTDebug.Debug(0,  FTDebug.DBG_INIT,  TAG, "REND1: "+module.module_clazz.module_name);        
        error = FTRendererRec.ft_add_renderer(module);
        if (error != 0) {
          if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_FONT_DRIVER) != 0L) {
................................................................................
              FTGlyphLoaderRec.FTGlyphLoaderDone(driver.glyph_loader);
            }
          }
          if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
            FTRendererRec renderer = (FTRendererRec)module;

            if (renderer.clazz != null &&
                 renderer.glyph_format == FTGlyphFormat.FT_GLYPH_FORMAT_OUTLINE &&
                 renderer.raster != null) {
              renderer.clazz.raster_class.raster_done.callClassMethod(renderer.raster);
            }
          }
//          FT_FREE(module);
          return error;
        }
................................................................................
              }
            }
            if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
              FTRendererRec renderer = (FTRendererRec)module;

              renderer.module_clazz = module.module_clazz;
              if (renderer.clazz != null &&
                   renderer.glyph_format == FTGlyphFormat.FT_GLYPH_FORMAT_OUTLINE &&
                   renderer.raster != null) {
                renderer.clazz.raster_class.raster_done.callClassMethod(renderer.raster);
              }
            }
            return error;
          }
        }
      }
*/
      if (module_clazz.module_init != null) {
FTDebug.Debug(0, FTDebug.DBG_INIT, TAG, "FT_Add_Module module_init: "+module.module_clazz.module_name);
        error = (int)module_clazz.module_init.callClassMethod(module);
      }
      if (error == 0) {
        /* add module to the library's table */
        library.modules[library.num_modules++] = module;
        return error;
      }
/*
      if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_FONT_DRIVER) != 0L) {
        FTDriverRec driver = (FTDriverRec)module;

        driver.module_clazz = module.module_clazz;
        if ((driver.driver_clazz.module_flags & FTModuleClassRec.FT_MODULE_DRIVER_NO_OUTLINES) == 0L) {
          FTGlyphLoaderRec.FTGlyphLoaderDone(driver.glyph_loader);
        }
      }
      if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
        FTRendererRec renderer = (FTRendererRec)module;

        renderer.module_clazz = module.module_clazz;
        if (renderer.clazz != null &&
             renderer.glyph_format == FTGlyphFormat.FT_GLYPH_FORMAT_OUTLINE &&
             renderer.raster != null) {
          renderer.clazz.raster_class.raster_done.callClassMethod(renderer.raster);
        }
      }
*/
//      FT_FREE(module);
      return error;
    }

}







<
|
|


|
|


|



|
|

<
|







 







<

|

<





<







 







|







 







|








<









<













|




<





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
...
194
195
196
197
198
199
200

201
202
203

204
205
206
207
208

209
210
211
212
213
214
215
...
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
...
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
     *   FTAddDefaultModules
     * =====================================================================
     */
    public int FTAddDefaultModules(FTLibraryRec library) {
      int error = 0;
      int i;


      fttruetype.TTDriverClass tt_driver_class = new fttruetype.TTDriverClass();
      default_modules[DRIVER_TT_DRIVER_CLASS] = tt_driver_class;
      num_modules++;

      ftraster.FTRaster1RendererClass ft_raster1_renderer_class = new ftraster.FTRaster1RendererClass();
      default_modules[RENDERER_FT_RASTER1_RENDERER_CLASS] = ft_raster1_renderer_class;
      num_modules++;

      ftsfnt.SfntModuleClass sfnt_module_class = new ftsfnt.SfntModuleClass();
      default_modules[MODULE_SFNT_MODULE_CLASS] = sfnt_module_class;
      num_modules++;

      ftraster.FTSmoothRendererClass ft_smooth_renderer_class = new ftraster.FTSmoothRendererClass();
      default_modules[RENDERER_FT_SMOOTH_RENDERER_CLASS] = ft_smooth_renderer_class;
      num_modules++;


      for (i = 0; i < FT_MAX_MODULES; i++) {
        if (used_modules[i] != 0) {
FTDebug.Debug(0,  FTDebug.DBG_INIT, TAG, String.format("add module: %d %s %c %c %c %c", i,
          default_modules[i].module_name,
          (char)((default_modules[i].module_type >> 24) & 0xFF), 
          (char)((default_modules[i].module_type >> 16) & 0xFF),
          (char)((default_modules[i].module_type >> 8) & 0xFF),
................................................................................
      if (module_clazz.module_type == FTModuleClassRec.FT_MODULE_TYPE_FT_MODULE_REC) {
        module = new FTModuleRec();
      }
      if (module_clazz.module_type == FTModuleClassRec.FT_MODULE_TYPE_FT_RENDERER_REC) {
        module = new FTRendererRec();
        ((FTRendererRec)module).clazz = (FTRendererClassRec)module_clazz;
      }

      if (module_clazz.module_type == FTModuleClassRec.FT_MODULE_TYPE_TT_DRIVER_REC) {
        module = new fttruetype.TTDriverRec();
      }

      // base initialization
      module.library = library;
      module.module_clazz = module_clazz;
      /* check whether the module is a renderer - this must be performed */
      /* before the normal module initialization                         */

      if ((module.module_clazz.module_flags &  FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
FTDebug.Debug(0, FTDebug.DBG_INIT,  TAG, "FTAddModule is renderer: "+module.module_clazz.module_name);
        // add to the renderers list
FTDebug.Debug(0,  FTDebug.DBG_INIT,  TAG, "REND1: "+module.module_clazz.module_name);        
        error = FTRendererRec.ft_add_renderer(module);
        if (error != 0) {
          if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_FONT_DRIVER) != 0L) {
................................................................................
              FTGlyphLoaderRec.FTGlyphLoaderDone(driver.glyph_loader);
            }
          }
          if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
            FTRendererRec renderer = (FTRendererRec)module;

            if (renderer.clazz != null &&
                 renderer.glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
                 renderer.raster != null) {
              renderer.clazz.raster_class.raster_done.callClassMethod(renderer.raster);
            }
          }
//          FT_FREE(module);
          return error;
        }
................................................................................
              }
            }
            if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
              FTRendererRec renderer = (FTRendererRec)module;

              renderer.module_clazz = module.module_clazz;
              if (renderer.clazz != null &&
                   renderer.glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
                   renderer.raster != null) {
                renderer.clazz.raster_class.raster_done.callClassMethod(renderer.raster);
              }
            }
            return error;
          }
        }
      }

      if (module_clazz.module_init != null) {
FTDebug.Debug(0, FTDebug.DBG_INIT, TAG, "FT_Add_Module module_init: "+module.module_clazz.module_name);
        error = (int)module_clazz.module_init.callClassMethod(module);
      }
      if (error == 0) {
        /* add module to the library's table */
        library.modules[library.num_modules++] = module;
        return error;
      }

      if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_FONT_DRIVER) != 0L) {
        FTDriverRec driver = (FTDriverRec)module;

        driver.module_clazz = module.module_clazz;
        if ((driver.driver_clazz.module_flags & FTModuleClassRec.FT_MODULE_DRIVER_NO_OUTLINES) == 0L) {
          FTGlyphLoaderRec.FTGlyphLoaderDone(driver.glyph_loader);
        }
      }
      if ((module.module_clazz.module_flags & FTModuleClassRec.FT_MODULE_RENDERER) != 0L) {
        FTRendererRec renderer = (FTRendererRec)module;

        renderer.module_clazz = module.module_clazz;
        if (renderer.clazz != null &&
             renderer.glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
             renderer.raster != null) {
          renderer.clazz.raster_class.raster_done.callClassMethod(renderer.raster);
        }
      }

//      FT_FREE(module);
      return error;
    }

}

Changes to ftbase/FTStreamRec.java.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import java.io.*;

  /* =====================================================================
   *    FTStreamRec
   *
   * @description:
   *   A structure used to describe an input stream.
   *
   * @input:







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import java.io.*;

  /* =====================================================================
   *    FTStreamRec
   *
   * @description:
   *   A structure used to describe an input stream.
   *
   * @input:

Changes to ftsfnt/TTLoad.java.

1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383

    /* =====================================================================
     * tt_face_build_cmaps
     * =====================================================================
     */
    public static int tt_face_build_cmaps(fttruetype.TTFaceRec face) {
      int error = 0;
      System.out.println("tt_face_build_cmaps");
      byte[] table = face.cmap_table;
      int limit = (int)face.cmap_size;
      int num_cmaps;
      int table_idx = 0;
      ftbase.FTReference<Integer> offset_ref = new ftbase.FTReference<Integer>();
  
      if (table == null || limit < 4) {







|







1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383

    /* =====================================================================
     * tt_face_build_cmaps
     * =====================================================================
     */
    public static int tt_face_build_cmaps(fttruetype.TTFaceRec face) {
      int error = 0;
Debug(0, DBG_CMAP, TAG, "tt_face_build_cmaps");
      byte[] table = face.cmap_table;
      int limit = (int)face.cmap_size;
      int num_cmaps;
      int table_idx = 0;
      ftbase.FTReference<Integer> offset_ref = new ftbase.FTReference<Integer>();
  
      if (table == null || limit < 4) {