aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/freetype/freetype.pas78
-rw-r--r--src/lib/freetype/ftimage.inc60
2 files changed, 121 insertions, 17 deletions
diff --git a/src/lib/freetype/freetype.pas b/src/lib/freetype/freetype.pas
index 6aaa3b59..01f507bc 100644
--- a/src/lib/freetype/freetype.pas
+++ b/src/lib/freetype/freetype.pas
@@ -152,6 +152,34 @@ const
(*************************************************************************)
(* *)
+ (* <Macro> *)
+ (* FT_ENC_TAG *)
+ (* *)
+ (* <Description> *)
+ (* This macro converts four-letter tags into an unsigned long. It is *)
+ (* used to define `encoding' identifiers (see @FT_Encoding). *)
+ (* *)
+ (* <Note> *)
+ (* Since many 16-bit compilers don't like 32-bit enumerations, you *)
+ (* should redefine this macro in case of problems to something like *)
+ (* this: *)
+ (* *)
+ (* { *)
+ (* #define FT_ENC_TAG( value, a, b, c, d ) value *)
+ (* } *)
+ (* *)
+ (* to get a simple enumeration without assigning special numbers. *)
+ (* *)
+ {
+ #define FT_ENC_TAG( value, a, b, c, d ) \
+ value = ( ( (FT_UInt32)(a) << 24 ) | \
+ ( (FT_UInt32)(b) << 16 ) | \
+ ( (FT_UInt32)(c) << 8 ) | \
+ (FT_UInt32)(d) )
+ }
+
+ (*************************************************************************)
+ (* *)
(* <Enum> *)
(* FT_Encoding *)
(* *)
@@ -289,17 +317,47 @@ const
(* *)
type
PFT_Encoding = ^FT_Encoding;
- FT_Encoding = array[0..3] of char;
+ FT_Encoding = cint32; // 32 bit enum of FT_ENC_TAG
const
- FT_ENCODING_NONE: FT_Encoding = (#0 ,#0 ,#0 ,#0 );
- FT_ENCODING_MS_SYMBOL: FT_Encoding = ('s', 'y', 'm', 'b' );
- FT_ENCODING_UNICODE: FT_Encoding = ('u', 'n', 'i', 'c' );
-
- FT_ENCODING_SJIS: FT_Encoding = ('s', 'j', 'i', 's');
- FT_ENCODING_GB2312: FT_Encoding = ('g', 'b', ' ', ' ');
- FT_ENCODING_BIG5: FT_Encoding = ('b', 'i', 'g', '5');
- FT_ENCODING_WANSUNG: FT_Encoding = ('w', 'a', 'n', 's');
- FT_ENCODING_JOHAB: FT_Encoding = ('j', 'o', 'h', 'a');
+ FT_ENCODING_NONE = (Ord(#0) shl 24) or
+ (Ord(#0) shl 16) or
+ (Ord(#0) shl 8) or
+ (Ord(#0) shl 0);
+
+ FT_ENCODING_MS_SYMBOL = (Ord('s') shl 24) or
+ (Ord('y') shl 16) or
+ (Ord('m') shl 8) or
+ (Ord('b') shl 0);
+
+ FT_ENCODING_UNICODE = (Ord('u') shl 24) or
+ (Ord('n') shl 16) or
+ (Ord('i') shl 8) or
+ (Ord('c') shl 0);
+
+ FT_ENCODING_SJIS = (Ord('s') shl 24) or
+ (Ord('j') shl 16) or
+ (Ord('i') shl 8) or
+ (Ord('s') shl 0);
+
+ FT_ENCODING_GB2312 = (Ord('g') shl 24) or
+ (Ord('b') shl 16) or
+ (Ord(' ') shl 8) or
+ (Ord(' ') shl 0);
+
+ FT_ENCODING_BIG5 = (Ord('b') shl 24) or
+ (Ord('i') shl 16) or
+ (Ord('g') shl 8) or
+ (Ord('5') shl 0);
+
+ FT_ENCODING_WANSUNG = (Ord('w') shl 24) or
+ (Ord('a') shl 16) or
+ (Ord('n') shl 8) or
+ (Ord('s') shl 0);
+
+ FT_ENCODING_JOHAB = (Ord('j') shl 24) or
+ (Ord('o') shl 16) or
+ (Ord('h') shl 8) or
+ (Ord('a') shl 0);
(*************************************************************************)
diff --git a/src/lib/freetype/ftimage.inc b/src/lib/freetype/ftimage.inc
index 9255c422..d16d52a2 100644
--- a/src/lib/freetype/ftimage.inc
+++ b/src/lib/freetype/ftimage.inc
@@ -453,6 +453,33 @@ const
(*************************************************************************)
+ (* *)
+ (* <Macro> *)
+ (* FT_IMAGE_TAG *)
+ (* *)
+ (* <Description> *)
+ (* This macro converts four-letter tags to an unsigned long type. *)
+ (* *)
+ (* <Note> *)
+ (* Since many 16-bit compilers don't like 32-bit enumerations, you *)
+ (* should redefine this macro in case of problems to something like *)
+ (* this: *)
+ (* *)
+ (* { *)
+ (* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value *)
+ (* } *)
+ (* *)
+ (* to get a simple enumeration without assigning special numbers. *)
+ (* *)
+ {
+ #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
+ value = ( ( (unsigned long)_x1 << 24 ) | \
+ ( (unsigned long)_x2 << 16 ) | \
+ ( (unsigned long)_x3 << 8 ) | \
+ (unsigned long)_x4 )
+ }
+
+ (*************************************************************************)
(* *)
(* <Enum> *)
(* FT_Glyph_Format *)
@@ -490,15 +517,34 @@ const
(* @FT_Outline, but FreeType isn't currently capable of rendering *)
(* them correctly. *)
(* *)
- FT_Glyph_Format = array[0..3] of char;
+ // Note: enums are 32 bit on x86 AND x86_64
+ FT_Glyph_Format = cuint32; // 32 bit enum of FT_IMAGE_TAG
{$ELSE TYPE_DECL}
const
- FT_GLYPH_FORMAT_NONE: FT_Glyph_Format = (#0, #0, #0, #0 );
-
- FT_GLYPH_FORMAT_COMPOSITE: FT_Glyph_Format = ('c', 'o', 'm', 'p' );
- FT_GLYPH_FORMAT_BITMAP: FT_Glyph_Format = ('b', 'i', 't', 's' );
- FT_GLYPH_FORMAT_OUTLINE: FT_Glyph_Format = ('o', 'u', 't', 'l' );
- FT_GLYPH_FORMAT_PLOTTER: FT_Glyph_Format = ('p', 'l', 'o', 't' );
+ FT_GLYPH_FORMAT_NONE = (Ord(#0) shl 24) or
+ (Ord(#0) shl 16) or
+ (Ord(#0) shl 8) or
+ (Ord(#0) shl 0);
+
+ FT_GLYPH_FORMAT_COMPOSITE = (Ord('c') shl 24) or
+ (Ord('o') shl 16) or
+ (Ord('m') shl 8) or
+ (Ord('p') shl 0);
+
+ FT_GLYPH_FORMAT_BITMAP = (Ord('b') shl 24) or
+ (Ord('i') shl 16) or
+ (Ord('t') shl 8) or
+ (Ord('s') shl 0);
+
+ FT_GLYPH_FORMAT_OUTLINE = (Ord('o') shl 24) or
+ (Ord('u') shl 16) or
+ (Ord('t') shl 8) or
+ (Ord('l') shl 0);
+
+ FT_GLYPH_FORMAT_PLOTTER = (Ord('p') shl 24) or
+ (Ord('l') shl 16) or
+ (Ord('o') shl 8) or
+ (Ord('t') shl 0);
{$ENDIF TYPE_DECL}