ApwFreetypeLibrary

Check-in [fba1151f13]
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:fba1151f1314ffef560b518d0f3116034ba6cc74
User & Date: arnulf 2014-12-30 15:55:23
Context
2014-12-30
15:55
initial version. check-in: f71f0b18c4 user: arnulf tags: trunk
15:55
fixes. check-in: fba1151f13 user: arnulf tags: trunk
15:18
initial version. check-in: 26c3e23c7f user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ftbase/FTFaceInternalRec.java.

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

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

    FTMatrixRec transform_matrix = null;
    FTVectorRec transform_delta = null;
    int transform_flags = 0;
    FTServiceCacheRec  services = null;
    boolean ignore_unpatented_hinter = false;
    int refcount;

    /* ==================== FTFaceInternalRec ================================== */
    public FTFaceInternalRec() {
      oid++;
      id = oid;







|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

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

    FTMatrixRec transform_matrix = null;
    FTVectorRec transform_delta = null;
    int transform_flags = 0;
    ftcache.FTServiceCacheRec services = null;
    boolean ignore_unpatented_hinter = false;
    int refcount;

    /* ==================== FTFaceInternalRec ================================== */
    public FTFaceInternalRec() {
      oid++;
      id = oid;

Changes to ftbase/FTGlyphLoaderFuncs.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
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
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
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
// ----------------------------------------------------------------
// FTGlyphLoaderFuncs.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// 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;

/* ======================================================================= */
/*  This Java implementation is derived from the Freetype code             */
/*  and has been implemented for reading .ttf font files                   */
/*                                                                         */



/*  Copyright (C) of the Java implementation 2014                          */
/*  Arnulf Wiedemann                                                       */
/*                                                                         */


/*  See the file "license.terms" for information on usage and              */
/*  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.   */
/*                                                                         */
/*  in this directory the truetype opcode interpreter is ported to Java    */
/*                                                                         */
/*  the next blocks are taken from the original source code                */
/*                                                                         */
/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */
/*            2010 by                                                      */
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
/*                                                                         */
/*  This file is part of the FreeType project, and may only be used,       */
/*  modified, and distributed under the terms of the FreeType project      */
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/* ======================================================================= */




  /* ===================================================================== */
  /*    FTGlyphLoaderFuncs                                                 */
  /*                                                                       */
  /* ===================================================================== */

import fttruetype.TTFaceRec;
import fttruetype.TTLoaderRec;
import fttruetype.TTSizeRec;

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

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

    /* ==================== FTGlyphLoaderFuncs ================================== */
    public FTGlyphLoaderFuncs() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
................................................................................
      slot.bitmap_left = 0;
      slot.bitmap_top = 0;
      slot.num_subglyphs = 0;
      slot.subglyphs = null;
      slot.control_data = 0;
      slot.control_len = 0;
      slot.other = 0;
      slot.format = FTGlyphFormat.FT_GLYPH_FORMAT_NONE;
      slot.linearHoriAdvance = 0L;
      slot.linearVertAdvance = 0L;
      slot.lsb_delta = 0L;
      slot.rsb_delta = 0L;
      slot_ref.Set(slot);
    }

................................................................................

    /* =====================================================================
     * compute_glyph_metrics
     * =====================================================================
     */
    public static int compute_glyph_metrics(FTReference<TTLoaderRec> loader_ref,
            int glyph_index) {
if (FTGlyphLoaderRec.glyph_debug > 2) {
System.out.println("compute_glyph_metrics");
}
      TTLoaderRec loader = loader_ref.Get();
      int error = 0;
      TTFaceRec face = (TTFaceRec)loader.face;
      FTBBoxRec bbox;
      long y_scale;
      FTGlyphSlotRec glyph = loader.glyph;
      TTSizeRec size = (TTSizeRec)loader.size;

int i;
for (i = 0; i < loader.gloader.current.outline.n_points + 4; i++) {
//System.out.println(String.format("PP2: i: %d x: %d y: %d\n", i, loader.gloader.current.outline.points[loader.gloader.current.outline.points_idx + i].x,
//loader.gloader.current.outline.points[loader.gloader.current.outline.points_idx + i].y));
}
      y_scale = 0x10000L;
      if ((loader.load_flags & FTGlyphLoaderFlags.FT_LOAD_NO_SCALE) == 0) {
        y_scale = size.metrics.y_scale;
      }
      if (glyph.format != FTGlyphFormat.FT_GLYPH_FORMAT_COMPOSITE) {
        FTReference<FTOutlineRec> outline_ref = new FTReference<FTOutlineRec>();
        FTReference<FTBBoxRec> bbox_ref = new FTReference<FTBBoxRec>();
        outline_ref.Set(glyph.outline);
        bbox_ref.Set(new FTBBoxRec());
        FTOutlineRec.FTOutlineGetCBox(outline_ref, bbox_ref);
        glyph.outline = outline_ref.Get();
        bbox = bbox_ref.Get();
................................................................................
      glyph.metrics.horiBearingY = bbox.yMax;
      glyph.metrics.horiAdvance = loader.pp2.x - loader.pp1.x;
      /* adjust advance width to the value contained in the hdmx table */
      if (face.postscript.isFixedPitch != 0 &&
           (loader.load_flags & FTGlyphLoaderFlags.FT_LOAD_NO_HINTING) == 0) {
        int widthpIdx;

        widthpIdx = TTLoad.tt_face_get_device_metrics(face, size.metrics.x_ppem, glyph_index);
        if (widthpIdx != 0) {
          glyph.metrics.horiAdvance = (long)(face.hdmx_table[widthpIdx] << 6);
        }
      }
      /* set glyph dimensions */
      glyph.metrics.width = bbox.xMax - bbox.xMin;
      glyph.metrics.height = bbox.yMax - bbox.yMin;
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>
>
>










|













|
<
|



|
<







 







|







 







<
|
<










|






|







 







|




















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
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
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
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192













/* =====================================================================
 *  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;

  /* ===================================================================== */
  /*    FTGlyphLoaderFuncs                                                 */
  /*                                                                       */
  /* ===================================================================== */

import fttruetype.TTFaceRec;
import fttruetype.TTLoaderRec;
import fttruetype.TTSizeRec;

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

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

    /* ==================== FTGlyphLoaderFuncs ================================== */
    public FTGlyphLoaderFuncs() {
      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();
    }
................................................................................
      slot.bitmap_left = 0;
      slot.bitmap_top = 0;
      slot.num_subglyphs = 0;
      slot.subglyphs = null;
      slot.control_data = 0;
      slot.control_len = 0;
      slot.other = 0;
      slot.format = FT_GLYPH_FORMAT_NONE;
      slot.linearHoriAdvance = 0L;
      slot.linearVertAdvance = 0L;
      slot.lsb_delta = 0L;
      slot.rsb_delta = 0L;
      slot_ref.Set(slot);
    }

................................................................................

    /* =====================================================================
     * compute_glyph_metrics
     * =====================================================================
     */
    public static int compute_glyph_metrics(FTReference<TTLoaderRec> loader_ref,
            int glyph_index) {

Debug(0, DBG_LOAD_GLYPH, TAG, "compute_glyph_metrics");

      TTLoaderRec loader = loader_ref.Get();
      int error = 0;
      TTFaceRec face = (TTFaceRec)loader.face;
      FTBBoxRec bbox;
      long y_scale;
      FTGlyphSlotRec glyph = loader.glyph;
      TTSizeRec size = (TTSizeRec)loader.size;

int i;
for (i = 0; i < loader.gloader.current.outline.n_points + 4; i++) {
//Debug(0, DBG_LOAD_GLYPH, TAG, String.format("PP2: i: %d x: %d y: %d\n", i, loader.gloader.current.outline.points[loader.gloader.current.outline.points_idx + i].x,
//loader.gloader.current.outline.points[loader.gloader.current.outline.points_idx + i].y));
}
      y_scale = 0x10000L;
      if ((loader.load_flags & FTGlyphLoaderFlags.FT_LOAD_NO_SCALE) == 0) {
        y_scale = size.metrics.y_scale;
      }
      if (glyph.format != FT_GLYPH_FORMAT_COMPOSITE) {
        FTReference<FTOutlineRec> outline_ref = new FTReference<FTOutlineRec>();
        FTReference<FTBBoxRec> bbox_ref = new FTReference<FTBBoxRec>();
        outline_ref.Set(glyph.outline);
        bbox_ref.Set(new FTBBoxRec());
        FTOutlineRec.FTOutlineGetCBox(outline_ref, bbox_ref);
        glyph.outline = outline_ref.Get();
        bbox = bbox_ref.Get();
................................................................................
      glyph.metrics.horiBearingY = bbox.yMax;
      glyph.metrics.horiAdvance = loader.pp2.x - loader.pp1.x;
      /* adjust advance width to the value contained in the hdmx table */
      if (face.postscript.isFixedPitch != 0 &&
           (loader.load_flags & FTGlyphLoaderFlags.FT_LOAD_NO_HINTING) == 0) {
        int widthpIdx;

        widthpIdx = ftsfnt.TTLoad.tt_face_get_device_metrics(face, size.metrics.x_ppem, glyph_index);
        if (widthpIdx != 0) {
          glyph.metrics.horiAdvance = (long)(face.hdmx_table[widthpIdx] << 6);
        }
      }
      /* set glyph dimensions */
      glyph.metrics.width = bbox.xMax - bbox.xMin;
      glyph.metrics.height = bbox.yMax - bbox.yMin;

Changes to ftbase/FTGlyphLoaderRec.java.

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    /* ==================== _showLoaderZone ================================== */
    public static void _showLoaderZone(String str) {
      int j;

      if (doDebug) {
        Debug(0, DBG_LOAD_GLYPH, TAG, String.format("%s", str));
        if (fttruetype.TTGlyphLoaderFuncs.loader != null) {
          loaderZone = TTGlyphLoaderFuncs.loader.zone;
          loaderLoad = TTGlyphLoaderFuncs.loader.gloader.current;
        }
        if (TTInterpBase.cur != null) {
          if (TTInterpBase.cur.zp0 != null) {
            if (TTInterpBase.cur.zp0.cur != null) {
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.cur: "+(Object)TTInterpBase.cur.zp0.cur);
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.org: "+(Object)TTInterpBase.cur.zp0.org);
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.orus: "+(Object)TTInterpBase.cur.zp0.orus);
................................................................................
      /* if it is a bitmap, that's easy :-) */
      if (slot.format == FT_GLYPH_FORMAT_BITMAP) {
        FTBitmapGlyphClassRec glyph_class = new FTBitmapGlyphClassRec();
        clazz = glyph_class;
      } else {
        /* if it is an outline */
        if (slot.format == FT_GLYPH_FORMAT_OUTLINE) {
          FTOutlineGlyphClass glyph_class = new FTOutlineGlyphClass();
          clazz = glyph_class;
        } else {
          /* try to find a renderer that supports the glyph image format */
          FTRendererRec render = FTRendererRec.FTLookupRenderer(library, slot.format, null);

          if (render != null) {
            clazz = render.glyph_class;







|
|







 







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    /* ==================== _showLoaderZone ================================== */
    public static void _showLoaderZone(String str) {
      int j;

      if (doDebug) {
        Debug(0, DBG_LOAD_GLYPH, TAG, String.format("%s", str));
        if (fttruetype.TTGlyphLoaderFuncs.loader != null) {
          loaderZone = fttruetype.TTGlyphLoaderFuncs.loader.zone;
          loaderLoad = fttruetype.TTGlyphLoaderFuncs.loader.gloader.current;
        }
        if (TTInterpBase.cur != null) {
          if (TTInterpBase.cur.zp0 != null) {
            if (TTInterpBase.cur.zp0.cur != null) {
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.cur: "+(Object)TTInterpBase.cur.zp0.cur);
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.org: "+(Object)TTInterpBase.cur.zp0.org);
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.orus: "+(Object)TTInterpBase.cur.zp0.orus);
................................................................................
      /* if it is a bitmap, that's easy :-) */
      if (slot.format == FT_GLYPH_FORMAT_BITMAP) {
        FTBitmapGlyphClassRec glyph_class = new FTBitmapGlyphClassRec();
        clazz = glyph_class;
      } else {
        /* if it is an outline */
        if (slot.format == FT_GLYPH_FORMAT_OUTLINE) {
          ftbase.FTOutlineGlyphClass glyph_class = new ftbase.FTOutlineGlyphClass();
          clazz = glyph_class;
        } else {
          /* try to find a renderer that supports the glyph image format */
          FTRendererRec render = FTRendererRec.FTLookupRenderer(library, slot.format, null);

          if (render != null) {
            clazz = render.glyph_class;

Changes to ftcache/FTCCMapCacheFuncs.java.

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

    /* =====================================================================
     *    FTGetCMapFormat
     *
     * =====================================================================
     */
    public static long FTGetCMapFormat(FTCharMapRec charmap) {
      FTServiceTTCMapsRec service;
      ftbase.FTFaceRec face;
      TTCMapInfoRec cmap_info;
  
  
      if (charmap == null || charmap.face == null) {
        return -1;
      }
      face = charmap.face;
      ftbase.FTModuleRec module = ((ftbase.FTModuleRec)face.driver);
      service = (FTServiceTTCMapsRec)module.module_clazz.get_interface.callClassMethod(module, "TT_CMAP");
//      FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
      if (service == null) {
        return -1;
      }
      FTReference<TTCMapInfoRec> cmap_info_ref = new FTReference<TTCMapInfoRec>();
      if ((int)service.get_cmap_info.callClassMethod(charmap, cmap_info_ref) == 0) {
        return -1;
      }
      cmap_info = cmap_info_ref.Get();
      return cmap_info.format;
    }








|

|







|




|







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

    /* =====================================================================
     *    FTGetCMapFormat
     *
     * =====================================================================
     */
    public static long FTGetCMapFormat(FTCharMapRec charmap) {
      ftbase.FTServiceTTCMapsRec service;
      ftbase.FTFaceRec face;
      fttruetype.TTCMapInfoRec cmap_info;
  
  
      if (charmap == null || charmap.face == null) {
        return -1;
      }
      face = charmap.face;
      ftbase.FTModuleRec module = ((ftbase.FTModuleRec)face.driver);
      service = (ftbase.FTServiceTTCMapsRec)module.module_clazz.get_interface.callClassMethod(module, "TT_CMAP");
//      FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
      if (service == null) {
        return -1;
      }
      ftbase.FTReference<fttruetype.TTCMapInfoRec> cmap_info_ref = new ftbase.FTReference<fttruetype.TTCMapInfoRec>();
      if ((int)service.get_cmap_info.callClassMethod(charmap, cmap_info_ref) == 0) {
        return -1;
      }
      cmap_info = cmap_info_ref.Get();
      return cmap_info.format;
    }

Changes to ftcache/FTCCacheFuncs.java.

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
      size_ref.Set(size);
      error = FTCManagerRec.FTCManagerLookupSize(manager, scaler_ref, size_ref);
      size = size_ref.Get();
      family.attrs.scaler = scaler_ref.Get();
      if (error == 0) {
        face = size.face;
        face_ref.Set(face);
        error = ftbase.FTGlyphLoaderRec.FTLoadGlyph(face_ref, gindex, (int)(family.attrs.load_flags | FTGlyphLoaderFlags.FT_LOAD_RENDER));
        face = face_ref.Get();
        if (error == 0) {
          face_ref.Set(face);
        }
      }
      return error;
    }







|







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
      size_ref.Set(size);
      error = FTCManagerRec.FTCManagerLookupSize(manager, scaler_ref, size_ref);
      size = size_ref.Get();
      family.attrs.scaler = scaler_ref.Get();
      if (error == 0) {
        face = size.face;
        face_ref.Set(face);
        error = ftbase.FTGlyphLoaderRec.FTLoadGlyph(face_ref, gindex, (int)(family.attrs.load_flags | FT_LOAD_RENDER));
        face = face_ref.Get();
        if (error == 0) {
          face_ref.Set(face);
        }
      }
      return error;
    }

Changes to ftcache/FTCSizeListFuncs.java.

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
/* ======================================================================= */

  /* ===================================================================== */
  /*    FTCSizeListFuncs                                                        */
  /*                                                                       */
  /* ===================================================================== */

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

    private int id;
    private static String TAG = "FTCSizeListFuncs";
    
    /* ==================== FTCSizeListFuncs ================================== */
    public FTCSizeListFuncs() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
................................................................................
 
    /* =====================================================================
     *    ftc_size_node_compare
     *
     * =====================================================================
     */
    public static boolean ftc_size_node_compare(Object ... args) {
if (FTCCacheRec.cache_debug > 2) {
System.out.println("ftc_size_node_compare");
}
      FTCMruNodeRec ftcnode = (FTCMruNodeRec)args[0];
      Object ftcscaler = args[1];
      FTCSizeNodeRec node = (FTCSizeNodeRec)ftcnode;
      FTCScalerRec scaler = (FTCScalerRec)ftcscaler;
      FTCScalerRec scaler0 = node.scaler;

      if (scaler0.face_id == scaler.face_id &&
          scaler0.width == scaler.width &&
          scaler0.height == scaler.height &&
          (scaler0.pixel != 0) == (scaler.pixel != 0) &&
          (scaler0.pixel != 0 ||
            (scaler0.x_res == scaler.x_res && scaler0.y_res == scaler.y_res))) {
        FTSizeRec.FTActivateSize(node.size);
        return true;
      }
      return false;
    }

    /* =====================================================================
     *    ftc_size_node_init
     *
     * =====================================================================
     */
    public static int ftc_size_node_init(Object ... args) {
      FTReference<Object> obj_ref = (FTReference<Object>)args[0];
      FTCMruNodeRec ftcnode = (FTCMruNodeRec)obj_ref.Get();
      FTCScalerRec ftcscaler = (FTCScalerRec)args[1];
      FTCManagerRec ftcmanager = (FTCManagerRec)args[2];
      FTCSizeNodeRec size_node = (FTCSizeNodeRec)ftcnode;
      int error = 0;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("ftc_size_node_init");
}
      size_node.scaler = ftcscaler;
      FTReference<FTSizeRec> size_ref = new FTReference<FTSizeRec>();

      error = FTCScalerRec.ftc_scaler_lookup_size(ftcmanager, ftcscaler, size_ref);
      size_node.size = size_ref.Get();
      obj_ref.Set(size_node);
      return error;
    }

    /* =====================================================================
     *    ftc_size_node_reset
     *
     * =====================================================================
     */
    public static int ftc_size_node_reset(Object ... args) {
      Log.w(TAG, "ftc_size_node_reset not yet implemented");
//      Object obj = args[0];

      int error = 0;

      return error;
    }

    /* =====================================================================
     *    ftc_size_node_done
     *
     * =====================================================================
     */
    public static int ftc_size_node_done(Object ... args) {
      Log.w(TAG, "ftc_size_node_done not yet implemented");
//      Object obj = args[0];

      int error = 0;

      return error;
    }

}







|













|
<
|



|
<







 







<
|
<












|











|






<
|
<

<
>













<













<







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
/* ======================================================================= */

  /* ===================================================================== */
  /*    FTCSizeListFuncs                                                        */
  /*                                                                       */
  /* ===================================================================== */

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

    private int id;
    private static String TAG = "FTCSizeListFuncs";
    
    /* ==================== FTCSizeListFuncs ================================== */
    public FTCSizeListFuncs() {
      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();
    }
................................................................................
 
    /* =====================================================================
     *    ftc_size_node_compare
     *
     * =====================================================================
     */
    public static boolean ftc_size_node_compare(Object ... args) {

Debug(0, DBG_CACHE, TAG, "ftc_size_node_compare");

      FTCMruNodeRec ftcnode = (FTCMruNodeRec)args[0];
      Object ftcscaler = args[1];
      FTCSizeNodeRec node = (FTCSizeNodeRec)ftcnode;
      FTCScalerRec scaler = (FTCScalerRec)ftcscaler;
      FTCScalerRec scaler0 = node.scaler;

      if (scaler0.face_id == scaler.face_id &&
          scaler0.width == scaler.width &&
          scaler0.height == scaler.height &&
          (scaler0.pixel != 0) == (scaler.pixel != 0) &&
          (scaler0.pixel != 0 ||
            (scaler0.x_res == scaler.x_res && scaler0.y_res == scaler.y_res))) {
        ftbase.FTSizeRec.FTActivateSize(node.size);
        return true;
      }
      return false;
    }

    /* =====================================================================
     *    ftc_size_node_init
     *
     * =====================================================================
     */
    public static int ftc_size_node_init(Object ... args) {
      ftbase.FTReference<Object> obj_ref = (ftbase.FTReference<Object>)args[0];
      FTCMruNodeRec ftcnode = (FTCMruNodeRec)obj_ref.Get();
      FTCScalerRec ftcscaler = (FTCScalerRec)args[1];
      FTCManagerRec ftcmanager = (FTCManagerRec)args[2];
      FTCSizeNodeRec size_node = (FTCSizeNodeRec)ftcnode;
      int error = 0;


Debug(0, DBG_CACHE, TAG, "ftc_size_node_init");

      size_node.scaler = ftcscaler;

      ftbase.FTReference<ftbase.FTSizeRec> size_ref = new ftbase.FTReference<ftbase.FTSizeRec>();
      error = FTCScalerRec.ftc_scaler_lookup_size(ftcmanager, ftcscaler, size_ref);
      size_node.size = size_ref.Get();
      obj_ref.Set(size_node);
      return error;
    }

    /* =====================================================================
     *    ftc_size_node_reset
     *
     * =====================================================================
     */
    public static int ftc_size_node_reset(Object ... args) {
      Log.w(TAG, "ftc_size_node_reset not yet implemented");


      int error = 0;

      return error;
    }

    /* =====================================================================
     *    ftc_size_node_done
     *
     * =====================================================================
     */
    public static int ftc_size_node_done(Object ... args) {
      Log.w(TAG, "ftc_size_node_done not yet implemented");


      int error = 0;

      return error;
    }

}

Changes to ftdemo/FTDemoStatusRec.java.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    private final static int RENDER_MODE_WATERFALL = 5;
    private final static int N_RENDER_MODES = 6;

    int update = 1;
    int width = DIM_X;
    int height = DIM_Y;
    int render_mode = RENDER_MODE_ALL;
    long encoding = FTEncoding.FT_ENCODING_NONE;
    int res = 72;
    int ptsize = 768;            /* current point size, 26.6 format */
    int lcd_mode = -1;
    double gamma = 1.0f;
    double xbold_factor = 0.04f;
    double ybold_factor = 0.04f;
    double radius = 0.02f;







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    private final static int RENDER_MODE_WATERFALL = 5;
    private final static int N_RENDER_MODES = 6;

    int update = 1;
    int width = DIM_X;
    int height = DIM_Y;
    int render_mode = RENDER_MODE_ALL;
    long encoding = ftbase.FTEncoding.FT_ENCODING_NONE;
    int res = 72;
    int ptsize = 768;            /* current point size, 26.6 format */
    int lcd_mode = -1;
    double gamma = 1.0f;
    double xbold_factor = 0.04f;
    double ybold_factor = 0.04f;
    double radius = 0.02f;

Changes to ftsfnt/TTSfntLoad.java.

10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
...
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
...
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
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

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


import fttruetype.TTFaceRec;
import fttruetype.TTNameTableRec;

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

    private int id;
................................................................................
        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;
................................................................................
         */
        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;







|



>







 







|



|
|


|



|


|
|







 







|

|




|
|
|





|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
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
...
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
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

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

import android.util.Log;
import fttruetype.TTFaceRec;
import fttruetype.TTNameTableRec;

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

    private int id;
................................................................................
        long flags = root.face_flags;

        /* =================================================================
         * Compute face flags.
         * =================================================================
         */
        if (has_outline == true) {
          flags |= FT_FACE_FLAG_SCALABLE;   /* scalable outlines */
        }
        /* The sfnt driver only supports bitmap fonts natively, thus we */
        /* don't set FT_FACE_FLAG_HINTER.                               */
        flags |= FT_FACE_FLAG_SFNT | /* SFNT file format  */
        		FT_FACE_FLAG_HORIZONTAL; /* horizontal data   */
        /* fixed width font? */
        if (face.postscript.isFixedPitch != 0) {
          flags |= FT_FACE_FLAG_FIXED_WIDTH;
        }
        /* vertical information? */
        if (face.vertical_info) {
          flags |= FT_FACE_FLAG_VERTICAL;
        }
        /* kerning available ? */
        if ((face.face_flags & FT_FACE_FLAG_KERNING) != 0) {
          flags |= FT_FACE_FLAG_KERNING;
        }
        root.face_flags = flags;
        /* =================================================================
         * Compute style flags.
         * =================================================================
         */
        flags = 0;
................................................................................
         */
        TTLoad.tt_face_build_cmaps(face);  /* ignore errors */
        /* set the encoding fields */
        {
          int  m;

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

            charmap.encoding = ftbase.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 & FT_FACE_FLAG_FIXED_SIZES) != 0 &&
                (root.face_flags & FT_FACE_FLAG_SCALABLE) == 0) {
          root.face_flags |= FT_FACE_FLAG_SCALABLE;
        }
        /* =================================================================
         *  Set up metrics.
         * =================================================================
         */
        if ((root.face_flags & 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;

Changes to fttruetype/TTDefaultGraphicsStateClass.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
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// ----------------------------------------------------------------
// TTDefaultGraphicsStateClass.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// 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;

/* ======================================================================= */
/*  This Java implementation is derived from the Freetype code             */
/*  and has been implemented to work together with the Apache batik code   */
/*  for reading .ttf ont files                                             */
/*                                                                         */



/*  Copyright (C) of the Java implementation 2014                          */
/*  Arnulf Wiedemann                                                       */
/*                                                                         */


/*  See the file "license.terms" for information on usage and              */
/*  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.   */
/*                                                                         */
/*  in this directory the truetype opcode interpreter is ported to Java    */
/*                                                                         */
/*  the next blocks are taken from the original source code                */
/*                                                                         */
/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,   */
/*            2010 by                                                      */
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
/*                                                                         */
/*  This file is part of the FreeType project, and may only be used,       */
/*  modified, and distributed under the terms of the FreeType project      */
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/* ======================================================================= */





  /* ===================================================================== */
  /*    TTDefaultGraphicsStateClass                                                    */
  /*                                                                       */
  /* <Struct>                                                              */
  /*    TTDefaultGraphicsStateClass                                                    */
  /*                                                                       */
................................................................................
    public TTDefaultGraphicsStateClass() {
      oid++;
      id = oid;

      rp0 = 0;
      rp1 = 0;
      rp2 = 0;
      dualVector = new FTUnitVectorRec();
      dualVector.x = 0x4000L;
      dualVector.y = 0L;
      projVector = new FTUnitVectorRec();
      projVector.x = 0x4000L;
      projVector.y = 0L;
      freeVector = new FTUnitVectorRec();
      freeVector.x = 0x4000L;
      freeVector.y = 0L;

      loop = 1;
      minimum_distance = 64;
      round_state = 1;

................................................................................
      gep0 = 1;
      gep1 = 1;
      gep2 = 1;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

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







 







|


|


|







 







|
<
|



|
<






















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
65
66
67
68
69
70
71
72

73
74
75
76
77

78
79
80
81
82
83
84
85
86













/* =====================================================================
 *  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;


  /* ===================================================================== */
  /*    TTDefaultGraphicsStateClass                                                    */
  /*                                                                       */
  /* <Struct>                                                              */
  /*    TTDefaultGraphicsStateClass                                                    */
  /*                                                                       */
................................................................................
    public TTDefaultGraphicsStateClass() {
      oid++;
      id = oid;

      rp0 = 0;
      rp1 = 0;
      rp2 = 0;
      dualVector = new ftbase.FTVectorRec();
      dualVector.x = 0x4000L;
      dualVector.y = 0L;
      projVector = new ftbase.FTVectorRec();
      projVector.x = 0x4000L;
      projVector.y = 0L;
      freeVector = new ftbase.FTVectorRec();
      freeVector.x = 0x4000L;
      freeVector.y = 0L;

      loop = 1;
      minimum_distance = 64;
      round_state = 1;

................................................................................
      gep0 = 1;
      gep1 = 1;
      gep2 = 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();
    }
 
}

Changes to fttruetype/TTDriverRec.java.

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
     *
     * <Note>
     *    Only the glyph loader and debugger should call this function.
     *
     * =====================================================================
     */
    public static int TTLoadContext(FTReference<TTExecContextRec> exec_ref, TTFaceRec face, TTSizeRec size) {
if (FTGlyphLoaderRec.glyph_debug > 2) {
System.out.println("TTLoadContext");
}
      TTExecContextRec exec = exec_ref.Get();
      int error = 0;
      int i;
      TTMaxProfile maxp ;

      exec.face = face;
      maxp = face.max_profile;







<
|
<







131
132
133
134
135
136
137

138

139
140
141
142
143
144
145
     *
     * <Note>
     *    Only the glyph loader and debugger should call this function.
     *
     * =====================================================================
     */
    public static int TTLoadContext(FTReference<TTExecContextRec> exec_ref, TTFaceRec face, TTSizeRec size) {

Debug(0, DBG_LOAD_GLYPH, TAG, "TTLoadContext");

      TTExecContextRec exec = exec_ref.Get();
      int error = 0;
      int i;
      TTMaxProfile maxp ;

      exec.face = face;
      maxp = face.max_profile;

Changes to fttruetype/TTExecContextRec.java.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    protected int error = 0;                  /* last execution error */
    protected int top = 0;                    /* top of exec. stack   */
    protected int stackSize = MAX_STACK_SIZE; /* size of exec. stack  */
    protected long[] stack = null;            /* current exec. stack  */
    protected int numArgs = 0;
    protected int[] args = null;
    protected int new_top = 0;                /* new top after exec.  */
    protected TTGlyphZoneRec zp0 = null;      /* zone records */
    protected TTGlyphZoneRec zp1 = null;
    protected TTGlyphZoneRec zp2 = null;
    protected TTGlyphZoneRec pts = null;
    protected TTGlyphZoneRec twilight = null;
    protected FTSizeMetricsRec metrics = null;
    protected TTSizeMetricsRec tt_metrics = null; /* size metrics */
    protected TTGraphicsStateRec GS = null;       /* current graphics state */
    protected int curRange = 0;             /* current code range number   */
    protected byte[] code = null;           /* current code range          */







|
|
|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    protected int error = 0;                  /* last execution error */
    protected int top = 0;                    /* top of exec. stack   */
    protected int stackSize = MAX_STACK_SIZE; /* size of exec. stack  */
    protected long[] stack = null;            /* current exec. stack  */
    protected int numArgs = 0;
    protected int[] args = null;
    protected int new_top = 0;                /* new top after exec.  */
    public TTGlyphZoneRec zp0 = null;      /* zone records */
    public TTGlyphZoneRec zp1 = null;
    public TTGlyphZoneRec zp2 = null;
    protected TTGlyphZoneRec pts = null;
    protected TTGlyphZoneRec twilight = null;
    protected FTSizeMetricsRec metrics = null;
    protected TTSizeMetricsRec tt_metrics = null; /* size metrics */
    protected TTGraphicsStateRec GS = null;       /* current graphics state */
    protected int curRange = 0;             /* current code range number   */
    protected byte[] code = null;           /* current code range          */

Changes to fttruetype/TTMaxProfile.java.

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
      id = oid;
      my_class_name = "org.apwtcl.gles20.truetype.TTMaxProfile";
      if (frame_info.size() == 0) {
//        va = new TTInstanceVariable(my_class_name, this, "format_tag", 1);
//        frame_info.add(new FTFrameEntry("format_tag", va, readInt, VAR_IS_INT));
      }
//      fillVariables();
if (FTInit.initDebug > 2) {
System.out.println("TTMaxProfile offset: "+String.format("0x%08x", stream.pos()));
}
      version = (long)stream.readInt(stream);
      numGlyphs = stream.readShort(stream);

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

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







<
|
<







|
<
|



|
<







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
      id = oid;
      my_class_name = "org.apwtcl.gles20.truetype.TTMaxProfile";
      if (frame_info.size() == 0) {
//        va = new TTInstanceVariable(my_class_name, this, "format_tag", 1);
//        frame_info.add(new FTFrameEntry("format_tag", va, readInt, VAR_IS_INT));
      }
//      fillVariables();

Debug(0, DBG_LOAD_GLYPH, TAG, "TTMaxProfile offset: "+String.format("0x%08x", stream.pos()));

      version = (long)stream.readInt(stream);
      numGlyphs = stream.readShort(stream);

    }
    
    /* ==================== 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();
    }

Changes to fttruetype/TTSizeFuncs.java.

21
22
23
24
25
26
27

28
29
30
31
32
33
34
...
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
...
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
import ftbase.FTFaceRec;
import ftbase.FTInstanceMethod;
import ftbase.FTReference;
import ftbase.FTSizeMetricsRec;
import ftbase.FTSizeRec;
import ftbase.FTSizeRequestRec;
import ftbase.FTTrace;

  /* ===================================================================== */
  /*    TTSizeFuncs                                                        */
  /*                                                                       */
  /* ===================================================================== */

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

    /* =====================================================================
     * TTGetHMetrics
     *
     * =====================================================================
     */
    public static void TTGetHMetrics(TTFaceRec face, int idx, FTReference<Short> lsb_ref, FTReference<Short> aw_ref) {
      ((FTSfntInterfaceClass)face.sfnt).get_metrics.callClassMethod(face, false, idx, lsb_ref, aw_ref);
      FTTrace.Trace(7, TAG, String.format("  advance width (font units): %d", aw_ref.Get()));
      FTTrace.Trace(7, TAG, String.format("  left side bearing (font units): %d", lsb_ref.Get()));
    }

    /* =====================================================================
     * TTGetVMetrics
     *
................................................................................
     * apparently does: It uses the ppem value as the advance height, and
     * sets the top side bearing to be zero.
     *
     * =====================================================================
     */
    public static void TTGetVMetrics(TTFaceRec face, int idx, FTReference<Short> tsb_ref, FTReference<Short> ah_ref) {
      if (face.vertical_info) {
        ((FTSfntInterfaceClass)face.sfnt).get_metrics.callClassMethod(face, true, idx, tsb_ref, ah_ref);
      } else {
        tsb_ref.Set((short)0);
        ah_ref.Set(face.units_per_EM);
      }
      FTTrace.Trace(7, TAG, String.format("  advance height (font units): %d", ah_ref.Get()));
      FTTrace.Trace(7, TAG, String.format("  top side bearing (font units): %d", tsb_ref.Get()));
    }







>







 







|







 







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
...
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
...
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
import ftbase.FTFaceRec;
import ftbase.FTInstanceMethod;
import ftbase.FTReference;
import ftbase.FTSizeMetricsRec;
import ftbase.FTSizeRec;
import ftbase.FTSizeRequestRec;
import ftbase.FTTrace;

  /* ===================================================================== */
  /*    TTSizeFuncs                                                        */
  /*                                                                       */
  /* ===================================================================== */

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

    /* =====================================================================
     * TTGetHMetrics
     *
     * =====================================================================
     */
    public static void TTGetHMetrics(TTFaceRec face, int idx, FTReference<Short> lsb_ref, FTReference<Short> aw_ref) {
      ((ftsfnt.FTSfntInterfaceClass)face.sfnt).get_metrics.callClassMethod(face, false, idx, lsb_ref, aw_ref);
      FTTrace.Trace(7, TAG, String.format("  advance width (font units): %d", aw_ref.Get()));
      FTTrace.Trace(7, TAG, String.format("  left side bearing (font units): %d", lsb_ref.Get()));
    }

    /* =====================================================================
     * TTGetVMetrics
     *
................................................................................
     * apparently does: It uses the ppem value as the advance height, and
     * sets the top side bearing to be zero.
     *
     * =====================================================================
     */
    public static void TTGetVMetrics(TTFaceRec face, int idx, FTReference<Short> tsb_ref, FTReference<Short> ah_ref) {
      if (face.vertical_info) {
        ((ftsfnt.FTSfntInterfaceClass)face.sfnt).get_metrics.callClassMethod(face, true, idx, tsb_ref, ah_ref);
      } else {
        tsb_ref.Set((short)0);
        ah_ref.Set(face.units_per_EM);
      }
      FTTrace.Trace(7, TAG, String.format("  advance height (font units): %d", ah_ref.Get()));
      FTTrace.Trace(7, TAG, String.format("  top side bearing (font units): %d", tsb_ref.Get()));
    }