ApwFreetypeLibrary

Check-in [7f48ba72a1]
Login

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

Overview
Comment:fixes.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7f48ba72a15449ec4ad33624f6653d0e71420a21
User & Date: arnulf 2014-12-30 15:18:08
Context
2014-12-30
15:18
initial version. check-in: 26c3e23c7f user: arnulf tags: trunk
15:18
fixes. check-in: 7f48ba72a1 user: arnulf tags: trunk
13:28
fixes and renaming check-in: 7db930fc07 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ftbase/FTConstants.java.

372
373
374
375
376
377
378
379

380


381





































382










    public final static long FT_FACE_FLAG_FAST_GLYPHS      = (1L <<  7);
    public final static long FT_FACE_FLAG_MULTIPLE_MASTERS = (1L <<  8);
    public final static long FT_FACE_FLAG_GLYPH_NAMES      = (1L <<  9);
    public final static long FT_FACE_FLAG_EXTERNAL_STREAM  = (1L << 10);
    public final static long FT_FACE_FLAG_HINTER           = (1L << 11);
    public final static long FT_FACE_FLAG_CID_KEYED        = (1L << 12);
    public final static long FT_FACE_FLAG_TRICKY           = (1L << 13);











































}


















>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
    public final static long FT_FACE_FLAG_FAST_GLYPHS      = (1L <<  7);
    public final static long FT_FACE_FLAG_MULTIPLE_MASTERS = (1L <<  8);
    public final static long FT_FACE_FLAG_GLYPH_NAMES      = (1L <<  9);
    public final static long FT_FACE_FLAG_EXTERNAL_STREAM  = (1L << 10);
    public final static long FT_FACE_FLAG_HINTER           = (1L << 11);
    public final static long FT_FACE_FLAG_CID_KEYED        = (1L << 12);
    public final static long FT_FACE_FLAG_TRICKY           = (1L << 13);

    /* =========================================================================
     *
     * @enum:
     *   TT_PLATFORM_XXX
     *
     * @description:
     *   A list of valid values for the `platform_id' identifier code in
     *   @FT_CharMapRec and @FT_SfntName structures.
     *
     * @values:
     *   TT_PLATFORM_APPLE_UNICODE ::
     *     Used by Apple to indicate a Unicode character map and/or name entry.
     *     See @TT_APPLE_ID_XXX for corresponding `encoding_id' values.  Note
     *     that name entries in this format are coded as big-endian UCS-2
     *     character codes _only_.
     *
     *   TT_PLATFORM_MACINTOSH ::
     *     Used by Apple to indicate a MacOS-specific charmap and/or name entry.
     *     See @TT_MAC_ID_XXX for corresponding `encoding_id' values.  Note that
     *     most TrueType fonts contain an Apple roman charmap to be usable on
     *     MacOS systems (even if they contain a Microsoft charmap as well).
     *
     *   TT_PLATFORM_ISO ::
     *     This value was used to specify ISO/IEC 10646 charmaps.  It is however
     *     now deprecated.  See @TT_ISO_ID_XXX for a list of corresponding
     *     `encoding_id' values.
     *
     *   TT_PLATFORM_MICROSOFT ::
     *     Used by Microsoft to indicate Windows-specific charmaps.  See
     *     @TT_MS_ID_XXX for a list of corresponding `encoding_id' values.
     *     Note that most fonts contain a Unicode charmap using
     *     (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS).
     *
     *   TT_PLATFORM_CUSTOM ::
     *     Used to indicate application-specific charmaps.
     *
     *   TT_PLATFORM_ADOBE ::
     *     This value isn't part of any font format specification, but is used
     *     by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec
     *     structure.  See @TT_ADOBE_ID_XXX.
     * =========================================================================
     */

    public final static int TT_PLATFORM_APPLE_UNICODE = 0;
    public final static int TT_PLATFORM_MACINTOSH     = 1;
    public final static int TT_PLATFORM_ISO           = 2; /* deprecated */
    public final static int TT_PLATFORM_MICROSOFT     = 3;
    public final static int TT_PLATFORM_CUSTOM        = 4;
    public final static int TT_PLATFORM_ADOBE         = 7; /* artificial */



}

Changes to ftsfnt/TTSfntLoad.java.

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



21
22
23
24
25
26
27
...
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
 *  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;

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




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

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

    public final static Long TTAG_avar  = (long)( 'a' << 24 | 'v' << 16 | 'a' << 8 | 'r' );
................................................................................
      /* 1.5 of the OpenType specification (May 2008).                 */
      face.family_name = null;
      face.style_name = null;
      ftbase.FTReference<String> str_ref = new ftbase.FTReference<String>();
      str_ref.Set(null);
      if (face.os2.version != 0xFFFF && (face.os2.fsSelection & 256) != 0) {
        if (!ignore_preferred_family) {
          error = TTLoad.tt_face_get_name(face, (short)TTNameTableRec.TT_NAME_ID_PREFERRED_FAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_PREFERRED_FAMILY");
            return error;
          }
          face.family_name = str_ref.Get();
        }
        if (face.family_name != null) {







|






>
>
>







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
 *  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;

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

import fttruetype.TTFaceRec;
import fttruetype.TTNameTableRec;

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

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

    public final static Long TTAG_avar  = (long)( 'a' << 24 | 'v' << 16 | 'a' << 8 | 'r' );
................................................................................
      /* 1.5 of the OpenType specification (May 2008).                 */
      face.family_name = null;
      face.style_name = null;
      ftbase.FTReference<String> str_ref = new ftbase.FTReference<String>();
      str_ref.Set(null);
      if (face.os2.version != 0xFFFF && (face.os2.fsSelection & 256) != 0) {
        if (!ignore_preferred_family) {
          error = TTLoad.tt_face_get_name(face, (short) TTNameTableRec.TT_NAME_ID_PREFERRED_FAMILY, str_ref);
          if (error != 0)  {
            ftbase.FTTrace.Trace(7, TAG, "sfnt_load_face: error TT_NAME_ID_PREFERRED_FAMILY");
            return error;
          }
          face.family_name = str_ref.Get();
        }
        if (face.family_name != null) {

Changes to fttruetype/TTLoaderRec.java.

25
26
27
28
29
30
31


32
33
34
35
36
37
38
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
...
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
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;
................................................................................
      }
      /* 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;
................................................................................
      }
      TTSizeFuncs.tt_get_metrics(loader, glyph_index);
      /* Set `offset' to the start of the glyph relative to the start of */
      /* the `glyf' table, and `byte_len' to the length of the glyph in  */
      /* bytes.                                                          */
      FTReference<Integer> byte_len_ref = new FTReference<Integer>();
      byte_len_ref.Set(loader.byte_len);
      offset = TTLoad.tt_face_get_location(face, glyph_index, byte_len_ref);
      loader.byte_len = byte_len_ref.Get();
      if (loader.byte_len > 0) {
        if (loader.glyf_offset == 0) {
          FTTrace.Trace(7, TAG, "no `glyf' table but non-zero `loca' entry");
          error = FTError.GLYPH_INVALID_TABLE;
          if (opened_frame) {
            face.forget_glyph_frame.callClassMethod(loader);
................................................................................
            face.forget_glyph_frame.callClassMethod(loader);
          }
          return error;
        }
        /* all data have been read */
        face.forget_glyph_frame.callClassMethod(loader);
        opened_frame = false;
        error = TTGlyphLoaderFuncs.TTProcessSimpleGlyph(loader);
        if (error != 0) {
          if (opened_frame) {
            face.forget_glyph_frame.callClassMethod(loader);
          }
          return error;
        }
        FTGlyphLoaderRec.FTGlyphLoaderAdd(gloader);







>
>







 







|







 







|







 







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
...
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
import ftbase.FTReference;
import ftbase.FTRendererRec;
import ftbase.FTSizeRec;
import ftbase.FTStreamRec;
import ftbase.FTSubGlyphRec;
import ftbase.FTTrace;
import ftbase.FTVectorRec;
import ftsfnt.TTSfntLoad;

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

public class TTLoaderRec extends FTDebug {
    private static int oid = 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;
................................................................................
      }
      TTSizeFuncs.tt_get_metrics(loader, glyph_index);
      /* Set `offset' to the start of the glyph relative to the start of */
      /* the `glyf' table, and `byte_len' to the length of the glyph in  */
      /* bytes.                                                          */
      FTReference<Integer> byte_len_ref = new FTReference<Integer>();
      byte_len_ref.Set(loader.byte_len);
      offset = ftsfnt.TTLoad.tt_face_get_location(face, glyph_index, byte_len_ref);
      loader.byte_len = byte_len_ref.Get();
      if (loader.byte_len > 0) {
        if (loader.glyf_offset == 0) {
          FTTrace.Trace(7, TAG, "no `glyf' table but non-zero `loca' entry");
          error = FTError.GLYPH_INVALID_TABLE;
          if (opened_frame) {
            face.forget_glyph_frame.callClassMethod(loader);
................................................................................
            face.forget_glyph_frame.callClassMethod(loader);
          }
          return error;
        }
        /* all data have been read */
        face.forget_glyph_frame.callClassMethod(loader);
        opened_frame = false;
        error = fttruetype.TTGlyphLoaderFuncs.TTProcessSimpleGlyph(loader);
        if (error != 0) {
          if (opened_frame) {
            face.forget_glyph_frame.callClassMethod(loader);
          }
          return error;
        }
        FTGlyphLoaderRec.FTGlyphLoaderAdd(gloader);

Changes to fttruetype/TTNameTableRec.java.

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
...
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
...
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
    private static int oid = 0;

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

    /* =========================================================================
     *
     * @enum:
     *   TT_PLATFORM_XXX
     *
     * @description:
     *   A list of valid values for the `platform_id' identifier code in
     *   @FT_CharMapRec and @FT_SfntName structures.
     *
     * @values:
     *   TT_PLATFORM_APPLE_UNICODE ::
     *     Used by Apple to indicate a Unicode character map and/or name entry.
     *     See @TT_APPLE_ID_XXX for corresponding `encoding_id' values.  Note
     *     that name entries in this format are coded as big-endian UCS-2
     *     character codes _only_.
     *
     *   TT_PLATFORM_MACINTOSH ::
     *     Used by Apple to indicate a MacOS-specific charmap and/or name entry.
     *     See @TT_MAC_ID_XXX for corresponding `encoding_id' values.  Note that
     *     most TrueType fonts contain an Apple roman charmap to be usable on
     *     MacOS systems (even if they contain a Microsoft charmap as well).
     *
     *   TT_PLATFORM_ISO ::
     *     This value was used to specify ISO/IEC 10646 charmaps.  It is however
     *     now deprecated.  See @TT_ISO_ID_XXX for a list of corresponding
     *     `encoding_id' values.
     *
     *   TT_PLATFORM_MICROSOFT ::
     *     Used by Microsoft to indicate Windows-specific charmaps.  See
     *     @TT_MS_ID_XXX for a list of corresponding `encoding_id' values.
     *     Note that most fonts contain a Unicode charmap using
     *     (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS).
     *
     *   TT_PLATFORM_CUSTOM ::
     *     Used to indicate application-specific charmaps.
     *
     *   TT_PLATFORM_ADOBE ::
     *     This value isn't part of any font format specification, but is used
     *     by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec
     *     structure.  See @TT_ADOBE_ID_XXX.
     * =========================================================================
     */

    public final static int TT_PLATFORM_APPLE_UNICODE = 0;
    public final static int TT_PLATFORM_MACINTOSH     = 1;
    public final static int TT_PLATFORM_ISO           = 2; /* deprecated */
    public final static int TT_PLATFORM_MICROSOFT     = 3;
    public final static int TT_PLATFORM_CUSTOM        = 4;
    public final static int TT_PLATFORM_ADOBE         = 7; /* artificial */

    /* =========================================================================
     *
     * @enum:
     *   TT_APPLE_ID_XXX
     *
     * @description:
     *   A list of valid values for the `encoding_id' for
     *   @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.
     *
................................................................................
      format = stream.readShort(stream);
      numNameRecords = (int)stream.readShort(stream);
      storageOffset = (int)stream.readShort(stream);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      String str = TAG+"!"+id+"!";
      return str;
    } 
        
    /* ==================== toString ===================================== */
    public String toString() {
      StringBuffer str = new StringBuffer(mySelf()+"!");
      return str.toString();
    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * tt_name_entry_ascii_from_utf16
     * =====================================================================
     */
    /* convert a UTF-16 name entry to ASCII */
    static String tt_name_entry_ascii_from_utf16(TTNameEntryRec entry) {
      String string = null;
      Log.w(TAG, "WARNING: tt_name_entry_ascii_from_utf16 not yet implemented");
System.out.println("tt_name_entry_ascii_from_other not yet implemented");
/*
      Integer len;
      Integer code;
      Integer n;
      byte read = entry.string;
      int error;

................................................................................
    }

    /* =====================================================================
     * tt_name_entry_ascii_from_other
     * =====================================================================
     */
    /* convert an Apple Roman or symbol name entry to ASCII */
    static String tt_name_entry_ascii_from_other(TTNameEntryRec entry) {
      String string = null;
      Log.w(TAG, "WARNING: tt_name_entry_ascii_from_other not yet implemented");
System.out.println("tt_name_entry_ascii_from_other not yet implemented");
/*
      Integer len;
      Integer code;
      Integer n;
      Byte[] read = (Byte)entry.string;
      int error;








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







 







|
<
|



|
<













|


|







 







|


|







42
43
44
45
46
47
48


















































49
50
51
52
53
54
55
...
776
777
778
779
780
781
782
783

784
785
786
787
788

789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
...
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
    private static int oid = 0;

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

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


















































     * @enum:
     *   TT_APPLE_ID_XXX
     *
     * @description:
     *   A list of valid values for the `encoding_id' for
     *   @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.
     *
................................................................................
      format = stream.readShort(stream);
      numNameRecords = (int)stream.readShort(stream);
      storageOffset = (int)stream.readShort(stream);
    }
    
    /* ==================== mySelf ================================== */
    public String mySelf() {
      return TAG+"!"+id+"!";

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

    }

    /* ==================== toDebugString ===================================== */
    public String toDebugString() {
      StringBuffer str = new StringBuffer(mySelf()+"\n");
      return str.toString();
    }
 
    /* =====================================================================
     * tt_name_entry_ascii_from_utf16
     * =====================================================================
     */
    /* convert a UTF-16 name entry to ASCII */
    public static String tt_name_entry_ascii_from_utf16(TTNameEntryRec entry) {
      String string = null;
      Log.w(TAG, "WARNING: tt_name_entry_ascii_from_utf16 not yet implemented");
Debug(0, DBG_LOAD_GLYPH, TAG, "tt_name_entry_ascii_from_other not yet implemented");
/*
      Integer len;
      Integer code;
      Integer n;
      byte read = entry.string;
      int error;

................................................................................
    }

    /* =====================================================================
     * tt_name_entry_ascii_from_other
     * =====================================================================
     */
    /* convert an Apple Roman or symbol name entry to ASCII */
    public static String tt_name_entry_ascii_from_other(TTNameEntryRec entry) {
      String string = null;
      Log.w(TAG, "WARNING: tt_name_entry_ascii_from_other not yet implemented");
Debug(0, DBG_LOAD_GLYPH, TAG, "tt_name_entry_ascii_from_other not yet implemented");
/*
      Integer len;
      Integer code;
      Integer n;
      Byte[] read = (Byte)entry.string;
      int error;