ApwFreetypeLibrary

Check-in [325bb5cc57]
Login

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

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

Name change from ftcache/FTCMapClassRec.java to ftbase/FTCMapClassRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39



40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
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
// ----------------------------------------------------------------
// FTCMapClassRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCMapClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public final static int FT_CMAP_CLASS_UNKNONW_TYPE = -1;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap0Class = 0;
................................................................................
    public final static int FT_CMAP_CLASS_TYPE_TTCMap8Class = 8;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap10Class = 10;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap12Class = 12;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap13Class = 13;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap14Class = 14;

    public int cmap_class_type = FT_CMAP_CLASS_UNKNONW_TYPE;
    public TTInstanceMethod init = null;
    public TTInstanceMethod done = null;
    public TTInstanceMethod char_index = null;
    public TTInstanceMethod char_next = null;

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

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






|







 







|
|
|
|

|
|
|
|
|









|
<
|



|
<






















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
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













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftbase;

  /* ===================================================================== */
  /*    FTCMapClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public final static int FT_CMAP_CLASS_UNKNONW_TYPE = -1;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap0Class = 0;
................................................................................
    public final static int FT_CMAP_CLASS_TYPE_TTCMap8Class = 8;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap10Class = 10;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap12Class = 12;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap13Class = 13;
    public final static int FT_CMAP_CLASS_TYPE_TTCMap14Class = 14;

    public int cmap_class_type = FT_CMAP_CLASS_UNKNONW_TYPE;
    public FTInstanceMethod init = null;
    public FTInstanceMethod done = null;
    public FTInstanceMethod char_index = null;
    public FTInstanceMethod char_next = null;

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

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

Name change from ftcache/FTCMapRec.java to ftbase/FTCMapRec.java.

1
2
3

4
5




6
7
8


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
..
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
// ----------------------------------------------------------------
// FTCMapRec.java --
//

// Copyright (c) 2014 by Arnulf P. Wiedemann
//




// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------



package ftcache;

import android.util.Log;
import org.apwtcl.gles20.batikfont.ftraster.*;

import ftbase.FTCharMapRec;

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

  /* ===================================================================== */
  /*    FTCMapRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCMapRec extends FTCharMapRec {
................................................................................

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

    /* ==================== FTCMapNew ===================================== */
    public static int FTCMapNew(FTCMapClassRec clazz, byte[] init_data, int init_offset, FTCharMapRec charmap, FTReference<FTCMapRec> acmap) {
      int error = 0;
      FTFaceRec face;
      FTCMapRec cmap = null;
  
      if (clazz == null || charmap == null || charmap.face == null) {
        return FT_Error.GLYPH_INVALID_ARGUMENT;
      } 
      face = charmap.face;
      switch (clazz.cmap_class_type) {
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap0Class:
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap2Class:
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap6Class:
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap8Class:
|
|
<
>
|
<
>
>
>
>
|
|
<
>
>

|


<

<
<
<
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
<
|



|
<









|

|



|







1
2

3
4

5
6
7
8
9
10

11
12
13
14
15
16

17



18
19
20
21
22




















23
24
25
26
27
28
29
..
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
/* =====================================================================
 *  This Java implementation is derived from FreeType code

 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.

 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.

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

package ftbase;

import android.util.Log;





import fttruetype.TTCMap12Rec;
import fttruetype.TTCMap13Rec;
import fttruetype.TTCMap14Rec;
import fttruetype.TTCMap4Rec;
import fttruetype.TTCMapRec;





















  /* ===================================================================== */
  /*    FTCMapRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCMapRec extends FTCharMapRec {
................................................................................

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

    /* ==================== FTCMapNew ===================================== */
    public static int FTCMapNew(FTCMapClassRec clazz, byte[] init_data, int init_offset, ftbase.FTCharMapRec charmap, FTReference<FTCMapRec> acmap) {
      int error = 0;
      ftbase.FTFaceRec face;
      FTCMapRec cmap = null;
  
      if (clazz == null || charmap == null || charmap.face == null) {
        return ftbase.FTError.GLYPH_INVALID_ARGUMENT;
      } 
      face = charmap.face;
      switch (clazz.cmap_class_type) {
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap0Class:
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap2Class:
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap6Class:
      case FTCMapClassRec.FT_CMAP_CLASS_TYPE_TTCMap8Class:

Changes to ftbase/FTCharMapRec.java.

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */
  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */
  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */
  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */
  /*    variant the Arabic encoding.                                       */
  /* ===================================================================== */

import ftcache.FTCMapRec;

public class FTCharMapRec extends ftbase.FTEncoding {
    private static int oid = 0;

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

    public final static int TT_PLATFORM_APPLE_UNICODE = 0;







<
<







153
154
155
156
157
158
159


160
161
162
163
164
165
166
  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */
  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */
  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */
  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */
  /*    variant the Arabic encoding.                                       */
  /* ===================================================================== */



public class FTCharMapRec extends ftbase.FTEncoding {
    private static int oid = 0;

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

    public final static int TT_PLATFORM_APPLE_UNICODE = 0;

Changes to ftbase/FTEncoding.java.

147
148
149
150
151
152
153


154
155
156
157
158
159
160
  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */
  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */
  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */
  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */
  /*    variant the Arabic encoding.                                       */
  /*                                                                       */
  /* ===================================================================== */



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

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








>
>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  /*    Then examine `encoding_id'.  If, for example, `encoding_id' is     */
  /*    @TT_MAC_ID_ROMAN and the language ID (minus~1) is                  */
  /*    `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman.        */
  /*    @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi       */
  /*    variant the Arabic encoding.                                       */
  /*                                                                       */
  /* ===================================================================== */

import fttruetype.TTNameTableRec;

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

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

Changes to ftbase/FTFaceRec.java.

10
11
12
13
14
15
16




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

package ftbase;

import java.io.*;





  /* ===================================================================== */
  /*    FTFaceRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    FreeType root face class structure.  A face object models a        */
  /*    typeface in a font file.                                           */







>
>
>
>







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

package ftbase;

import java.io.*;

import fttruetype.TTDriverClass;
import fttruetype.TTDriverRec;
import fttruetype.TTFaceRec;

  /* ===================================================================== */
  /*    FTFaceRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    FreeType root face class structure.  A face object models a        */
  /*    typeface in a font file.                                           */

Changes to ftbase/FTGlyphLoaderFuncs.java.

37
38
39
40
41
42
43




44
45
46
47
48
49
50
/*                                                                         */
/* ======================================================================= */

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





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

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








>
>
>
>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*                                                                         */
/* ======================================================================= */

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

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

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

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

Changes to ftbase/FTGlyphLoaderRec.java.

10
11
12
13
14
15
16




17
18
19
20
21
22
23
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;




  /* ===================================================================== */
  /*    FTGlyphLoaderRec                                                   */
  /*                                                                       */
  /* ===================================================================== */

public class FTGlyphLoaderRec extends FTDebug {
    private static int oid = 0;
................................................................................
 
    /* ==================== _showLoaderZone ================================== */
    public static void _showLoaderZone(String str) {
      int j;

      if (doDebug) {
        Debug(0, DBG_LOAD_GLYPH, TAG, String.format("%s", str));
        if (TTGlyphLoaderFuncs.loader != null) {
          loaderZone = TTGlyphLoaderFuncs.loader.zone;
          loaderLoad = TTGlyphLoaderFuncs.loader.gloader.current;
        }
        if (TTInterpBase.cur != null) {
          if (TTInterpBase.cur.zp0 != null) {
            if (TTInterpBase.cur.zp0.cur != null) {
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.cur: "+(Object)TTInterpBase.cur.zp0.cur);







>
>
>
>







 







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;

import fttruetype.TTFaceRec;
import fttruetype.TTGlyphZoneRec;
import fttruetype.TTInterpBase;
  /* ===================================================================== */
  /*    FTGlyphLoaderRec                                                   */
  /*                                                                       */
  /* ===================================================================== */

public class FTGlyphLoaderRec extends FTDebug {
    private static int oid = 0;
................................................................................
 
    /* ==================== _showLoaderZone ================================== */
    public static void _showLoaderZone(String str) {
      int j;

      if (doDebug) {
        Debug(0, DBG_LOAD_GLYPH, TAG, String.format("%s", str));
        if (fttruetype.TTGlyphLoaderFuncs.loader != null) {
          loaderZone = TTGlyphLoaderFuncs.loader.zone;
          loaderLoad = TTGlyphLoaderFuncs.loader.gloader.current;
        }
        if (TTInterpBase.cur != null) {
          if (TTInterpBase.cur.zp0 != null) {
            if (TTInterpBase.cur.zp0.cur != null) {
              Debug(0, DBG_LOAD_GLYPH, TAG, "zp0.cur: "+(Object)TTInterpBase.cur.zp0.cur);

Changes to ftbase/FTSizeRec.java.

27
28
29
30
31
32
33



34
35
36
37
38
39
40
  /*               library or any of its drivers.  It can be used by       */
  /*               client applications to link their own data to each size */
  /*               object.                                                 */
  /*                                                                       */
  /*    metrics :: Metrics for this size object.  This field is read-only. */
  /*                                                                       */
  /* ===================================================================== */




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

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








>
>
>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  /*               library or any of its drivers.  It can be used by       */
  /*               client applications to link their own data to each size */
  /*               object.                                                 */
  /*                                                                       */
  /*    metrics :: Metrics for this size object.  This field is read-only. */
  /*                                                                       */
  /* ===================================================================== */

import fttruetype.TTDriverClass;
import fttruetype.TTSizeRec;

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

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

Changes to ftcache/FTCCacheRec.java.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

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

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

    public static int cache_debug = 0;

    public final static int FTC_HASH_INITIAL_SIZE = 8;
    public final static int FTC_HASH_MIN_LOAD = 1;
    public final static int FTC_HASH_MAX_LOAD = 2;
    public final static int FTC_HASH_SUB_LOAD = (FTC_HASH_MAX_LOAD - FTC_HASH_MIN_LOAD);

    public int p = 0;
    public int mask = 0;
................................................................................
     FTCNodeRec bucket;
     FTCNodeRec pnode;
     FTCNodeRec node = node_ref.Get();
     int pnodeIdx= -1;
     boolean list_changed = false;
     boolean isLinkNode = false;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCCacheLookup");
}
     ftbase.FTInstanceMethod compare = cache.clazz.node_compare;

     if (cache == null || node_ref == null) {
       return ftbase.FTError.GLYPH_INVALID_ARGUMENT;
     }
     /* Go to the `top' node of the list sharing same masked hash */
     pnodeIdx = FTCMruFuncs.ftc_get_top_node_for_hash(cache, hash);
................................................................................
   /* =====================================================================
    * FTCCacheNewNode
    * =====================================================================
    */
   public static int FTCCacheNewNode(FTCCacheRec cache, Object hash, Object query, ftbase.FTReference<FTCNodeRec> node_ref) {
     int error = ftbase.FTError.INTERP_ERR_OK;
     FTCNodeRec node;
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCCacheNewNode");
}
     /*
      * We use the FTC_CACHE_TRYLOOP macros to support out-of-memory
      * errors (OOM) correctly, i.e., by flushing the cache progressively
      * in order to make more room.
      */

// FIXME to be implemented later !!







<
<







 







<
|
<







 







<
|
<







22
23
24
25
26
27
28


29
30
31
32
33
34
35
..
87
88
89
90
91
92
93

94

95
96
97
98
99
100
101
...
162
163
164
165
166
167
168

169

170
171
172
173
174
175
176

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

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



    public final static int FTC_HASH_INITIAL_SIZE = 8;
    public final static int FTC_HASH_MIN_LOAD = 1;
    public final static int FTC_HASH_MAX_LOAD = 2;
    public final static int FTC_HASH_SUB_LOAD = (FTC_HASH_MAX_LOAD - FTC_HASH_MIN_LOAD);

    public int p = 0;
    public int mask = 0;
................................................................................
     FTCNodeRec bucket;
     FTCNodeRec pnode;
     FTCNodeRec node = node_ref.Get();
     int pnodeIdx= -1;
     boolean list_changed = false;
     boolean isLinkNode = false;


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

     ftbase.FTInstanceMethod compare = cache.clazz.node_compare;

     if (cache == null || node_ref == null) {
       return ftbase.FTError.GLYPH_INVALID_ARGUMENT;
     }
     /* Go to the `top' node of the list sharing same masked hash */
     pnodeIdx = FTCMruFuncs.ftc_get_top_node_for_hash(cache, hash);
................................................................................
   /* =====================================================================
    * FTCCacheNewNode
    * =====================================================================
    */
   public static int FTCCacheNewNode(FTCCacheRec cache, Object hash, Object query, ftbase.FTReference<FTCNodeRec> node_ref) {
     int error = ftbase.FTError.INTERP_ERR_OK;
     FTCNodeRec node;

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

     /*
      * We use the FTC_CACHE_TRYLOOP macros to support out-of-memory
      * errors (OOM) correctly, i.e., by flushing the cache progressively
      * in order to make more room.
      */

// FIXME to be implemented later !!

Changes to ftcache/FTCHashFuncs.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
48
49
50
51
52
53
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ----------------------------------------------------------------
// FTCHashFuncs.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCHashFuncs                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public final static int FTC_CMAP_INDICES_MAX = 128;

................................................................................
    public FTCHashFuncs() {
      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();
    }
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>





|







 







|
<
|



|
<




















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
30
31
32
33
34
35
36
37

38
39
40
41
42

43
44
45
46
47
48
49













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCHashFuncs                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public final static int FTC_CMAP_INDICES_MAX = 128;

................................................................................
    public FTCHashFuncs() {
      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();
    }

Changes to ftcache/FTCIFamilyClassRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// ----------------------------------------------------------------
// FTCIFamilyClassRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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



  /* ===================================================================== */
  /*    FTCIFamilyClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCIFamilyClassRec extends FTCMruListClassRec {
    private static int oid = 0;

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

    public TTInstanceMethod family_load_glyph = null;

    /* ==================== FTCIFamilyClassRec ================================== */
    public FTCIFamilyClassRec(String initStr) {
      super(initStr);
      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();
    }
 
}
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>











|










|
<
|



|
<






















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42

43
44
45
46
47
48
49
50
51













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;
  /* ===================================================================== */
  /*    FTCIFamilyClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCIFamilyClassRec extends FTCMruListClassRec {
    private static int oid = 0;

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

    public ftbase.FTInstanceMethod family_load_glyph = null;

    /* ==================== FTCIFamilyClassRec ================================== */
    public FTCIFamilyClassRec(String initStr) {
      super(initStr);
      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();
    }
 
}

Changes to ftcache/FTCINodeRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// ----------------------------------------------------------------
// FTCINodeRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCINodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCINodeRec extends FTCGNodeRec {
    private static int oid = 0;

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

    public FTCGNodeRec gnode = null;
    public FTGlyphRec glyph = null;

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

}
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>

|










|









|
<
|



|
<








<
<
<
|
<













1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43

44
45
46
47
48
49
50
51



52














/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCINodeRec                                                        */
  /*                                                                       */
  /* ===================================================================== */

public class FTCINodeRec extends FTCGNodeRec {
    private static int oid = 0;

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

    public FTCGNodeRec gnode = null;
    public ftbase.FTGlyphRec glyph = null;

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



}

Changes to ftcache/FTCManagerRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



20
21
22


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

41



42
43
44
45
46
47
48
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
// ----------------------------------------------------------------
// FTCManagerRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

import android.util.Log;
import org.apwtcl.gles20.batikfont.ftraster.FT_Error;

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



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


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





  /* ===================================================================== */
  /*    FTCManagerRec                                                      */
  /*                                                                       */
  /* <Description>                                                         */
  /*    This object corresponds to one instance of the cache-subsystem.    */
  /*    It is used to cache one or more @FT_Face objects, along with       */
  /*    corresponding @FT_Size objects.                                    */
................................................................................
  /*                                                                       */
  /*    All limitations are enforced by keeping lists of managed objects   */
  /*    in most-recently-used order, and flushing old nodes to make room   */
  /*    for new ones.                                                      */
  /*                                                                       */
  /* ===================================================================== */

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

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

    private final static int FTC_MAX_FACES_DEFAULT = 2;
    private final static int FTC_MAX_SIZES_DEFAULT = 4;
    private final static int FTC_MAX_CACHES = 16;

    public FTLibraryRec library = null;
    public FTCNodeRec nodes_list = null;
    public long max_weight = 0L;
    public long cur_weight = 0L;
    public int num_nodes = 0;
    public FTCCacheRec[] caches = new FTCCacheRec[FTC_MAX_CACHES];
    public int num_caches = 0;
    public FTCMruListRec faces = null;
    public FTCMruListRec sizes = null;
    public Object request_data = null;
    public TTInstanceMethod request_face = null;

    /* ==================== FTCManagerRec ================================== */
    public FTCManagerRec() {
      oid++;
      id = oid;
      faces = new FTCMruListRec("manager.faces");
      sizes = new FTCMruListRec("manager.sizes");
................................................................................
      for (int i = 0; i < FTC_MAX_CACHES; i++) {
        caches[i] = new FTCCacheRec();
      }
    }
    
    /* ==================== 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();
    }

    /* =====================================================================
     * FTCManagerNew
     * =====================================================================
     */
    public static int FTCManagerNew(FTLibraryRec library, int max_faces, int max_sizes,
            TTInstanceMethod requester, Object req_data, FTReference<FTCManagerRec> manager_ref) {
      int error = 0;
      FTCManagerRec manager = null;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerNew");
}
      if (library  == null) {
        error= FT_Error.GLYPH_INVALID_LIBRARY_HANDLE;
        return error;
      }
      manager = new FTCManagerRec();
      if (max_faces == 0) {
        max_faces = FTC_MAX_FACES_DEFAULT;
      }
      if (max_sizes == 0) {
        max_sizes = FTC_MAX_SIZES_DEFAULT;
      }
      manager.library = library;
      manager.request_face = requester;
      manager.request_data = req_data;
if (FTCCacheRec.cache_debug > 2) {
System.out.println("call FTC_MruList_Init faces FTCFaceListClass");
}
      FTCMruListRec.FTCMruListInit(manager.faces, (FTCMruListClassRec)new FTCFaceListClass(), max_faces, manager);
if (FTCCacheRec.cache_debug > 2) {
System.out.println("call FTC_MruList_Init sizes FTCSizeListClass");
}
      FTCMruListRec.FTCMruListInit(manager.sizes, (FTCMruListClassRec)new FTCSizeListClass(), max_sizes, manager);
      manager_ref.Set(manager);
      return error;
    }
    
    /* =====================================================================
     * FTCSBitCacheNew
     * =====================================================================
     */
    public static int FTCSBitCacheNew(FTCManagerRec manager, FTReference<FTCGCacheRec> cache_ref) {
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCSBitCacheNew");
}
      return FTCGCacheClassRec.FTCGCacheNew(manager, new FTCBasicSCacheClass(), cache_ref);
    }
    
    /* =====================================================================
     * FTCCMapCacheNew
     * =====================================================================
     */
    public static int FTCCMapCacheNew(FTCManagerRec cache_manager, FTReference<FTCGCacheRec> cache_ref) {
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCCMapCacheNew");
}
      return FTCManagerRegisterCache(cache_manager, new FTCCMapCacheClass(), cache_ref);
    }
    
    /* =====================================================================
     * FTCImageCacheNew
     * =====================================================================
     */
    public static int FTCImageCacheNew(FTCManagerRec cache_manager, FTReference<FTCGCacheRec> cache_ref) {
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCImageCacheNew");
}
      return FTCGCacheClassRec.FTCGCacheNew(cache_manager, new FTCBasicICacheClass(), cache_ref);
    }
    
    /* =====================================================================
     * FTCManagerRegisterCache
     * =====================================================================
     */
    public static int FTCManagerRegisterCache(FTCManagerRec manager, FTCCacheClassRec clazz, FTReference<FTCGCacheRec> cache_ref) {
      int error = FT_Error.GLYPH_INVALID_ARGUMENT;
      FTCGCacheRec cache = null;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerRegisterCache");
}
      if (manager != null && clazz != null && cache_ref != null) {
        if (manager.num_caches >= FTC_MAX_CACHES) {
          error = FT_Error.GLYPH_TOO_MANY_CACHES;
          Log.e(TAG, "FTCManagerRegisterCache: too many registered caches");
          return error;
        }
        cache = new FTCGCacheRec();
        if (cache != null) {
          cache.manager = manager;
          switch (clazz.cache_class_type) {
................................................................................
            cache.clazz.copy(clazz);
            break;
          case FTCCacheClassRec.FTC_CACHE_CLASS_TYPE_FTCCMapCacheClass:
            cache.clazz = new FTCCMapCacheClass();
            cache.clazz.copy(clazz);
            break;
          default:
            error = FT_Error.GLYPH_BAD_CACHE_CLASS_TYPE;
            Log.e(TAG, "FTCManagerRegisterCache: bad cache_class_type");
            return error;            
          }
if (FTCCacheRec.cache_debug > 2) {
System.out.println("cache.class: "+clazz.toDebugString());
}
          cache.org_class = (FTCCacheClassRec)clazz;
          /* THIS IS VERY IMPORTANT!  IT WILL WRETCH THE MANAGER */
          /* IF IT IS NOT SET CORRECTLY                          */
          cache.index = manager.num_caches;
          error = (int)clazz.cache_init.callClassMethod(cache);
          if (error != 0) {
            clazz.cache_done.callClassMethod(cache);
................................................................................
      return error;
    }

    /* =====================================================================
     * FTCManagerLookupSize
     * =====================================================================
     */
    public static int FTCManagerLookupSize(FTCManagerRec manager, FTReference<FTCScalerRec> scaler_ref, FTReference<FTSizeRec> size_ref) {
      int error = 0;
      FTReference<Object> mru_ref = new FTReference<Object>();
      FTCScalerRec scaler = scaler_ref.Get();
      FTCMruNodeRec mrunode = null;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerLookupSize");
}
      if (size_ref == null) {
        return FT_Error.GLYPH_INVALID_ARGUMENT;
      }
      size_ref.Set(null);
      if (manager == null) {
        return FT_Error.GLYPH_INVALID_CACHE_HANDLE;
      }
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerLookupSize1b");
}
      error = FTCMruListRec.FTCMruListLookup(manager.sizes, (Object)scaler, mru_ref);
      mrunode = (FTCMruNodeRec)mru_ref.Get();
      if (error == 0) {
        FTCSizeNodeRec size_node = (FTCSizeNodeRec)mrunode;
        size_node.scaler = scaler;
        size_ref.Set(size_node.size);
      }
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerLookupSize2");
}
      scaler_ref.Set(scaler);
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerLookupSize3");
}
      return error;
    }

    /* =====================================================================
     * FTCManagerLookupFace
     * =====================================================================
     */
    public static int FTCManagerLookupFace(FTCManagerRec manager, Object face_id, FTReference<FTFaceRec> face_ref) {
      int error = 0;

      FTReference<Object> mru_ref = new FTReference<Object>();

if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCManagerLookupFace");
}
      if (face_ref == null) {
        return FT_Error.GLYPH_INVALID_ARGUMENT;
      }
      face_ref.Set(null);
      if (manager == null) {
        return FT_Error.GLYPH_INVALID_CACHE_HANDLE;
      }
      error = FTCMruListRec.FTCMruListLookup(manager.faces, (Object)face_id, mru_ref);
      FTCFaceNodeRec face_node = (FTCFaceNodeRec)mru_ref.Get();
      if (error == 0) {
if (FTCCacheRec.cache_debug > 2) {
System.out.println("face_node.face: "+face_node+"+"+face_node.face+"+"+face_node.face.driver);
}
        face_ref.Set(face_node.face);
      }
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTC_Manager_LookupFace end "+face_node+"+"+face_node.face+"+"+face_node.face.driver);
}
      return error;
    }

    /* =====================================================================
     * FTCManagerCompress
     * =====================================================================
     */
................................................................................

      if (manager == null) {
        return;
      }
      first = manager.nodes_list;

//      FTC_Manager_Check( manager );
      FT_Trace.Trace(7, TAG, String.format("compressing, weight = %d, max = %d, nodes = %d",
          manager.cur_weight, manager.max_weight, manager.num_nodes ));
      if (manager.cur_weight < manager.max_weight || first == null) {
        return;
      }
      /* go to last node -- it's a circular list */
      node = first.prev;
      do {
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>
>







 







|









|









|







 







|
<
|



|
<












|
|



<
|
<

|












<
|
<

<
|
<









|
<
|
<







|
<
|
<







|
<
|
<







|
|


<
|
<


|







 







|



<
|
<







 







|

|



<
|
<

|



|

<
|
<







<
|
<

<
|
<







|


|

<
|
<

|



|




<
|
<


<
|
<







 







|





















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
..
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
66
67
68
69
70
71
72
73

74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

96

97
98
99
100
101
102
103
104
105
106
107
108
109
110

111

112

113

114
115
116
117
118
119
120
121
122
123

124

125
126
127
128
129
130
131
132

133

134
135
136
137
138
139
140
141

142

143
144
145
146
147
148
149
150
151
152
153

154

155
156
157
158
159
160
161
162
163
164
...
171
172
173
174
175
176
177
178
179
180
181

182

183
184
185
186
187
188
189
...
199
200
201
202
203
204
205
206
207
208
209
210
211

212

213
214
215
216
217
218
219

220

221
222
223
224
225
226
227

228

229

230

231
232
233
234
235
236
237
238
239
240
241
242

243

244
245
246
247
248
249
250
251
252
253

254

255
256

257

258
259
260
261
262
263
264
...
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283














/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

import android.util.Log;
  /* ===================================================================== */
  /*    FTCManagerRec                                                      */
  /*                                                                       */
  /* <Description>                                                         */
  /*    This object corresponds to one instance of the cache-subsystem.    */
  /*    It is used to cache one or more @FT_Face objects, along with       */
  /*    corresponding @FT_Size objects.                                    */
................................................................................
  /*                                                                       */
  /*    All limitations are enforced by keeping lists of managed objects   */
  /*    in most-recently-used order, and flushing old nodes to make room   */
  /*    for new ones.                                                      */
  /*                                                                       */
  /* ===================================================================== */

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

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

    private final static int FTC_MAX_FACES_DEFAULT = 2;
    private final static int FTC_MAX_SIZES_DEFAULT = 4;
    private final static int FTC_MAX_CACHES = 16;

    public ftbase.FTLibraryRec library = null;
    public FTCNodeRec nodes_list = null;
    public long max_weight = 0L;
    public long cur_weight = 0L;
    public int num_nodes = 0;
    public FTCCacheRec[] caches = new FTCCacheRec[FTC_MAX_CACHES];
    public int num_caches = 0;
    public FTCMruListRec faces = null;
    public FTCMruListRec sizes = null;
    public Object request_data = null;
    public ftbase.FTInstanceMethod request_face = null;

    /* ==================== FTCManagerRec ================================== */
    public FTCManagerRec() {
      oid++;
      id = oid;
      faces = new FTCMruListRec("manager.faces");
      sizes = new FTCMruListRec("manager.sizes");
................................................................................
      for (int i = 0; i < FTC_MAX_CACHES; i++) {
        caches[i] = new FTCCacheRec();
      }
    }
    
    /* ==================== 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();
    }

    /* =====================================================================
     * FTCManagerNew
     * =====================================================================
     */
    public static int FTCManagerNew(ftbase.FTLibraryRec library, int max_faces, int max_sizes,
            ftbase.FTInstanceMethod requester, Object req_data, ftbase.FTReference<FTCManagerRec> manager_ref) {
      int error = 0;
      FTCManagerRec manager = null;


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

      if (library  == null) {
        error= ftbase.FTError.GLYPH_INVALID_LIBRARY_HANDLE;
        return error;
      }
      manager = new FTCManagerRec();
      if (max_faces == 0) {
        max_faces = FTC_MAX_FACES_DEFAULT;
      }
      if (max_sizes == 0) {
        max_sizes = FTC_MAX_SIZES_DEFAULT;
      }
      manager.library = library;
      manager.request_face = requester;
      manager.request_data = req_data;

Debug(0, DBG_CACHE, TAG, "call FTC_MruList_Init faces FTCFaceListClass");

      FTCMruListRec.FTCMruListInit(manager.faces, (FTCMruListClassRec)new FTCFaceListClass(), max_faces, manager);

Debug(0, DBG_CACHE, TAG, "call FTC_MruList_Init sizes FTCSizeListClass");

      FTCMruListRec.FTCMruListInit(manager.sizes, (FTCMruListClassRec)new FTCSizeListClass(), max_sizes, manager);
      manager_ref.Set(manager);
      return error;
    }
    
    /* =====================================================================
     * FTCSBitCacheNew
     * =====================================================================
     */
    public static int FTCSBitCacheNew(FTCManagerRec manager, ftbase.FTReference<FTCGCacheRec> cache_ref) {

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

      return FTCGCacheClassRec.FTCGCacheNew(manager, new FTCBasicSCacheClass(), cache_ref);
    }
    
    /* =====================================================================
     * FTCCMapCacheNew
     * =====================================================================
     */
    public static int FTCCMapCacheNew(FTCManagerRec cache_manager, ftbase.FTReference<FTCGCacheRec> cache_ref) {

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

      return FTCManagerRegisterCache(cache_manager, new FTCCMapCacheClass(), cache_ref);
    }
    
    /* =====================================================================
     * FTCImageCacheNew
     * =====================================================================
     */
    public static int FTCImageCacheNew(FTCManagerRec cache_manager, ftbase.FTReference<FTCGCacheRec> cache_ref) {

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

      return FTCGCacheClassRec.FTCGCacheNew(cache_manager, new FTCBasicICacheClass(), cache_ref);
    }
    
    /* =====================================================================
     * FTCManagerRegisterCache
     * =====================================================================
     */
    public static int FTCManagerRegisterCache(FTCManagerRec manager, FTCCacheClassRec clazz, ftbase.FTReference<FTCGCacheRec> cache_ref) {
      int error = ftbase.FTError.GLYPH_INVALID_ARGUMENT;
      FTCGCacheRec cache = null;


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

      if (manager != null && clazz != null && cache_ref != null) {
        if (manager.num_caches >= FTC_MAX_CACHES) {
          error = ftbase.FTError.GLYPH_TOO_MANY_CACHES;
          Log.e(TAG, "FTCManagerRegisterCache: too many registered caches");
          return error;
        }
        cache = new FTCGCacheRec();
        if (cache != null) {
          cache.manager = manager;
          switch (clazz.cache_class_type) {
................................................................................
            cache.clazz.copy(clazz);
            break;
          case FTCCacheClassRec.FTC_CACHE_CLASS_TYPE_FTCCMapCacheClass:
            cache.clazz = new FTCCMapCacheClass();
            cache.clazz.copy(clazz);
            break;
          default:
            error = ftbase.FTError.GLYPH_BAD_CACHE_CLASS_TYPE;
            Log.e(TAG, "FTCManagerRegisterCache: bad cache_class_type");
            return error;            
          }

Debug(0, DBG_CACHE, TAG, "cache.class: "+clazz.toDebugString());

          cache.org_class = (FTCCacheClassRec)clazz;
          /* THIS IS VERY IMPORTANT!  IT WILL WRETCH THE MANAGER */
          /* IF IT IS NOT SET CORRECTLY                          */
          cache.index = manager.num_caches;
          error = (int)clazz.cache_init.callClassMethod(cache);
          if (error != 0) {
            clazz.cache_done.callClassMethod(cache);
................................................................................
      return error;
    }

    /* =====================================================================
     * FTCManagerLookupSize
     * =====================================================================
     */
    public static int FTCManagerLookupSize(FTCManagerRec manager, ftbase.FTReference<FTCScalerRec> scaler_ref, ftbase.FTReference<ftbase.FTSizeRec> size_ref) {
      int error = 0;
      ftbase.FTReference<Object> mru_ref = new ftbase.FTReference<Object>();
      FTCScalerRec scaler = scaler_ref.Get();
      FTCMruNodeRec mrunode = null;


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

      if (size_ref == null) {
        return ftbase.FTError.GLYPH_INVALID_ARGUMENT;
      }
      size_ref.Set(null);
      if (manager == null) {
        return ftbase.FTError.GLYPH_INVALID_CACHE_HANDLE;
      }

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

      error = FTCMruListRec.FTCMruListLookup(manager.sizes, (Object)scaler, mru_ref);
      mrunode = (FTCMruNodeRec)mru_ref.Get();
      if (error == 0) {
        FTCSizeNodeRec size_node = (FTCSizeNodeRec)mrunode;
        size_node.scaler = scaler;
        size_ref.Set(size_node.size);
      }

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

      scaler_ref.Set(scaler);

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

      return error;
    }

    /* =====================================================================
     * FTCManagerLookupFace
     * =====================================================================
     */
    public static int FTCManagerLookupFace(FTCManagerRec manager, Object face_id, ftbase.FTReference<ftbase.FTFaceRec> face_ref) {
      int error = 0;

      ftbase.FTReference<Object> mru_ref = new ftbase.FTReference<Object>();


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

      if (face_ref == null) {
        return ftbase.FTError.GLYPH_INVALID_ARGUMENT;
      }
      face_ref.Set(null);
      if (manager == null) {
        return ftbase.FTError.GLYPH_INVALID_CACHE_HANDLE;
      }
      error = FTCMruListRec.FTCMruListLookup(manager.faces, (Object)face_id, mru_ref);
      FTCFaceNodeRec face_node = (FTCFaceNodeRec)mru_ref.Get();
      if (error == 0) {

Debug(0, DBG_CACHE, TAG, "face_node.face: "+face_node+"+"+face_node.face+"+"+face_node.face.driver);

        face_ref.Set(face_node.face);
      }

Debug(0, DBG_CACHE, TAG, "FTC_Manager_LookupFace end "+face_node+"+"+face_node.face+"+"+face_node.face.driver);

      return error;
    }

    /* =====================================================================
     * FTCManagerCompress
     * =====================================================================
     */
................................................................................

      if (manager == null) {
        return;
      }
      first = manager.nodes_list;

//      FTC_Manager_Check( manager );
      ftbase.FTTrace.Trace(7, TAG, String.format("compressing, weight = %d, max = %d, nodes = %d",
          manager.cur_weight, manager.max_weight, manager.num_nodes ));
      if (manager.cur_weight < manager.max_weight || first == null) {
        return;
      }
      /* go to last node -- it's a circular list */
      node = first.prev;
      do {

Changes to ftcache/FTCMruFuncs.java.

1
2
3

4
5




6
7
8


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
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
...
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// ----------------------------------------------------------------
// FTCMruFuncs.java --
//

// Copyright (c) 2014 by Arnulf P. Wiedemann
//




// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------



package ftcache;

import android.util.Log;

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

  /* ===================================================================== */
  /*    FTCMruFuncs                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public static final int FTC_HASH_MIN_LOAD = 1;
    public static final int FTC_HASH_MAX_LOAD = 2;
................................................................................
    public FTCMruFuncs() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * ftc_node_mru_link
     * =====================================================================
     */
    public static void ftc_node_mru_link(FTCNodeRec node, FTCManagerRec manager) {
      FTReference<FTCMruNodeRec> nodes_list_ref = new FTReference<FTCMruNodeRec>();
      nodes_list_ref.Set(manager.nodes_list);
      FTCMruNodeRec.FTCMruNodePrepend(nodes_list_ref, (FTCMruNodeRec)node);
      manager.nodes_list = (FTCNodeRec)nodes_list_ref.Get();
      manager.num_nodes++;
    }

    /* =====================================================================
................................................................................
//              }
//              cache.mask >>= 1;
//              p = cache.mask;
            } else {
              p--;
            }
            linkNode = null;
	    linkIdx = p;
            pnode = cache.buckets[p];
            while (pnode != null) {
              linkNode = pnode;
              pnode = pnode.link;
            }
            pold = cache.buckets[old_index];
            if (linkNode != null) {
................................................................................
      FTCNodeRec linkNode = null;
      
      for (;;) {
        FTCNodeRec node;
        node = pnode;

        if (node == null) {
          FT_Trace.Trace(7, TAG, "ftc_node_hash_unlink: unknown node");
          return;
        }
        if (node == node0) {
          break;
        }
	linkNode = pnode;
        pnode = pnode.link;
................................................................................
     * =====================================================================
     */
    public static void ftc_node_destroy(FTCNodeRec node, FTCManagerRec manager) {
      FTCCacheRec cache;

      /* find node's cache */
      if (node.cache_index >= manager.num_caches) {
        FT_Trace.Trace(7, TAG, "ftc_node_destroy: invalid node handle");
        return;
      }
      cache = manager.caches[node.cache_index];
      if (cache == null) {
        FT_Trace.Trace(7, TAG, "ftc_node_destroy: invalid node handle");
        return;
      }
      manager.cur_weight -= (int)cache.clazz.node_weight.callClassMethod(node, cache);
      /* remove node from mru list */
      ftc_node_mru_unlink(node, manager);
      /* remove node from cache's hash table */
      ftc_node_hash_unlink(node, cache);
      /* now finalize it */
      cache.clazz.node_free.callClassMethod(node, cache);
    }

}
|
|
<
>
|
<
>
>
>
>
|
|
<
>
>





<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<





|







 







|
<
|



|
<













|







 







|







 







|







 







|




|












1
2

3
4

5
6
7
8
9
10

11
12
13
14
15
16
17



























18
19
20
21
22
23
24
25
26
27
28
29
30
..
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
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
/* =====================================================================
 *  This Java implementation is derived from FreeType code

 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.

 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.

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

package ftcache;

import android.util.Log;




























  /* ===================================================================== */
  /*    FTCMruFuncs                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public static final int FTC_HASH_MIN_LOAD = 1;
    public static final int FTC_HASH_MAX_LOAD = 2;
................................................................................
    public FTCMruFuncs() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

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

    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * ftc_node_mru_link
     * =====================================================================
     */
    public static void ftc_node_mru_link(FTCNodeRec node, FTCManagerRec manager) {
      ftbase.FTReference<FTCMruNodeRec> nodes_list_ref = new ftbase.FTReference<FTCMruNodeRec>();
      nodes_list_ref.Set(manager.nodes_list);
      FTCMruNodeRec.FTCMruNodePrepend(nodes_list_ref, (FTCMruNodeRec)node);
      manager.nodes_list = (FTCNodeRec)nodes_list_ref.Get();
      manager.num_nodes++;
    }

    /* =====================================================================
................................................................................
//              }
//              cache.mask >>= 1;
//              p = cache.mask;
            } else {
              p--;
            }
            linkNode = null;
            linkIdx = p;
            pnode = cache.buckets[p];
            while (pnode != null) {
              linkNode = pnode;
              pnode = pnode.link;
            }
            pold = cache.buckets[old_index];
            if (linkNode != null) {
................................................................................
      FTCNodeRec linkNode = null;
      
      for (;;) {
        FTCNodeRec node;
        node = pnode;

        if (node == null) {
          ftbase.FTTrace.Trace(7, TAG, "ftc_node_hash_unlink: unknown node");
          return;
        }
        if (node == node0) {
          break;
        }
	linkNode = pnode;
        pnode = pnode.link;
................................................................................
     * =====================================================================
     */
    public static void ftc_node_destroy(FTCNodeRec node, FTCManagerRec manager) {
      FTCCacheRec cache;

      /* find node's cache */
      if (node.cache_index >= manager.num_caches) {
        ftbase.FTTrace.Trace(7, TAG, "ftc_node_destroy: invalid node handle");
        return;
      }
      cache = manager.caches[node.cache_index];
      if (cache == null) {
        ftbase.FTTrace.Trace(7, TAG, "ftc_node_destroy: invalid node handle");
        return;
      }
      manager.cur_weight -= (int)cache.clazz.node_weight.callClassMethod(node, cache);
      /* remove node from mru list */
      ftc_node_mru_unlink(node, manager);
      /* remove node from cache's hash table */
      ftc_node_hash_unlink(node, cache);
      /* now finalize it */
      cache.clazz.node_free.callClassMethod(node, cache);
    }

}

Changes to ftcache/FTCMruListClassRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
48
49
50
51
52
53
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// ----------------------------------------------------------------
// FTCMruListClassRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCMruListClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

    private int id;
    private static String TAG = "FTCMruListClassRec";
    public String initStr;
    public final static int NODE_TYPE_UNKNOWN = 0;
    public final static int NODE_TYPE_FTC_FACE_NODE_REC = 1;
................................................................................
    public final static int NODE_TYPE_FTC_SIZE_NODE_REC = 2;
    public final static int NODE_TYPE_FTC_GNODE_REC = 3;
    public final static int NODE_TYPE_FTC_INODE_REC = 4;
    public final static int NODE_TYPE_FTC_SNODE_REC = 5;
    public final static int NODE_TYPE_FTC_BASIC_FAMILY_REC = 6;
    
    public int node_type = NODE_TYPE_UNKNOWN;
    public TTInstanceMethod node_compare = null;
    public TTInstanceMethod node_init = null;
    public TTInstanceMethod node_reset = null;
    public TTInstanceMethod node_done = null;

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

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

>
>





|







 







|
|
|
|











|
<
|



|
<






















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
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













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCMruListClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

    private int id;
    private static String TAG = "FTCMruListClassRec";
    public String initStr;
    public final static int NODE_TYPE_UNKNOWN = 0;
    public final static int NODE_TYPE_FTC_FACE_NODE_REC = 1;
................................................................................
    public final static int NODE_TYPE_FTC_SIZE_NODE_REC = 2;
    public final static int NODE_TYPE_FTC_GNODE_REC = 3;
    public final static int NODE_TYPE_FTC_INODE_REC = 4;
    public final static int NODE_TYPE_FTC_SNODE_REC = 5;
    public final static int NODE_TYPE_FTC_BASIC_FAMILY_REC = 6;
    
    public int node_type = NODE_TYPE_UNKNOWN;
    public ftbase.FTInstanceMethod node_compare = null;
    public ftbase.FTInstanceMethod node_init = null;
    public ftbase.FTInstanceMethod node_reset = null;
    public ftbase.FTInstanceMethod node_done = null;

    /* ==================== FTCMruListClassRec ================================== */
    public FTCMruListClassRec(String initStr) {
      super();
      oid++;
      id = oid;
      this.initStr = initStr;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

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

    }

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

Changes to ftcache/FTCMruListRec.java.

1
2
3

4
5




6
7
8


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
...
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
...
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
// ----------------------------------------------------------------
// FTCMruListRec.java --
//

// Copyright (c) 2014 by Arnulf P. Wiedemann
//




// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------



package ftcache;

import android.util.Log;
//import org.apwtcl.gles20.truetype.*;

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

  /* ===================================================================== */
  /*    FTCMruListRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCMruListRec extends FTCMruListClassRec {
................................................................................
      return error;
    }

    /* =====================================================================
     * FTCMruListLookup
     * =====================================================================
     */
    public static int FTCMruListLookup(FTCMruListRec list, Object key, FTReference<Object> node_ref) {
      FTCMruNodeRec node;
      int error = 0;

      node = FTCMruListFind(list, key);
      if (node == null) {
        return FTCMruListNew(list, key, node_ref);
      }
................................................................................
    }

    /* =====================================================================
     * FTCMruListFind
     * =====================================================================
     */
    public static FTCMruNodeRec FTCMruListFind(FTCMruListRec list, Object key) {
      TTInstanceMethod compare = list.node_compare;
      FTCMruNodeRec node;
      FTCMruNodeRec first;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCMruListFind");
}
      first = list.nodes;
      node = null;
      if (first != null) {
        node = list.nodes;
        do {
          if ((boolean)compare.callClassMethod(node, key)) {
            if (first != node) {
if (FTCCacheRec.cache_debug > 2) {
System.out.println("first: "+first+"!"+node+"!");            	
}
              FTCMruNodeRec.FTCMruNodeUp(list.nodes, node);
            }
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCMruListFind found: "+node+"!");
}
            return node;
          }
          node = list.nodes.next;
        } while (node != first);
      }
      return null;
    }

    /* =====================================================================
     * FTCMruListNew
     * =====================================================================
     */
    public static int FTCMruListNew(FTCMruListRec list, Object key, FTReference<Object> node_ref) {
      FTCMruNodeRec node = null;
      Object node_obj = node;
      int error = 0;

if (FTCCacheRec.cache_debug > 2) {
System.out.println(String.format("FTCMruListNew: list.num_nodes: %d list.max_nodes: %d", list.num_nodes, list.max_nodes));      
}
      if (list.num_nodes >= list.max_nodes && list.max_nodes > 0) {
        node = list.nodes.prev;
//        FT_ASSERT( node );
        if (list.node_reset != null) {
          node_ref.Set(list.nodes);
          FTCMruNodeRec.FTCMruNodeUp(list.nodes, node);
          list.nodes = (FTCMruNodeRec)node_ref.Get();
................................................................................
          break;
        }
        if (node == null) {
          node_ref.Set(node);
          return error;
        }
      }
      FTReference<Object> obj_ref = new FTReference<Object>();
      obj_ref.Set(node);
if (FTCCacheRec.cache_debug > 2) {
System.out.println("node_init: node: "+node+"!"+list.initStr+"!"+list.initStr);
System.out.println("node_init2: key: "+key+"!data: "+list.data+"!");
}
      error = (int)list.node_init.callClassMethod(obj_ref, key, list.data);
      node_obj = obj_ref.Get();
      if (error != 0) {
        if (list.node_done != null) {
          list.node_done.callClassMethod((FTCMruNodeRec)node_obj, list.data);
        }
//      FT_FREE( node );
        node_ref.Set(null);
        return error;
      }
if (FTCCacheRec.cache_debug > 2) {
System.out.println("list.nodes. "+list.nodes);
}
      FTReference<FTCMruNodeRec> nodes_ref = new FTReference<FTCMruNodeRec>();
      nodes_ref.Set(list.nodes);
      FTCMruNodeRec.FTCMruNodePrepend(nodes_ref, (FTCMruNodeRec)node_obj);
      list.nodes = nodes_ref.Get();
      list.num_nodes++;
      node_ref.Set(node_obj);
      return error;
    }

    /* =====================================================================
     * FTCMruListLookupCmp
     * =====================================================================
     */
    public static void FTCMruListLookupCmp(FTReference<FTCMruListRec> list_ref, Object key, TTInstanceMethod compare, FTCMruNodeRec node) {
      FTCMruListRec list = list_ref.Get();
      FTCMruNodeRec first = list.nodes;
      if (first == null) ;

    }
}
|
|
<
>
|
<
>
>
>
>
|
|
<
>
>




<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|







 







|



<
|
<







<
|
<


<
|
<












|




<
|
<







 







|

<
|
|
<










<
|
<
|












|






1
2

3
4

5
6
7
8
9
10

11
12
13
14
15
16




























17
18
19
20
21
22
23
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
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
...
190
191
192
193
194
195
196
197
198

199
200

201
202
203
204
205
206
207
208
209
210

211

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* =====================================================================
 *  This Java implementation is derived from FreeType code

 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.

 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.

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

package ftcache;

import android.util.Log;





























  /* ===================================================================== */
  /*    FTCMruListRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCMruListRec extends FTCMruListClassRec {
................................................................................
      return error;
    }

    /* =====================================================================
     * FTCMruListLookup
     * =====================================================================
     */
    public static int FTCMruListLookup(FTCMruListRec list, Object key, ftbase.FTReference<Object> node_ref) {
      FTCMruNodeRec node;
      int error = 0;

      node = FTCMruListFind(list, key);
      if (node == null) {
        return FTCMruListNew(list, key, node_ref);
      }
................................................................................
    }

    /* =====================================================================
     * FTCMruListFind
     * =====================================================================
     */
    public static FTCMruNodeRec FTCMruListFind(FTCMruListRec list, Object key) {
      ftbase.FTInstanceMethod compare = list.node_compare;
      FTCMruNodeRec node;
      FTCMruNodeRec first;


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

      first = list.nodes;
      node = null;
      if (first != null) {
        node = list.nodes;
        do {
          if ((boolean)compare.callClassMethod(node, key)) {
            if (first != node) {

Debug(0, DBG_CACHE, TAG, "first: "+first+"!"+node+"!");

              FTCMruNodeRec.FTCMruNodeUp(list.nodes, node);
            }

Debug(0, DBG_CACHE, TAG, "FTCMruListFind found: "+node+"!");

            return node;
          }
          node = list.nodes.next;
        } while (node != first);
      }
      return null;
    }

    /* =====================================================================
     * FTCMruListNew
     * =====================================================================
     */
    public static int FTCMruListNew(FTCMruListRec list, Object key, ftbase.FTReference<Object> node_ref) {
      FTCMruNodeRec node = null;
      Object node_obj = node;
      int error = 0;


Debug(0, DBG_CACHE, TAG, String.format("FTCMruListNew: list.num_nodes: %d list.max_nodes: %d", list.num_nodes, list.max_nodes));

      if (list.num_nodes >= list.max_nodes && list.max_nodes > 0) {
        node = list.nodes.prev;
//        FT_ASSERT( node );
        if (list.node_reset != null) {
          node_ref.Set(list.nodes);
          FTCMruNodeRec.FTCMruNodeUp(list.nodes, node);
          list.nodes = (FTCMruNodeRec)node_ref.Get();
................................................................................
          break;
        }
        if (node == null) {
          node_ref.Set(node);
          return error;
        }
      }
      ftbase.FTReference<Object> obj_ref = new ftbase.FTReference<Object>();
      obj_ref.Set(node);

Debug(0, DBG_CACHE, TAG, "node_init: node: "+node+"!"+list.initStr+"!"+list.initStr);
Debug(0, DBG_CACHE, TAG, "node_init2: key: "+key+"!data: "+list.data+"!");

      error = (int)list.node_init.callClassMethod(obj_ref, key, list.data);
      node_obj = obj_ref.Get();
      if (error != 0) {
        if (list.node_done != null) {
          list.node_done.callClassMethod((FTCMruNodeRec)node_obj, list.data);
        }
//      FT_FREE( node );
        node_ref.Set(null);
        return error;
      }

Debug(0, DBG_CACHE, TAG, "list.nodes. "+list.nodes);

      ftbase.FTReference<FTCMruNodeRec> nodes_ref = new ftbase.FTReference<FTCMruNodeRec>();
      nodes_ref.Set(list.nodes);
      FTCMruNodeRec.FTCMruNodePrepend(nodes_ref, (FTCMruNodeRec)node_obj);
      list.nodes = nodes_ref.Get();
      list.num_nodes++;
      node_ref.Set(node_obj);
      return error;
    }

    /* =====================================================================
     * FTCMruListLookupCmp
     * =====================================================================
     */
    public static void FTCMruListLookupCmp(ftbase.FTReference<FTCMruListRec> list_ref, Object key, ftbase.FTInstanceMethod compare, FTCMruNodeRec node) {
      FTCMruListRec list = list_ref.Get();
      FTCMruNodeRec first = list.nodes;
      if (first == null) ;

    }
}

Changes to ftcache/FTCMruNodeRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
48
49
50
51
52
53
..
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
// ----------------------------------------------------------------
// FTCMruNodeRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCMruNodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public FTCMruNodeRec next = null;
    public FTCMruNodeRec prev = null;
................................................................................
    public FTCMruNodeRec() {
      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();
    }
 
    /* =====================================================================
     * FTCMruNodePrepend
     * =====================================================================
     */
    public static void FTCMruNodePrepend(FTReference<FTCMruNodeRec> nodes_ref, FTCMruNodeRec node) {
      FTCMruNodeRec first = nodes_ref.Get();
      
 
if (FTCCacheRec.cache_debug > 2) {
System.out.println("FTCMruNodePrepend"+first+"!"+node+"!");      
}
      if (first != null) {
        FTCMruNodeRec last = null;
        if (first.prev != null) {
          last = first.prev;
        }
        first.prev = node;
        if (last != null) {
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>





|







 







|
<
|



|
<












|



<
|
<




















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
31
32
33
34
35
36
37
38

39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

60

61
62
63
64
65
66
67













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCMruNodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public FTCMruNodeRec next = null;
    public FTCMruNodeRec prev = null;
................................................................................
    public FTCMruNodeRec() {
      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();
    }
 
    /* =====================================================================
     * FTCMruNodePrepend
     * =====================================================================
     */
    public static void FTCMruNodePrepend(ftbase.FTReference<FTCMruNodeRec> nodes_ref, FTCMruNodeRec node) {
      FTCMruNodeRec first = nodes_ref.Get();
      
 

Debug(0, DBG_CACHE, TAG, "FTCMruNodePrepend"+first+"!"+node+"!");

      if (first != null) {
        FTCMruNodeRec last = null;
        if (first.prev != null) {
          last = first.prev;
        }
        first.prev = node;
        if (last != null) {

Changes to ftcache/FTCNodeRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// ----------------------------------------------------------------
// FTCNodeRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /* Each cache controls one or more cache nodes.  Each node is part of    */
  /* the global_lru list of the manager.  Its `data' field however is used */
  /* as a reference count for now.                                         */
  /*                                                                       */
  /* A node can be anything, depending on the type of information held by  */
  /* the cache.  It can be an individual glyph image, a set of bitmaps     */
................................................................................
    public FTCNodeRec() {
      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();
    }

}
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>







 







|
<
|



|
<






















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
..
45
46
47
48
49
50
51
52

53
54
55
56
57

58
59
60
61
62
63
64
65
66













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /* Each cache controls one or more cache nodes.  Each node is part of    */
  /* the global_lru list of the manager.  Its `data' field however is used */
  /* as a reference count for now.                                         */
  /*                                                                       */
  /* A node can be anything, depending on the type of information held by  */
  /* the cache.  It can be an individual glyph image, a set of bitmaps     */
................................................................................
    public FTCNodeRec() {
      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();
    }

}

Changes to ftcache/FTCSBitRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



20
21
22


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

41


42
43
44
45
46
47
48
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// ----------------------------------------------------------------
// FTCSBitRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;
import org.apwtcl.gles20.batikfont.ftraster.*;

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



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


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




  /* ===================================================================== */
  /*    FTCSBitRec                                                         */
  /* <Description>                                                         */
  /*    A very compact structure used to describe a small glyph bitmap.    */
  /*                                                                       */
  /* <Fields>                                                              */
  /*    width     :: The bitmap width in pixels.                           */
................................................................................
  /*                                                                       */
  /*    yadvance  :: The vertical advance height in pixels.                */
  /*                                                                       */
  /*    buffer    :: A pointer to the bitmap pixels.                       */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public short width = 0;
    public short height = 0;
................................................................................
    public FTCSBitRec() {
      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();
    }
................................................................................
 
    /* =====================================================================
     * FTCSBitCacheLookupScaler
     * =====================================================================
     */
    public static int FTCSBitCacheLookupScaler(Object cache,
             FTCScalerRec scaler, Long load_flags, int glyphIndex,
             FTReference<FTCSBitRec> sbit_ref, FTReference<FTCNodeRec> node_ref) {
      int error = 0;
      FTCSBitRec sbit;
      FTCBasicQueryRec query = new FTCBasicQueryRec();
      FTCNodeRec node = null; /* make compiler happy */
      Object hash;

      if (node_ref != null) {
          node_ref.Set(null);
      }
      /* other argument checks delayed to FTC_Cache_Lookup */
      if (sbit_ref == null || scaler == null) {
          return FT_Error.GLYPH_INVALID_ARGUMENT;
      }
      sbit_ref.Set(null);
      /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
//      if (load_flags > FT_UINT_MAX ) {
//        FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
//        FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
//      }
      query.attrs.scaler = scaler;
      query.attrs.load_flags = load_flags.intValue();
      /* beware, the hash must be the same for all glyph ranges! */
      hash = FTCHashFuncs.FTC_BASIC_ATTR_HASH(query.attrs) + glyphIndex / FTCSNodeRec.FTC_SBIT_ITEMS_PER_NODE;
      FTReference<FTCBasicQueryRec> query_ref = new FTReference<FTCBasicQueryRec>();
      query_ref.Set(query);
System.out.println("FTCSBitCacheLookupScaler: cache: "+(FTCGCacheRec)cache+"!"+((FTCGCacheRec)cache).families+"!");
      error = FTCGCacheRec.FTCGCacheLookup((FTCGCacheRec)cache, (int)hash, glyphIndex, (FTCGQueryRec)query, node_ref);
//      FTC_GCACHE_LOOKUP_CMP(cache, ftc_basic_family_compare, FTC_SNode_Compare,
//              hash, glyphIndex, query_ref, node, error );
//      query = query_ref.Get();
      node = node_ref.Get();    
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>







 







|







 







|
<
|



|
<







 







|











|











|





















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
68
69
70
71
72
73
74
75

76
77
78
79
80

81
82
83
84
85
86
87
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126














/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCSBitRec                                                         */
  /* <Description>                                                         */
  /*    A very compact structure used to describe a small glyph bitmap.    */
  /*                                                                       */
  /* <Fields>                                                              */
  /*    width     :: The bitmap width in pixels.                           */
................................................................................
  /*                                                                       */
  /*    yadvance  :: The vertical advance height in pixels.                */
  /*                                                                       */
  /*    buffer    :: A pointer to the bitmap pixels.                       */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public short width = 0;
    public short height = 0;
................................................................................
    public FTCSBitRec() {
      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();
    }
................................................................................
 
    /* =====================================================================
     * FTCSBitCacheLookupScaler
     * =====================================================================
     */
    public static int FTCSBitCacheLookupScaler(Object cache,
             FTCScalerRec scaler, Long load_flags, int glyphIndex,
             ftbase.FTReference<FTCSBitRec> sbit_ref, ftbase.FTReference<FTCNodeRec> node_ref) {
      int error = 0;
      FTCSBitRec sbit;
      FTCBasicQueryRec query = new FTCBasicQueryRec();
      FTCNodeRec node = null; /* make compiler happy */
      Object hash;

      if (node_ref != null) {
          node_ref.Set(null);
      }
      /* other argument checks delayed to FTC_Cache_Lookup */
      if (sbit_ref == null || scaler == null) {
          return ftbase.FTError.GLYPH_INVALID_ARGUMENT;
      }
      sbit_ref.Set(null);
      /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
//      if (load_flags > FT_UINT_MAX ) {
//        FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
//        FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
//      }
      query.attrs.scaler = scaler;
      query.attrs.load_flags = load_flags.intValue();
      /* beware, the hash must be the same for all glyph ranges! */
      hash = FTCHashFuncs.FTC_BASIC_ATTR_HASH(query.attrs) + glyphIndex / FTCSNodeRec.FTC_SBIT_ITEMS_PER_NODE;
      ftbase.FTReference<FTCBasicQueryRec> query_ref = new ftbase.FTReference<FTCBasicQueryRec>();
      query_ref.Set(query);
System.out.println("FTCSBitCacheLookupScaler: cache: "+(FTCGCacheRec)cache+"!"+((FTCGCacheRec)cache).families+"!");
      error = FTCGCacheRec.FTCGCacheLookup((FTCGCacheRec)cache, (int)hash, glyphIndex, (FTCGQueryRec)query, node_ref);
//      FTC_GCACHE_LOOKUP_CMP(cache, ftc_basic_family_compare, FTC_SNode_Compare,
//              hash, glyphIndex, query_ref, node, error );
//      query = query_ref.Get();
      node = node_ref.Get();    

Changes to ftcache/FTCSFamilyClassRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// ----------------------------------------------------------------
// FTCSFamilyClassRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCSFamilyClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSFamilyClassRec extends FTCMruListClassRec {
    private static int oid = 0;

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

    public TTInstanceMethod family_get_count = null;
    public TTInstanceMethod family_load_glyph = null;

    /* ==================== FTCSFamilyClassRec ================================== */
    public FTCSFamilyClassRec(String initStr) {
      super(initStr);
      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();
    }
 
    /* =====================================================================
     * =====================================================================
     */

}
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>











|
|










|
<
|



|
<








<
<
<
|
<













1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44

45
46
47
48
49
50
51
52



53














/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCSFamilyClassRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSFamilyClassRec extends FTCMruListClassRec {
    private static int oid = 0;

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

    public ftbase.FTInstanceMethod family_get_count = null;
    public ftbase.FTInstanceMethod family_load_glyph = null;

    /* ==================== FTCSFamilyClassRec ================================== */
    public FTCSFamilyClassRec(String initStr) {
      super(initStr);
      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();
    }
 



}

Changes to ftcache/FTCSNodeRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
..
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
// ----------------------------------------------------------------
// FTCSNodeRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCSNodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSNodeRec extends FTCGNodeRec {
    private static int oid = 0;
................................................................................
      for (int i = 0; i < FTC_SBIT_ITEMS_PER_NODE; i++) {
        sbits[i] = new FTCSBitRec();
      }
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

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

}
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>







 







|
<
|



|
<








<
<
<
|
<













1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
..
36
37
38
39
40
41
42
43

44
45
46
47
48

49
50
51
52
53
54
55
56



57














/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCSNodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSNodeRec extends FTCGNodeRec {
    private static int oid = 0;
................................................................................
      for (int i = 0; i < FTC_SBIT_ITEMS_PER_NODE; i++) {
        sbits[i] = new FTCSBitRec();
      }
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

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

    }

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



}

Changes to ftcache/FTCScalerRec.java.

1
2
3

4
5




6
7
8


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// ----------------------------------------------------------------
// FTCScalerRec.java --
//

// Copyright (c) 2014 by Arnulf P. Wiedemann
//




// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------



package ftcache;

import android.util.Log;

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

  /* ===================================================================== */
  /*    FTCScalerRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to describe a given character size in either      */
  /*    pixels or points to the cache manager.  See                        */
  /*    @FTC_Manager_LookupSize.                                           */
................................................................................
  /*                                                                       */
  /* <Note>                                                                */
  /*    This type is mainly used to retrieve @FT_Size objects through the  */
  /*    cache manager.                                                     */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public Object face_id = null;
    public int width = 0;
................................................................................
    public FTCScalerRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * ftc_scaler_lookup_size
     * =====================================================================
     */
    public static int ftc_scaler_lookup_size(FTCManagerRec manager, FTCScalerRec scaler, FTReference<FTSizeRec> size_ref) {
      int error = 0;
      FTFaceRec face;
      FTSizeRec size = null;

if (FTCCacheRec.cache_debug > 2) {
System.out.println("ftc_scaler_lookup_size");
}
      FTReference<FTFaceRec> face_ref = new FTReference<FTFaceRec>();

      error = FTCManagerRec.FTCManagerLookupFace(manager, scaler.face_id, face_ref);
      face = face_ref.Get();
      if (error != 0) {
        size_ref.Set(size);
        return error;
      }
      error = FTSizeRec.FTNewSize(face, size_ref);
      size = size_ref.Get();
      if (error != 0) {
        size_ref.Set(size);
        return error;
      }
      FTSizeRec.FTActivateSize(size);
      if (scaler.pixel != 0) {
        Log.w(TAG, "FTSetPixelSizes not yet implemented!!");
//        error = FTSetPixelSizes(face, scaler.width, scaler.height);
      } else {
        error = FTSizeRec.FTSetCharSize(face, scaler.width, scaler.height, scaler.x_res, scaler.y_res);
      }
      if (error != 0) {
//        FTSizeRec.FTDoneSize(size);
        size = null;
      }
      size_ref.Set(face.size);
      return error;
    }

}
|
|
<
>
|
<
>
>
>
>
|
|
<
>
>





<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|







 







|
<
|



|
<












|

|
|

<
|
<
<
>






|





|




|










1
2

3
4

5
6
7
8
9
10

11
12
13
14
15
16
17



























18
19
20
21
22
23
24
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
..
63
64
65
66
67
68
69
70

71
72
73
74
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

93


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* =====================================================================
 *  This Java implementation is derived from FreeType code

 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.

 *
 *  Copyright (C) of the Java implementation 2014
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.

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

package ftcache;

import android.util.Log;




























  /* ===================================================================== */
  /*    FTCScalerRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to describe a given character size in either      */
  /*    pixels or points to the cache manager.  See                        */
  /*    @FTC_Manager_LookupSize.                                           */
................................................................................
  /*                                                                       */
  /* <Note>                                                                */
  /*    This type is mainly used to retrieve @FT_Size objects through the  */
  /*    cache manager.                                                     */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public Object face_id = null;
    public int width = 0;
................................................................................
    public FTCScalerRec() {
      oid++;
      id = oid;
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

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

    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * ftc_scaler_lookup_size
     * =====================================================================
     */
    public static int ftc_scaler_lookup_size(FTCManagerRec manager, FTCScalerRec scaler, ftbase.FTReference<ftbase.FTSizeRec> size_ref) {
      int error = 0;
      ftbase.FTFaceRec face;
      ftbase.FTSizeRec size = null;


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


      ftbase.FTReference<ftbase.FTFaceRec> face_ref = new ftbase.FTReference<ftbase.FTFaceRec>();
      error = FTCManagerRec.FTCManagerLookupFace(manager, scaler.face_id, face_ref);
      face = face_ref.Get();
      if (error != 0) {
        size_ref.Set(size);
        return error;
      }
      error = ftbase.FTSizeRec.FTNewSize(face, size_ref);
      size = size_ref.Get();
      if (error != 0) {
        size_ref.Set(size);
        return error;
      }
      ftbase.FTSizeRec.FTActivateSize(size);
      if (scaler.pixel != 0) {
        Log.w(TAG, "FTSetPixelSizes not yet implemented!!");
//        error = FTSetPixelSizes(face, scaler.width, scaler.height);
      } else {
        error = ftbase.FTSizeRec.FTSetCharSize(face, scaler.width, scaler.height, scaler.x_res, scaler.y_res);
      }
      if (error != 0) {
//        FTSizeRec.FTDoneSize(size);
        size = null;
      }
      size_ref.Set(face.size);
      return error;
    }

}

Changes to ftcache/FTCSizeListClass.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
..
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
// ----------------------------------------------------------------
// FTCSizeListClass.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCSizeListClass                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSizeListClass extends FTCMruListClassRec {
    private static int oid = 0;
................................................................................
    /* ==================== FTCSizeListClass ================================== */
    public FTCSizeListClass() {
      super("FTCSizeListClass");
      oid++;
      id = oid;
      String class_name = "org.apwtcl.gles20.truetype.FTCSizeListFuncs";
      this.node_type = NODE_TYPE_FTC_SIZE_NODE_REC;
      this.node_compare = new TTInstanceMethod(class_name, "ftc_size_node_compare", 1);
      this.node_init    = new TTInstanceMethod(class_name, "ftc_size_node_init", 1);
      this.node_reset   = new TTInstanceMethod(class_name, "ftc_size_node_reset", 1);
      this.node_done    = new TTInstanceMethod(class_name, "ftc_size_node_done", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

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

>
>







 







|
|
|
|




|
<
|



|
<






















1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
..
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













/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCSizeListClass                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSizeListClass extends FTCMruListClassRec {
    private static int oid = 0;
................................................................................
    /* ==================== FTCSizeListClass ================================== */
    public FTCSizeListClass() {
      super("FTCSizeListClass");
      oid++;
      id = oid;
      String class_name = "org.apwtcl.gles20.truetype.FTCSizeListFuncs";
      this.node_type = NODE_TYPE_FTC_SIZE_NODE_REC;
      this.node_compare = new ftbase.FTInstanceMethod(class_name, "ftc_size_node_compare", 1);
      this.node_init    = new ftbase.FTInstanceMethod(class_name, "ftc_size_node_init", 1);
      this.node_reset   = new ftbase.FTInstanceMethod(class_name, "ftc_size_node_reset", 1);
      this.node_done    = new ftbase.FTInstanceMethod(class_name, "ftc_size_node_done", 1);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

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

    }

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

Changes to ftcache/FTCSizeNodeRec.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
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
// ----------------------------------------------------------------
// FTCSizeNodeRec.java --
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftcache;

//import android.util.Log;

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



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


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




  /* ===================================================================== */
  /*    FTCSizeNodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSizeNodeRec extends FTCMruNodeRec {
    private static int oid = 0;

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

    public FTSizeRec size = null;
    public FTCScalerRec scaler = null;

    /* ==================== FTCSizeNodeRec ================================== */
    public FTCSizeNodeRec() {
      oid++;
      id = oid;
    }
................................................................................
    /* ==================== FTCSizeNodeRec ================================== */
    public FTCSizeNodeRec(FTCMruNodeRec node) {
      oid++;
      id = oid;
      
      this.next = node.next;
      this.prev = node.prev;;
      size = new FTSizeRec();
      scaler = new FTCScalerRec();
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

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

}
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
>
>
>
|
<
<
>
>
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>

>
>











|







 







|





|
<
|



|
<








<
<
<
|
<













1
2



3
4
5
6


7
8
9
10















11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
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














/* =====================================================================
 *  This Java implementation is derived from FreeType code



 *  Portions of this software are copyright (C) 2014 The FreeType
 *  Project (www.freetype.org).  All rights reserved.
 *
 *  Copyright (C) of the Java implementation 2014


 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.















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

package ftcache;

  /* ===================================================================== */
  /*    FTCSizeNodeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class FTCSizeNodeRec extends FTCMruNodeRec {
    private static int oid = 0;

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

    public ftbase.FTSizeRec size = null;
    public FTCScalerRec scaler = null;

    /* ==================== FTCSizeNodeRec ================================== */
    public FTCSizeNodeRec() {
      oid++;
      id = oid;
    }
................................................................................
    /* ==================== FTCSizeNodeRec ================================== */
    public FTCSizeNodeRec(FTCMruNodeRec node) {
      oid++;
      id = oid;
      
      this.next = node.next;
      this.prev = node.prev;;
      size = new ftbase.FTSizeRec();
      scaler = new FTCScalerRec();
    }
    
    /* ==================== 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();
    }
 



}

Name change from ftsfnt/TTCHeaderRec.java to fttruetype/TTCHeaderRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTCHeaderRec                                                       */
  /*                                                                       */
  /* <Description>                                                         */
  /*    TrueType collection header.  This table contains the offsets of    */
  /*    the font headers of each distinct TrueType face in the file.       */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCHeaderRec                                                       */
  /*                                                                       */
  /* <Description>                                                         */
  /*    TrueType collection header.  This table contains the offsets of    */
  /*    the font headers of each distinct TrueType face in the file.       */

Name change from ftbase/TTCallRec.java to fttruetype/TTCallRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTCallRec                                                          */
  /*                                                                       */
  /* This class defines a call record, used to manage function calls.      */
  /* ===================================================================== */



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

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








|






>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCallRec                                                          */
  /*                                                                       */
  /* This class defines a call record, used to manage function calls.      */
  /* ===================================================================== */

import ftbase.FTDebug;

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

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

Name change from ftbase/TTCodeRange.java to fttruetype/TTCodeRange.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTCodeRange                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCodeRange extends Object {







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTCodeRange                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTCodeRange extends Object {

Name change from ftbase/TTDefRec.java to fttruetype/TTDefRec.java.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftbase;

//import android.util.Log;

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







|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package fttruetype;

//import android.util.Log;

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

Name change from ftbase/TTDefaultGraphicsStateClass.java to fttruetype/TTDefaultGraphicsStateClass.java.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftbase;

//import android.util.Log;

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







|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package fttruetype;

//import android.util.Log;

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

Name change from ftbase/TTDriverClass.java to fttruetype/TTDriverClass.java.

7
8
9
10
11
12
13
14
15
16
17
18
19




20
21
22
23
24
25
26
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTDriverClass                                                          */
  /*                                                                       */
  /* ===================================================================== */





public class TTDriverClass extends FTDriverClassRec {
    private static int oid = 0;

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








|





>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTDriverClass                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTDriverClassRec;
import ftbase.FTInstanceMethod;
import ftbase.FTModuleClassRec;

public class TTDriverClass extends FTDriverClassRec {
    private static int oid = 0;

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

Name change from ftbase/TTDriverRec.java to fttruetype/TTDriverRec.java.

7
8
9
10
11
12
13
14
15
16







17
18
19
20
21
22
23
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;








  /* ===================================================================== */
  /*    TTDriverRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTDriverRec extends FTDriverRec {







|


>
>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import android.util.Log;

import ftbase.FTDriverClassRec;
import ftbase.FTDriverRec;
import ftbase.FTGlyphLoaderRec;
import ftbase.FTLibraryRec;
import ftbase.FTModuleClassRec;
import ftbase.FTReference;

  /* ===================================================================== */
  /*    TTDriverRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

public class TTDriverRec extends FTDriverRec {

Name change from ftbase/TTExecContextRec.java to fttruetype/TTExecContextRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19



20
21
22
23
24
25
26
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTExecContextRec                                                          */
  /*                                                                       */
  /* ===================================================================== */




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

    private int id;
    private static String TAG = "TTExecContextRec";
    private final static int MAX_STACK_SIZE = 32;







|





>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTExecContextRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTInstanceMethod;
import ftbase.FTSizeMetricsRec;

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

    private int id;
    private static String TAG = "TTExecContextRec";
    private final static int MAX_STACK_SIZE = 32;

Name change from ftbase/TTFaceRec.java to fttruetype/TTFaceRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
202
203
204
205
206
207
208




209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
...
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTFaceRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    The TrueType face class.  These objects model the resolution and   */
  /*    point-size independent data found in a TrueType font file.         */
................................................................................
  /*    extra                :: Reserved for third-party font drivers.     */
  /*                                                                       */
  /*    postscript_name      :: The PS name of the font.  Used by the      */
  /*                            postscript name service.                   */
  /*                                                                       */
  /* ===================================================================== */





public class TTFaceRec extends FTFaceRec {
    private static int oid = 0;

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

    public ftsfnt.TTCHeaderRec ttc_header = null;
    public long format_tag = 0L;
    public short num_tables = 0;
    public ftsfnt.TTTableRec[] dir_tables = null;
    public ftsfnt.TTHeaderRec header = null;           /* TrueType header table          */
    public ftsfnt.TTHoriHeader horizontal = null;   /* TrueType horizontal header     */
    public TTMaxProfile max_profile = null;
    public boolean vertical_info = false;
    public ftsfnt.TTVertHeader vertical = null;     /* TT Vertical header, if present */
    public short num_names = 0;              /* number of name records  */
    public TTNameTableRec name_table = null; /* name table              */
    public ftsfnt.TTOS2 os2 = null;                 /* TrueType OS/2 table            */
    public ftsfnt.TTPostscript postscript = null;   /* TrueType Postscript table      */
    public byte[] cmap_table = null;   /* extracted `cmap' table */
    public long cmap_size = 0L;
    public FTInstanceMethod goto_table = null;
    public FTInstanceMethod access_glyph_frame = null;
    public FTInstanceMethod forget_glyph_frame = null;
    public FTInstanceMethod read_glyph_header = null;
    public FTInstanceMethod read_simple_glyph = null;
................................................................................
    public Object[] psnames = null;
    /* ===================================================================== */
    /*                                                                       */
    /* Optional TrueType/OpenType tables                                     */
    /*                                                                       */
    /* ===================================================================== */
    /* grid-fitting and scaling table */
    public ftsfnt.TTGaspRec gasp = null;                 /* the `gasp' table */
    /* PCL 5 table */
    public ftsfnt.TTPCLT pclt = null;
    /* embedded bitmaps support */
    public long num_sbit_scales = 0L;
//    public TTSBitScale sbit_scales = null;
    /* postscript names table */
//    public TTPostNamesRec postscript_names = null;
    /* ===================================================================== */
    /*                                                                     */
................................................................................
    public long vert_metrics_offset = 0L;
 
    /* ==================== TTFaceRec ================================== */
    public TTFaceRec() {
      super("TTFaceRec");
      oid++;
      id = oid; 
      ttc_header = new ftsfnt.TTCHeaderRec();
      header = new ftsfnt.TTHeaderRec();
Debug(0, DBG_INIT, TAG, "ttface1: "+cvt+"!"+mySelf()+"!");
    }
        
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }







|







 







>
>
>
>






|


|
|
|


|


|
|







 







|

|







 







|
|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
...
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
...
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTFaceRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    The TrueType face class.  These objects model the resolution and   */
  /*    point-size independent data found in a TrueType font file.         */
................................................................................
  /*    extra                :: Reserved for third-party font drivers.     */
  /*                                                                       */
  /*    postscript_name      :: The PS name of the font.  Used by the      */
  /*                            postscript name service.                   */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTFaceRec;
import ftbase.FTInstanceMethod;
import ftbase.FTModuleInterface;

public class TTFaceRec extends FTFaceRec {
    private static int oid = 0;

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

    public TTCHeaderRec ttc_header = null;
    public long format_tag = 0L;
    public short num_tables = 0;
    public TTTableRec[] dir_tables = null;
    public TTHeaderRec header = null;           /* TrueType header table          */
    public TTHoriHeader horizontal = null;   /* TrueType horizontal header     */
    public TTMaxProfile max_profile = null;
    public boolean vertical_info = false;
    public TTVertHeader vertical = null;     /* TT Vertical header, if present */
    public short num_names = 0;              /* number of name records  */
    public TTNameTableRec name_table = null; /* name table              */
    public TTOS2 os2 = null;                 /* TrueType OS/2 table            */
    public TTPostscript postscript = null;   /* TrueType Postscript table      */
    public byte[] cmap_table = null;   /* extracted `cmap' table */
    public long cmap_size = 0L;
    public FTInstanceMethod goto_table = null;
    public FTInstanceMethod access_glyph_frame = null;
    public FTInstanceMethod forget_glyph_frame = null;
    public FTInstanceMethod read_glyph_header = null;
    public FTInstanceMethod read_simple_glyph = null;
................................................................................
    public Object[] psnames = null;
    /* ===================================================================== */
    /*                                                                       */
    /* Optional TrueType/OpenType tables                                     */
    /*                                                                       */
    /* ===================================================================== */
    /* grid-fitting and scaling table */
    public TTGaspRec gasp = null;                 /* the `gasp' table */
    /* PCL 5 table */
    public TTPCLT pclt = null;
    /* embedded bitmaps support */
    public long num_sbit_scales = 0L;
//    public TTSBitScale sbit_scales = null;
    /* postscript names table */
//    public TTPostNamesRec postscript_names = null;
    /* ===================================================================== */
    /*                                                                     */
................................................................................
    public long vert_metrics_offset = 0L;
 
    /* ==================== TTFaceRec ================================== */
    public TTFaceRec() {
      super("TTFaceRec");
      oid++;
      id = oid; 
      ttc_header = new TTCHeaderRec();
      header = new TTHeaderRec();
Debug(0, DBG_INIT, TAG, "ttface1: "+cvt+"!"+mySelf()+"!");
    }
        
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";
    }

Name change from ftsfnt/TTGaspRangeRec.java to fttruetype/TTGaspRangeRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTGaspRangeRec                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A tiny structure used to model a gasp range according to the       */
  /*    TrueType specification.                                            */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTGaspRangeRec                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A tiny structure used to model a gasp range according to the       */
  /*    TrueType specification.                                            */

Name change from ftsfnt/TTGaspRec.java to fttruetype/TTGaspRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTGaspRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure modeling the TrueType `gasp' table used to specify     */
  /*    grid-fitting and anti-aliasing behaviour.                          */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTGaspRec                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure modeling the TrueType `gasp' table used to specify     */
  /*    grid-fitting and anti-aliasing behaviour.                          */

Name change from ftbase/TTGlyphZoneRec.java to fttruetype/TTGlyphZoneRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
40
41
42
43
44
45
46






47
48
49
50
51
52
53
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTGlyphZoneRec                                                     */
 /*                                                                       */
  /*  <Description>                                                        */
  /*     A glyph zone is used to load, scale and hint glyph outline        */
  /*     coordinates.                                                      */
................................................................................
  /*                                                                       */
  /*     contours     :: The contours end points.                          */
  /*                                                                       */
  /*     first_point  :: Offset of the current subglyph's first point.     */
  /*                                                                       */
  /* ===================================================================== */







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

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

//    FT_Memory memory;







|







 







>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTGlyphZoneRec                                                     */
 /*                                                                       */
  /*  <Description>                                                        */
  /*     A glyph zone is used to load, scale and hint glyph outline        */
  /*     coordinates.                                                      */
................................................................................
  /*                                                                       */
  /*     contours     :: The contours end points.                          */
  /*                                                                       */
  /*     first_point  :: Offset of the current subglyph's first point.     */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTDebug;
import ftbase.FTGlyphLoadRec;
import ftbase.FTGlyphLoaderRec;
import ftbase.FTReference;
import ftbase.FTVectorRec;

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

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

//    FT_Memory memory;

Name change from ftbase/TTGraphicsStateRec.java to fttruetype/TTGraphicsStateRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25



26
27
28
29
30
31
32
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTGraphicsStateRec                                                    */
  /*                                                                       */
  /* <Struct>                                                              */
  /*    TTGraphicsStateRec                                                    */
  /*                                                                       */
  /* <Description>                                                         */
  /*    The TrueType graphics state used during bytecode interpretation.   */
  /* ===================================================================== */




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

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

    public short rp0;







|











>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTGraphicsStateRec                                                    */
  /*                                                                       */
  /* <Struct>                                                              */
  /*    TTGraphicsStateRec                                                    */
  /*                                                                       */
  /* <Description>                                                         */
  /*    The TrueType graphics state used during bytecode interpretation.   */
  /* ===================================================================== */

import ftbase.FTDebug;
import ftbase.FTVectorRec;

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

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

    public short rp0;

Name change from ftsfnt/TTHeaderRec.java to fttruetype/TTHeaderRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTHeaderRec                                                           */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType font header table.  All       */
  /*    fields follow the TrueType specification.                          */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTHeaderRec                                                           */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType font header table.  All       */
  /*    fields follow the TrueType specification.                          */

Name change from ftsfnt/TTHoriHeader.java to fttruetype/TTHoriHeader.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTHoriHeader                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType horizontal header, the `hhea' */
  /*    table, as well as the corresponding horizontal metrics table,      */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTHoriHeader                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType horizontal header, the `hhea' */
  /*    table, as well as the corresponding horizontal metrics table,      */

Name change from ftbase/TTInterpBase.java to fttruetype/TTInterpBase.java.

7
8
9
10
11
12
13
14
15
16
17
18



19
20
21
22
23
24
25
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;




  /* ===================================================================== */
  /*    TTInterpBase                                                       */
  /*                                                                       */
  /* ===================================================================== */

public class TTInterpBase extends FTDebug {







|




>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;

import ftbase.FTDebug;
import ftbase.FTError;

  /* ===================================================================== */
  /*    TTInterpBase                                                       */
  /*                                                                       */
  /* ===================================================================== */

public class TTInterpBase extends FTDebug {

Name change from ftbase/TTInterpFuncs3.java to fttruetype/TTInterpFuncs3.java.

7
8
9
10
11
12
13
14
15
16




17
18
19
20
21
22
23
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;




  /* ===================================================================== */
  /*    TTInterpFuncs3                                                        */
  /*                                                                       */
  /* ===================================================================== */

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







|


>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import android.util.Log;

import ftbase.FTCalc;
import ftbase.FTDebug;
import ftbase.FTGlyphLoaderRec;
  /* ===================================================================== */
  /*    TTInterpFuncs3                                                        */
  /*                                                                       */
  /* ===================================================================== */

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

Name change from ftbase/TTInterpInsFuncs1.java to fttruetype/TTInterpInsFuncs1.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20




21
22
23
24
25
26
27
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTInterpInsFuncs1                                                          */
  /*                                                                       */
  /* ===================================================================== */





public class TTInterpInsFuncs1 extends TTInterpOpcodeFuncs1 {
    private static int oid = 0;

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

    /* ==================== TTInterpInsFuncs1 ================================== */







|






>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTInterpInsFuncs1                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTError;
import ftbase.FTReference;
import ftbase.FTVectorRec;

public class TTInterpInsFuncs1 extends TTInterpOpcodeFuncs1 {
    private static int oid = 0;

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

    /* ==================== TTInterpInsFuncs1 ================================== */

Name change from ftbase/TTInterpInsFuncs2.java to fttruetype/TTInterpInsFuncs2.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20






21
22
23
24
25
26
27
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTInterpInsFuncs2                                                          */
  /*                                                                       */
  /* ===================================================================== */







public class TTInterpInsFuncs2 extends TTInterpInsFuncs1 {
    private static int oid = 0;

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

    /* ==================== TTInterpInsFuncs2 ================================== */







|






>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTInterpInsFuncs2                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTCalc;
import ftbase.FTError;
import ftbase.FTReference;
import ftbase.FTVectorRec;
import ftbase.IUPWorkerRec;

public class TTInterpInsFuncs2 extends TTInterpInsFuncs1 {
    private static int oid = 0;

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

    /* ==================== TTInterpInsFuncs2 ================================== */

Name change from ftbase/TTInterpOpcodeFuncs1.java to fttruetype/TTInterpOpcodeFuncs1.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20





21
22
23
24
25
26
27
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTInterpOpcodeFuncs1                                                          */
  /*                                                                       */
  /* ===================================================================== */






public class TTInterpOpcodeFuncs1 extends TTInterpBase {
    private static int oid = 0;

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

    /* ==================== TTInterpOpcodeFuncs1 ================================== */
................................................................................
     *    Returns FAILURE if a vector parameter is zero.
     *
     * <Note>
     *    In case Vx and Vy are both zero, Normalize() returns SUCCESS, and
     *    R is undefined.
     * ====================================================================
     */
    public static boolean Normalize(Long Vx, Long Vy, FTReference<FTVectorRec>  R_ref) {
      Long  W;
      FTVectorRec R = R_ref.Get();

Debug(0, DBG_INTERP, TAG, String.format("Normalize: Vx: %d, vy: %d", Vx, Vy));
      if (FTCalc.FT_ABS(Vx) < 0x4000L && FTCalc.FT_ABS(Vy) < 0x4000L) {
        if (Vx == 0 && Vy == 0) {
          /* XXX: UNDOCUMENTED! It seems that it is possible to try   */







|






>
>
>
>
>







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTInterpOpcodeFuncs1                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTCalc;
import ftbase.FTError;
import ftbase.FTReference;
import ftbase.FTVectorRec;

public class TTInterpOpcodeFuncs1 extends TTInterpBase {
    private static int oid = 0;

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

    /* ==================== TTInterpOpcodeFuncs1 ================================== */
................................................................................
     *    Returns FAILURE if a vector parameter is zero.
     *
     * <Note>
     *    In case Vx and Vy are both zero, Normalize() returns SUCCESS, and
     *    R is undefined.
     * ====================================================================
     */
    public static boolean Normalize(Long Vx, Long Vy, FTReference<FTVectorRec> R_ref) {
      Long  W;
      FTVectorRec R = R_ref.Get();

Debug(0, DBG_INTERP, TAG, String.format("Normalize: Vx: %d, vy: %d", Vx, Vy));
      if (FTCalc.FT_ABS(Vx) < 0x4000L && FTCalc.FT_ABS(Vy) < 0x4000L) {
        if (Vx == 0 && Vy == 0) {
          /* XXX: UNDOCUMENTED! It seems that it is possible to try   */

Name change from ftbase/TTInterpRun.java to fttruetype/TTInterpRun.java.

7
8
9
10
11
12
13
14
15
16
17
18
19






20
21
22
23
24
25
26
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTInterpRun                                                          */
  /*                                                                       */
  /* ===================================================================== */







public class TTInterpRun extends TTInterpInsFuncs2 {
    private static int oid = 0;

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








|





>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTInterpRun                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTError;
import ftbase.FTGlyphLoaderRec;
import ftbase.FTInstanceMethod;
import ftbase.FTReference;
import ftbase.FTTrace;

public class TTInterpRun extends TTInterpInsFuncs2 {
    private static int oid = 0;

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

Name change from ftbase/TTLoaderRec.java to fttruetype/TTLoaderRec.java.

7
8
9
10
11
12
13
14
15
16















17
18
19
20
21
22
23
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;















  /* ===================================================================== */
  /*    TTLoaderRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public FTFaceRec face = null;
    public FTSizeRec size = null;
    public FTGlyphSlotRec glyph = null;
    public FTGlyphLoaderRec  gloader = null;
    public long load_flags = 0L;
    public int glyph_index = 0;
    public FTStreamRec stream = null;
    public int byte_len = 0;
    public short n_contours = 0;
    public FTBBoxRec bbox = null;
    public int left_bearing = 0;
................................................................................
      }
      /* seek to the beginning of the glyph table -- for Type 42 fonts     */
      /* the table might be accessed from a Postscript stream or something */
      /* else...                                                           */
      {
        FTReference<Long> length_ref = new FTReference<Long>();
        length_ref.Set(new Long(0));
        int error = (int)face.goto_table.callClassMethod(face, TTSfntLoad.TTAG_glyf, face.stream, length_ref);

        if (error == FTError.GLYPH_TABLE_MISSING) {
          loader.glyf_offset = 0L;
        } else {
          if (error != 0) {
            Log.e(TAG, "tt_loader_init: could not access glyph table");
            return error;







|


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







 







|







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import android.util.Log;

import ftbase.FTBBoxRec;
import ftbase.FTDebug;
import ftbase.FTError;
import ftbase.FTFaceRec;
import ftbase.FTGlyphLoaderFlags;
import ftbase.FTGlyphLoaderRec;
import ftbase.FTGlyphSlotRec;
import ftbase.FTReference;
import ftbase.FTRendererRec;
import ftbase.FTSizeRec;
import ftbase.FTStreamRec;
import ftbase.FTSubGlyphRec;
import ftbase.FTTrace;
import ftbase.FTVectorRec;
  /* ===================================================================== */
  /*    TTLoaderRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

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

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

    public FTFaceRec face = null;
    public FTSizeRec size = null;
    public FTGlyphSlotRec glyph = null;
    public FTGlyphLoaderRec gloader = null;
    public long load_flags = 0L;
    public int glyph_index = 0;
    public FTStreamRec stream = null;
    public int byte_len = 0;
    public short n_contours = 0;
    public FTBBoxRec bbox = null;
    public int left_bearing = 0;
................................................................................
      }
      /* seek to the beginning of the glyph table -- for Type 42 fonts     */
      /* the table might be accessed from a Postscript stream or something */
      /* else...                                                           */
      {
        FTReference<Long> length_ref = new FTReference<Long>();
        length_ref.Set(new Long(0));
        int error = (int)face.goto_table.callClassMethod(face, fttruetype.TTSfntLoad.TTAG_glyf, face.stream, length_ref);

        if (error == FTError.GLYPH_TABLE_MISSING) {
          loader.glyf_offset = 0L;
        } else {
          if (error != 0) {
            Log.e(TAG, "tt_loader_init: could not access glyph table");
            return error;

Name change from ftbase/TTMaxProfile.java to fttruetype/TTMaxProfile.java.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
99
100
101
102
103
104
105




106
107
108
109
110
111
112
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftbase;

//import android.util.Log;

/* ======================================================================= */
/*  This Java implementation is derived from the Freetype code             */
/*  and has been implemented to work together with the Apache batik code   */
/*  for reading .ttf font files                                             */
................................................................................
  /*    maxComponentDepth     :: The maximum nesting depth of composite    */
  /*                             glyphs.                                   */
  /*                                                                       */
  /* <Note>                                                                */
  /*    This structure is only used during font loading.                   */
  /*                                                                       */
  /* ===================================================================== */





public class TTMaxProfile extends FTFrameRead {
    private static int oid = 0;

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








|







 







>
>
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package fttruetype;

//import android.util.Log;

/* ======================================================================= */
/*  This Java implementation is derived from the Freetype code             */
/*  and has been implemented to work together with the Apache batik code   */
/*  for reading .ttf font files                                             */
................................................................................
  /*    maxComponentDepth     :: The maximum nesting depth of composite    */
  /*                             glyphs.                                   */
  /*                                                                       */
  /* <Note>                                                                */
  /*    This structure is only used during font loading.                   */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTFrameRead;
import ftbase.FTInit;
import ftbase.FTStreamRec;

public class TTMaxProfile extends FTFrameRead {
    private static int oid = 0;

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

Name change from ftbase/TTNameEntryRec.java to fttruetype/TTNameEntryRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
35
36
37
38
39
40
41



42
43
44
45
46
47
48
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTNameEntryRec                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure modeling TrueType name records.  Name records are used */
  /*    to store important strings like family name, style name,           */
................................................................................
  /*                                                                       */
  /*    stringOffset :: The offset to the string in the `name' table.      */
  /*                                                                       */
  /*    string       :: A pointer to the string's bytes.  Note that these  */
  /*                    are usually UTF-16 encoded characters.             */
  /*                                                                       */
  /* ===================================================================== */




public class TTNameEntryRec extends FTFrameRead {
    private static int oid = 0;

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








|







 







>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTNameEntryRec                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure modeling TrueType name records.  Name records are used */
  /*    to store important strings like family name, style name,           */
................................................................................
  /*                                                                       */
  /*    stringOffset :: The offset to the string in the `name' table.      */
  /*                                                                       */
  /*    string       :: A pointer to the string's bytes.  Note that these  */
  /*                    are usually UTF-16 encoded characters.             */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTFrameRead;
import ftbase.FTStreamRec;

public class TTNameEntryRec extends FTFrameRead {
    private static int oid = 0;

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

Name change from ftbase/TTNameTableRec.java to fttruetype/TTNameTableRec.java.

7
8
9
10
11
12
13
14
15
16



17
18
19
20
21
22
23
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;




  /* ===================================================================== */
  /*    TTNameTableRec                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure modeling the TrueType name table.                      */
  /*                                                                       */







|


>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import android.util.Log;

import ftbase.FTFrameRead;
import ftbase.FTStreamRec;

  /* ===================================================================== */
  /*    TTNameTableRec                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure modeling the TrueType name table.                      */
  /*                                                                       */

Name change from ftsfnt/TTOS2.java to fttruetype/TTOS2.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTOS2                                                              */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType OS/2 table. This is the long  */
  /*    table version.  All fields comply to the TrueType specification.   */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTOS2                                                              */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType OS/2 table. This is the long  */
  /*    table version.  All fields comply to the TrueType specification.   */

Name change from ftsfnt/TTPCLT.java to fttruetype/TTPCLT.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTPCLT                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType PCLT table.  All fields       */
  /*    comply to the TrueType specification.                              */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTPCLT                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType PCLT table.  All fields       */
  /*    comply to the TrueType specification.                              */

Name change from ftsfnt/TTPostscript.java to fttruetype/TTPostscript.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTPostscript                                                       */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType PostScript table.  All fields */
  /*    comply to the TrueType specification.  This structure does not     */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTPostscript                                                       */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType PostScript table.  All fields */
  /*    comply to the TrueType specification.  This structure does not     */

Name change from ftbase/TTSizeFuncs.java to fttruetype/TTSizeFuncs.java.

7
8
9
10
11
12
13
14
15
16











17
18
19
20
21
22
23
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

import android.util.Log;











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

public class TTSizeFuncs extends FTDebug {
    private static int oid = 0;
................................................................................
      }
      /* This bit flag, if set, indicates that the ppems must be       */
      /* rounded to integers.  Nearly all TrueType fonts have this bit */
      /* set, as hinting won't work really well otherwise.             */
      /*                                                               */
Debug(0, DBG_LOAD_GLYPH, TAG, "face.header.flags: "+(face.header.Flags & 8)+"!");
      if ((face.header.Flags & 8) != 0) {
        size.metrics.x_scale = FTCalc.FTDivFix((long)(size.metrics.x_ppem << 6),
                                      (long)face.units_per_EM);
        size.metrics.y_scale = FTCalc.FTDivFix((long)(size.metrics.y_ppem << 6),
                                      (long)face.units_per_EM );

        size.metrics.ascender = 
                FTCalc.FT_PIX_ROUND(FTCalc.FTMulFix((long)face.ascender, (long)size.metrics.y_scale));
        size.metrics.descender = 
                FTCalc.FT_PIX_ROUND(FTCalc.FTMulFix((long)face.descender, (long)size.metrics.y_scale));
................................................................................
      }
      size.twilight.n_points = n_twilight;
      size.GS = new TTDefaultGraphicsStateClass();
      /* set `face.interpreter' according to the debug hook present */
      {
//        FTLibraryRec library = face.driver.library;

        String class_name = "org.apwtcl.apwfreetype.ftbase.TTInterpRun";
//        face.interpreter = (TTInterpRun) library.debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
        if (face.interpreter == null) {
          face.interpreter = new FTInstanceMethod(class_name, "TTRunIns", 1);
        }
      }
      /* Fine, now run the font program! */
      error = tt_size_run_fpgm(size, pedantic);







|


>
>
>
>
>
>
>
>
>
>
>







 







|
|







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
...
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

import android.util.Log;

import ftbase.FTCalc;
import ftbase.FTDebug;
import ftbase.FTError;
import ftbase.FTFaceRec;
import ftbase.FTInstanceMethod;
import ftbase.FTReference;
import ftbase.FTSizeMetricsRec;
import ftbase.FTSizeRec;
import ftbase.FTSizeRequestRec;
import ftbase.FTTrace;
  /* ===================================================================== */
  /*    TTSizeFuncs                                                        */
  /*                                                                       */
  /* ===================================================================== */

public class TTSizeFuncs extends FTDebug {
    private static int oid = 0;
................................................................................
      }
      /* This bit flag, if set, indicates that the ppems must be       */
      /* rounded to integers.  Nearly all TrueType fonts have this bit */
      /* set, as hinting won't work really well otherwise.             */
      /*                                                               */
Debug(0, DBG_LOAD_GLYPH, TAG, "face.header.flags: "+(face.header.Flags & 8)+"!");
      if ((face.header.Flags & 8) != 0) {
        size.metrics.x_scale = FTCalc.FTDivFix((long) (size.metrics.x_ppem << 6),
                (long) face.units_per_EM);
        size.metrics.y_scale = FTCalc.FTDivFix((long)(size.metrics.y_ppem << 6),
                                      (long)face.units_per_EM );

        size.metrics.ascender = 
                FTCalc.FT_PIX_ROUND(FTCalc.FTMulFix((long)face.ascender, (long)size.metrics.y_scale));
        size.metrics.descender = 
                FTCalc.FT_PIX_ROUND(FTCalc.FTMulFix((long)face.descender, (long)size.metrics.y_scale));
................................................................................
      }
      size.twilight.n_points = n_twilight;
      size.GS = new TTDefaultGraphicsStateClass();
      /* set `face.interpreter' according to the debug hook present */
      {
//        FTLibraryRec library = face.driver.library;

        String class_name = "org.apwtcl.apwfreetype.fttruetype.TTInterpRun";
//        face.interpreter = (TTInterpRun) library.debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
        if (face.interpreter == null) {
          face.interpreter = new FTInstanceMethod(class_name, "TTRunIns", 1);
        }
      }
      /* Fine, now run the font program! */
      error = tt_size_run_fpgm(size, pedantic);

Name change from ftbase/TTSizeMetricsRec.java to fttruetype/TTSizeMetricsRec.java.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package ftbase;

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







|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
// Copyright (c) 2014 by Arnulf P. Wiedemann
//
// See the file "license.terms" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//------------------------------------------------------------------------

package fttruetype;

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

Name change from ftbase/TTSizeRec.java to fttruetype/TTSizeRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19



20
21
22
23
24
25
26
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftbase;

  /* ===================================================================== */
  /*    TTSizeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */




public class TTSizeRec extends FTSizeRec {
    private static int oid = 0;

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







|





>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTSizeRec                                                          */
  /*                                                                       */
  /* ===================================================================== */

import ftbase.FTSizeMetricsRec;
import ftbase.FTSizeRec;

public class TTSizeRec extends FTSizeRec {
    private static int oid = 0;

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

Name change from ftsfnt/TTTableRec.java to fttruetype/TTTableRec.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTTableRec                                                         */
  /*                                                                       */
  /* <Description>                                                         */
  /*    This structure describes a given table of a TrueType font.         */
  /*                                                                       */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTTableRec                                                         */
  /*                                                                       */
  /* <Description>                                                         */
  /*    This structure describes a given table of a TrueType font.         */
  /*                                                                       */

Name change from ftsfnt/TTVertHeader.java to fttruetype/TTVertHeader.java.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package ftsfnt;

  /* ===================================================================== */
  /*    TTVertHeader                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType horizontal header, the `hhea' */
  /*    table, as well as the corresponding horizontal metrics table,      */







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *  Arnulf Wiedemann arnulf at wiedemann-pri.de
 *
 *  See the file "license.terms" for information on usage and
 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * =====================================================================
 */

package fttruetype;

  /* ===================================================================== */
  /*    TTVertHeader                                                          */
  /*                                                                       */
  /* <Description>                                                         */
  /*    A structure used to model a TrueType horizontal header, the `hhea' */
  /*    table, as well as the corresponding horizontal metrics table,      */