aboutsummaryrefslogtreecommitdiffstats
path: root/unicode
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-01-12 22:47:43 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-01-12 22:47:43 +0000
commitc61a339ad465ecb43897975538a77c3eb87110be (patch)
tree7d5fb0f26cacb301d251c133801390b0fb0bdf95 /unicode
parentb11259674b78bc872c08d3f2d554ede56543e954 (diff)
downloadusdx-c61a339ad465ecb43897975538a77c3eb87110be.tar.gz
usdx-c61a339ad465ecb43897975538a77c3eb87110be.tar.xz
usdx-c61a339ad465ecb43897975538a77c3eb87110be.zip
freetype update
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1569 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--unicode/src/lib/freetype/freetype.pas907
-rw-r--r--unicode/src/lib/freetype/ftconfig.inc35
-rw-r--r--unicode/src/lib/freetype/ftglyph.inc412
-rw-r--r--unicode/src/lib/freetype/ftimage.inc801
-rw-r--r--unicode/src/lib/freetype/ftoutln.inc497
-rw-r--r--unicode/src/lib/freetype/ftstroke.inc711
-rw-r--r--unicode/src/lib/freetype/fttypes.inc303
7 files changed, 2872 insertions, 794 deletions
diff --git a/unicode/src/lib/freetype/freetype.pas b/unicode/src/lib/freetype/freetype.pas
index 6a9d2062..dd8a141e 100644
--- a/unicode/src/lib/freetype/freetype.pas
+++ b/unicode/src/lib/freetype/freetype.pas
@@ -1,23 +1,42 @@
-//----------------------------------------------------------------------------
-// FreeType2 pascal header
-//----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.4 (Public License)
-// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
-//
-// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)
-// Pascal Port By: Milan Marusinec alias Milano
-// milan@marusinec.sk
-// http://www.aggpas.org
-// Copyright (c) 2005-2007
-//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
-// This software is provided "as is" without express or implied
-// warranty, and with no claim as to its suitability for any purpose.
-//
-//----------------------------------------------------------------------------
-// Adapted by the UltraStar Deluxe Team
-//----------------------------------------------------------------------------
+(***************************************************************************)
+(* *)
+(* freetype.h *)
+(* *)
+(* FreeType high-level API and common types (specification only). *)
+(* *)
+(* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 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. *)
+(* *)
+(***************************************************************************)
+
+(***************************************************************************)
+(* Initial Pascal port by *)
+(***************************************************************************)
+(* Anti-Grain Geometry - Version 2.4 (Public License) *)
+(* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) *)
+(* *)
+(* Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3) *)
+(* Pascal Port By: Milan Marusinec alias Milano *)
+(* milan@marusinec.sk *)
+(* http://www.aggpas.org *)
+(* Copyright (c) 2005-2007 *)
+(* *)
+(* Permission to copy, use, modify, sell and distribute this software *)
+(* is granted provided this copyright notice appears in all copies. *)
+(* This software is provided "as is" without express or implied *)
+(* warranty, and with no claim as to its suitability for any purpose. *)
+(* *)
+(***************************************************************************)
+
+(***************************************************************************)
+(* Extended by the UltraStar Deluxe Team *)
+(***************************************************************************)
unit freetype;
@@ -45,32 +64,24 @@ const
{$IFEND}
type
- FT_Byte = cuchar;
- FT_Short = csshort;
- FT_UShort = cushort;
- FT_Int = csint;
- FT_UInt = cuint;
- FT_Int16 = cint16;
- FT_UInt16 = cuint16;
- FT_Int32 = cint32;
- FT_UInt32 = cuint32;
- FT_Long = cslong;
- FT_ULong = culong;
-
- FT_Fixed = cslong;
- FT_Pos = cslong;
- FT_Error = cint;
- FT_F26Dot6 = cslong;
- FT_String = cchar;
- FT_Bool = cuchar;
-
- PFT_Byte = ^FT_Byte;
- PFT_Short = ^FT_Short;
- PFT_String = ^FT_String;
-
-
- TByteArray = array [0 .. (MaxInt div SizeOf(byte))-1] of byte;
- PByteArray = ^TByteArray;
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Library *)
+ (* *)
+ (* <Description> *)
+ (* A handle to a FreeType library instance. Each `library' is *)
+ (* completely independent from the others; it is the `root' of a set *)
+ (* of objects like fonts, faces, sizes, etc. *)
+ (* *)
+ (* It also embeds a memory manager (see @FT_Memory), as well as a *)
+ (* scan-line converter object (see @FT_Raster). *)
+ (* *)
+ (* <Note> *)
+ (* Library objects are normally created by @FT_Init_FreeType, and *)
+ (* destroyed with @FT_Done_FreeType. *)
+ (* *)
+ FT_Library = Pointer;
(*************************************************************************)
@@ -290,54 +301,6 @@ const
FT_ENCODING_WANSUNG: FT_Encoding = ('w', 'a', 'n', 's');
FT_ENCODING_JOHAB: FT_Encoding = ('j', 'o', 'h', 'a');
- (*************************************************************************)
- (* *)
- (* <Enum> *)
- (* FT_Glyph_Format *)
- (* *)
- (* <Description> *)
- (* An enumeration type used to describe the format of a given glyph *)
- (* image. Note that this version of FreeType only supports two image *)
- (* formats, even though future font drivers will be able to register *)
- (* their own format. *)
- (* *)
- (* <Values> *)
- (* FT_GLYPH_FORMAT_NONE :: *)
- (* The value 0 is reserved and does describe a glyph format. *)
- (* *)
- (* FT_GLYPH_FORMAT_COMPOSITE :: *)
- (* The glyph image is a composite of several other images. This *)
- (* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to *)
- (* report compound glyphs (like accented characters). *)
- (* *)
- (* FT_GLYPH_FORMAT_BITMAP :: *)
- (* The glyph image is a bitmap, and can be described as an *)
- (* @FT_Bitmap. You generally need to access the `bitmap' field of *)
- (* the @FT_GlyphSlotRec structure to read it. *)
- (* *)
- (* FT_GLYPH_FORMAT_OUTLINE :: *)
- (* The glyph image is a vertorial outline made of line segments *)
- (* and Bezier arcs; it can be described as an @FT_Outline; you *)
- (* generally want to access the `outline' field of the *)
- (* @FT_GlyphSlotRec structure to read it. *)
- (* *)
- (* FT_GLYPH_FORMAT_PLOTTER :: *)
- (* The glyph image is a vectorial path with no inside/outside *)
- (* contours. Some Type 1 fonts, like those in the Hershey family, *)
- (* contain glyphs in this format. These are described as *)
- (* @FT_Outline, but FreeType isn't currently capable of rendering *)
- (* them correctly. *)
- (* *)
-type
- FT_Glyph_Format = array[0..3] of char;
-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' );
-
(*************************************************************************)
(* *)
@@ -358,7 +321,7 @@ const
const
FT_STYLE_FLAG_ITALIC = 1 shl 0;
FT_STYLE_FLAG_BOLD = 1 shl 1;
-
+
(***************************************************************************
*
@@ -567,7 +530,7 @@ const
(* perform this pass. *)
(* *)
type
- FT_Render_Mode = FT_Int;
+ FT_Render_Mode = cint;
const
FT_RENDER_MODE_NORMAL = 0;
FT_RENDER_MODE_LIGHT = FT_RENDER_MODE_NORMAL + 1;
@@ -579,63 +542,34 @@ const
(*************************************************************************)
(* *)
- (* <Enum> *)
- (* FT_Pixel_Mode *)
+ (* <Type> *)
+ (* FT_GlyphSlot *)
(* *)
(* <Description> *)
- (* An enumeration type used to describe the format of pixels in a *)
- (* given bitmap. Note that additional formats may be added in the *)
- (* future. *)
+ (* A handle to a given `glyph slot'. A slot is a container where it *)
+ (* is possible to load any one of the glyphs contained in its parent *)
+ (* face. *)
(* *)
- (* <Values> *)
- (* FT_PIXEL_MODE_NONE :: *)
- (* Value 0 is reserved. *)
- (* *)
- (* FT_PIXEL_MODE_MONO :: *)
- (* A monochrome bitmap, using 1 bit per pixel. Note that pixels *)
- (* are stored in most-significant order (MSB), which means that *)
- (* the left-most pixel in a byte has value 128. *)
- (* *)
- (* FT_PIXEL_MODE_GRAY :: *)
- (* An 8-bit bitmap, generally used to represent anti-aliased glyph *)
- (* images. Each pixel is stored in one byte. Note that the number *)
- (* of value `gray' levels is stored in the `num_bytes' field of *)
- (* the @FT_Bitmap structure (it generally is 256). *)
- (* *)
- (* FT_PIXEL_MODE_GRAY2 :: *)
- (* A 2-bit/pixel bitmap, used to represent embedded anti-aliased *)
- (* bitmaps in font files according to the OpenType specification. *)
- (* We haven't found a single font using this format, however. *)
- (* *)
- (* FT_PIXEL_MODE_GRAY4 :: *)
- (* A 4-bit/pixel bitmap, used to represent embedded anti-aliased *)
- (* bitmaps in font files according to the OpenType specification. *)
- (* We haven't found a single font using this format, however. *)
- (* *)
- (* FT_PIXEL_MODE_LCD :: *)
- (* An 8-bit bitmap, used to represent RGB or BGR decimated glyph *)
- (* images used for display on LCD displays; the bitmap is three *)
- (* times wider than the original glyph image. See also *)
- (* @FT_RENDER_MODE_LCD. *)
- (* *)
- (* FT_PIXEL_MODE_LCD_V :: *)
- (* An 8-bit bitmap, used to represent RGB or BGR decimated glyph *)
- (* images used for display on rotated LCD displays; the bitmap *)
- (* is three times taller than the original glyph image. See also *)
- (* @FT_RENDER_MODE_LCD_V. *)
+ (* In other words, each time you call @FT_Load_Glyph or *)
+ (* @FT_Load_Char, the slot's content is erased by the new glyph data, *)
+ (* i.e. the glyph's metrics, its image (bitmap or outline), and *)
+ (* other control information. *)
+ (* *)
+ (* <Also> *)
+ (* @FT_GlyphSlotRec details the publicly accessible glyph fields. *)
(* *)
type
- FT_Pixel_Mode = byte;
-const
- FT_PIXEL_MODE_NONE = 0;
- FT_PIXEL_MODE_MONO = FT_PIXEL_MODE_NONE + 1;
- FT_PIXEL_MODE_GRAY = FT_PIXEL_MODE_MONO + 1;
- FT_PIXEL_MODE_GRAY2 = FT_PIXEL_MODE_GRAY + 1;
- FT_PIXEL_MODE_GRAY4 = FT_PIXEL_MODE_GRAY2 + 1;
- FT_PIXEL_MODE_LCD = FT_PIXEL_MODE_GRAY4 + 1;
- FT_PIXEL_MODE_LCD_V = FT_PIXEL_MODE_LCD + 1;
+ FT_GlyphSlot = ^FT_GlyphSlotRec;
- FT_PIXEL_MODE_MAX = FT_PIXEL_MODE_LCD_V + 1; (* do not remove *)
+
+{$DEFINE TYPE_DECL}
+{$I ftconfig.inc}
+{$I fttypes.inc}
+{$I ftimage.inc}
+{$I ftglyph.inc}
+{$I ftstroke.inc}
+{$I ftoutln.inc}
+{$UNDEF TYPE_DECL}
(*************************************************************************)
@@ -674,7 +608,6 @@ const
(* vertAdvance :: *)
(* Advance height for vertical layout. *)
(* *)
-type
FT_Glyph_Metrics = record
width ,
height : FT_Pos;
@@ -759,140 +692,6 @@ type
(*************************************************************************)
(* *)
- (* <Struct> *)
- (* FT_Vector *)
- (* *)
- (* <Description> *)
- (* A simple structure used to store a 2D vector; coordinates are of *)
- (* the FT_Pos type. *)
- (* *)
- (* <Fields> *)
- (* x :: The horizontal coordinate. *)
- (* y :: The vertical coordinate. *)
- (* *)
- PFT_Vector = ^FT_Vector;
- FT_Vector = record
- x ,
- y : FT_Pos;
- end;
-
-
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_Outline *)
- (* *)
- (* <Description> *)
- (* This structure is used to describe an outline to the scan-line *)
- (* converter. *)
- (* *)
- (* <Fields> *)
- (* n_contours :: The number of contours in the outline. *)
- (* *)
- (* n_points :: The number of points in the outline. *)
- (* *)
- (* points :: A pointer to an array of `n_points' FT_Vector *)
- (* elements, giving the outline's point coordinates. *)
- (* *)
- (* tags :: A pointer to an array of `n_points' chars, giving *)
- (* each outline point's type. If bit 0 is unset, the *)
- (* point is `off' the curve, i.e. a Bezier control *)
- (* point, while it is `on' when set. *)
- (* *)
- (* Bit 1 is meaningful for `off' points only. If set, *)
- (* it indicates a third-order Bezier arc control point; *)
- (* and a second-order control point if unset. *)
- (* *)
- (* contours :: An array of `n_contours' shorts, giving the end *)
- (* point of each contour within the outline. For *)
- (* example, the first contour is defined by the points *)
- (* `0' to `contours[0]', the second one is defined by *)
- (* the points `contours[0]+1' to `contours[1]', etc. *)
- (* *)
- (* flags :: A set of bit flags used to characterize the outline *)
- (* and give hints to the scan-converter and hinter on *)
- (* how to convert/grid-fit it. See FT_Outline_Flags. *)
- (* *)
- PFT_Outline = ^FT_Outline;
- FT_Outline = record
- n_contours : FT_Short;
- n_points : FT_Short;
-
- points : PFT_Vector;
- tags : PChar;
- contours : PFT_Short;
-
- flags : FT_Int;
- end;
-
-
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_Bitmap *)
- (* *)
- (* <Description> *)
- (* A structure used to describe a bitmap or pixmap to the raster. *)
- (* Note that we now manage pixmaps of various depths through the *)
- (* `pixel_mode' field. *)
- (* *)
- (* <Fields> *)
- (* rows :: The number of bitmap rows. *)
- (* *)
- (* width :: The number of pixels in bitmap row. *)
- (* *)
- (* pitch :: The pitch's absolute value is the number of bytes *)
- (* taken by one bitmap row, including padding. *)
- (* However, the pitch is positive when the bitmap has *)
- (* a `down' flow, and negative when it has an `up' *)
- (* flow. In all cases, the pitch is an offset to add *)
- (* to a bitmap pointer in order to go down one row. *)
- (* *)
- (* buffer :: A typeless pointer to the bitmap buffer. This *)
- (* value should be aligned on 32-bit boundaries in *)
- (* most cases. *)
- (* *)
- (* num_grays :: This field is only used with *)
- (* `FT_PIXEL_MODE_GRAY'; it gives the number of gray *)
- (* levels used in the bitmap. *)
- (* *)
- (* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. *)
- (* See @FT_Pixel_Mode for possible values. *)
- (* *)
- (* palette_mode :: This field is only used with paletted pixel modes; *)
- (* it indicates how the palette is stored. *)
- (* *)
- (* palette :: A typeless pointer to the bitmap palette; only *)
- (* used for paletted pixel modes. *)
- (* *)
- (* <Note> *)
- (* For now, the only pixel mode supported by FreeType are mono and *)
- (* grays. However, drivers might be added in the future to support *)
- (* more `colorful' options. *)
- (* *)
- (* When using pixel modes pal2, pal4 and pal8 with a void `palette' *)
- (* field, a gray pixmap with respectively 4, 16, and 256 levels of *)
- (* gray is assumed. This, in order to be compatible with some *)
- (* embedded bitmap formats defined in the TrueType specification. *)
- (* *)
- (* Note that no font was found presenting such embedded bitmaps, so *)
- (* this is currently completely unhandled by the library. *)
- (* *)
- PFT_Bitmap = ^FT_Bitmap;
- FT_Bitmap = record
- rows ,
- width : FT_Int;
- pitch : FT_Int;
- buffer : PByteArray;
- num_grays : FT_Short;
- pixel_mode ,
- palette_mode : byte;
- palette : pointer;
- end;
-
-
- (*************************************************************************)
- (* *)
(* <Type> *)
(* FT_Face *)
(* *)
@@ -950,183 +749,10 @@ type
PAFT_CharMap = ^FT_CharMap;
AFT_CharMap = array[0..High(Word)] of FT_CharMap;
- (*************************************************************************)
- (* *)
- (* <Type> *)
- (* FT_Library *)
- (* *)
- (* <Description> *)
- (* A handle to a FreeType library instance. Each `library' is *)
- (* completely independent from the others; it is the `root' of a set *)
- (* of objects like fonts, faces, sizes, etc. *)
- (* *)
- (* It also embeds a memory manager (see @FT_Memory), as well as a *)
- (* scan-line converter object (see @FT_Raster). *)
- (* *)
- (* <Note> *)
- (* Library objects are normally created by @FT_Init_FreeType, and *)
- (* destroyed with @FT_Done_FreeType. *)
- (* *)
- FT_Library = ^FT_LibraryRec;
- FT_LibraryRec = record // internal
- end;
- (*************************************************************************)
- (* *)
- (* <Section> *)
- (* glyph_management *)
- (* *)
- (* <Title> *)
- (* Glyph Management *)
- (* *)
- (* <Abstract> *)
- (* Generic interface to manage individual glyph data. *)
- (* *)
- (* <Description> *)
- (* This section contains definitions used to manage glyph data *)
- (* through generic FT_Glyph objects. Each of them can contain a *)
- (* bitmap, a vector outline, or even images in other formats. *)
- (* *)
- (*************************************************************************)
- (* forward declaration to a private type *)
- PFT_Glyph_Class = ^FT_Glyph_Class;
- FT_Glyph_Class = record // internal
- end;
- (*************************************************************************)
- (* *)
- (* <Type> *)
- (* FT_Glyph *)
- (* *)
- (* <Description> *)
- (* Handle to an object used to model generic glyph images. It is a *)
- (* pointer to the @FT_GlyphRec structure and can contain a glyph *)
- (* bitmap or pointer. *)
- (* *)
- (* <Note> *)
- (* Glyph objects are not owned by the library. You must thus release *)
- (* them manually (through @FT_Done_Glyph) _before_ calling *)
- (* @FT_Done_FreeType. *)
- (* *)
- FT_Glyph = ^FT_GlyphRec;
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_GlyphRec *)
- (* *)
- (* <Description> *)
- (* The root glyph structure contains a given glyph image plus its *)
- (* advance width in 16.16 fixed float format. *)
- (* *)
- (* <Fields> *)
- (* library :: A handle to the FreeType library object. *)
- (* *)
- (* clazz :: A pointer to the glyph's class. Private. *)
- (* *)
- (* format :: The format of the glyph's image. *)
- (* *)
- (* advance :: A 16.16 vector that gives the glyph's advance width. *)
- (* *)
- FT_GlyphRec = record
- library_: FT_Library;
- clazz: PFT_Glyph_Class;
- format: FT_Glyph_Format;
- advance: FT_Vector;
- end;
-
-
- (*************************************************************************)
- (* *)
- (* <Type> *)
- (* FT_BitmapGlyph *)
- (* *)
- (* <Description> *)
- (* A handle to an object used to model a bitmap glyph image. This is *)
- (* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. *)
- (* *)
- FT_BitmapGlyph = ^FT_BitmapGlyphRec;
-
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_BitmapGlyphRec *)
- (* *)
- (* <Description> *)
- (* A structure used for bitmap glyph images. This really is a *)
- (* `sub-class' of `FT_GlyphRec'. *)
- (* *)
- (* <Fields> *)
- (* root :: The root FT_Glyph fields. *)
- (* *)
- (* left :: The left-side bearing, i.e., the horizontal distance *)
- (* from the current pen position to the left border of the *)
- (* glyph bitmap. *)
- (* *)
- (* top :: The top-side bearing, i.e., the vertical distance from *)
- (* the current pen position to the top border of the glyph *)
- (* bitmap. This distance is positive for upwards-y! *)
- (* *)
- (* bitmap :: A descriptor for the bitmap. *)
- (* *)
- (* <Note> *)
- (* You can typecast FT_Glyph to FT_BitmapGlyph if you have *)
- (* glyph->format == FT_GLYPH_FORMAT_BITMAP. This lets you access *)
- (* the bitmap's contents easily. *)
- (* *)
- (* The corresponding pixel buffer is always owned by the BitmapGlyph *)
- (* and is thus created and destroyed with it. *)
- (* *)
- FT_BitmapGlyphRec = record
- root: FT_GlyphRec;
- left: FT_Int;
- top: FT_Int;
- bitmap: FT_Bitmap;
- end;
-
-
- (*************************************************************************)
- (* *)
- (* <Type> *)
- (* FT_OutlineGlyph *)
- (* *)
- (* <Description> *)
- (* A handle to an object used to model an outline glyph image. This *)
- (* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. *)
- (* *)
- FT_OutlineGlyph = ^FT_OutlineGlyphRec;
-
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_OutlineGlyphRec *)
- (* *)
- (* <Description> *)
- (* A structure used for outline (vectorial) glyph images. This *)
- (* really is a `sub-class' of `FT_GlyphRec'. *)
- (* *)
- (* <Fields> *)
- (* root :: The root FT_Glyph fields. *)
- (* *)
- (* outline :: A descriptor for the outline. *)
- (* *)
- (* <Note> *)
- (* You can typecast FT_Glyph to FT_OutlineGlyph if you have *)
- (* glyph->format == FT_GLYPH_FORMAT_OUTLINE. This lets you access *)
- (* the outline's content easily. *)
- (* *)
- (* As the outline is extracted from a glyph slot, its coordinates are *)
- (* expressed normally in 26.6 pixels, unless the flag *)
- (* FT_LOAD_NO_SCALE was used in FT_Load_Glyph() or FT_Load_Char(). *)
- (* *)
- (* The outline's tables are always owned by the object and are *)
- (* destroyed with it. *)
- (* *)
- FT_OutlineGlyphRec = record
- root: FT_GlyphRec;
- outline: FT_Outline;
- end;
(*************************************************************************)
@@ -1149,101 +775,6 @@ type
(*************************************************************************)
(* *)
- (* <FuncType> *)
- (* FT_Generic_Finalizer *)
- (* *)
- (* <Description> *)
- (* Describes a function used to destroy the `client' data of any *)
- (* FreeType object. See the description of the FT_Generic type for *)
- (* details of usage. *)
- (* *)
- (* <Input> *)
- (* The address of the FreeType object which is under finalization. *)
- (* Its client data is accessed through its `generic' field. *)
- (* *)
- FT_Generic_Finalizer = procedure(AnObject : pointer ); cdecl;
-
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_Generic *)
- (* *)
- (* <Description> *)
- (* Client applications often need to associate their own data to a *)
- (* variety of FreeType core objects. For example, a text layout API *)
- (* might want to associate a glyph cache to a given size object. *)
- (* *)
- (* Most FreeType object contains a `generic' field, of type *)
- (* FT_Generic, which usage is left to client applications and font *)
- (* servers. *)
- (* *)
- (* It can be used to store a pointer to client-specific data, as well *)
- (* as the address of a `finalizer' function, which will be called by *)
- (* FreeType when the object is destroyed (for example, the previous *)
- (* client example would put the address of the glyph cache destructor *)
- (* in the `finalizer' field). *)
- (* *)
- (* <Fields> *)
- (* data :: A typeless pointer to any client-specified data. This *)
- (* field is completely ignored by the FreeType library. *)
- (* *)
- (* finalizer :: A pointer to a `generic finalizer' function, which *)
- (* will be called when the object is destroyed. If this *)
- (* field is set to NULL, no code will be called. *)
- (* *)
- FT_Generic = record
- data : pointer;
- finalizer : FT_Generic_Finalizer;
- end;
-
- (*************************************************************************)
- (* *)
- (* <Struct> *)
- (* FT_BBox *)
- (* *)
- (* <Description> *)
- (* A structure used to hold an outline's bounding box, i.e., the *)
- (* coordinates of its extrema in the horizontal and vertical *)
- (* directions. *)
- (* *)
- (* <Fields> *)
- (* xMin :: The horizontal minimum (left-most). *)
- (* *)
- (* yMin :: The vertical minimum (bottom-most). *)
- (* *)
- (* xMax :: The horizontal maximum (right-most). *)
- (* *)
- (* yMax :: The vertical maximum (top-most). *)
- (* *)
- PFT_BBox = ^FT_BBox;
- FT_BBox = record
- xMin, yMin : FT_Pos;
- xMax, yMax : FT_Pos;
- end;
-
-
- (*************************************************************************)
- (* *)
- (* <Type> *)
- (* FT_GlyphSlot *)
- (* *)
- (* <Description> *)
- (* A handle to a given `glyph slot'. A slot is a container where it *)
- (* is possible to load any one of the glyphs contained in its parent *)
- (* face. *)
- (* *)
- (* In other words, each time you call @FT_Load_Glyph or *)
- (* @FT_Load_Char, the slot's content is erased by the new glyph data, *)
- (* i.e. the glyph's metrics, its image (bitmap or outline), and *)
- (* other control information. *)
- (* *)
- (* <Also> *)
- (* @FT_GlyphSlotRec details the publicly accessible glyph fields. *)
- (* *)
- FT_GlyphSlot = ^FT_GlyphSlotRec;
-
- (*************************************************************************)
- (* *)
(* <Struct> *)
(* FT_GlyphSlotRec *)
(* *)
@@ -1432,7 +963,7 @@ type
subglyphs : FT_SubGlyph;
control_data : pointer;
- control_len : longint;
+ control_len : clong;
lsb_delta: FT_Pos;
rsb_delta: FT_Pos;
@@ -1497,15 +1028,15 @@ type
(* computations. *)
(* *)
FT_Size_Metrics = record
- x_ppem ,
- y_ppem : FT_UShort;
- x_scale ,
- y_scale : FT_Fixed;
-
- ascender ,
- descender : FT_Pos;
- height : FT_Pos;
- max_advance : FT_Pos;
+ x_ppem, (* horizontal pixels per EM *)
+ y_ppem: FT_UShort; (* vertical pixels per EM *)
+ x_scale, (* scaling values used to convert font *)
+ y_scale: FT_Fixed; (* units to 26.6 fractional pixels *)
+
+ ascender, (* ascender in 26.6 frac. pixels *)
+ descender: FT_Pos; (* descender in 26.6 frac. pixels *)
+ height: FT_Pos; (* text height in 26.6 frac. pixels *)
+ max_advance: FT_Pos; (* max horizontal advance, in 26.6 pixels *)
end;
(*************************************************************************)
@@ -1786,21 +1317,29 @@ type
encoding_id : FT_UShort;
end;
+
+{$I ftconfig.inc}
+{$I fttypes.inc}
+{$I ftimage.inc}
+{$I ftglyph.inc}
+{$I ftstroke.inc}
+{$I ftoutln.inc}
+
+
{ GLOBAL PROCEDURES }
(*************************************************************************)
(* *)
(* @macro: *)
- (* FT_CURVE_TAG ( flag ) *)
+ (* FT_HAS_KERNING( face ) *)
(* *)
- function FT_CURVE_TAG(flag: byte): byte;
-
-const
- FT_CURVE_TAG_ON = 1;
- FT_CURVE_TAG_CONIC = 0;
- FT_CURVE_TAG_CUBIC = 2;
-
+ (* @description: *)
+ (* A macro that returns true whenever a face object contains kerning *)
+ (* data that can be accessed with @FT_Get_Kerning. *)
+ (* *)
+ function FT_HAS_KERNING(face : FT_Face ) : cbool;
+
(*************************************************************************)
(* *)
(* @macro: *)
@@ -1813,16 +1352,6 @@ const
(* *)
function FT_IS_SCALABLE(face : FT_Face ) : cbool;
- (*************************************************************************)
- (* *)
- (* @macro: *)
- (* FT_HAS_KERNING( face ) *)
- (* *)
- (* @description: *)
- (* A macro that returns true whenever a face object contains kerning *)
- (* data that can be accessed with @FT_Get_Kerning. *)
- (* *)
- function FT_HAS_KERNING(face : FT_Face ) : cbool;
(*************************************************************************)
(* *)
@@ -2284,216 +1813,6 @@ const
pixel_height : FT_UInt ) : FT_Error;
cdecl; external ft_lib name 'FT_Set_Pixel_Sizes';
- (*************************************************************************)
- (* *)
- (* <Function> *)
- (* FT_Get_Glyph *)
- (* *)
- (* <Description> *)
- (* A function used to extract a glyph image from a slot. *)
- (* *)
- (* <Input> *)
- (* slot :: A handle to the source glyph slot. *)
- (* *)
- (* <Output> *)
- (* aglyph :: A handle to the glyph object. *)
- (* *)
- (* <Return> *)
- (* FreeType error code. 0 means success. *)
- (* *)
- function FT_Get_Glyph(
- slot: FT_GlyphSlot;
- out aglyph: FT_Glyph ): FT_Error;
- cdecl; external ft_lib name 'FT_Get_Glyph';
-
- (*************************************************************************)
- (* *)
- (* <Enum> *)
- (* FT_Glyph_BBox_Mode *)
- (* *)
- (* <Description> *)
- (* The mode how the values of @FT_Glyph_Get_CBox are returned. *)
- (* *)
- (* <Values> *)
- (* FT_GLYPH_BBOX_UNSCALED :: *)
- (* Return unscaled font units. *)
- (* *)
- (* FT_GLYPH_BBOX_SUBPIXELS :: *)
- (* Return unfitted 26.6 coordinates. *)
- (* *)
- (* FT_GLYPH_BBOX_GRIDFIT :: *)
- (* Return grid-fitted 26.6 coordinates. *)
- (* *)
- (* FT_GLYPH_BBOX_TRUNCATE :: *)
- (* Return coordinates in integer pixels. *)
- (* *)
- (* FT_GLYPH_BBOX_PIXELS :: *)
- (* Return grid-fitted pixel coordinates. *)
- (* *)
-type
- FT_Glyph_BBox_Mode = FT_UInt;
-const
- FT_GLYPH_BBOX_UNSCALED = 0;
- FT_GLYPH_BBOX_SUBPIXELS = 0;
- FT_GLYPH_BBOX_GRIDFIT = 1;
- FT_GLYPH_BBOX_TRUNCATE = 2;
- FT_GLYPH_BBOX_PIXELS = 3;
-
- (*************************************************************************)
- (* *)
- (* <Function> *)
- (* FT_Glyph_Get_CBox *)
- (* *)
- (* <Description> *)
- (* Return a glyph's `control box'. The control box encloses all the *)
- (* outline's points, including Bézier control points. Though it *)
- (* coincides with the exact bounding box for most glyphs, it can be *)
- (* slightly larger in some situations (like when rotating an outline *)
- (* which contains Bézier outside arcs). *)
- (* *)
- (* Computing the control box is very fast, while getting the bounding *)
- (* box can take much more time as it needs to walk over all segments *)
- (* and arcs in the outline. To get the latter, you can use the *)
- (* `ftbbox' component which is dedicated to this single task. *)
- (* *)
- (* <Input> *)
- (* glyph :: A handle to the source glyph object. *)
- (* *)
- (* mode :: The mode which indicates how to interpret the returned *)
- (* bounding box values. *)
- (* *)
- (* <Output> *)
- (* acbox :: The glyph coordinate bounding box. Coordinates are *)
- (* expressed in 1/64th of pixels if it is grid-fitted. *)
- (* *)
- (* <Note> *)
- (* Coordinates are relative to the glyph origin, using the Y-upwards *)
- (* convention. *)
- (* *)
- (* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' *)
- (* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font *)
- (* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS *)
- (* is another name for this constant. *)
- (* *)
- (* Note that the maximum coordinates are exclusive, which means that *)
- (* one can compute the width and height of the glyph image (be it in *)
- (* integer or 26.6 pixels) as: *)
- (* *)
- (* { *)
- (* width = bbox.xMax - bbox.xMin; *)
- (* height = bbox.yMax - bbox.yMin; *)
- (* } *)
- (* *)
- (* Note also that for 26.6 coordinates, if `bbox_mode' is set to *)
- (* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, *)
- (* which corresponds to: *)
- (* *)
- (* { *)
- (* bbox.xMin = FLOOR(bbox.xMin); *)
- (* bbox.yMin = FLOOR(bbox.yMin); *)
- (* bbox.xMax = CEILING(bbox.xMax); *)
- (* bbox.yMax = CEILING(bbox.yMax); *)
- (* } *)
- (* *)
- (* To get the bbox in pixel coordinates, set `bbox_mode' to *)
- (* @FT_GLYPH_BBOX_TRUNCATE. *)
- (* *)
- (* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' *)
- (* to @FT_GLYPH_BBOX_PIXELS. *)
- (* *)
- procedure FT_Glyph_Get_CBox( glyph: FT_Glyph;
- bbox_mode: FT_UInt;
- out acbox: FT_BBox );
- cdecl; external ft_lib name 'FT_Glyph_Get_CBox';
-
- (*************************************************************************)
- (* *)
- (* <Function> *)
- (* FT_Glyph_To_Bitmap *)
- (* *)
- (* <Description> *)
- (* Converts a given glyph object to a bitmap glyph object. *)
- (* *)
- (* <InOut> *)
- (* the_glyph :: A pointer to a handle to the target glyph. *)
- (* *)
- (* <Input> *)
- (* render_mode :: An enumeration that describe how the data is *)
- (* rendered. *)
- (* *)
- (* origin :: A pointer to a vector used to translate the glyph *)
- (* image before rendering. Can be 0 (if no *)
- (* translation). The origin is expressed in *)
- (* 26.6 pixels. *)
- (* *)
- (* destroy :: A boolean that indicates that the original glyph *)
- (* image should be destroyed by this function. It is *)
- (* never destroyed in case of error. *)
- (* *)
- (* <Return> *)
- (* FreeType error code. 0 means success. *)
- (* *)
- (* <Note> *)
- (* The glyph image is translated with the `origin' vector before *)
- (* rendering. *)
- (* *)
- (* The first parameter is a pointer to a FT_Glyph handle, that will *)
- (* be replaced by this function. Typically, you would use (omitting *)
- (* error handling): *)
- (* *)
- (* *)
- (* { *)
- (* FT_Glyph glyph; *)
- (* FT_BitmapGlyph glyph_bitmap; *)
- (* *)
- (* *)
- (* // load glyph *)
- (* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); *)
- (* *)
- (* // extract glyph image *)
- (* error = FT_Get_Glyph( face->glyph, &glyph ); *)
- (* *)
- (* // convert to a bitmap (default render mode + destroy old) *)
- (* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) *)
- (* { *)
- (* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT, *)
- (* 0, 1 ); *)
- (* if ( error ) // glyph unchanged *)
- (* ... *)
- (* } *)
- (* *)
- (* // access bitmap content by typecasting *)
- (* glyph_bitmap = (FT_BitmapGlyph)glyph; *)
- (* *)
- (* // do funny stuff with it, like blitting/drawing *)
- (* ... *)
- (* *)
- (* // discard glyph image (bitmap or not) *)
- (* FT_Done_Glyph( glyph ); *)
- (* } *)
- (* *)
- (* *)
- (* This function does nothing if the glyph format isn't scalable. *)
- (* *)
- function FT_Glyph_To_Bitmap(var the_glyph: FT_Glyph;
- render_mode: FT_Render_Mode;
- origin: PFT_Vector;
- destroy: FT_Bool ): FT_Error;
- cdecl; external ft_lib name 'FT_Glyph_To_Bitmap';
-
- (*************************************************************************)
- (* *)
- (* <Function> *)
- (* FT_Done_Glyph *)
- (* *)
- (* <Description> *)
- (* Destroys a given glyph. *)
- (* *)
- (* <Input> *)
- (* glyph :: A handle to the target glyph object. *)
- (* *)
- procedure FT_Done_Glyph( glyph: FT_Glyph );
- cdecl; external ft_lib name 'FT_Done_Glyph';
implementation
@@ -2504,17 +1823,17 @@ begin
result := flag and 3;
end;
-{ FT_IS_SCALABLE }
-function FT_IS_SCALABLE(face : FT_Face ) : cbool;
-begin
- result := cbool(face.face_flags and FT_FACE_FLAG_SCALABLE );
-end;
-
{ FT_HAS_KERNING }
function FT_HAS_KERNING(face : FT_Face ) : cbool;
begin
result := cbool(face.face_flags and FT_FACE_FLAG_KERNING );
end;
+{ FT_IS_SCALABLE }
+function FT_IS_SCALABLE(face : FT_Face ) : cbool;
+begin
+ result := cbool(face.face_flags and FT_FACE_FLAG_SCALABLE );
+end;
+
end.
diff --git a/unicode/src/lib/freetype/ftconfig.inc b/unicode/src/lib/freetype/ftconfig.inc
new file mode 100644
index 00000000..100fb2e0
--- /dev/null
+++ b/unicode/src/lib/freetype/ftconfig.inc
@@ -0,0 +1,35 @@
+(***************************************************************************)
+(* *)
+(* ftconfig.h *)
+(* *)
+(* ANSI-specific configuration file (specification only). *)
+(* *)
+(* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 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. *)
+(* *)
+(***************************************************************************)
+(***************************************************************************)
+(* Pascal port by the UltraStar Deluxe Team *)
+(***************************************************************************)
+
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* IntN types *)
+ (* *)
+ (* Used to guarantee the size of some specific integers. *)
+ (* *)
+ FT_Int16 = cint16;
+ FT_UInt16 = cuint16;
+ FT_Int32 = cint32;
+ FT_UInt32 = cuint32;
+
+{$ENDIF TYPE_DECL}
+
diff --git a/unicode/src/lib/freetype/ftglyph.inc b/unicode/src/lib/freetype/ftglyph.inc
new file mode 100644
index 00000000..577e448b
--- /dev/null
+++ b/unicode/src/lib/freetype/ftglyph.inc
@@ -0,0 +1,412 @@
+(***************************************************************************)
+(* *)
+(* ftglyph.h *)
+(* *)
+(* FreeType convenience functions to handle glyphs (specification). *)
+(* *)
+(* Copyright 1996-2001, 2002, 2003, 2006 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. *)
+(* *)
+(***************************************************************************)
+(***************************************************************************)
+(* Pascal port by the UltraStar Deluxe Team *)
+(***************************************************************************)
+
+
+ (*************************************************************************)
+ (* *)
+ (* This file contains the definition of several convenience functions *)
+ (* that can be used by client applications to easily retrieve glyph *)
+ (* bitmaps and outlines from a given face. *)
+ (* *)
+ (* These functions should be optional if you are writing a font server *)
+ (* or text layout engine on top of FreeType. However, they are pretty *)
+ (* handy for many other simple uses of the library. *)
+ (* *)
+ (*************************************************************************)
+
+ (*************************************************************************)
+ (* *)
+ (* <Section> *)
+ (* glyph_management *)
+ (* *)
+ (* <Title> *)
+ (* Glyph Management *)
+ (* *)
+ (* <Abstract> *)
+ (* Generic interface to manage individual glyph data. *)
+ (* *)
+ (* <Description> *)
+ (* This section contains definitions used to manage glyph data *)
+ (* through generic FT_Glyph objects. Each of them can contain a *)
+ (* bitmap, a vector outline, or even images in other formats. *)
+ (* *)
+ (*************************************************************************)
+
+{$IFDEF TYPE_DECL}
+
+ (* forward declaration to a private type *)
+ PFT_Glyph_Class = Pointer;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Glyph *)
+ (* *)
+ (* <Description> *)
+ (* Handle to an object used to model generic glyph images. It is a *)
+ (* pointer to the @FT_GlyphRec structure and can contain a glyph *)
+ (* bitmap or pointer. *)
+ (* *)
+ (* <Note> *)
+ (* Glyph objects are not owned by the library. You must thus release *)
+ (* them manually (through @FT_Done_Glyph) _before_ calling *)
+ (* @FT_Done_FreeType. *)
+ (* *)
+ FT_Glyph = ^FT_GlyphRec;
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_GlyphRec *)
+ (* *)
+ (* <Description> *)
+ (* The root glyph structure contains a given glyph image plus its *)
+ (* advance width in 16.16 fixed float format. *)
+ (* *)
+ (* <Fields> *)
+ (* library :: A handle to the FreeType library object. *)
+ (* *)
+ (* clazz :: A pointer to the glyph's class. Private. *)
+ (* *)
+ (* format :: The format of the glyph's image. *)
+ (* *)
+ (* advance :: A 16.16 vector that gives the glyph's advance width. *)
+ (* *)
+ FT_GlyphRec = record
+ library_: FT_Library;
+ clazz: PFT_Glyph_Class;
+ format: FT_Glyph_Format;
+ advance: FT_Vector;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_BitmapGlyph *)
+ (* *)
+ (* <Description> *)
+ (* A handle to an object used to model a bitmap glyph image. This is *)
+ (* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. *)
+ (* *)
+ FT_BitmapGlyph = ^FT_BitmapGlyphRec;
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_BitmapGlyphRec *)
+ (* *)
+ (* <Description> *)
+ (* A structure used for bitmap glyph images. This really is a *)
+ (* `sub-class' of `FT_GlyphRec'. *)
+ (* *)
+ (* <Fields> *)
+ (* root :: The root FT_Glyph fields. *)
+ (* *)
+ (* left :: The left-side bearing, i.e., the horizontal distance *)
+ (* from the current pen position to the left border of the *)
+ (* glyph bitmap. *)
+ (* *)
+ (* top :: The top-side bearing, i.e., the vertical distance from *)
+ (* the current pen position to the top border of the glyph *)
+ (* bitmap. This distance is positive for upwards-y! *)
+ (* *)
+ (* bitmap :: A descriptor for the bitmap. *)
+ (* *)
+ (* <Note> *)
+ (* You can typecast FT_Glyph to FT_BitmapGlyph if you have *)
+ (* glyph->format == FT_GLYPH_FORMAT_BITMAP. This lets you access *)
+ (* the bitmap's contents easily. *)
+ (* *)
+ (* The corresponding pixel buffer is always owned by the BitmapGlyph *)
+ (* and is thus created and destroyed with it. *)
+ (* *)
+ FT_BitmapGlyphRec = record
+ root: FT_GlyphRec;
+ left: FT_Int;
+ top: FT_Int;
+ bitmap: FT_Bitmap;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_OutlineGlyph *)
+ (* *)
+ (* <Description> *)
+ (* A handle to an object used to model an outline glyph image. This *)
+ (* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. *)
+ (* *)
+ FT_OutlineGlyph = ^FT_OutlineGlyphRec;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_OutlineGlyphRec *)
+ (* *)
+ (* <Description> *)
+ (* A structure used for outline (vectorial) glyph images. This *)
+ (* really is a `sub-class' of `FT_GlyphRec'. *)
+ (* *)
+ (* <Fields> *)
+ (* root :: The root FT_Glyph fields. *)
+ (* *)
+ (* outline :: A descriptor for the outline. *)
+ (* *)
+ (* <Note> *)
+ (* You can typecast FT_Glyph to FT_OutlineGlyph if you have *)
+ (* glyph->format == FT_GLYPH_FORMAT_OUTLINE. This lets you access *)
+ (* the outline's content easily. *)
+ (* *)
+ (* As the outline is extracted from a glyph slot, its coordinates are *)
+ (* expressed normally in 26.6 pixels, unless the flag *)
+ (* FT_LOAD_NO_SCALE was used in FT_Load_Glyph() or FT_Load_Char(). *)
+ (* *)
+ (* The outline's tables are always owned by the object and are *)
+ (* destroyed with it. *)
+ (* *)
+ FT_OutlineGlyphRec = record
+ root: FT_GlyphRec;
+ outline: FT_Outline;
+ end;
+
+{$ELSE TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Get_Glyph *)
+ (* *)
+ (* <Description> *)
+ (* A function used to extract a glyph image from a slot. *)
+ (* *)
+ (* <Input> *)
+ (* slot :: A handle to the source glyph slot. *)
+ (* *)
+ (* <Output> *)
+ (* aglyph :: A handle to the glyph object. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ function FT_Get_Glyph(
+ slot: FT_GlyphSlot;
+ out aglyph: FT_Glyph ): FT_Error;
+ cdecl; external ft_lib name 'FT_Get_Glyph';
+
+{$ENDIF TYPE_DECL}
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Enum> *)
+ (* FT_Glyph_BBox_Mode *)
+ (* *)
+ (* <Description> *)
+ (* The mode how the values of @FT_Glyph_Get_CBox are returned. *)
+ (* *)
+ (* <Values> *)
+ (* FT_GLYPH_BBOX_UNSCALED :: *)
+ (* Return unscaled font units. *)
+ (* *)
+ (* FT_GLYPH_BBOX_SUBPIXELS :: *)
+ (* Return unfitted 26.6 coordinates. *)
+ (* *)
+ (* FT_GLYPH_BBOX_GRIDFIT :: *)
+ (* Return grid-fitted 26.6 coordinates. *)
+ (* *)
+ (* FT_GLYPH_BBOX_TRUNCATE :: *)
+ (* Return coordinates in integer pixels. *)
+ (* *)
+ (* FT_GLYPH_BBOX_PIXELS :: *)
+ (* Return grid-fitted pixel coordinates. *)
+ (* *)
+ FT_Glyph_BBox_Mode = cint;
+{$ELSE TYPE_DECL}
+const
+ FT_GLYPH_BBOX_UNSCALED = 0;
+ FT_GLYPH_BBOX_SUBPIXELS = 0;
+ FT_GLYPH_BBOX_GRIDFIT = 1;
+ FT_GLYPH_BBOX_TRUNCATE = 2;
+ FT_GLYPH_BBOX_PIXELS = 3;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Glyph_Get_CBox *)
+ (* *)
+ (* <Description> *)
+ (* Return a glyph's `control box'. The control box encloses all the *)
+ (* outline's points, including Bézier control points. Though it *)
+ (* coincides with the exact bounding box for most glyphs, it can be *)
+ (* slightly larger in some situations (like when rotating an outline *)
+ (* which contains Bézier outside arcs). *)
+ (* *)
+ (* Computing the control box is very fast, while getting the bounding *)
+ (* box can take much more time as it needs to walk over all segments *)
+ (* and arcs in the outline. To get the latter, you can use the *)
+ (* `ftbbox' component which is dedicated to this single task. *)
+ (* *)
+ (* <Input> *)
+ (* glyph :: A handle to the source glyph object. *)
+ (* *)
+ (* mode :: The mode which indicates how to interpret the returned *)
+ (* bounding box values. *)
+ (* *)
+ (* <Output> *)
+ (* acbox :: The glyph coordinate bounding box. Coordinates are *)
+ (* expressed in 1/64th of pixels if it is grid-fitted. *)
+ (* *)
+ (* <Note> *)
+ (* Coordinates are relative to the glyph origin, using the Y-upwards *)
+ (* convention. *)
+ (* *)
+ (* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' *)
+ (* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font *)
+ (* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS *)
+ (* is another name for this constant. *)
+ (* *)
+ (* Note that the maximum coordinates are exclusive, which means that *)
+ (* one can compute the width and height of the glyph image (be it in *)
+ (* integer or 26.6 pixels) as: *)
+ (* *)
+ (* { *)
+ (* width = bbox.xMax - bbox.xMin; *)
+ (* height = bbox.yMax - bbox.yMin; *)
+ (* } *)
+ (* *)
+ (* Note also that for 26.6 coordinates, if `bbox_mode' is set to *)
+ (* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, *)
+ (* which corresponds to: *)
+ (* *)
+ (* { *)
+ (* bbox.xMin = FLOOR(bbox.xMin); *)
+ (* bbox.yMin = FLOOR(bbox.yMin); *)
+ (* bbox.xMax = CEILING(bbox.xMax); *)
+ (* bbox.yMax = CEILING(bbox.yMax); *)
+ (* } *)
+ (* *)
+ (* To get the bbox in pixel coordinates, set `bbox_mode' to *)
+ (* @FT_GLYPH_BBOX_TRUNCATE. *)
+ (* *)
+ (* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' *)
+ (* to @FT_GLYPH_BBOX_PIXELS. *)
+ (* *)
+ procedure FT_Glyph_Get_CBox( glyph: FT_Glyph;
+ bbox_mode: FT_UInt;
+ out acbox: FT_BBox );
+ cdecl; external ft_lib name 'FT_Glyph_Get_CBox';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Glyph_To_Bitmap *)
+ (* *)
+ (* <Description> *)
+ (* Converts a given glyph object to a bitmap glyph object. *)
+ (* *)
+ (* <InOut> *)
+ (* the_glyph :: A pointer to a handle to the target glyph. *)
+ (* *)
+ (* <Input> *)
+ (* render_mode :: An enumeration that describe how the data is *)
+ (* rendered. *)
+ (* *)
+ (* origin :: A pointer to a vector used to translate the glyph *)
+ (* image before rendering. Can be 0 (if no *)
+ (* translation). The origin is expressed in *)
+ (* 26.6 pixels. *)
+ (* *)
+ (* destroy :: A boolean that indicates that the original glyph *)
+ (* image should be destroyed by this function. It is *)
+ (* never destroyed in case of error. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ (* <Note> *)
+ (* The glyph image is translated with the `origin' vector before *)
+ (* rendering. *)
+ (* *)
+ (* The first parameter is a pointer to a FT_Glyph handle, that will *)
+ (* be replaced by this function. Typically, you would use (omitting *)
+ (* error handling): *)
+ (* *)
+ (* *)
+ (* { *)
+ (* FT_Glyph glyph; *)
+ (* FT_BitmapGlyph glyph_bitmap; *)
+ (* *)
+ (* *)
+ (* // load glyph *)
+ (* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); *)
+ (* *)
+ (* // extract glyph image *)
+ (* error = FT_Get_Glyph( face->glyph, &glyph ); *)
+ (* *)
+ (* // convert to a bitmap (default render mode + destroy old) *)
+ (* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) *)
+ (* { *)
+ (* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT, *)
+ (* 0, 1 ); *)
+ (* if ( error ) // glyph unchanged *)
+ (* ... *)
+ (* } *)
+ (* *)
+ (* // access bitmap content by typecasting *)
+ (* glyph_bitmap = (FT_BitmapGlyph)glyph; *)
+ (* *)
+ (* // do funny stuff with it, like blitting/drawing *)
+ (* ... *)
+ (* *)
+ (* // discard glyph image (bitmap or not) *)
+ (* FT_Done_Glyph( glyph ); *)
+ (* } *)
+ (* *)
+ (* *)
+ (* This function does nothing if the glyph format isn't scalable. *)
+ (* *)
+ function FT_Glyph_To_Bitmap(var the_glyph: FT_Glyph;
+ render_mode: FT_Render_Mode;
+ origin: PFT_Vector;
+ destroy: FT_Bool ): FT_Error;
+ cdecl; external ft_lib name 'FT_Glyph_To_Bitmap';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Done_Glyph *)
+ (* *)
+ (* <Description> *)
+ (* Destroys a given glyph. *)
+ (* *)
+ (* <Input> *)
+ (* glyph :: A handle to the target glyph object. *)
+ (* *)
+ procedure FT_Done_Glyph( glyph: FT_Glyph );
+ cdecl; external ft_lib name 'FT_Done_Glyph';
+
+{$ENDIF TYPE_DECL}
diff --git a/unicode/src/lib/freetype/ftimage.inc b/unicode/src/lib/freetype/ftimage.inc
new file mode 100644
index 00000000..a6babc98
--- /dev/null
+++ b/unicode/src/lib/freetype/ftimage.inc
@@ -0,0 +1,801 @@
+(***************************************************************************)
+(* *)
+(* ftimage.h *)
+(* *)
+(* FreeType glyph image formats and default raster interface *)
+(* (specification). *)
+(* *)
+(* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 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. *)
+(* *)
+(***************************************************************************)
+(***************************************************************************)
+(* Pascal port by the UltraStar Deluxe Team *)
+(***************************************************************************)
+
+ (*************************************************************************)
+ (* *)
+ (* Note: A `raster' is simply a scan-line converter, used to render *)
+ (* FT_Outlines into FT_Bitmaps. *)
+ (* *)
+ (*************************************************************************)
+
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Pos *)
+ (* *)
+ (* <Description> *)
+ (* The type FT_Pos is a 32-bit integer used to store vectorial *)
+ (* coordinates. Depending on the context, these can represent *)
+ (* distances in integer font units, or 16,16, or 26.6 fixed float *)
+ (* pixel coordinates. *)
+ (* *)
+ FT_Pos = cslong;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Vector *)
+ (* *)
+ (* <Description> *)
+ (* A simple structure used to store a 2D vector; coordinates are of *)
+ (* the FT_Pos type. *)
+ (* *)
+ (* <Fields> *)
+ (* x :: The horizontal coordinate. *)
+ (* y :: The vertical coordinate. *)
+ (* *)
+ PFT_Vector = ^FT_Vector;
+ FT_Vector = record
+ x ,
+ y : FT_Pos;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_BBox *)
+ (* *)
+ (* <Description> *)
+ (* A structure used to hold an outline's bounding box, i.e., the *)
+ (* coordinates of its extrema in the horizontal and vertical *)
+ (* directions. *)
+ (* *)
+ (* <Fields> *)
+ (* xMin :: The horizontal minimum (left-most). *)
+ (* *)
+ (* yMin :: The vertical minimum (bottom-most). *)
+ (* *)
+ (* xMax :: The horizontal maximum (right-most). *)
+ (* *)
+ (* yMax :: The vertical maximum (top-most). *)
+ (* *)
+ PFT_BBox = ^FT_BBox;
+ FT_BBox = record
+ xMin, yMin : FT_Pos;
+ xMax, yMax : FT_Pos;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Enum> *)
+ (* FT_Pixel_Mode *)
+ (* *)
+ (* <Description> *)
+ (* An enumeration type used to describe the format of pixels in a *)
+ (* given bitmap. Note that additional formats may be added in the *)
+ (* future. *)
+ (* *)
+ (* <Values> *)
+ (* FT_PIXEL_MODE_NONE :: *)
+ (* Value 0 is reserved. *)
+ (* *)
+ (* FT_PIXEL_MODE_MONO :: *)
+ (* A monochrome bitmap, using 1 bit per pixel. Note that pixels *)
+ (* are stored in most-significant order (MSB), which means that *)
+ (* the left-most pixel in a byte has value 128. *)
+ (* *)
+ (* FT_PIXEL_MODE_GRAY :: *)
+ (* An 8-bit bitmap, generally used to represent anti-aliased glyph *)
+ (* images. Each pixel is stored in one byte. Note that the number *)
+ (* of value `gray' levels is stored in the `num_bytes' field of *)
+ (* the @FT_Bitmap structure (it generally is 256). *)
+ (* *)
+ (* FT_PIXEL_MODE_GRAY2 :: *)
+ (* A 2-bit/pixel bitmap, used to represent embedded anti-aliased *)
+ (* bitmaps in font files according to the OpenType specification. *)
+ (* We haven't found a single font using this format, however. *)
+ (* *)
+ (* FT_PIXEL_MODE_GRAY4 :: *)
+ (* A 4-bit/pixel bitmap, used to represent embedded anti-aliased *)
+ (* bitmaps in font files according to the OpenType specification. *)
+ (* We haven't found a single font using this format, however. *)
+ (* *)
+ (* FT_PIXEL_MODE_LCD :: *)
+ (* An 8-bit bitmap, used to represent RGB or BGR decimated glyph *)
+ (* images used for display on LCD displays; the bitmap is three *)
+ (* times wider than the original glyph image. See also *)
+ (* @FT_RENDER_MODE_LCD. *)
+ (* *)
+ (* FT_PIXEL_MODE_LCD_V :: *)
+ (* An 8-bit bitmap, used to represent RGB or BGR decimated glyph *)
+ (* images used for display on rotated LCD displays; the bitmap *)
+ (* is three times taller than the original glyph image. See also *)
+ (* @FT_RENDER_MODE_LCD_V. *)
+ (* *)
+ FT_Pixel_Mode = cint;
+{$ELSE TYPE_DECL}
+const
+ FT_PIXEL_MODE_NONE = 0;
+ FT_PIXEL_MODE_MONO = FT_PIXEL_MODE_NONE + 1;
+ FT_PIXEL_MODE_GRAY = FT_PIXEL_MODE_MONO + 1;
+ FT_PIXEL_MODE_GRAY2 = FT_PIXEL_MODE_GRAY + 1;
+ FT_PIXEL_MODE_GRAY4 = FT_PIXEL_MODE_GRAY2 + 1;
+ FT_PIXEL_MODE_LCD = FT_PIXEL_MODE_GRAY4 + 1;
+ FT_PIXEL_MODE_LCD_V = FT_PIXEL_MODE_LCD + 1;
+
+ FT_PIXEL_MODE_MAX = FT_PIXEL_MODE_LCD_V + 1; (* do not remove *)
+{$ENDIF TYPE_DECL}
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Bitmap *)
+ (* *)
+ (* <Description> *)
+ (* A structure used to describe a bitmap or pixmap to the raster. *)
+ (* Note that we now manage pixmaps of various depths through the *)
+ (* `pixel_mode' field. *)
+ (* *)
+ (* <Fields> *)
+ (* rows :: The number of bitmap rows. *)
+ (* *)
+ (* width :: The number of pixels in bitmap row. *)
+ (* *)
+ (* pitch :: The pitch's absolute value is the number of bytes *)
+ (* taken by one bitmap row, including padding. *)
+ (* However, the pitch is positive when the bitmap has *)
+ (* a `down' flow, and negative when it has an `up' *)
+ (* flow. In all cases, the pitch is an offset to add *)
+ (* to a bitmap pointer in order to go down one row. *)
+ (* *)
+ (* buffer :: A typeless pointer to the bitmap buffer. This *)
+ (* value should be aligned on 32-bit boundaries in *)
+ (* most cases. *)
+ (* *)
+ (* num_grays :: This field is only used with *)
+ (* `FT_PIXEL_MODE_GRAY'; it gives the number of gray *)
+ (* levels used in the bitmap. *)
+ (* *)
+ (* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. *)
+ (* See @FT_Pixel_Mode for possible values. *)
+ (* *)
+ (* palette_mode :: This field is only used with paletted pixel modes; *)
+ (* it indicates how the palette is stored. *)
+ (* *)
+ (* palette :: A typeless pointer to the bitmap palette; only *)
+ (* used for paletted pixel modes. *)
+ (* *)
+ (* <Note> *)
+ (* For now, the only pixel mode supported by FreeType are mono and *)
+ (* grays. However, drivers might be added in the future to support *)
+ (* more `colorful' options. *)
+ (* *)
+ (* When using pixel modes pal2, pal4 and pal8 with a void `palette' *)
+ (* field, a gray pixmap with respectively 4, 16, and 256 levels of *)
+ (* gray is assumed. This, in order to be compatible with some *)
+ (* embedded bitmap formats defined in the TrueType specification. *)
+ (* *)
+ (* Note that no font was found presenting such embedded bitmaps, so *)
+ (* this is currently completely unhandled by the library. *)
+ (* *)
+ PFT_Bitmap = ^FT_Bitmap;
+ FT_Bitmap = record
+ rows: FT_Int;
+ width: FT_Int;
+ pitch: FT_Int;
+ buffer: PByteArray;
+ num_grays: FT_Short;
+ pixel_mode: byte;
+ palette_mode: byte;
+ palette: pointer;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Section> *)
+ (* outline_processing *)
+ (* *)
+ (*************************************************************************)
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Outline *)
+ (* *)
+ (* <Description> *)
+ (* This structure is used to describe an outline to the scan-line *)
+ (* converter. *)
+ (* *)
+ (* <Fields> *)
+ (* n_contours :: The number of contours in the outline. *)
+ (* *)
+ (* n_points :: The number of points in the outline. *)
+ (* *)
+ (* points :: A pointer to an array of `n_points' FT_Vector *)
+ (* elements, giving the outline's point coordinates. *)
+ (* *)
+ (* tags :: A pointer to an array of `n_points' chars, giving *)
+ (* each outline point's type. If bit 0 is unset, the *)
+ (* point is `off' the curve, i.e. a Bezier control *)
+ (* point, while it is `on' when set. *)
+ (* *)
+ (* Bit 1 is meaningful for `off' points only. If set, *)
+ (* it indicates a third-order Bezier arc control point; *)
+ (* and a second-order control point if unset. *)
+ (* *)
+ (* contours :: An array of `n_contours' shorts, giving the end *)
+ (* point of each contour within the outline. For *)
+ (* example, the first contour is defined by the points *)
+ (* `0' to `contours[0]', the second one is defined by *)
+ (* the points `contours[0]+1' to `contours[1]', etc. *)
+ (* *)
+ (* flags :: A set of bit flags used to characterize the outline *)
+ (* and give hints to the scan-converter and hinter on *)
+ (* how to convert/grid-fit it. See FT_Outline_Flags. *)
+ (* *)
+ PFT_Outline = ^FT_Outline;
+ FT_Outline = record
+ n_contours: FT_Short; (* number of contours in glyph *)
+ n_points: FT_Short; (* number of points in the glyph *)
+
+ points: PFT_Vector; (* the outline's points *)
+ tags: PChar; (* the points flags *)
+ contours: PFT_Short; (* the contour end points *)
+
+ flags: FT_Int; (* outline masks *)
+ end;
+
+{$ELSE TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* @macro: *)
+ (* FT_CURVE_TAG ( flag ) *)
+ (* *)
+ function FT_CURVE_TAG(flag: byte): byte;
+
+const
+ FT_CURVE_TAG_ON = 1;
+ FT_CURVE_TAG_CONIC = 0;
+ FT_CURVE_TAG_CUBIC = 2;
+
+ FT_CURVE_TAG_TOUCH_X = 8; // reserved for the TrueType hinter
+ FT_CURVE_TAG_TOUCH_Y = 16; // reserved for the TrueType hinter
+
+ FT_CURVE_TAG_TOUCH_BOTH = ( FT_CURVE_TAG_TOUCH_X or
+ FT_CURVE_TAG_TOUCH_Y );
+{$ENDIF TYPE_DECL}
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Outline_MoveToFunc *)
+ (* *)
+ (* <Description> *)
+ (* A function pointer type used to describe the signature of a `move *)
+ (* to' function during outline walking/decomposition. *)
+ (* *)
+ (* A `move to' is emitted to start a new contour in an outline. *)
+ (* *)
+ (* <Input> *)
+ (* to :: A pointer to the target point of the `move to'. *)
+ (* *)
+ (* user :: A typeless pointer which is passed from the caller of the *)
+ (* decomposition function. *)
+ (* *)
+ (* <Return> *)
+ (* Error code. 0 means success. *)
+ (* *)
+ FT_Outline_MoveToFunc = function(to_: {const} PFT_Vector;
+ user: Pointer): cint; cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Outline_LineToFunc *)
+ (* *)
+ (* <Description> *)
+ (* A function pointer type used to describe the signature of a `line *)
+ (* to' function during outline walking/decomposition. *)
+ (* *)
+ (* A `line to' is emitted to indicate a segment in the outline. *)
+ (* *)
+ (* <Input> *)
+ (* to :: A pointer to the target point of the `line to'. *)
+ (* *)
+ (* user :: A typeless pointer which is passed from the caller of the *)
+ (* decomposition function. *)
+ (* *)
+ (* <Return> *)
+ (* Error code. 0 means success. *)
+ (* *)
+ FT_Outline_LineToFunc = function(to_: {const} PFT_Vector;
+ user: Pointer): cint; cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Outline_ConicToFunc *)
+ (* *)
+ (* <Description> *)
+ (* A function pointer type use to describe the signature of a `conic *)
+ (* to' function during outline walking/decomposition. *)
+ (* *)
+ (* A `conic to' is emitted to indicate a second-order Bézier arc in *)
+ (* the outline. *)
+ (* *)
+ (* <Input> *)
+ (* control :: An intermediate control point between the last position *)
+ (* and the new target in `to'. *)
+ (* *)
+ (* to :: A pointer to the target end point of the conic arc. *)
+ (* *)
+ (* user :: A typeless pointer which is passed from the caller of *)
+ (* the decomposition function. *)
+ (* *)
+ (* <Return> *)
+ (* Error code. 0 means success. *)
+ (* *)
+ FT_Outline_ConicToFunc = function(control: {const} PFT_Vector;
+ to_: {const} PFT_Vector;
+ user: Pointer): cint; cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Outline_CubicToFunc *)
+ (* *)
+ (* <Description> *)
+ (* A function pointer type used to describe the signature of a `cubic *)
+ (* to' function during outline walking/decomposition. *)
+ (* *)
+ (* A `cubic to' is emitted to indicate a third-order Bézier arc. *)
+ (* *)
+ (* <Input> *)
+ (* control1 :: A pointer to the first Bézier control point. *)
+ (* *)
+ (* control2 :: A pointer to the second Bézier control point. *)
+ (* *)
+ (* to :: A pointer to the target end point. *)
+ (* *)
+ (* user :: A typeless pointer which is passed from the caller of *)
+ (* the decomposition function. *)
+ (* *)
+ (* <Return> *)
+ (* Error code. 0 means success. *)
+ (* *)
+ FT_Outline_CubicToFunc = function( control1: {const} PFT_Vector;
+ control2: {const} PFT_Vector;
+ to_: {const} PFT_Vector;
+ user: Pointer ): cint; cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Outline_Funcs *)
+ (* *)
+ (* <Description> *)
+ (* A structure to hold various function pointers used during outline *)
+ (* decomposition in order to emit segments, conic, and cubic Béziers, *)
+ (* as well as `move to' and `close to' operations. *)
+ (* *)
+ (* <Fields> *)
+ (* move_to :: The `move to' emitter. *)
+ (* *)
+ (* line_to :: The segment emitter. *)
+ (* *)
+ (* conic_to :: The second-order Bézier arc emitter. *)
+ (* *)
+ (* cubic_to :: The third-order Bézier arc emitter. *)
+ (* *)
+ (* shift :: The shift that is applied to coordinates before they *)
+ (* are sent to the emitter. *)
+ (* *)
+ (* delta :: The delta that is applied to coordinates before they *)
+ (* are sent to the emitter, but after the shift. *)
+ (* *)
+ (* <Note> *)
+ (* The point coordinates sent to the emitters are the transformed *)
+ (* version of the original coordinates (this is important for high *)
+ (* accuracy during scan-conversion). The transformation is simple: *)
+ (* *)
+ (* { *)
+ (* x' = (x << shift) - delta *)
+ (* y' = (x << shift) - delta *)
+ (* } *)
+ (* *)
+ (* Set the value of `shift' and `delta' to 0 to get the original *)
+ (* point coordinates. *)
+ (* *)
+ PFT_Outline_Funcs = ^FT_Outline_Funcs;
+ FT_Outline_Funcs = record
+ move_to: FT_Outline_MoveToFunc;
+ line_to: FT_Outline_LineToFunc;
+ conic_to: FT_Outline_ConicToFunc;
+ cubic_to: FT_Outline_CubicToFunc;
+
+ shift: cint;
+ delta: FT_Pos;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Enum> *)
+ (* FT_Glyph_Format *)
+ (* *)
+ (* <Description> *)
+ (* An enumeration type used to describe the format of a given glyph *)
+ (* image. Note that this version of FreeType only supports two image *)
+ (* formats, even though future font drivers will be able to register *)
+ (* their own format. *)
+ (* *)
+ (* <Values> *)
+ (* FT_GLYPH_FORMAT_NONE :: *)
+ (* The value 0 is reserved and does describe a glyph format. *)
+ (* *)
+ (* FT_GLYPH_FORMAT_COMPOSITE :: *)
+ (* The glyph image is a composite of several other images. This *)
+ (* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to *)
+ (* report compound glyphs (like accented characters). *)
+ (* *)
+ (* FT_GLYPH_FORMAT_BITMAP :: *)
+ (* The glyph image is a bitmap, and can be described as an *)
+ (* @FT_Bitmap. You generally need to access the `bitmap' field of *)
+ (* the @FT_GlyphSlotRec structure to read it. *)
+ (* *)
+ (* FT_GLYPH_FORMAT_OUTLINE :: *)
+ (* The glyph image is a vertorial outline made of line segments *)
+ (* and Bezier arcs; it can be described as an @FT_Outline; you *)
+ (* generally want to access the `outline' field of the *)
+ (* @FT_GlyphSlotRec structure to read it. *)
+ (* *)
+ (* FT_GLYPH_FORMAT_PLOTTER :: *)
+ (* The glyph image is a vectorial path with no inside/outside *)
+ (* contours. Some Type 1 fonts, like those in the Hershey family, *)
+ (* contain glyphs in this format. These are described as *)
+ (* @FT_Outline, but FreeType isn't currently capable of rendering *)
+ (* them correctly. *)
+ (* *)
+ FT_Glyph_Format = array[0..3] of char;
+{$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' );
+
+{$ENDIF TYPE_DECL}
+
+ (*************************************************************************)
+ (*************************************************************************)
+ (*************************************************************************)
+ (***** *****)
+ (***** R A S T E R D E F I N I T I O N S *****)
+ (***** *****)
+ (*************************************************************************)
+ (*************************************************************************)
+ (*************************************************************************)
+
+
+ (*************************************************************************)
+ (* *)
+ (* A raster is a scan converter, in charge of rendering an outline into *)
+ (* a a bitmap. This section contains the public API for rasters. *)
+ (* *)
+ (* Note that in FreeType 2, all rasters are now encapsulated within *)
+ (* specific modules called `renderers'. See `freetype/ftrender.h' for *)
+ (* more details on renderers. *)
+ (* *)
+ (*************************************************************************)
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Section> *)
+ (* raster *)
+ (* *)
+ (* <Title> *)
+ (* Scanline Converter *)
+ (* *)
+ (* <Abstract> *)
+ (* How vectorial outlines are converted into bitmaps and pixmaps. *)
+ (* *)
+ (* <Description> *)
+ (* This section contains technical definitions. *)
+ (* *)
+ (*************************************************************************)
+
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Raster *)
+ (* *)
+ (* <Description> *)
+ (* A handle (pointer) to a raster object. Each object can be used *)
+ (* independently to convert an outline into a bitmap or pixmap. *)
+ (* *)
+ FT_Raster = Pointer;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Span *)
+ (* *)
+ (* <Description> *)
+ (* A structure used to model a single span of gray (or black) pixels *)
+ (* when rendering a monochrome or anti-aliased bitmap. *)
+ (* *)
+ (* <Fields> *)
+ (* x :: The span's horizontal start position. *)
+ (* *)
+ (* len :: The span's length in pixels. *)
+ (* *)
+ (* coverage :: The span color/coverage, ranging from 0 (background) *)
+ (* to 255 (foreground). Only used for anti-aliased *)
+ (* rendering. *)
+ (* *)
+ (* <Note> *)
+ (* This structure is used by the span drawing callback type named *)
+ (* @FT_SpanFunc which takes the y-coordinate of the span as a *)
+ (* a parameter. *)
+ (* *)
+ (* The coverage value is always between 0 and 255. *)
+ (* *)
+ PFT_Span = ^FT_Span;
+ FT_Span = record
+ x: cshort;
+ len: cushort;
+ coverage: cuchar;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_SpanFunc *)
+ (* *)
+ (* <Description> *)
+ (* A function used as a call-back by the anti-aliased renderer in *)
+ (* order to let client applications draw themselves the gray pixel *)
+ (* spans on each scan line. *)
+ (* *)
+ (* <Input> *)
+ (* y :: The scanline's y-coordinate. *)
+ (* *)
+ (* count :: The number of spans to draw on this scanline. *)
+ (* *)
+ (* spans :: A table of `count' spans to draw on the scanline. *)
+ (* *)
+ (* user :: User-supplied data that is passed to the callback. *)
+ (* *)
+ (* <Note> *)
+ (* This callback allows client applications to directly render the *)
+ (* gray spans of the anti-aliased bitmap to any kind of surfaces. *)
+ (* *)
+ (* This can be used to write anti-aliased outlines directly to a *)
+ (* given background bitmap, and even perform translucency. *)
+ (* *)
+ (* Note that the `count' field cannot be greater than a fixed value *)
+ (* defined by the `FT_MAX_GRAY_SPANS' configuration macro in *)
+ (* `ftoption.h'. By default, this value is set to 32, which means *)
+ (* that if there are more than 32 spans on a given scanline, the *)
+ (* callback is called several times with the same `y' parameter in *)
+ (* order to draw all callbacks. *)
+ (* *)
+ (* Otherwise, the callback is only called once per scan-line, and *)
+ (* only for those scanlines that do have `gray' pixels on them. *)
+ (* *)
+ FT_SpanFunc = procedure(y: cint;
+ count: cint;
+ spans: {const} PFT_Span;
+ user: Pointer ); cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Raster_BitTest_Func *)
+ (* *)
+ (* <Description> *)
+ (* THIS TYPE IS DEPRECATED. DO NOT USE IT. *)
+ (* *)
+ (* A function used as a call-back by the monochrome scan-converter *)
+ (* to test whether a given target pixel is already set to the drawing *)
+ (* `color'. These tests are crucial to implement drop-out control *)
+ (* per-se the TrueType spec. *)
+ (* *)
+ (* <Input> *)
+ (* y :: The pixel's y-coordinate. *)
+ (* *)
+ (* x :: The pixel's x-coordinate. *)
+ (* *)
+ (* user :: User-supplied data that is passed to the callback. *)
+ (* *)
+ (* <Return> *)
+ (* 1 if the pixel is `set', 0 otherwise. *)
+ (* *)
+ FT_Raster_BitTest_Func = function(y: cint;
+ x: cint;
+ user: Pointer): cint; cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Raster_BitSet_Func *)
+ (* *)
+ (* <Description> *)
+ (* THIS TYPE IS DEPRECATED. DO NOT USE IT. *)
+ (* *)
+ (* A function used as a call-back by the monochrome scan-converter *)
+ (* to set an individual target pixel. This is crucial to implement *)
+ (* drop-out control according to the TrueType specification. *)
+ (* *)
+ (* <Input> *)
+ (* y :: The pixel's y-coordinate. *)
+ (* *)
+ (* x :: The pixel's x-coordinate. *)
+ (* *)
+ (* user :: User-supplied data that is passed to the callback. *)
+ (* *)
+ (* <Return> *)
+ (* 1 if the pixel is `set', 0 otherwise. *)
+ (* *)
+ FT_Raster_BitSet_Func = procedure(y: cint;
+ x: cint;
+ user: Pointer ); cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Enum> *)
+ (* FT_RASTER_FLAG_XXX *)
+ (* *)
+ (* <Description> *)
+ (* A list of bit flag constants as used in the `flags' field of a *)
+ (* @FT_Raster_Params structure. *)
+ (* *)
+ (* <Values> *)
+ (* FT_RASTER_FLAG_DEFAULT :: This value is 0. *)
+ (* *)
+ (* FT_RASTER_FLAG_AA :: This flag is set to indicate that an *)
+ (* anti-aliased glyph image should be *)
+ (* generated. Otherwise, it will be *)
+ (* monochrome (1-bit). *)
+ (* *)
+ (* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct *)
+ (* rendering. In this mode, client *)
+ (* applications must provide their own span *)
+ (* callback. This lets them directly *)
+ (* draw or compose over an existing bitmap. *)
+ (* If this bit is not set, the target *)
+ (* pixmap's buffer _must_ be zeroed before *)
+ (* rendering. *)
+ (* *)
+ (* Note that for now, direct rendering is *)
+ (* only possible with anti-aliased glyphs. *)
+ (* *)
+ (* FT_RASTER_FLAG_CLIP :: This flag is only used in direct *)
+ (* rendering mode. If set, the output will *)
+ (* be clipped to a box specified in the *)
+ (* `clip_box' field of the *)
+ (* @FT_Raster_Params structure. *)
+ (* *)
+ (* Note that by default, the glyph bitmap *)
+ (* is clipped to the target pixmap, except *)
+ (* in direct rendering mode where all spans *)
+ (* are generated if no clipping box is set. *)
+ (* *)
+{$ELSE TYPE_DECL}
+const
+ FT_RASTER_FLAG_DEFAULT = $0;
+ FT_RASTER_FLAG_AA = $1;
+ FT_RASTER_FLAG_DIRECT = $2;
+ FT_RASTER_FLAG_CLIP = $4;
+
+{$ENDIF TYPE_DECL}
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Raster_Params *)
+ (* *)
+ (* <Description> *)
+ (* A structure to hold the arguments used by a raster's render *)
+ (* function. *)
+ (* *)
+ (* <Fields> *)
+ (* target :: The target bitmap. *)
+ (* *)
+ (* source :: A pointer to the source glyph image (e.g., an *)
+ (* @FT_Outline). *)
+ (* *)
+ (* flags :: The rendering flags. *)
+ (* *)
+ (* gray_spans :: The gray span drawing callback. *)
+ (* *)
+ (* black_spans :: The black span drawing callback. *)
+ (* *)
+ (* bit_test :: The bit test callback. UNIMPLEMENTED! *)
+ (* *)
+ (* bit_set :: The bit set callback. UNIMPLEMENTED! *)
+ (* *)
+ (* user :: User-supplied data that is passed to each drawing *)
+ (* callback. *)
+ (* *)
+ (* clip_box :: An optional clipping box. It is only used in *)
+ (* direct rendering mode. Note that coordinates here *)
+ (* should be expressed in _integer_ pixels (and not in *)
+ (* 26.6 fixed-point units). *)
+ (* *)
+ (* <Note> *)
+ (* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA *)
+ (* bit flag is set in the `flags' field, otherwise a monochrome *)
+ (* bitmap is generated. *)
+ (* *)
+ (* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the *)
+ (* raster will call the `gray_spans' callback to draw gray pixel *)
+ (* spans, in the case of an aa glyph bitmap, it will call *)
+ (* `black_spans', and `bit_test' and `bit_set' in the case of a *)
+ (* monochrome bitmap. This allows direct composition over a *)
+ (* pre-existing bitmap through user-provided callbacks to perform the *)
+ (* span drawing/composition. *)
+ (* *)
+ (* Note that the `bit_test' and `bit_set' callbacks are required when *)
+ (* rendering a monochrome bitmap, as they are crucial to implement *)
+ (* correct drop-out control as defined in the TrueType specification. *)
+ (* *)
+ PFT_Raster_Params = ^FT_Raster_Params;
+ FT_Raster_Params = record
+ target: {const} PFT_Bitmap;
+ source: {const} Pointer;
+ flags: cint;
+ gray_spans: FT_SpanFunc;
+ black_spans: FT_SpanFunc;
+ bit_test: FT_Raster_BitTest_Func; (* doesn't work! *)
+ bit_set: FT_Raster_BitSet_Func; (* doesn't work! *)
+ user: Pointer;
+ clip_box: FT_BBox;
+ end;
+
+{$ENDIF TYPE_DECL}
+
+
diff --git a/unicode/src/lib/freetype/ftoutln.inc b/unicode/src/lib/freetype/ftoutln.inc
new file mode 100644
index 00000000..a47f7bab
--- /dev/null
+++ b/unicode/src/lib/freetype/ftoutln.inc
@@ -0,0 +1,497 @@
+(***************************************************************************)
+(* *)
+(* ftoutln.h *)
+(* *)
+(* Support for the FT_Outline type used to store glyph shapes of *)
+(* most scalable font formats (specification). *)
+(* *)
+(* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007 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. *)
+(* *)
+(***************************************************************************)
+(***************************************************************************)
+(* Pascal port by the UltraStar Deluxe Team *)
+(***************************************************************************)
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Section> *)
+ (* outline_processing *)
+ (* *)
+ (* <Title> *)
+ (* Outline Processing *)
+ (* *)
+ (* <Abstract> *)
+ (* Functions to create, transform, and render vectorial glyph images. *)
+ (* *)
+ (* <Description> *)
+ (* This section contains routines used to create and destroy scalable *)
+ (* glyph images known as `outlines'. These can also be measured, *)
+ (* transformed, and converted into bitmaps and pixmaps. *)
+ (* *)
+ (* <Order> *)
+ (* FT_Outline *)
+ (* FT_OUTLINE_FLAGS *)
+ (* FT_Outline_New *)
+ (* FT_Outline_Done *)
+ (* FT_Outline_Copy *)
+ (* FT_Outline_Translate *)
+ (* FT_Outline_Transform *)
+ (* FT_Outline_Embolden *)
+ (* FT_Outline_Reverse *)
+ (* FT_Outline_Check *)
+ (* *)
+ (* FT_Outline_Get_CBox *)
+ (* FT_Outline_Get_BBox *)
+ (* *)
+ (* FT_Outline_Get_Bitmap *)
+ (* FT_Outline_Render *)
+ (* *)
+ (* FT_Outline_Decompose *)
+ (* FT_Outline_Funcs *)
+ (* FT_Outline_MoveTo_Func *)
+ (* FT_Outline_LineTo_Func *)
+ (* FT_Outline_ConicTo_Func *)
+ (* FT_Outline_CubicTo_Func *)
+ (* *)
+ (*************************************************************************)
+
+{$IFNDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Decompose *)
+ (* *)
+ (* <Description> *)
+ (* Walks over an outline's structure to decompose it into individual *)
+ (* segments and Bézier arcs. This function is also able to emit *)
+ (* `move to' and `close to' operations to indicate the start and end *)
+ (* of new contours in the outline. *)
+ (* *)
+ (* <Input> *)
+ (* outline :: A pointer to the source target. *)
+ (* *)
+ (* func_interface :: A table of `emitters', i.e,. function pointers *)
+ (* called during decomposition to indicate path *)
+ (* operations. *)
+ (* *)
+ (* <InOut> *)
+ (* user :: A typeless pointer which is passed to each *)
+ (* emitter during the decomposition. It can be *)
+ (* used to store the state during the *)
+ (* decomposition. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ function FT_Outline_Decompose(
+ outline: PFT_Outline;
+ func_interface: {const} PFT_Outline_Funcs;
+ user: Pointer): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Decompose';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_New *)
+ (* *)
+ (* <Description> *)
+ (* Creates a new outline of a given size. *)
+ (* *)
+ (* <Input> *)
+ (* library :: A handle to the library object from where the *)
+ (* outline is allocated. Note however that the new *)
+ (* outline will *not* necessarily be *freed*, when *)
+ (* destroying the library, by @FT_Done_FreeType. *)
+ (* *)
+ (* numPoints :: The maximal number of points within the outline. *)
+ (* *)
+ (* numContours :: The maximal number of contours within the outline. *)
+ (* *)
+ (* <Output> *)
+ (* anoutline :: A handle to the new outline. NULL in case of *)
+ (* error. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ (* <Note> *)
+ (* The reason why this function takes a `library' parameter is simply *)
+ (* to use the library's memory allocator. *)
+ (* *)
+ function FT_Outline_New(
+ library_: FT_Library;
+ numPoints: FT_UInt;
+ numContours: FT_Int;
+ anoutline: PFT_Outline): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_New';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Done *)
+ (* *)
+ (* <Description> *)
+ (* Destroys an outline created with @FT_Outline_New. *)
+ (* *)
+ (* <Input> *)
+ (* library :: A handle of the library object used to allocate the *)
+ (* outline. *)
+ (* *)
+ (* outline :: A pointer to the outline object to be discarded. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ (* <Note> *)
+ (* If the outline's `owner' field is not set, only the outline *)
+ (* descriptor will be released. *)
+ (* *)
+ (* The reason why this function takes an `library' parameter is *)
+ (* simply to use ft_mem_free(). *)
+ (* *)
+ function FT_Outline_Done(library_: FT_Library;
+ outline: PFT_Outline): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Done';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Check *)
+ (* *)
+ (* <Description> *)
+ (* Check the contents of an outline descriptor. *)
+ (* *)
+ (* <Input> *)
+ (* outline :: A handle to a source outline. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ function FT_Outline_Check( outline: PFT_Outline ): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Check';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Get_CBox *)
+ (* *)
+ (* <Description> *)
+ (* Returns an outline's `control box'. The control box encloses all *)
+ (* the outline's points, including Bézier control points. Though it *)
+ (* coincides with the exact bounding box for most glyphs, it can be *)
+ (* slightly larger in some situations (like when rotating an outline *)
+ (* which contains Bézier outside arcs). *)
+ (* *)
+ (* Computing the control box is very fast, while getting the bounding *)
+ (* box can take much more time as it needs to walk over all segments *)
+ (* and arcs in the outline. To get the latter, you can use the *)
+ (* `ftbbox' component which is dedicated to this single task. *)
+ (* *)
+ (* <Input> *)
+ (* outline :: A pointer to the source outline descriptor. *)
+ (* *)
+ (* <Output> *)
+ (* acbox :: The outline's control box. *)
+ (* *)
+ procedure FT_Outline_Get_CBox(
+ outline: {const} PFT_Outline;
+ acbox: PFT_BBox);
+ cdecl; external ft_lib name 'FT_Outline_Get_CBox';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Translate *)
+ (* *)
+ (* <Description> *)
+ (* Applies a simple translation to the points of an outline. *)
+ (* *)
+ (* <InOut> *)
+ (* outline :: A pointer to the target outline descriptor. *)
+ (* *)
+ (* <Input> *)
+ (* xOffset :: The horizontal offset. *)
+ (* *)
+ (* yOffset :: The vertical offset. *)
+ (* *)
+ procedure FT_Outline_Translate(
+ outline: {const} PFT_Outline;
+ xOffset: FT_Pos;
+ yOffset: FT_Pos);
+ cdecl; external ft_lib name 'FT_Outline_Translate';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Copy *)
+ (* *)
+ (* <Description> *)
+ (* Copies an outline into another one. Both objects must have the *)
+ (* same sizes (number of points & number of contours) when this *)
+ (* function is called. *)
+ (* *)
+ (* <Input> *)
+ (* source :: A handle to the source outline. *)
+ (* *)
+ (* <Output> *)
+ (* target :: A handle to the target outline. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ function FT_Outline_Copy(
+ source: {const} PFT_Outline;
+ target: PFT_Outline): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Copy';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Transform *)
+ (* *)
+ (* <Description> *)
+ (* Applies a simple 2x2 matrix to all of an outline's points. Useful *)
+ (* for applying rotations, slanting, flipping, etc. *)
+ (* *)
+ (* <InOut> *)
+ (* outline :: A pointer to the target outline descriptor. *)
+ (* *)
+ (* <Input> *)
+ (* matrix :: A pointer to the transformation matrix. *)
+ (* *)
+ (* <Note> *)
+ (* You can use @FT_Outline_Translate if you need to translate the *)
+ (* outline's points. *)
+ (* *)
+ procedure FT_Outline_Transform(
+ outline: {const} PFT_Outline;
+ matrix: {const} PFT_Matrix);
+ cdecl; external ft_lib name 'FT_Outline_Transform';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Embolden *)
+ (* *)
+ (* <Description> *)
+ (* Emboldens an outline. The new outline will be at most 4 times *)
+ (* `strength' pixels wider and higher. You may think of the left and *)
+ (* bottom borders as unchanged. *)
+ (* *)
+ (* Negative `strength' values to reduce the outline thickness are *)
+ (* possible also. *)
+ (* *)
+ (* <InOut> *)
+ (* outline :: A handle to the target outline. *)
+ (* *)
+ (* <Input> *)
+ (* strength :: How strong the glyph is emboldened. Expressed in *)
+ (* 26.6 pixel format. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ (* <Note> *)
+ (* The used algorithm to increase or decrease the thickness of the *)
+ (* glyph doesn't change the number of points; this means that certain *)
+ (* situations like acute angles or intersections are sometimes *)
+ (* handled incorrectly. *)
+ (* *)
+ (* Example call: *)
+ (* *)
+ (* { *)
+ (* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); *)
+ (* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) *)
+ (* FT_Outline_Embolden( &face->slot->outline, strength ); *)
+ (* } *)
+ (* *)
+ function FT_Outline_Embolden(
+ outline: PFT_Outline;
+ strength: FT_Pos): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Embolden';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Reverse *)
+ (* *)
+ (* <Description> *)
+ (* Reverses the drawing direction of an outline. This is used to *)
+ (* ensure consistent fill conventions for mirrored glyphs. *)
+ (* *)
+ (* <InOut> *)
+ (* outline :: A pointer to the target outline descriptor. *)
+ (* *)
+ (* <Note> *)
+ (* This functions toggles the bit flag @FT_OUTLINE_REVERSE_FILL in *)
+ (* the outline's `flags' field. *)
+ (* *)
+ (* It shouldn't be used by a normal client application, unless it *)
+ (* knows what it is doing. *)
+ (* *)
+ procedure FT_Outline_Reverse( outline: PFT_Outline );
+ cdecl; external ft_lib name 'FT_Outline_Reverse';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Get_Bitmap *)
+ (* *)
+ (* <Description> *)
+ (* Renders an outline within a bitmap. The outline's image is simply *)
+ (* OR-ed to the target bitmap. *)
+ (* *)
+ (* <Input> *)
+ (* library :: A handle to a FreeType library object. *)
+ (* *)
+ (* outline :: A pointer to the source outline descriptor. *)
+ (* *)
+ (* <InOut> *)
+ (* abitmap :: A pointer to the target bitmap descriptor. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ (* <Note> *)
+ (* This function does NOT CREATE the bitmap, it only renders an *)
+ (* outline image within the one you pass to it! *)
+ (* *)
+ (* It will use the raster corresponding to the default glyph format. *)
+ (* *)
+ function FT_Outline_Get_Bitmap(
+ library_: FT_Library;
+ outline: PFT_Outline;
+ abitmap: {const} PFT_Bitmap): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Get_Bitmap';
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Function> *)
+ (* FT_Outline_Render *)
+ (* *)
+ (* <Description> *)
+ (* Renders an outline within a bitmap using the current scan-convert. *)
+ (* This functions uses an @FT_Raster_Params structure as an argument, *)
+ (* allowing advanced features like direct composition, translucency, *)
+ (* etc. *)
+ (* *)
+ (* <Input> *)
+ (* library :: A handle to a FreeType library object. *)
+ (* *)
+ (* outline :: A pointer to the source outline descriptor. *)
+ (* *)
+ (* <InOut> *)
+ (* params :: A pointer to an @FT_Raster_Params structure used to *)
+ (* describe the rendering operation. *)
+ (* *)
+ (* <Return> *)
+ (* FreeType error code. 0 means success. *)
+ (* *)
+ (* <Note> *)
+ (* You should know what you are doing and how @FT_Raster_Params works *)
+ (* to use this function. *)
+ (* *)
+ (* The field `params.source' will be set to `outline' before the scan *)
+ (* converter is called, which means that the value you give to it is *)
+ (* actually ignored. *)
+ (* *)
+ function FT_Outline_Render(
+ library_: FT_Library;
+ outline: PFT_Outline;
+ params: PFT_Raster_Params): FT_Error;
+ cdecl; external ft_lib name 'FT_Outline_Render';
+
+{$ENDIF TYPE_DECL}
+
+ (**************************************************************************
+ *
+ * @enum:
+ * FT_Orientation
+ *
+ * @description:
+ * A list of values used to describe an outline's contour orientation.
+ *
+ * The TrueType and Postscript specifications use different conventions
+ * to determine whether outline contours should be filled or unfilled.
+ *
+ * @values:
+ * FT_ORIENTATION_TRUETYPE ::
+ * According to the TrueType specification, clockwise contours must
+ * be filled, and counter-clockwise ones must be unfilled.
+ *
+ * FT_ORIENTATION_POSTSCRIPT ::
+ * According to the Postscript specification, counter-clockwise contours
+ * must be filled, and clockwise ones must be unfilled.
+ *
+ * FT_ORIENTATION_FILL_RIGHT ::
+ * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
+ * remember that in TrueType, everything that is to the right of
+ * the drawing direction of a contour must be filled.
+ *
+ * FT_ORIENTATION_FILL_LEFT ::
+ * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
+ * remember that in Postscript, everything that is to the left of
+ * the drawing direction of a contour must be filled.
+ *
+ * FT_ORIENTATION_NONE ::
+ * The orientation cannot be determined. That is, different parts of
+ * the glyph have different orientation.
+ *
+ *)
+{$IFDEF TYPE_DECL}
+ FT_Orientation = cint;
+{$ELSE TYPE_DECL}
+const
+ FT_ORIENTATION_TRUETYPE = 0;
+ FT_ORIENTATION_POSTSCRIPT = 1;
+ FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE;
+ FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT;
+ FT_ORIENTATION_NONE = FT_ORIENTATION_FILL_LEFT+1;
+
+ (**************************************************************************
+ *
+ * @function:
+ * FT_Outline_Get_Orientation
+ *
+ * @description:
+ * This function analyzes a glyph outline and tries to compute its
+ * fill orientation (see @FT_Orientation). This is done by computing
+ * the direction of each global horizontal and/or vertical extrema
+ * within the outline.
+ *
+ * Note that this will return @FT_ORIENTATION_TRUETYPE for empty
+ * outlines.
+ *
+ * @input:
+ * outline ::
+ * A handle to the source outline.
+ *
+ * @return:
+ * The orientation.
+ *
+ *)
+ function FT_Outline_Get_Orientation( outline: PFT_Outline ): FT_Orientation;
+ cdecl; external ft_lib name 'FT_Outline_Get_Orientation';
+
+{$ENDIF TYPE_DECL}
+
diff --git a/unicode/src/lib/freetype/ftstroke.inc b/unicode/src/lib/freetype/ftstroke.inc
new file mode 100644
index 00000000..72ec774f
--- /dev/null
+++ b/unicode/src/lib/freetype/ftstroke.inc
@@ -0,0 +1,711 @@
+{***************************************************************************}
+{* *}
+{* ftstroke.h *}
+{* *}
+{* FreeType path stroker (specification). *}
+{* *}
+{* Copyright 2002, 2003, 2004, 2005, 2006 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. *}
+{* *}
+{***************************************************************************}
+(***************************************************************************)
+(* Pascal port by the UltraStar Deluxe Team *)
+(***************************************************************************)
+
+ {************************************************************************
+ *
+ * @section:
+ * glyph_stroker
+ *
+ * @title:
+ * Glyph Stroker
+ *
+ * @abstract:
+ * Generating bordered and stroked glyphs.
+ *
+ * @description:
+ * This component generates stroked outlines of a given vectorial
+ * glyph. It also allows you to retrieve the `outside' and/or the
+ * `inside' borders of the stroke.
+ *
+ * This can be useful to generate `bordered' glyph, i.e., glyphs
+ * displayed with a coloured (and anti-aliased) border around their
+ * shape.
+ *}
+
+{$IFDEF TYPE_DECL}
+
+ {**************************************************************
+ *
+ * @type:
+ * FT_Stroker
+ *
+ * @description:
+ * Opaque handler to a path stroker object.
+ *}
+ FT_Stroker = Pointer;
+
+
+ {**************************************************************
+ *
+ * @enum:
+ * FT_Stroker_LineJoin
+ *
+ * @description:
+ * These values determine how two joining lines are rendered
+ * in a stroker.
+ *
+ * @values:
+ * FT_STROKER_LINEJOIN_ROUND ::
+ * Used to render rounded line joins. Circular arcs are used
+ * to join two lines smoothly.
+ *
+ * FT_STROKER_LINEJOIN_BEVEL ::
+ * Used to render beveled line joins; i.e., the two joining lines
+ * are extended until they intersect.
+ *
+ * FT_STROKER_LINEJOIN_MITER ::
+ * Same as beveled rendering, except that an additional line
+ * break is added if the angle between the two joining lines
+ * is too closed (this is useful to avoid unpleasant spikes
+ * in beveled rendering).
+ *}
+ FT_Stroker_LineJoin = cint;
+{$ELSE TYPE_DECL}
+const
+ FT_STROKER_LINEJOIN_ROUND = 0;
+ FT_STROKER_LINEJOIN_BEVEL = 1;
+ FT_STROKER_LINEJOIN_MITER = 2;
+
+{$ENDIF TYPE_DECL}
+{$IFDEF TYPE_DECL}
+
+ {**************************************************************
+ *
+ * @enum:
+ * FT_Stroker_LineCap
+ *
+ * @description:
+ * These values determine how the end of opened sub-paths are
+ * rendered in a stroke.
+ *
+ * @values:
+ * FT_STROKER_LINECAP_BUTT ::
+ * The end of lines is rendered as a full stop on the last
+ * point itself.
+ *
+ * FT_STROKER_LINECAP_ROUND ::
+ * The end of lines is rendered as a half-circle around the
+ * last point.
+ *
+ * FT_STROKER_LINECAP_SQUARE ::
+ * The end of lines is rendered as a square around the
+ * last point.
+ *}
+ FT_Stroker_LineCap = cint;
+{$ELSE TYPE_DECL}
+const
+ FT_STROKER_LINECAP_BUTT = 0;
+ FT_STROKER_LINECAP_ROUND = 1;
+ FT_STROKER_LINECAP_SQUARE = 2;
+
+{$ENDIF TYPE_DECL}
+{$IFDEF TYPE_DECL}
+
+ {**************************************************************
+ *
+ * @enum:
+ * FT_StrokerBorder
+ *
+ * @description:
+ * These values are used to select a given stroke border
+ * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
+ *
+ * @values:
+ * FT_STROKER_BORDER_LEFT ::
+ * Select the left border, relative to the drawing direction.
+ *
+ * FT_STROKER_BORDER_RIGHT ::
+ * Select the right border, relative to the drawing direction.
+ *
+ * @note:
+ * Applications are generally interested in the `inside' and `outside'
+ * borders. However, there is no direct mapping between these and the
+ * `left' and `right' ones, since this really depends on the glyph's
+ * drawing orientation, which varies between font formats.
+ *
+ * You can however use @FT_Outline_GetInsideBorder and
+ * @FT_Outline_GetOutsideBorder to get these.
+ *}
+ FT_StrokerBorder = cint;
+{$ELSE TYPE_DECL}
+const
+ FT_STROKER_BORDER_LEFT = 0;
+ FT_STROKER_BORDER_RIGHT = 1;
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Outline_GetInsideBorder
+ *
+ * @description:
+ * Retrieve the @FT_StrokerBorder value corresponding to the
+ * `inside' borders of a given outline.
+ *
+ * @input:
+ * outline ::
+ * The source outline handle.
+ *
+ * @return:
+ * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
+ * outlines.
+ *}
+ function FT_Outline_GetInsideBorder( outline: PFT_Outline ): FT_StrokerBorder;
+ cdecl; external ft_lib name 'FT_Outline_GetInsideBorder';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Outline_GetOutsideBorder
+ *
+ * @description:
+ * Retrieve the @FT_StrokerBorder value corresponding to the
+ * `outside' borders of a given outline.
+ *
+ * @input:
+ * outline ::
+ * The source outline handle.
+ *
+ * @return:
+ * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
+ * outlines.
+ *}
+ function FT_Outline_GetOutsideBorder( outline: PFT_Outline ): FT_StrokerBorder;
+ cdecl; external ft_lib name 'FT_Outline_GetOutsideBorder';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_New
+ *
+ * @description:
+ * Create a new stroker object.
+ *
+ * @input:
+ * library ::
+ * FreeType library handle.
+ *
+ * @output:
+ * astroker ::
+ * A new stroker object handle. NULL in case of error.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *}
+ function FT_Stroker_New(
+ library_: FT_Library;
+ out astroker: FT_Stroker ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_New';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_Set
+ *
+ * @description:
+ * Reset a stroker object's attributes.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * radius ::
+ * The border radius.
+ *
+ * line_cap ::
+ * The line cap style.
+ *
+ * line_join ::
+ * The line join style.
+ *
+ * miter_limit ::
+ * The miter limit for the FT_STROKER_LINEJOIN_MITER style,
+ * expressed as 16.16 fixed point value.
+ *
+ * @note:
+ * The radius is expressed in the same units that the outline
+ * coordinates.
+ *}
+ procedure FT_Stroker_Set(
+ stroker: FT_Stroker;
+ radius: FT_Fixed;
+ line_cap: FT_Stroker_LineCap;
+ line_join: FT_Stroker_LineJoin;
+ miter_limit: FT_Fixed );
+ cdecl; external ft_lib name 'FT_Stroker_Set';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_Rewind
+ *
+ * @description:
+ * Reset a stroker object without changing its attributes.
+ * You should call this function before beginning a new
+ * series of calls to @FT_Stroker_BeginSubPath or
+ * @FT_Stroker_EndSubPath.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *}
+ procedure FT_Stroker_Rewind( stroker: FT_Stroker );
+ cdecl; external ft_lib name 'FT_Stroker_Rewind';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_ParseOutline
+ *
+ * @description:
+ * A convenience function used to parse a whole outline with
+ * the stroker. The resulting outline(s) can be retrieved
+ * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * outline ::
+ * The source outline.
+ *
+ * opened ::
+ * A boolean. If 1, the outline is treated as an open path instead
+ * of a closed one.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * If `opened' is 0 (the default), the outline is treated as a closed
+ * path, and the stroker will generate two distinct `border' outlines.
+ *
+ * If `opened' is 1, the outline is processed as an open path, and the
+ * stroker will generate a single `stroke' outline.
+ *
+ * This function calls @FT_Stroker_Rewind automatically.
+ *}
+ function FT_Stroker_ParseOutline(
+ stroker: FT_Stroker;
+ outline: PFT_Outline;
+ opened: FT_Bool): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_ParseOutline';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_BeginSubPath
+ *
+ * @description:
+ * Start a new sub-path in the stroker.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * to ::
+ * A pointer to the start vector.
+ *
+ * open ::
+ * A boolean. If 1, the sub-path is treated as an open one.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * This function is useful when you need to stroke a path that is
+ * not stored as an @FT_Outline object.
+ *}
+ function FT_Stroker_BeginSubPath(
+ stroker: FT_Stroker;
+ to_: PFT_Vector;
+ open: FT_Bool ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_BeginSubPath';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_EndSubPath
+ *
+ * @description:
+ * Close the current sub-path in the stroker.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * You should call this function after @FT_Stroker_BeginSubPath.
+ * If the subpath was not `opened', this function will `draw' a
+ * single line segment to the start position when needed.
+ *}
+ function FT_Stroker_EndSubPath( stroker: FT_Stroker ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_EndSubPath';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_LineTo
+ *
+ * @description:
+ * `Draw' a single line segment in the stroker's current sub-path,
+ * from the last position.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * to ::
+ * A pointer to the destination point.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * You should call this function between @FT_Stroker_BeginSubPath and
+ * @FT_Stroker_EndSubPath.
+ *}
+ function FT_Stroker_LineTo(
+ stroker: FT_Stroker;
+ to_: PFT_Vector ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_LineTo';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_ConicTo
+ *
+ * @description:
+ * `Draw' a single quadratic Bézier in the stroker's current sub-path,
+ * from the last position.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * control ::
+ * A pointer to a Bézier control point.
+ *
+ * to ::
+ * A pointer to the destination point.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * You should call this function between @FT_Stroker_BeginSubPath and
+ * @FT_Stroker_EndSubPath.
+ *}
+ function FT_Stroker_ConicTo(
+ stroker: FT_Stroker;
+ control: PFT_Vector;
+ to_: PFT_Vector ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_ConicTo';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_CubicTo
+ *
+ * @description:
+ * `Draw' a single cubic Bézier in the stroker's current sub-path,
+ * from the last position.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * control1 ::
+ * A pointer to the first Bézier control point.
+ *
+ * control2 ::
+ * A pointer to second Bézier control point.
+ *
+ * to ::
+ * A pointer to the destination point.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * You should call this function between @FT_Stroker_BeginSubPath and
+ * @FT_Stroker_EndSubPath.
+ *}
+ function FT_Stroker_CubicTo(
+ stroker: FT_Stroker;
+ control1: PFT_Vector;
+ control2: PFT_Vector;
+ to_: PFT_Vector ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_CubicTo';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_GetBorderCounts
+ *
+ * @description:
+ * Call this function once you have finished parsing your paths
+ * with the stroker. It will return the number of points and
+ * contours necessary to export one of the `border' or `stroke'
+ * outlines generated by the stroker.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * border ::
+ * The border index.
+ *
+ * @output:
+ * anum_points ::
+ * The number of points.
+ *
+ * anum_contours ::
+ * The number of contours.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * When an outline, or a sub-path, is `closed', the stroker generates
+ * two independent `border' outlines, named `left' and `right'.
+ *
+ * When the outline, or a sub-path, is `opened', the stroker merges
+ * the `border' outlines with caps. The `left' border receives all
+ * points, while the `right' border becomes empty.
+ *
+ * Use the function @FT_Stroker_GetCounts instead if you want to
+ * retrieve the counts associated to both borders.
+ *}
+ function FT_Stroker_GetBorderCounts(
+ stroker: FT_Stroker;
+ border: FT_StrokerBorder;
+ out anum_points: FT_UInt;
+ out anum_contours: FT_UInt ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_GetBorderCounts';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_ExportBorder
+ *
+ * @description:
+ * Call this function after @FT_Stroker_GetBorderCounts to
+ * export the corresponding border to your own @FT_Outline
+ * structure.
+ *
+ * Note that this function will append the border points and
+ * contours to your outline, but will not try to resize its
+ * arrays.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * border ::
+ * The border index.
+ *
+ * outline ::
+ * The target outline handle.
+ *
+ * @note:
+ * Always call this function after @FT_Stroker_GetBorderCounts to
+ * get sure that there is enough room in your @FT_Outline object to
+ * receive all new data.
+ *
+ * When an outline, or a sub-path, is `closed', the stroker generates
+ * two independent `border' outlines, named `left' and `right'
+ *
+ * When the outline, or a sub-path, is `opened', the stroker merges
+ * the `border' outlines with caps. The `left' border receives all
+ * points, while the `right' border becomes empty.
+ *
+ * Use the function @FT_Stroker_Export instead if you want to
+ * retrieve all borders at once.
+ *}
+ procedure FT_Stroker_ExportBorder(
+ stroker: FT_Stroker;
+ border: FT_StrokerBorder;
+ outline: PFT_Outline );
+ cdecl; external ft_lib name 'FT_Stroker_ExportBorder';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_GetCounts
+ *
+ * @description:
+ * Call this function once you have finished parsing your paths
+ * with the stroker. It returns the number of points and
+ * contours necessary to export all points/borders from the stroked
+ * outline/path.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * @output:
+ * anum_points ::
+ * The number of points.
+ *
+ * anum_contours ::
+ * The number of contours.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *}
+ function FT_Stroker_GetCounts(
+ stroker: FT_Stroker;
+ out anum_points: FT_UInt;
+ out anum_contours: FT_UInt ): FT_Error;
+ cdecl; external ft_lib name 'FT_Stroker_GetCounts';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_Export
+ *
+ * @description:
+ * Call this function after @FT_Stroker_GetBorderCounts to
+ * export the all borders to your own @FT_Outline structure.
+ *
+ * Note that this function will append the border points and
+ * contours to your outline, but will not try to resize its
+ * arrays.
+ *
+ * @input:
+ * stroker ::
+ * The target stroker handle.
+ *
+ * outline ::
+ * The target outline handle.
+ *}
+ procedure FT_Stroker_Export(
+ stroker: FT_Stroker;
+ outline: PFT_Outline );
+ cdecl; external ft_lib name 'FT_Stroker_Export';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Stroker_Done
+ *
+ * @description:
+ * Destroy a stroker object.
+ *
+ * @input:
+ * stroker ::
+ * A stroker handle. Can be NULL.
+ *}
+ procedure FT_Stroker_Done( stroker: FT_Stroker );
+ cdecl; external ft_lib name 'FT_Stroker_Done';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Glyph_Stroke
+ *
+ * @description:
+ * Stroke a given outline glyph object with a given stroker.
+ *
+ * @inout:
+ * pglyph ::
+ * Source glyph handle on input, new glyph handle on output.
+ *
+ * @input:
+ * stroker ::
+ * A stroker handle.
+ *
+ * destroy ::
+ * A Boolean. If 1, the source glyph object is destroyed
+ * on success.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * The source glyph is untouched in case of error.
+ *}
+ function FT_Glyph_Stroke(
+ var glyph: FT_Glyph;
+ stroker: FT_Stroker;
+ destroy: FT_Bool ): FT_Error;
+ cdecl; external ft_lib name 'FT_Glyph_Stroke';
+
+
+ {**************************************************************
+ *
+ * @function:
+ * FT_Glyph_StrokeBorder
+ *
+ * @description:
+ * Stroke a given outline glyph object with a given stroker, but
+ * only return either its inside or outside border.
+ *
+ * @inout:
+ * pglyph ::
+ * Source glyph handle on input, new glyph handle on output.
+ *
+ * @input:
+ * stroker ::
+ * A stroker handle.
+ *
+ * inside ::
+ * A Boolean. If 1, return the inside border, otherwise
+ * the outside border.
+ *
+ * destroy ::
+ * A Boolean. If 1, the source glyph object is destroyed
+ * on success.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * The source glyph is untouched in case of error.
+ *}
+ function FT_Glyph_StrokeBorder(
+ var glyph: FT_Glyph;
+ stroker: FT_Stroker;
+ inside: FT_Bool;
+ destroy: FT_Bool ): FT_Error;
+ cdecl; external ft_lib name 'FT_Glyph_StrokeBorder';
+
+{$ENDIF TYPE_DECL}
+
diff --git a/unicode/src/lib/freetype/fttypes.inc b/unicode/src/lib/freetype/fttypes.inc
new file mode 100644
index 00000000..c77dd1e8
--- /dev/null
+++ b/unicode/src/lib/freetype/fttypes.inc
@@ -0,0 +1,303 @@
+(***************************************************************************)
+(* *)
+(* fttypes.h *)
+(* *)
+(* FreeType simple types definitions (specification only). *)
+(* *)
+(* Copyright 1996-2001, 2002, 2004, 2006, 2007 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. *)
+(* *)
+(***************************************************************************)
+(***************************************************************************)
+(* Pascal port by the UltraStar Deluxe Team *)
+(***************************************************************************)
+
+ (*************************************************************************)
+ (* *)
+ (* <Section> *)
+ (* basic_types *)
+ (* *)
+ (* <Title> *)
+ (* Basic Data Types *)
+ (* *)
+ (* <Abstract> *)
+ (* The basic data types defined by the library. *)
+ (* *)
+ (* <Description> *)
+ (* This section contains the basic data types defined by FreeType 2, *)
+ (* ranging from simple scalar types to bitmap descriptors. More *)
+ (* font-specific structures are defined in a different section. *)
+ (* *)
+ (* <Order> *)
+ (* FT_Byte *)
+ (* FT_Bytes *)
+ (* FT_Char *)
+ (* FT_Int *)
+ (* FT_UInt *)
+ (* FT_Short *)
+ (* FT_UShort *)
+ (* FT_Long *)
+ (* FT_ULong *)
+ (* FT_Bool *)
+ (* FT_Offset *)
+ (* FT_PtrDist *)
+ (* FT_String *)
+ (* FT_Tag *)
+ (* FT_Error *)
+ (* FT_Fixed *)
+ (* FT_Pointer *)
+ (* FT_Pos *)
+ (* FT_Vector *)
+ (* FT_BBox *)
+ (* FT_Matrix *)
+ (* FT_FWord *)
+ (* FT_UFWord *)
+ (* FT_F2Dot14 *)
+ (* FT_UnitVector *)
+ (* FT_F26Dot6 *)
+ (* *)
+ (* *)
+ (* FT_Generic *)
+ (* FT_Generic_Finalizer *)
+ (* *)
+ (* FT_Bitmap *)
+ (* FT_Pixel_Mode *)
+ (* FT_Palette_Mode *)
+ (* FT_Glyph_Format *)
+ (* FT_IMAGE_TAG *)
+ (* *)
+ (*************************************************************************)
+
+{$IFDEF TYPE_DECL}
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Bool *)
+ (* *)
+ (* <Description> *)
+ (* A typedef of unsigned char, used for simple booleans. As usual, *)
+ (* values 1 and 0 represent true and false, respectively. *)
+ (* *)
+ FT_Bool = cuchar;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Byte *)
+ (* *)
+ (* <Description> *)
+ (* A simple typedef for the _unsigned_ char type. *)
+ (* *)
+ FT_Byte = cuchar;
+ PFT_Byte = ^FT_Byte;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_String *)
+ (* *)
+ (* <Description> *)
+ (* A simple typedef for the char type, usually used for strings. *)
+ (* *)
+ FT_String = cchar;
+ PFT_String = ^FT_String;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Short *)
+ (* *)
+ (* <Description> *)
+ (* A typedef for signed short. *)
+ (* *)
+ FT_Short = csshort;
+ PFT_Short = ^FT_Short;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_UShort *)
+ (* *)
+ (* <Description> *)
+ (* A typedef for unsigned short. *)
+ (* *)
+ FT_UShort = cushort;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Int *)
+ (* *)
+ (* <Description> *)
+ (* A typedef for the int type. *)
+ (* *)
+ FT_Int = csint;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_UInt *)
+ (* *)
+ (* <Description> *)
+ (* A typedef for the unsigned int type. *)
+ (* *)
+ FT_UInt = cuint;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Long *)
+ (* *)
+ (* <Description> *)
+ (* A typedef for signed long. *)
+ (* *)
+ FT_Long = cslong;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_ULong *)
+ (* *)
+ (* <Description> *)
+ (* A typedef for unsigned long. *)
+ (* *)
+ FT_ULong = culong;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_F26Dot6 *)
+ (* *)
+ (* <Description> *)
+ (* A signed 26.6 fixed float type used for vectorial pixel *)
+ (* coordinates. *)
+ (* *)
+ FT_F26Dot6 = cslong;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Fixed *)
+ (* *)
+ (* <Description> *)
+ (* This type is used to store 16.16 fixed float values, like scaling *)
+ (* values or matrix coefficients. *)
+ (* *)
+ FT_Fixed = cslong;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Type> *)
+ (* FT_Error *)
+ (* *)
+ (* <Description> *)
+ (* The FreeType error code type. A value of 0 is always interpreted *)
+ (* as a successful operation. *)
+ (* *)
+ FT_Error = cint;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Matrix *)
+ (* *)
+ (* <Description> *)
+ (* A simple structure used to store a 2x2 matrix. Coefficients are *)
+ (* in 16.16 fixed float format. The computation performed is: *)
+ (* *)
+ (* { *)
+ (* x' = x*xx + y*xy *)
+ (* y' = x*yx + y*yy *)
+ (* } *)
+ (* *)
+ (* <Fields> *)
+ (* xx :: Matrix coefficient. *)
+ (* *)
+ (* xy :: Matrix coefficient. *)
+ (* *)
+ (* yx :: Matrix coefficient. *)
+ (* *)
+ (* yy :: Matrix coefficient. *)
+ (* *)
+ PFT_Matrix = ^FT_Matrix;
+ FT_Matrix = record
+ xx, xy: FT_Fixed;
+ yx, yy: FT_Fixed;
+ end;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <FuncType> *)
+ (* FT_Generic_Finalizer *)
+ (* *)
+ (* <Description> *)
+ (* Describes a function used to destroy the `client' data of any *)
+ (* FreeType object. See the description of the FT_Generic type for *)
+ (* details of usage. *)
+ (* *)
+ (* <Input> *)
+ (* The address of the FreeType object which is under finalization. *)
+ (* Its client data is accessed through its `generic' field. *)
+ (* *)
+ FT_Generic_Finalizer = procedure(AnObject : pointer ); cdecl;
+
+
+ (*************************************************************************)
+ (* *)
+ (* <Struct> *)
+ (* FT_Generic *)
+ (* *)
+ (* <Description> *)
+ (* Client applications often need to associate their own data to a *)
+ (* variety of FreeType core objects. For example, a text layout API *)
+ (* might want to associate a glyph cache to a given size object. *)
+ (* *)
+ (* Most FreeType object contains a `generic' field, of type *)
+ (* FT_Generic, which usage is left to client applications and font *)
+ (* servers. *)
+ (* *)
+ (* It can be used to store a pointer to client-specific data, as well *)
+ (* as the address of a `finalizer' function, which will be called by *)
+ (* FreeType when the object is destroyed (for example, the previous *)
+ (* client example would put the address of the glyph cache destructor *)
+ (* in the `finalizer' field). *)
+ (* *)
+ (* <Fields> *)
+ (* data :: A typeless pointer to any client-specified data. This *)
+ (* field is completely ignored by the FreeType library. *)
+ (* *)
+ (* finalizer :: A pointer to a `generic finalizer' function, which *)
+ (* will be called when the object is destroyed. If this *)
+ (* field is set to NULL, no code will be called. *)
+ (* *)
+ FT_Generic = record
+ data: pointer;
+ finalizer: FT_Generic_Finalizer;
+ end;
+
+
+ TByteArray = array [0 .. (MaxInt div SizeOf(byte))-1] of byte;
+ PByteArray = ^TByteArray;
+
+{$ENDIF TYPE_DECL}
+