apwfreetypelib

Check-in [57e19d7f58]
Login

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

Overview
Comment:renaming and fixes.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:57e19d7f58352142b31b0b39f75eea6cae384a22
User & Date: arnulf 2015-01-25 16:18:43
Context
2015-01-25
16:21
fixes and renaming. check-in: 75a6e99504 user: arnulf tags: trunk
16:18
renaming and fixes. check-in: 57e19d7f58 user: arnulf tags: trunk
15:17
fixes. check-in: bba9c91bde user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to aftbase/FTRendererClassRec.java.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
  /*    raster_class    :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.    */
  /*                       This is a pointer to its raster's class.        */
  /*                                                                       */
  /* ===================================================================== */

import android.util.Log;

import org.apwtcl.apwfreetypelib.aftraster.FTRasterParams;
import org.apwtcl.apwfreetypelib.aftraster.FTRasterRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;
import org.apwtcl.apwfreetypelib.aftutil.FTMatrixRec;
import org.apwtcl.apwfreetypelib.aftutil.FTParameter;
import org.apwtcl.apwfreetypelib.aftutil.FTReference;
import org.apwtcl.apwfreetypelib.aftutil.FTVectorRec;
................................................................................
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Log.e(TAG, "rasterSetMode not yet implemented");
    return error;
  }

  /* ==================== rasterRender ===================================== */
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParams params) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Log.e(TAG, "rasterRender not yet implemented");
    return error;
  }

  /* ==================== rasterDone ===================================== */







|







 







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
  /*    raster_class    :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.    */
  /*                       This is a pointer to its raster's class.        */
  /*                                                                       */
  /* ===================================================================== */

import android.util.Log;

import org.apwtcl.apwfreetypelib.aftraster.FTRasterParamsRec;
import org.apwtcl.apwfreetypelib.aftraster.FTRasterRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;
import org.apwtcl.apwfreetypelib.aftutil.FTMatrixRec;
import org.apwtcl.apwfreetypelib.aftutil.FTParameter;
import org.apwtcl.apwfreetypelib.aftutil.FTReference;
import org.apwtcl.apwfreetypelib.aftutil.FTVectorRec;
................................................................................
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Log.e(TAG, "rasterSetMode not yet implemented");
    return error;
  }

  /* ==================== rasterRender ===================================== */
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParamsRec params) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Log.e(TAG, "rasterRender not yet implemented");
    return error;
  }

  /* ==================== rasterDone ===================================== */

Changes to aftbase/FTRendererRec.java.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

  /* ===================================================================== */
  /*    FTRendererRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

import android.util.Log;
import android.util.SparseArray;

import org.apwtcl.apwfreetypelib.aftraster.FTRasterParams;
import org.apwtcl.apwfreetypelib.aftraster.FTRasterRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;
import org.apwtcl.apwfreetypelib.aftutil.FTParameter;
import org.apwtcl.apwfreetypelib.aftutil.FTReference;
import org.apwtcl.apwfreetypelib.aftutil.FTVectorRec;

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

  /* ==================== rasterRender ===================================== */
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParams params) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Log.e(TAG, "rasterRest not yet fully implemented");
    return clazz.rasterRender(raster, params);
  }

  /* ==================== render ===================================== */







<

|







 







|







16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

  /* ===================================================================== */
  /*    FTRendererRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

import android.util.Log;


import org.apwtcl.apwfreetypelib.aftraster.FTRasterParamsRec;
import org.apwtcl.apwfreetypelib.aftraster.FTRasterRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;
import org.apwtcl.apwfreetypelib.aftutil.FTParameter;
import org.apwtcl.apwfreetypelib.aftutil.FTReference;
import org.apwtcl.apwfreetypelib.aftutil.FTVectorRec;

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

  /* ==================== rasterRender ===================================== */
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParamsRec params) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    Log.e(TAG, "rasterRest not yet fully implemented");
    return clazz.rasterRender(raster, params);
  }

  /* ==================== render ===================================== */

Changes to aftraster/FTRaster1RendererClass.java.

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
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
...
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    }

  /* =====================================================================
   *    ft_black_init
   *
   * =====================================================================
   */
  private FTError.ErrorTag ft_black_init(blackTRaster raster) {
Debug(0, DebugTag.DBG_INIT, TAG, "ft_black_init");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    // nothing to do yet
    return error;
  }

  /* =====================================================================
................................................................................
   *    ft_black_new
   *
   * =====================================================================
   */
  public FTError.ErrorTag ft_black_new(FTReference<FTRasterRec> raster_ref) {
Debug(0, DebugTag.DBG_INIT, TAG, "ft_black_new");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    blackTRaster raster = null;

    raster_ref.Set(null);
    raster = new blackTRaster();
    if (raster != null) {
      ft_black_init(raster);
      raster_ref.Set(raster);
    }
    return error;
  }

................................................................................
  /* =====================================================================
   *    ft_black_reset
   *
   * =====================================================================
   */
  public FTError.ErrorTag ft_black_reset(FTRasterRec raster_param, byte[] pool_base, int pool_size) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    blackTRaster raster = (blackTRaster)raster_param;

    if (raster != null) {
      if (pool_base != null) {
        blackTWorker worker =  new blackTWorker();
        raster.buffer = pool_base;
        raster.buffer_size = pool_size;
        raster.worker = worker;
      } else {
        raster.buffer = null;
        raster.buffer_size = 0;
        raster.worker = null;
      }
    }
    return error;
  }

  /* =====================================================================
   *    ft_black_set_mode
................................................................................
  }

  /* =====================================================================
   *    ft_black_render
   *
   * =====================================================================
   */
  public FTError.ErrorTag ft_black_render(FTRasterRec raster, FTRasterParams params) {
    Log.e(TAG, "ft_black_render not yet implemented");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    return error;
  }

  /* =====================================================================
................................................................................
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    FTOutlineRec outline;
    FTBBoxRec cbox = new FTBBoxRec();
    Integer width;
    Integer height;
    Integer pitch;
    FTBitmapRec bitmap;
    FTRasterParams params = new FTRasterParams();
    FTReference<FTBBoxRec> cbox_ref = new FTReference<FTBBoxRec>();

      /* check glyph image format */
    if (slot.getFormat().getVal() != render.getGlyph_format().getVal()) {
      error = FTError.ErrorTag.GLYPH_INVALID_ARGUMENT;
      return error;
    }
................................................................................
    // realloc cout = pitch, item_size ) height
    bitmap.setBuffer(new byte[pitch * height]);
    slot.getInternal().setFlags(FTTags.GlyphFormat.getTableTag(slot.getInternal().getFlags().getVal() | FTTags.GlyphFormat.OWN_BITMAP.getVal()));
    Debug(0, DebugTag.DBG_INIT, TAG, String.format("cbox_xMin: %d %dn", -cbox.getxMin(), -cbox.getyMin()));
      /* translate outline to render it into the bitmap */
    outline.OutlineTranslate(-cbox.getxMin(), -cbox.getyMin());
      /* set up parameters */
    params.target = bitmap;
    params.source = outline;
    params.flags  = 0;
    if (bitmap.getPixel_mode() == FTTags.PixelMode.GRAY) {
      params.flags |= FTRasterParams.FT_RASTER_FLAG_AA;
    }
      /* render outline into the bitmap */
    error = render.rasterRender(render.getRaster(), params);
    outline.OutlineTranslate(cbox.getxMin(), cbox.getyMin());
    if (error != FTError.ErrorTag.ERR_OK) {
      return error;
    }
................................................................................
  @Override
  public FTError.ErrorTag rasterSetMode() {
    return ft_black_set_mode();
  }

  /* ==================== rasterRender ===================================== */
  @Override
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParams params) {
    return ft_black_render(raster, params);
  }

  /* ==================== rasterDone ===================================== */
  @Override
  public FTError.ErrorTag rasterDone(FTRasterRec raster) {
    return ft_black_done();
  }

}







|







 







|


|







 







|



|


|



|







 







|







 







|







 







|
|
|

|







 







|










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
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
...
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    }

  /* =====================================================================
   *    ft_black_init
   *
   * =====================================================================
   */
  private FTError.ErrorTag ft_black_init(blackTRasterRec raster) {
Debug(0, DebugTag.DBG_INIT, TAG, "ft_black_init");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    // nothing to do yet
    return error;
  }

  /* =====================================================================
................................................................................
   *    ft_black_new
   *
   * =====================================================================
   */
  public FTError.ErrorTag ft_black_new(FTReference<FTRasterRec> raster_ref) {
Debug(0, DebugTag.DBG_INIT, TAG, "ft_black_new");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    blackTRasterRec raster = null;

    raster_ref.Set(null);
    raster = new blackTRasterRec();
    if (raster != null) {
      ft_black_init(raster);
      raster_ref.Set(raster);
    }
    return error;
  }

................................................................................
  /* =====================================================================
   *    ft_black_reset
   *
   * =====================================================================
   */
  public FTError.ErrorTag ft_black_reset(FTRasterRec raster_param, byte[] pool_base, int pool_size) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    blackTRasterRec raster = (blackTRasterRec)raster_param;

    if (raster != null) {
      if (pool_base != null) {
        blackTWorkerRec worker =  new blackTWorkerRec();
        raster.buffer = pool_base;
        raster.buffer_size = pool_size;
        raster.setWorker(worker);
      } else {
        raster.buffer = null;
        raster.buffer_size = 0;
        raster.setWorker(null);
      }
    }
    return error;
  }

  /* =====================================================================
   *    ft_black_set_mode
................................................................................
  }

  /* =====================================================================
   *    ft_black_render
   *
   * =====================================================================
   */
  public FTError.ErrorTag ft_black_render(FTRasterRec raster, FTRasterParamsRec params) {
    Log.e(TAG, "ft_black_render not yet implemented");
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;

    return error;
  }

  /* =====================================================================
................................................................................
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    FTOutlineRec outline;
    FTBBoxRec cbox = new FTBBoxRec();
    Integer width;
    Integer height;
    Integer pitch;
    FTBitmapRec bitmap;
    FTRasterParamsRec params = new FTRasterParamsRec();
    FTReference<FTBBoxRec> cbox_ref = new FTReference<FTBBoxRec>();

      /* check glyph image format */
    if (slot.getFormat().getVal() != render.getGlyph_format().getVal()) {
      error = FTError.ErrorTag.GLYPH_INVALID_ARGUMENT;
      return error;
    }
................................................................................
    // realloc cout = pitch, item_size ) height
    bitmap.setBuffer(new byte[pitch * height]);
    slot.getInternal().setFlags(FTTags.GlyphFormat.getTableTag(slot.getInternal().getFlags().getVal() | FTTags.GlyphFormat.OWN_BITMAP.getVal()));
    Debug(0, DebugTag.DBG_INIT, TAG, String.format("cbox_xMin: %d %dn", -cbox.getxMin(), -cbox.getyMin()));
      /* translate outline to render it into the bitmap */
    outline.OutlineTranslate(-cbox.getxMin(), -cbox.getyMin());
      /* set up parameters */
    params.setTarget(bitmap);
    params.setSource(outline);
    params.setFlags(0);
    if (bitmap.getPixel_mode() == FTTags.PixelMode.GRAY) {
      params.setFlags(params.getFlags() | FTRasterParamsRec.FT_RASTER_FLAG_AA);
    }
      /* render outline into the bitmap */
    error = render.rasterRender(render.getRaster(), params);
    outline.OutlineTranslate(cbox.getxMin(), cbox.getyMin());
    if (error != FTError.ErrorTag.ERR_OK) {
      return error;
    }
................................................................................
  @Override
  public FTError.ErrorTag rasterSetMode() {
    return ft_black_set_mode();
  }

  /* ==================== rasterRender ===================================== */
  @Override
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParamsRec params) {
    return ft_black_render(raster, params);
  }

  /* ==================== rasterDone ===================================== */
  @Override
  public FTError.ErrorTag rasterDone(FTRasterRec raster) {
    return ft_black_done();
  }

}

Name change from aftraster/FTRasterParams.java to aftraster/FTRasterParamsRec.java.

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152

153
154
155
156



157















































  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftbase.FTBBoxRec;
import org.apwtcl.apwfreetypelib.aftbase.FTBitmapRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;

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

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

    public final static int FT_RASTER_FLAG_DEFAULT = 0x0;
    public final static int FT_RASTER_FLAG_AA      =  0x1;
    public final static int FT_RASTER_FLAG_DIRECT  =  0x2;
    public final static int FT_RASTER_FLAG_CLIP    =  0x4;

    public FTBitmapRec target = null;
    public Object source = null;
    public int flags;
    // FT_SpanFunc             black_spans;  /* doesn't work! */
    // FT_Raster_BitTest_Func  bit_test;     /* doesn't work! */
    // FT_Raster_BitSet_Func   bit_set;      /* doesn't work! */
    public Object user = null;
    public FTBBoxRec clip_box = null;

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


  public FTError.ErrorTag graySpans() {
    return FTError.ErrorTag.ERR_OK;
  }




}






















































|
|

|
|

|
|
|
|

|
|
|
<
<
<
|
|

|
|
|
|
|

|
|



|
|



|
|
|
>
|
|

>




>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftbase.FTBBoxRec;
import org.apwtcl.apwfreetypelib.aftbase.FTBitmapRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;

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

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

  public final static int FT_RASTER_FLAG_DEFAULT = 0x0;
  public final static int FT_RASTER_FLAG_AA      =  0x1;
  public final static int FT_RASTER_FLAG_DIRECT  =  0x2;
  public final static int FT_RASTER_FLAG_CLIP    =  0x4;

  private FTBitmapRec target = null;
  private Object source = null;
  private int flags;



  private Object user_data = null;
  private FTBBoxRec clip_box = null;

  /* ==================== FTRasterParams ================================== */
  public FTRasterParamsRec() {
    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");
    str.append("...flags: "+flags+'\n');
    return str.toString();
  }

  /* ==================== graySpans ================================== */
  public FTError.ErrorTag graySpans() {
    return FTError.ErrorTag.ERR_OK;
  }

  /* ==================== getTarget ================================== */
  public FTBitmapRec getTarget() {
    return target;
  }

  /* ==================== setTarget ================================== */
  public void setTarget(FTBitmapRec target) {
    this.target = target;
  }

  /* ==================== getSource ================================== */
  public Object getSource() {
    return source;
  }

  /* ==================== setSource ================================== */
  public void setSource(Object source) {
    this.source = source;
  }

  /* ==================== getFlags ================================== */
  public int getFlags() {
    return flags;
  }

  /* ==================== setFlags ================================== */
  public void setFlags(int flags) {
    this.flags = flags;
  }

  /* ==================== getUser_data ================================== */
  public Object getUser_data() {
    return user_data;
  }

  /* ==================== setUser_data ================================== */
  public void setUser(Object user_data) {
    this.user_data = user_data;
  }

  /* ==================== getClip_box ================================== */
  public FTBBoxRec getClip_box() {
    return clip_box;
  }

  /* ==================== setClip_box ================================== */
  public void setClip_box(FTBBoxRec clip_box) {
    this.clip_box = clip_box;
  }

}

Changes to aftraster/FTRasterRec.java.

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

















  /*    FTRasterRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

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

    public byte[] buffer = null;
    public int buffer_size = 0;

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



}
























|

|
|

|
|

|
|
|
|
|

|
|
|
|
|

|
|
|
|
|

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

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

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

  protected byte[] buffer = null;
  protected int buffer_size = 0;

  /* ==================== FTRasterRec ================================== */
  public FTRasterRec() {
    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");
    str.append("...buffer_size: "+buffer_size+'\n');
    return str.toString();
  }

  /* ==================== getBuffer ================================== */
  public byte[] getBuffer() {
    return buffer;
  }

  /* ==================== setBuffer ================================== */
  public void setBuffer(byte[] buffer) {
    this.buffer = buffer;
  }

  /* ==================== getBuffer_size ================================== */
  public int getBuffer_size() {
    return buffer_size;
  }

  /* ==================== setBuffer_size ================================== */
  public void setBuffer_size(int buffer_size) {
    this.buffer_size = buffer_size;
  }

}

Changes to aftraster/FTSmoothRendererClass.java.

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
...
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
...
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
...
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
...
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
...
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
    boolean vmul = mode == FTTags.RenderMode.LCD_V.getVal();
    int x_shift = 0;
    int y_shift = 0;
    int x_left = 0;
    int y_top = 0;
    int height_org;
    int width_org;
    FTRasterParams params = new FTRasterParams();
    boolean have_translated_origin = false;
    boolean have_outline_shifted = false;
    boolean have_buffer = false;
    FTReference<FTBBoxRec> cbox_ref = new FTReference<FTBBoxRec>();

      /* check glyph image format */
    if (slot.getFormat() != render.getGlyph_format()) {
................................................................................
    slot.getOutline().OutlineTranslate(-x_shift, -y_shift);
    have_outline_shifted = true;
    bitmap.setBuffer(new byte[pitch * height]);

    have_buffer = true;
    slot.getInternal().setFlags(FTTags.GlyphFormat.getTableTag(slot.getInternal().getFlags().getVal() | FTTags.GlyphFormat.OWN_BITMAP.getVal()));
      /* set up parameters */
    params.target = bitmap;
    params.source = slot.getOutline();
    params.flags = FTRasterParams.FT_RASTER_FLAG_AA;
      /* render outline into bitmap */
    error = render.rasterRender(render.getRaster(), params);
    if (error != FTError.ErrorTag.ERR_OK) {
      if (have_outline_shifted) {
        slot.getOutline().OutlineTranslate(x_shift, y_shift);
      }
      if (have_translated_origin) {
................................................................................
  }

  /* =====================================================================
   *    gray_raster_render
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_render(FTRasterRec raster_param, FTRasterParams params) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_raster_render");
    grayTRaster raster = (grayTRaster)raster_param;
    FTOutlineRec outline = (FTOutlineRec)params.source;
    FTBitmapRec target_map = params.target;
    grayTWorker worker;

    if (raster == null || raster.buffer == null || raster.buffer_size == 0) {
      return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
    }
    if (outline == null) {
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
................................................................................
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
    }
    if (outline.getN_points() != outline.getContours()[outline.getN_contours() - 1] + 1) {
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
    }
    worker = raster.worker;
      /* if direct mode is not set, we must have a target bitmap */
    if ((params.flags & FTRasterParams.FT_RASTER_FLAG_DIRECT) == 0) {
      if (target_map == null) {
        return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
      }
        /* nothing to do */
      if (target_map.getWidth() == 0|| target_map.getRows() == 0) {
        return FTError.ErrorTag.ERR_OK;
      }
      if (target_map.getBuffer() == null) {
        return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
      }
    }
      /* this version does not support monochrome rendering */
    if ((params.flags & FTRasterParams.FT_RASTER_FLAG_AA) == 0) {
      return FTError.ErrorTag.RENDER_INVALID_MODE;
    }
      /* compute clipping box */
    if ((params.flags & FTRasterParams.FT_RASTER_FLAG_DIRECT) == 0) {
        /* compute clip box from target pixmap */
      worker.clip_box.setxMin(0);
      worker.clip_box.setyMin(0);
      worker.clip_box.setxMax(target_map.getWidth());
      worker.clip_box.setyMax(target_map.getRows());
    } else {
      if ((params.flags & FTRasterParams.FT_RASTER_FLAG_CLIP) != 0) {
        worker.clip_box = params.clip_box;
      } else {
        worker.clip_box.setxMin(-32768);
        worker.clip_box.setyMin(-32768);
        worker.clip_box.setxMax(32767);
        worker.clip_box.setyMax(32767);
      }
    }
    gray_init_cells(worker, raster.buffer, raster.buffer_size);
    worker.outline = outline;
    worker.num_cells = 0;
    worker.invalid = true;
    worker.band_size = raster.band_size;
    worker.num_gray_spans = 0;
    if ((params.flags & FTRasterParams.FT_RASTER_FLAG_DIRECT) != 0) {
/* NEEDED !!!
      worker.render_span = params.gray_spans;
  NEEDED !!! */
      worker.render_span_data = params.user;
    } else {
      worker.target = target_map;
/* NEEDED !!!
      worker.render_span = FTGrayRasterClassFuncs.gray_render_span;
      NEEDED !!! */
      worker.render_span_data = worker;
    }
................................................................................
  }

  /* =====================================================================
   *    gray_render_span
   *
   * =====================================================================
   */
  private void gray_render_span(int y, int count, FTSpan[] spans, grayTWorker worker) {
    int spansIdx = 0;
    int pIdx;
    int qIdx;
    FTBitmapRec map = worker.target;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_render_span y: %d, count: %d", y, count));

    /* first of all, compute the scanline offset */
    pIdx = 0 - y * map.getPitch();
    if (map.getPitch() >= 0) {
      pIdx += ((map.getRows() - 1) * map.getPitch());
    }
    for (; count > 0; count--, spansIdx++) {
      byte coverage = spans[spansIdx].coverage;

      if (coverage != 0) {
          /* For small-spans it is faster to do it by ourselves than
           * calling `memset'.  This is mainly due to the cost of the
           * function call.
           */
        if (spans[spansIdx].len >= 8) {
          int lgth = spans[spansIdx].len;
          int i;
          for (i = spans[spansIdx].x; i < spans[spansIdx].x + lgth; i++) {
            map.getBuffer()[i] = (byte)coverage;
          }
//            FT_MEM_SET(p + spans[spansIdx].x, (char)coverage, spans[spansIdx].len);
        } else {
//            char*  q = p + spans.x;
          qIdx = pIdx + spans[spansIdx].x;

          switch (spans[spansIdx].len) {
            case 7: map.getBuffer()[qIdx++] = (byte)coverage;
            case 6: map.getBuffer()[qIdx++] = (byte)coverage;
            case 5: map.getBuffer()[qIdx++] = (byte)coverage;
            case 4: map.getBuffer()[qIdx++] = (byte)coverage;
            case 3: map.getBuffer()[qIdx++] = (byte)coverage;
            case 2: map.getBuffer()[qIdx++] = (byte)coverage;
            case 1: map.getBuffer()[qIdx] = (byte)coverage;
................................................................................
      /* FT_Span.y is an integer, so limit our coordinates appropriately */
    if (y >= 0xFFFF) {
      y = 0xFFFF;
    }
    Debug(0, DebugTag.DBG_RENDER, TAG, String.format("x: %d, y: %d, coverage: %x", x, y, coverage));
    if (coverage != 0) {
      int count;
      FTSpan span = null;

        /* see whether we can add this span to the current list */
      count = worker.num_gray_spans;
      spanIdx = count - 1;
      if (count > 0) {
        span = worker.gray_spans[count - 1];
      } else {
      }
      if (count > 0 && worker.span_y == y && (int)span.x + span.len == (int)x &&
          (span.coverage & 0xFF) == coverage) {
        span.len = (short)(span.len + acount);
        worker.gray_spans[count - 1] = span;
        return;
      }
      if (worker.span_y != y || count >= FTSpan.FT_MAX_GRAY_SPANS) {
        if (count > 0) {
          worker.renderSpan(worker.span_y, count, worker.gray_spans,
              (grayTWorker)worker.render_span_data);
        }
        if (count > 0) {
          int  n;
          StringBuffer str = new StringBuffer();

          str.append(String.format("y = %3d ", worker.span_y));
          for (n = 0; n < count; n++) {
            str.append(String.format("  [%d..%d]:0x%02x ",
                worker.gray_spans[n].x, worker.gray_spans[n].x + worker.gray_spans[n].len - 1, worker.gray_spans[n].coverage));
          }
          FTTrace.Trace(7, TAG, str.toString());
        }
        worker.num_gray_spans = 0;
        worker.span_y = (int)y;
        count = 0;
        spanIdx = 0;
      } else {
        spanIdx++;
      }
        /* add a gray span to the current list */
      worker.gray_spans[spanIdx].x = (short)x;
      worker.gray_spans[spanIdx].len = (short)acount;
      worker.gray_spans[spanIdx].coverage = (byte)coverage;
      worker.num_gray_spans++;
    }
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_hline END 2");
  }

  /* =====================================================================
   *    gray_sweep
................................................................................
      }
    }
    if (worker.num_gray_spans > 0) {
      worker.renderSpan(worker.span_y, worker.num_gray_spans,
          worker.gray_spans, (grayTWorker)worker.render_span_data);
    }
    if (worker.num_gray_spans > 0) {
      FTSpan span;
      int spanIdx = 0;
      int n;
      StringBuffer str = new StringBuffer("");

      str.append(String.format("y = %3d ", worker.span_y));
      for (n = 0; n < worker.num_gray_spans; n++, spanIdx++) {
        span = worker.gray_spans[spanIdx];
        str.append(String.format("  [%d..%d]:0x%02x ",
            span.x, span.x + span.len - 1, span.coverage & 0xFF));
      }
      FTTrace.Trace(7, TAG, str.toString());
    }
    FTTrace.Trace(7, TAG, "gray_sweep: end");
  }

  /* =====================================================================
................................................................................
  public FTError.ErrorTag rasterSetMode() {
    Log.e(TAG, "rasterSetMode");
    return FTError.ErrorTag.ERR_OK;
  }

  /* ==================== rasterRender ===================================== */
  @Override
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParams params) {
    return gray_raster_render(raster, params);
  }

  /* ==================== rasterDone ===================================== */
  @Override
  public FTError.ErrorTag rasterDone(FTRasterRec raster) {
    return gray_raster_done();
  }

  /* ==================== grayRenderSpan ===================================== */
  public void grayRenderSpan(int y, int count, FTSpan[] spans, grayTWorker worker) {
    gray_render_span(y, count, spans, worker);
  }

}







|







 







|
|
|







 







|


|
|







 







|












|



|






|
|













|



|







 







|












|






|
|

|





|

|







 







|








|
|
|



|











|











|
|
|







 







|








|







 







|










|




91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
...
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
...
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
...
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
...
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
...
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
    boolean vmul = mode == FTTags.RenderMode.LCD_V.getVal();
    int x_shift = 0;
    int y_shift = 0;
    int x_left = 0;
    int y_top = 0;
    int height_org;
    int width_org;
    FTRasterParamsRec params = new FTRasterParamsRec();
    boolean have_translated_origin = false;
    boolean have_outline_shifted = false;
    boolean have_buffer = false;
    FTReference<FTBBoxRec> cbox_ref = new FTReference<FTBBoxRec>();

      /* check glyph image format */
    if (slot.getFormat() != render.getGlyph_format()) {
................................................................................
    slot.getOutline().OutlineTranslate(-x_shift, -y_shift);
    have_outline_shifted = true;
    bitmap.setBuffer(new byte[pitch * height]);

    have_buffer = true;
    slot.getInternal().setFlags(FTTags.GlyphFormat.getTableTag(slot.getInternal().getFlags().getVal() | FTTags.GlyphFormat.OWN_BITMAP.getVal()));
      /* set up parameters */
    params.setTarget(bitmap);
    params.setSource(slot.getOutline());
    params.setFlags(FTRasterParamsRec.FT_RASTER_FLAG_AA);
      /* render outline into bitmap */
    error = render.rasterRender(render.getRaster(), params);
    if (error != FTError.ErrorTag.ERR_OK) {
      if (have_outline_shifted) {
        slot.getOutline().OutlineTranslate(x_shift, y_shift);
      }
      if (have_translated_origin) {
................................................................................
  }

  /* =====================================================================
   *    gray_raster_render
   *
   * =====================================================================
   */
  private FTError.ErrorTag gray_raster_render(FTRasterRec raster_param, FTRasterParamsRec params) {
Debug(0, DebugTag.DBG_RENDER, TAG, "gray_raster_render");
    grayTRaster raster = (grayTRaster)raster_param;
    FTOutlineRec outline = (FTOutlineRec)params.getSource();
    FTBitmapRec target_map = params.getTarget();
    grayTWorker worker;

    if (raster == null || raster.buffer == null || raster.buffer_size == 0) {
      return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
    }
    if (outline == null) {
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
................................................................................
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
    }
    if (outline.getN_points() != outline.getContours()[outline.getN_contours() - 1] + 1) {
      return FTError.ErrorTag.RENDER_INVALID_OUTLINE;
    }
    worker = raster.worker;
      /* if direct mode is not set, we must have a target bitmap */
    if ((params.getFlags() & FTRasterParamsRec.FT_RASTER_FLAG_DIRECT) == 0) {
      if (target_map == null) {
        return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
      }
        /* nothing to do */
      if (target_map.getWidth() == 0|| target_map.getRows() == 0) {
        return FTError.ErrorTag.ERR_OK;
      }
      if (target_map.getBuffer() == null) {
        return FTError.ErrorTag.RENDER_INVALID_ARGUMENT;
      }
    }
      /* this version does not support monochrome rendering */
    if ((params.getFlags() & FTRasterParamsRec.FT_RASTER_FLAG_AA) == 0) {
      return FTError.ErrorTag.RENDER_INVALID_MODE;
    }
      /* compute clipping box */
    if ((params.getFlags() & FTRasterParamsRec.FT_RASTER_FLAG_DIRECT) == 0) {
        /* compute clip box from target pixmap */
      worker.clip_box.setxMin(0);
      worker.clip_box.setyMin(0);
      worker.clip_box.setxMax(target_map.getWidth());
      worker.clip_box.setyMax(target_map.getRows());
    } else {
      if ((params.getFlags() & FTRasterParamsRec.FT_RASTER_FLAG_CLIP) != 0) {
        worker.clip_box = params.getClip_box();
      } else {
        worker.clip_box.setxMin(-32768);
        worker.clip_box.setyMin(-32768);
        worker.clip_box.setxMax(32767);
        worker.clip_box.setyMax(32767);
      }
    }
    gray_init_cells(worker, raster.buffer, raster.buffer_size);
    worker.outline = outline;
    worker.num_cells = 0;
    worker.invalid = true;
    worker.band_size = raster.band_size;
    worker.num_gray_spans = 0;
    if ((params.getFlags() & FTRasterParamsRec.FT_RASTER_FLAG_DIRECT) != 0) {
/* NEEDED !!!
      worker.render_span = params.gray_spans;
  NEEDED !!! */
      worker.render_span_data = params.getUser_data();
    } else {
      worker.target = target_map;
/* NEEDED !!!
      worker.render_span = FTGrayRasterClassFuncs.gray_render_span;
      NEEDED !!! */
      worker.render_span_data = worker;
    }
................................................................................
  }

  /* =====================================================================
   *    gray_render_span
   *
   * =====================================================================
   */
  private void gray_render_span(int y, int count, FTSpanRec[] spans, grayTWorker worker) {
    int spansIdx = 0;
    int pIdx;
    int qIdx;
    FTBitmapRec map = worker.target;
Debug(0, DebugTag.DBG_RENDER, TAG, String.format("gray_render_span y: %d, count: %d", y, count));

    /* first of all, compute the scanline offset */
    pIdx = 0 - y * map.getPitch();
    if (map.getPitch() >= 0) {
      pIdx += ((map.getRows() - 1) * map.getPitch());
    }
    for (; count > 0; count--, spansIdx++) {
      byte coverage = spans[spansIdx].getCoverage();

      if (coverage != 0) {
          /* For small-spans it is faster to do it by ourselves than
           * calling `memset'.  This is mainly due to the cost of the
           * function call.
           */
        if (spans[spansIdx].getLen() >= 8) {
          int lgth = spans[spansIdx].getLen();
          int i;
          for (i = spans[spansIdx].getX(); i < spans[spansIdx].getX() + lgth; i++) {
            map.getBuffer()[i] = (byte)coverage;
          }
//            FT_MEM_SET(p + spans[spansIdx].x, (char)coverage, spans[spansIdx].len);
        } else {
//            char*  q = p + spans.x;
          qIdx = pIdx + spans[spansIdx].getX();

          switch (spans[spansIdx].getLen()) {
            case 7: map.getBuffer()[qIdx++] = (byte)coverage;
            case 6: map.getBuffer()[qIdx++] = (byte)coverage;
            case 5: map.getBuffer()[qIdx++] = (byte)coverage;
            case 4: map.getBuffer()[qIdx++] = (byte)coverage;
            case 3: map.getBuffer()[qIdx++] = (byte)coverage;
            case 2: map.getBuffer()[qIdx++] = (byte)coverage;
            case 1: map.getBuffer()[qIdx] = (byte)coverage;
................................................................................
      /* FT_Span.y is an integer, so limit our coordinates appropriately */
    if (y >= 0xFFFF) {
      y = 0xFFFF;
    }
    Debug(0, DebugTag.DBG_RENDER, TAG, String.format("x: %d, y: %d, coverage: %x", x, y, coverage));
    if (coverage != 0) {
      int count;
      FTSpanRec span = null;

        /* see whether we can add this span to the current list */
      count = worker.num_gray_spans;
      spanIdx = count - 1;
      if (count > 0) {
        span = worker.gray_spans[count - 1];
      } else {
      }
      if (count > 0 && worker.span_y == y && (int)span.getX() + span.getLen() == (int)x &&
          (span.getCoverage() & 0xFF) == coverage) {
        span.setLen(span.getLen() + acount);
        worker.gray_spans[count - 1] = span;
        return;
      }
      if (worker.span_y != y || count >= FTSpanRec.FT_MAX_GRAY_SPANS) {
        if (count > 0) {
          worker.renderSpan(worker.span_y, count, worker.gray_spans,
              (grayTWorker)worker.render_span_data);
        }
        if (count > 0) {
          int  n;
          StringBuffer str = new StringBuffer();

          str.append(String.format("y = %3d ", worker.span_y));
          for (n = 0; n < count; n++) {
            str.append(String.format("  [%d..%d]:0x%02x ",
                worker.gray_spans[n].getX(), worker.gray_spans[n].getX() + worker.gray_spans[n].getLen() - 1, worker.gray_spans[n].getCoverage()));
          }
          FTTrace.Trace(7, TAG, str.toString());
        }
        worker.num_gray_spans = 0;
        worker.span_y = (int)y;
        count = 0;
        spanIdx = 0;
      } else {
        spanIdx++;
      }
        /* add a gray span to the current list */
      worker.gray_spans[spanIdx].setX(x);
      worker.gray_spans[spanIdx].setLen(acount);
      worker.gray_spans[spanIdx].setCoverage((byte)coverage);
      worker.num_gray_spans++;
    }
    Debug(0, DebugTag.DBG_RENDER, TAG, "gray_hline END 2");
  }

  /* =====================================================================
   *    gray_sweep
................................................................................
      }
    }
    if (worker.num_gray_spans > 0) {
      worker.renderSpan(worker.span_y, worker.num_gray_spans,
          worker.gray_spans, (grayTWorker)worker.render_span_data);
    }
    if (worker.num_gray_spans > 0) {
      FTSpanRec span;
      int spanIdx = 0;
      int n;
      StringBuffer str = new StringBuffer("");

      str.append(String.format("y = %3d ", worker.span_y));
      for (n = 0; n < worker.num_gray_spans; n++, spanIdx++) {
        span = worker.gray_spans[spanIdx];
        str.append(String.format("  [%d..%d]:0x%02x ",
            span.getX(), span.getX() + span.getLen() - 1, span.getCoverage() & 0xFF));
      }
      FTTrace.Trace(7, TAG, str.toString());
    }
    FTTrace.Trace(7, TAG, "gray_sweep: end");
  }

  /* =====================================================================
................................................................................
  public FTError.ErrorTag rasterSetMode() {
    Log.e(TAG, "rasterSetMode");
    return FTError.ErrorTag.ERR_OK;
  }

  /* ==================== rasterRender ===================================== */
  @Override
  public FTError.ErrorTag rasterRender(FTRasterRec raster, FTRasterParamsRec params) {
    return gray_raster_render(raster, params);
  }

  /* ==================== rasterDone ===================================== */
  @Override
  public FTError.ErrorTag rasterDone(FTRasterRec raster) {
    return gray_raster_done();
  }

  /* ==================== grayRenderSpan ===================================== */
  public void grayRenderSpan(int y, int count, FTSpanRec[] spans, grayTWorker worker) {
    gray_render_span(y, count, spans, worker);
  }

}

Name change from aftraster/FTSpan.java to aftraster/FTSpanRec.java.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74



75
76
77



78



























  /*    The coverage value is always between 0 and 255.  If you want less  */
  /*    gray values, the callback function has to reduce them.             */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

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

    public static int FT_MAX_GRAY_SPANS = 32;

    public short x;
    public short len;
    public byte coverage;

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



}


































|
|

|
|

|

|
|
|

|
|
|
|
|

|
|



|
|



|
|
|
>
>
>
|
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
  /*    The coverage value is always between 0 and 255.  If you want less  */
  /*    gray values, the callback function has to reduce them.             */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

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

  public static int FT_MAX_GRAY_SPANS = 32;

  private int x;
  private int len;
  private byte coverage;

  /* ==================== FTSpan ================================== */
  public FTSpanRec() {
    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");
    str.append("...x: "+x+'\n');
    str.append("...len: "+len+'\n');
    str.append("...coverage: "+coverage+'\n');
    return str.toString();
  }

  /* ==================== getX ================================== */
  public int getX() {
    return x;
  }

  /* ==================== setX ================================== */
  public void setX(int x) {
    this.x = x;
  }

  /* ==================== getLen ================================== */
  public int getLen() {
    return len;
  }

  /* ==================== setLen ================================== */
  public void setLen(int len) {
    this.len = len;
  }

  /* ==================== getCoverage ================================== */
  public byte getCoverage() {
    return coverage;
  }

  /* ==================== setCoverage ================================== */
  public void setCoverage(byte coverage) {
    this.coverage = coverage;
  }

}

Name change from aftraster/blackTBand.java to aftraster/blackTBandRec.java.

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

















  /* ===================================================================== */
  /*    blackTBand                                                          */
  /*                                                                       */
  /* ===================================================================== */

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

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

    public Short y_min = 0;   /* band's minimum */
    public Short y_max = 0;   /* band's maximum */

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



}
























|
|

|
|

|
|

|
|
|
|
|

|
|



|
|



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

import org.apwtcl.apwfreetypelib.aftutil.FTDebug;

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

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

  private int y_min = 0;   /* band's minimum */
  private int y_max = 0;   /* band's maximum */

  /* ==================== blackTBand ================================== */
  public blackTBandRec() {
    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");
    str.append("...y_min: "+y_min+'\n');
    str.append("...y_max: "+y_max+'\n');
    return str.toString();
  }

  /* ==================== getY_min ================================== */
  public int getY_min() {
    return y_min;
  }

  /* ==================== setY_min ================================== */
  public void setY_min(int y_min) {
    this.y_min = y_min;
  }

  /* ==================== getY_max ================================== */
  public int getY_max() {
    return y_max;
  }

  /* ==================== setY_max ================================== */
  public void setY_max(int y_max) {
    this.y_max = y_max;
  }

}

Name change from aftraster/blackTRaster.java to aftraster/blackTRasterRec.java.

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



























package org.apwtcl.apwfreetypelib.aftraster;

  /* ===================================================================== */
  /*    blackTRaster                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class blackTRaster extends FTRasterRec {
    private static int oid = 0;

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

    public blackTWorker worker = null;
    public byte[] grays = new byte[5];
    public short gray_width = 0;

    /* ==================== blackTRaster ================================== */
    public blackTRaster() {
      oid++;
      id = oid;
    }

    

    /* ==================== blackTRaster ================================== */
    public blackTRaster(FTRasterRec raster_rec) {
      oid++;
      id = oid;

      this.buffer = raster_rec.buffer;
      this.buffer_size = raster_rec.buffer_size;
    }
    
    /* ==================== 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();
    }
 



}


































|
|

|
|

|
|
|

|
|
|
|
|
>
|
>
|
|
|
|
>
|
|
|

|
|



|
|



|
|
|
>
|
|
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package org.apwtcl.apwfreetypelib.aftraster;

  /* ===================================================================== */
  /*    blackTRaster                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class blackTRasterRec extends FTRasterRec {
  private static int oid = 0;

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

  private blackTWorkerRec worker = null;
  private byte[] grays = null;
  private int gray_width = 0;

  /* ==================== blackTRaster ================================== */
  public blackTRasterRec() {
    oid++;
    id = oid;

    grays = new byte[5];
  }
    
  /* ==================== blackTRaster ================================== */
  public blackTRasterRec(FTRasterRec raster_rec) {
    oid++;
    id = oid;

    this.buffer = raster_rec.buffer;
    this.buffer_size = raster_rec.buffer_size;
  }
    
  /* ==================== mySelf ================================== */
  public String mySelf() {
      return TAG+"!"+id+"!";
    }
        
  /* ==================== toString ===================================== */
  public String toString() {
      return mySelf()+"!";
    }

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

  /* ==================== getWorker ================================== */
  public blackTWorkerRec getWorker() {
    return worker;
  }

  /* ==================== setWorker ================================== */
  public void setWorker(blackTWorkerRec worker) {
    this.worker = worker;
  }

  /* ==================== getGrays ================================== */
  public byte[] getGrays() {
    return grays;
  }

  /* ==================== setGrays ================================== */
  public void setGrays(byte[] grays) {
    this.grays = grays;
  }

  /* ==================== getGray_width ================================== */
  public int getGray_width() {
    return gray_width;
  }

  /* ==================== setGray_width ================================== */
  public void setGray_width(int gray_width) {
    this.gray_width = gray_width;
  }

}

Name change from aftraster/blackTWorker.java to aftraster/blackTWorkerRec.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package org.apwtcl.apwfreetypelib.aftraster;

  /* ===================================================================== */
  /*    blackTWorker                                                          */
  /*                                                                       */
  /* ===================================================================== */

import android.util.Log;

import org.apwtcl.apwfreetypelib.aftbase.FTBitmapRec;
import org.apwtcl.apwfreetypelib.aftbase.FTOutlineRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;

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

    private int id;
    private static String TAG = "blackTWorker";
    private final static int MaxBezier = 32;

    public int precision_bits = 0;     /* precision related variables         */
    public int precision = 0;
    public int precision_half = 0;
    public int precision_shift = 0;
    public int precision_step = 0;
    public int precision_jitter = 0;
    public int scale_shift = 0;        /* == precision_shift   for bitmaps    */
                                       /* == precision_shift+1 for pixmaps    */
    public int[] buff = null;               /* The profiles buffer                 */
    public int sizeBuff = 0;           /* Render pool size                    */
    public int maxBuff = 0;            /* Profiles buffer size                */
    public int top = 0;                /* Current cursor in buffer            */
    public int error = 0;
    public int numTurns = 0;             /* number of Y-turns in outline        */
    public TPoint arc = null;            /* current Bezier arc pointer          */
    public Short bWidth = 0;             /* target bitmap width                 */
    public byte[] bTarget = null;        /* target bitmap buffer                */
    public byte[] gTarget = null;        /* target pixmap buffer                */
    public int lastX = 0;
    public int lastY = 0;
    public int minY = 0;
    public int maxY = 0;
    public Short num_Profs = 0;          /* current number of profiles          */
    public boolean fresh = false;        /* signals a fresh new profile which   */
                                  /* `start' field must be completed     */
    public boolean joint = false;        /* signals that the last arc ended     */
                                  /* exactly on a scanline.  Allows      */
                                  /* removal of doublets                 */
    public TProfile cProfile = null;     /* current profile                     */
    public TProfile fProfile = null;     /* head of linked list of profiles     */
    public TProfile gProfile = null;     /* contour's first profile in case     */
                                         /* of impact                           */
    public TStates state = null;         /* rendering state                     */
    public FTBitmapRec target = null;    /* description of target bit/pixmap    */
    public FTOutlineRec outline = null;
    public int traceOfs = 0;           /* current offset in target bitmap     */
    public int traceG = 0;             /* current offset in target pixmap     */
    public short traceIncr = 0;          /* sweep's increment in target bitmap  */
    public short gray_min_x = 0;         /* current min x during gray rendering */
    public short gray_max_x = 0;         /* current max x during gray rendering */
    public byte dropOutControl = 0;      /* current drop_out control method     */
    public boolean second_pass = false;  /* indicates whether a horizontal pass */
                                  /* should be performed to control      */
                                  /* drop-out accurately when calling    */
                                  /* Render_Glyph.  Note that there is   */
                                  /* no horizontal pass during gray      */
                                  /* rendering.                          */
    public TPoint[] arcs = new TPoint[3 * MaxBezier + 1]; /* The Bezier stack  */
    public blackTBand[] band_stack = new blackTBand[16]; /* band stack used for sub-banding */
    public int band_top;                /* band stack top                      */

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

  /* ==================== SweepInit ===================================== */
  public FTError.ErrorTag SweepInit() {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    Log.e(TAG, "SweepInit not yet implemented");
    return error;
  }







|










|
|

|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|

|
|



|
|



|
|
|
|
|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package org.apwtcl.apwfreetypelib.aftraster;

  /* ===================================================================== */
  /*    blackTWorker Rec                                                   */
  /*                                                                       */
  /* ===================================================================== */

import android.util.Log;

import org.apwtcl.apwfreetypelib.aftbase.FTBitmapRec;
import org.apwtcl.apwfreetypelib.aftbase.FTOutlineRec;
import org.apwtcl.apwfreetypelib.aftutil.FTDebug;
import org.apwtcl.apwfreetypelib.aftutil.FTError;

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

  private int id;
  private static String TAG = "blackTWorker";
  private final static int MaxBezier = 32;

  private int precision_bits = 0;     /* precision related variables         */
  private int precision = 0;
  private int precision_half = 0;
  private int precision_shift = 0;
  private int precision_step = 0;
  private int precision_jitter = 0;
  private int scale_shift = 0;        /* == precision_shift   for bitmaps    */
                                     /* == precision_shift+1 for pixmaps    */
  private int[] buff = null;          /* The profiles buffer                 */
  private int sizeBuff = 0;           /* Render pool size                    */
  private int maxBuff = 0;            /* Profiles buffer size                */
  private int top = 0;                /* Current cursor in buffer            */
  private int error = 0;
  private int numTurns = 0;           /* number of Y-turns in outline        */
  private TPoint arc = null;          /* current Bezier arc pointer          */
  private int bWidth = 0;             /* target bitmap width                 */
  private byte[] bTarget = null;      /* target bitmap buffer                */
  private byte[] gTarget = null;      /* target pixmap buffer                */
  private int lastX = 0;
  private int lastY = 0;
  private int minY = 0;
  private int maxY = 0;
  private int num_Profs = 0;          /* current number of profiles          */
  private boolean fresh = false;      /* signals a fresh new profile which   */
                                     /* `start' field must be completed     */
  private boolean joint = false;      /* signals that the last arc ended     */
                                     /* exactly on a scanline.  Allows      */
                                     /* removal of doublets                 */
  private TProfile cProfile = null;   /* current profile                     */
  private TProfile fProfile = null;   /* head of linked list of profiles     */
  private TProfile gProfile = null;   /* contour's first profile in case     */
                                     /* of impact                           */
  private TStates state = null;       /* rendering state                     */
  private FTBitmapRec target = null;  /* description of target bit/pixmap    */
  private FTOutlineRec outline = null;
  private int traceOfs = 0;           /* current offset in target bitmap     */
  private int traceG = 0;             /* current offset in target pixmap     */
  private int traceIncr = 0;          /* sweep's increment in target bitmap  */
  private int gray_min_x = 0;         /* current min x during gray rendering */
  private int gray_max_x = 0;         /* current max x during gray rendering */
  private byte dropOutControl = 0;    /* current drop_out control method     */
  private boolean second_pass = false; /* indicates whether a horizontal pass */
                                     /* should be performed to control      */
                                     /* drop-out accurately when calling    */
                                     /* Render_Glyph.  Note that there is   */
                                     /* no horizontal pass during gray      */
                                     /* rendering.                          */
  private TPoint[] arcs = new TPoint[3 * MaxBezier + 1]; /* The Bezier stack  */
  private blackTBandRec[] band_stack = new blackTBandRec[16]; /* band stack used for sub-banding */
  private int band_top;               /* band stack top                      */

  /* ==================== blackTWorker ================================== */
  public blackTWorkerRec() {
    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();
  }

  /* ==================== SweepInit ===================================== */
  public FTError.ErrorTag SweepInit() {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    Log.e(TAG, "SweepInit not yet implemented");
    return error;
  }

Changes to aftraster/grayTWorker.java.

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
    public int y;
    public int last_ey;
    public FTVectorRec[] bez_stack = new FTVectorRec[MaxBezier * 3 + 1];
    public int[] lev_stack = new int[32];
    public FTOutlineRec outline;
    public FTBitmapRec target;
    public FTBBoxRec clip_box;
    public FTSpan[] gray_spans = new FTSpan [FTSpan.FT_MAX_GRAY_SPANS];
    public int num_gray_spans;
    public Object render_span_data;
    public int span_y;
    public int band_size;
    public int band_shoot;
//    public ft_jmp_buf jump_buffer;
    public Object buffer;
................................................................................
      int i;

      oid++;
      id = oid;
      target = new FTBitmapRec();
      outline = new FTOutlineRec();
      clip_box = new FTBBoxRec();
      for (i = 0; i < FTSpan.FT_MAX_GRAY_SPANS; i++) {
        gray_spans[i] = new FTSpan();
      }
      for (i = 0; i < MaxBezier * 3 + 1; i++) {
        bez_stack[i] = new FTVectorRec();
      }
    }
    
    /* ==================== mySelf ================================== */
................................................................................

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

  public FTError.ErrorTag renderSpan(int y, int count, FTSpan[] spans, grayTWorker worker) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    Log.e(TAG, "renderSpan not yet implemented");
    return error;
  }

}







|







 







|
|







 







|






54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
    public int y;
    public int last_ey;
    public FTVectorRec[] bez_stack = new FTVectorRec[MaxBezier * 3 + 1];
    public int[] lev_stack = new int[32];
    public FTOutlineRec outline;
    public FTBitmapRec target;
    public FTBBoxRec clip_box;
    public FTSpanRec[] gray_spans = new FTSpanRec[FTSpanRec.FT_MAX_GRAY_SPANS];
    public int num_gray_spans;
    public Object render_span_data;
    public int span_y;
    public int band_size;
    public int band_shoot;
//    public ft_jmp_buf jump_buffer;
    public Object buffer;
................................................................................
      int i;

      oid++;
      id = oid;
      target = new FTBitmapRec();
      outline = new FTOutlineRec();
      clip_box = new FTBBoxRec();
      for (i = 0; i < FTSpanRec.FT_MAX_GRAY_SPANS; i++) {
        gray_spans[i] = new FTSpanRec();
      }
      for (i = 0; i < MaxBezier * 3 + 1; i++) {
        bez_stack[i] = new FTVectorRec();
      }
    }
    
    /* ==================== mySelf ================================== */
................................................................................

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

  public FTError.ErrorTag renderSpan(int y, int count, FTSpanRec[] spans, grayTWorker worker) {
    FTError.ErrorTag error = FTError.ErrorTag.ERR_OK;
    Log.e(TAG, "renderSpan not yet implemented");
    return error;
  }

}