apwfreetypelib

Check-in [0f24cb935e]
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:0f24cb935e58ec1569c18eec277057953a5612a2
User & Date: arnulf 2015-02-07 16:49:53
Context
2015-02-07
21:23
fixes and make a Set for Flags.Face. check-in: dac67504dc user: arnulf tags: trunk
16:49
fixes. check-in: 0f24cb935e user: arnulf tags: trunk
2015-02-06
21:44
fixes. check-in: 6a644b50ad user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to aftdemo/demo1.java.

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

      if (error != FTError.ErrorTag.ERR_OK) {
        Log.e(TAG, "could not load glyph 72");
        return;
      }


      FTFaceRequester requester = new FTDemoFaceRequester();
      FTCManagerRec manager = new FTCManagerRec(library, max_faces, max_sizes, requester, font_args);

      FTCGCacheClassRec sbits_cache = new FTCBasicSCacheClass();    /* the glyph small bitmaps cache */
      error = manager.RegisterCache(sbits_cache);
Debug(0, DebugTag.DBG_INIT, TAG, "sbits_cache: " + sbits_cache.toDebugString());
      if (error != FTError.ErrorTag.ERR_OK) {
        Log.e(TAG, "could not initialize small bitmaps cache");







|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

      if (error != FTError.ErrorTag.ERR_OK) {
        Log.e(TAG, "could not load glyph 72");
        return;
      }


        FTFaceRequester requester = new FTDemoFaceRequester();
      FTCManagerRec manager = new FTCManagerRec(library, max_faces, max_sizes, requester, font_args);

      FTCGCacheClassRec sbits_cache = new FTCBasicSCacheClass();    /* the glyph small bitmaps cache */
      error = manager.RegisterCache(sbits_cache);
Debug(0, DebugTag.DBG_INIT, TAG, "sbits_cache: " + sbits_cache.toDebugString());
      if (error != FTError.ErrorTag.ERR_OK) {
        Log.e(TAG, "could not initialize small bitmaps cache");

Changes to afttruetype/TTGlyphLoaderRec.java.

142
143
144
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
161
162
      current.setTag(flag_idx, Flags.Curve.makeTableTagSet(TTTags.GlyphFlags.GlyphFlagsSetToInt(ttglyph.getTag(flag_idx))));
      flag_idx++;
    }
for(int t = 0; t < flag_idx; t++) {
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("Tag: t: %d: 0x%02x", t, Flags.Curve.CurveSetToInt(current.getTag(t)))+Flags.Curve.CurveSetToString(current.getTag(t)));
}

      /* loading the X and y coordinates */
    vec_limit = n_points;
    for (vec_idx = 0; vec_idx < vec_limit; vec_idx++) {
      current.getPoints()[vec_idx] = ttglyph.getPoints()[vec_idx];

    }
    current.setN_points(n_points);
    current.setN_contours(n_contours);
for (int i = 0; i < n_points; i++) {
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("point i:%d  %d %d", i, current.getPoints()[i].getX(), current.getPoints()[i].getY()));
}
    return error;
  }

}







|


|
>










142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
      current.setTag(flag_idx, Flags.Curve.makeTableTagSet(TTTags.GlyphFlags.GlyphFlagsSetToInt(ttglyph.getTag(flag_idx))));
      flag_idx++;
    }
for(int t = 0; t < flag_idx; t++) {
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("Tag: t: %d: 0x%02x", t, Flags.Curve.CurveSetToInt(current.getTag(t)))+Flags.Curve.CurveSetToString(current.getTag(t)));
}

      /* loading the x and y coordinates */
    vec_limit = n_points;
    for (vec_idx = 0; vec_idx < vec_limit; vec_idx++) {
      current.setPoint_x(vec_idx, ttglyph.getPoint_x(vec_idx));
      current.setPoint_y(vec_idx, ttglyph.getPoint_y(vec_idx));
    }
    current.setN_points(n_points);
    current.setN_contours(n_contours);
for (int i = 0; i < n_points; i++) {
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("point i:%d  %d %d", i, current.getPoints()[i].getX(), current.getPoints()[i].getY()));
}
    return error;
  }

}

Changes to afttruetype/TTGlyphSimpleRec.java.

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
...
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
...
349
350
351
352
353
354
355















356
357
358
359
360
361
362
      delta = 0;
      tag = tags[vec_idx];
      if(tag.contains(TTTags.GlyphFlags.X_SHORT)) {
        if(stream.pos() + 1 > limit) {
          return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
        }
        delta = stream.readByte() & 0xFF;

        if(tag.contains(TTTags.GlyphFlags.X_SAME)) {
          delta = -delta;
        }
      } else {
        if(tag.contains(TTTags.GlyphFlags.X_SAME)) {
          if(stream.pos() + 2 > limit) {
            return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
          }
          delta = (short)stream.readShort();

        }
      }
      x += delta;

      x_coordinates[vec_idx] = delta;
      points[vec_idx].setX(x);
      tags[tag_idx].remove(TTTags.GlyphFlags.X_SHORT);
      tags[tag_idx].remove(TTTags.GlyphFlags.X_SAME);
      tag_idx++;
    }

................................................................................
      delta = 0;
      tag = tags[vec_idx];
      if(tag.contains(TTTags.GlyphFlags.Y_SHORT)) {
        if(stream.pos() + 1 > limit) {
          return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
        }
        delta = stream.readByte() & 0xFF;

        if(tag.contains(TTTags.GlyphFlags.Y_SAME)) {
          delta = -delta;
        }
      } else {
        if(tag.contains(TTTags.GlyphFlags.Y_SAME)) {
          if(stream.pos() + 2 > limit) {
            return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
          }
          delta = (short)stream.readShort();

        }
      }
      y += delta;

      y_coordinates[vec_idx] = delta;
      points[vec_idx].setY(y);
      tags[tag_idx].remove(TTTags.GlyphFlags.Y_SHORT);
      tags[tag_idx].remove(TTTags.GlyphFlags.Y_SAME);
      tags[tag_idx].remove(TTTags.GlyphFlags.REPEAT);
      tags[tag_idx].remove(TTTags.GlyphFlags.RESERVED1);
      tags[tag_idx].remove(TTTags.GlyphFlags.RESERVED2);
................................................................................
    this.tags = tags;
  }

  /* ==================== getPoints ================================== */
  public FTVectorRec[] getPoints() {
    return points;
  }
















  /* ==================== setPoints ================================== */
  public void setPoints(FTVectorRec[] points) {
    this.points = points;
  }

  /* ==================== getNum_points ================================== */







>
|



|




>



>







 







>
|



|




>



>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
...
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
...
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
      delta = 0;
      tag = tags[vec_idx];
      if(tag.contains(TTTags.GlyphFlags.X_SHORT)) {
        if(stream.pos() + 1 > limit) {
          return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
        }
        delta = stream.readByte() & 0xFF;
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("  x delta_byte: %d", delta));
        if(!tag.contains(TTTags.GlyphFlags.X_SAME)) {
          delta = -delta;
        }
      } else {
        if(!tag.contains(TTTags.GlyphFlags.X_SAME)) {
          if(stream.pos() + 2 > limit) {
            return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
          }
          delta = (short)stream.readShort();
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("  x delta_short: %d", delta));
        }
      }
      x += delta;
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("  x: %d, delta: %d", x, delta));
      x_coordinates[vec_idx] = delta;
      points[vec_idx].setX(x);
      tags[tag_idx].remove(TTTags.GlyphFlags.X_SHORT);
      tags[tag_idx].remove(TTTags.GlyphFlags.X_SAME);
      tag_idx++;
    }

................................................................................
      delta = 0;
      tag = tags[vec_idx];
      if(tag.contains(TTTags.GlyphFlags.Y_SHORT)) {
        if(stream.pos() + 1 > limit) {
          return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
        }
        delta = stream.readByte() & 0xFF;
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("  y delta_byte: %d", delta));
        if(!tag.contains(TTTags.GlyphFlags.Y_SAME)) {
          delta = -delta;
        }
      } else {
        if(!tag.contains(TTTags.GlyphFlags.Y_SAME)) {
          if(stream.pos() + 2 > limit) {
            return FTError.ErrorTag.GLYPH_INVALID_OUTLINE;
          }
          delta = (short)stream.readShort();
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("  y delta_short: %d", delta));
        }
      }
      y += delta;
Debug(0, DebugTag.DBG_LOAD_GLYPH, TAG, String.format("  y: %d, delta: %d", y, delta));
      y_coordinates[vec_idx] = delta;
      points[vec_idx].setY(y);
      tags[tag_idx].remove(TTTags.GlyphFlags.Y_SHORT);
      tags[tag_idx].remove(TTTags.GlyphFlags.Y_SAME);
      tags[tag_idx].remove(TTTags.GlyphFlags.REPEAT);
      tags[tag_idx].remove(TTTags.GlyphFlags.RESERVED1);
      tags[tag_idx].remove(TTTags.GlyphFlags.RESERVED2);
................................................................................
    this.tags = tags;
  }

  /* ==================== getPoints ================================== */
  public FTVectorRec[] getPoints() {
    return points;
  }

  /* ==================== getPoint ================================== */
  public FTVectorRec getPoint(int point_idx) {
    return points[point_idx];
  }

  /* ==================== getPoint_x ================================== */
  public int getPoint_x(int point_idx) {
    return points[point_idx].getX();
  }

  /* ==================== getPoint_y ================================== */
  public int getPoint_y(int point_idx) {
    return points[point_idx].getY();
  }

  /* ==================== setPoints ================================== */
  public void setPoints(FTVectorRec[] points) {
    this.points = points;
  }

  /* ==================== getNum_points ================================== */

Changes to afttruetype/TTOs2Rec.java.

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    ul_unicode_range4 = stream.readInt();
    for (int i = 0; i < 4; i++) {
      ach_vend_id[i] = (char)stream.readByte();
    }
    fs_selection = stream.readShort();
    us_first_char_index = stream.readShort();
    us_last_char_index = stream.readShort();
    s_typo_ascender = stream.readShort();
    s_typo_descender = stream.readShort();
    s_typo_line_gap = stream.readShort();
    us_win_ascent = stream.readShort();
    us_win_descent = stream.readShort();

    if (version >= 0x0001) {
          /* only version 1 tables */
      ul_code_page_range1 = stream.readInt();       /* Bits 0-31   */







|
|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    ul_unicode_range4 = stream.readInt();
    for (int i = 0; i < 4; i++) {
      ach_vend_id[i] = (char)stream.readByte();
    }
    fs_selection = stream.readShort();
    us_first_char_index = stream.readShort();
    us_last_char_index = stream.readShort();
    s_typo_ascender = (short)stream.readShort();
    s_typo_descender = (short)stream.readShort();
    s_typo_line_gap = stream.readShort();
    us_win_ascent = stream.readShort();
    us_win_descent = stream.readShort();

    if (version >= 0x0001) {
          /* only version 1 tables */
      ul_code_page_range1 = stream.readInt();       /* Bits 0-31   */

Changes to aftttinterpreter/TTInstructionFuncGrp3.java.

81
82
83
84
85
86
87

88
89
90
91
92
93
94
...
149
150
151
152
153
154
155


156
157
158
159
160
161
162
    if (useX) {
      orus1 = worker.getOrusPoint_x(ref1);
      orus2 = worker.getOrusPoint_x(ref2);
    } else {
      orus1 = worker.getOrusPoint_y(ref1);
      orus2 = worker.getOrusPoint_y(ref2);
    }

    if (orus1 > orus2) {
      int tmp_o;
      int tmp_r;

      tmp_o = orus1;
      orus1 = orus2;
      orus2 = tmp_o;
................................................................................
          x += delta1;
        } else {
          if (x >= org2) {
            x += delta2;
          } else {
            if (!scale_valid) {
              scale_valid = true;


              scale = FTCalc.FTDivFix(org2 + delta2 - (org1 + delta1), orus2 - orus1);
            }
Debug(0, DebugTag.DBG_INTERP, TAG, String.format("scale: %d, org1: %d, delta1: %d, worker.orus[i].x: %d, orus1: %d", scale, org1, delta1, useX ?  worker.getOrusPoint_x(i) :  worker.getOrusPoint_y(i), orus1));
            if (useX) {
              x = (org1 + delta1) + TTUtil.FTMulFix(worker.getOrusPoint_x(i) - orus1, scale);
            } else {
              x = (org1 + delta1) + TTUtil.FTMulFix(worker.getOrusPoint_y(i) - orus1, scale);







>







 







>
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
    if (useX) {
      orus1 = worker.getOrusPoint_x(ref1);
      orus2 = worker.getOrusPoint_x(ref2);
    } else {
      orus1 = worker.getOrusPoint_y(ref1);
      orus2 = worker.getOrusPoint_y(ref2);
    }
Debug(0, DebugTag.DBG_INTERP, TAG, String.format("_iup_worker_interpolate: orus1: %d, orus2: %d, ref1: %d ref2: %d", orus1, orus2, ref1, ref2));
    if (orus1 > orus2) {
      int tmp_o;
      int tmp_r;

      tmp_o = orus1;
      orus1 = orus2;
      orus2 = tmp_o;
................................................................................
          x += delta1;
        } else {
          if (x >= org2) {
            x += delta2;
          } else {
            if (!scale_valid) {
              scale_valid = true;
Debug(0, DebugTag.DBG_INTERP, TAG, String.format("org2: %d, delta2: %d, org1: %d, delta1: %d, orus2: %d, orus1: %d", org2, delta2, org1, delta1, orus2, orus1));
Debug(0, DebugTag.DBG_INTERP, TAG, String.format("FDF: %d, %d", org2 + delta2 - (org1 + delta1), orus2 - orus1));
              scale = FTCalc.FTDivFix(org2 + delta2 - (org1 + delta1), orus2 - orus1);
            }
Debug(0, DebugTag.DBG_INTERP, TAG, String.format("scale: %d, org1: %d, delta1: %d, worker.orus[i].x: %d, orus1: %d", scale, org1, delta1, useX ?  worker.getOrusPoint_x(i) :  worker.getOrusPoint_y(i), orus1));
            if (useX) {
              x = (org1 + delta1) + TTUtil.FTMulFix(worker.getOrusPoint_x(i) - orus1, scale);
            } else {
              x = (org1 + delta1) + TTUtil.FTMulFix(worker.getOrusPoint_y(i) - orus1, scale);

Changes to aftttinterpreter/TTRunInstructions.java.

682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
          }
            /* increment instruction counter and check if we didn't */
            /* run this program for too long (e.g. infinite loops). */
          if (++ins_counter > MAX_RUNNABLE_OPCODES) {
            return FTError.ErrorTag.INTERP_EXECUTION_TOO_LONG;
          }
        }
if (numInstructions > 5100) {
  Debug(0, DebugTag.DBG_INTERP, TAG, String.format("ll4: %d %d", IP, codeSize));
  zp0.showLoaderZone("ZP0", this);
  zp2.showLoaderZone("ZP1", this);
}
//        showLoaderZone();
        if (IP >= codeSize) {
          if (callTop > 0) {







|







682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
          }
            /* increment instruction counter and check if we didn't */
            /* run this program for too long (e.g. infinite loops). */
          if (++ins_counter > MAX_RUNNABLE_OPCODES) {
            return FTError.ErrorTag.INTERP_EXECUTION_TOO_LONG;
          }
        }
if (numInstructions > 5099) {
  Debug(0, DebugTag.DBG_INTERP, TAG, String.format("ll4: %d %d", IP, codeSize));
  zp0.showLoaderZone("ZP0", this);
  zp2.showLoaderZone("ZP1", this);
}
//        showLoaderZone();
        if (IP >= codeSize) {
          if (callTop > 0) {

Changes to aftutil/FTCalc.java.

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
        s = -s;
      }
      if (b == 0) {
        /* check for division by 0 */
        q = 0x7FFFFFFF;
      } else {
        /* compute result directly */
        q = (int)((((a << 16) + (b >> 1)) / b));
      }
      return (s < 0 ? -q : q);
    }

    /* ==================== FTMulFix ===================================== */
    public static int FTMulFix(int a, int b) {
      int s = 1;







|







163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
        s = -s;
      }
      if (b == 0) {
        /* check for division by 0 */
        q = 0x7FFFFFFF;
      } else {
        /* compute result directly */
        q = ((((a << 16) + (b >> 1)) / b));
      }
      return (s < 0 ? -q : q);
    }

    /* ==================== FTMulFix ===================================== */
    public static int FTMulFix(int a, int b) {
      int s = 1;