From 66f499d9516f60a650a114a865687f4eb9ffaadd Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 23 Jul 2009 14:58:51 +0000 Subject: some missing freetype functions added to headers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1859 b956fd51-792f-4845-bead-9b4dfca2ff2c --- unicode/src/lib/freetype/demo/engine-test.bdsproj | 14 ++++---- unicode/src/lib/freetype/demo/engine-test.dpr | 16 ++++++---- unicode/src/lib/freetype/demo/engine-test.lpi | 39 ++++++++++++++--------- unicode/src/lib/freetype/freetype.pas | 8 ++++- unicode/src/lib/freetype/ftglyph.inc | 23 +++++++++++++ unicode/src/lib/freetype/ftimage.inc | 14 ++++---- unicode/src/lib/freetype/fttypes.inc | 10 +++++- 7 files changed, 87 insertions(+), 37 deletions(-) (limited to 'unicode') diff --git a/unicode/src/lib/freetype/demo/engine-test.bdsproj b/unicode/src/lib/freetype/demo/engine-test.bdsproj index 9547f18f..e5b3e97d 100644 --- a/unicode/src/lib/freetype/demo/engine-test.bdsproj +++ b/unicode/src/lib/freetype/demo/engine-test.bdsproj @@ -27,13 +27,13 @@ 1 0 0 - 1 - 0 - 1 - 0 - 1 - 0 - 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 0 0 0 diff --git a/unicode/src/lib/freetype/demo/engine-test.dpr b/unicode/src/lib/freetype/demo/engine-test.dpr index 80177735..bbd7d890 100644 --- a/unicode/src/lib/freetype/demo/engine-test.dpr +++ b/unicode/src/lib/freetype/demo/engine-test.dpr @@ -27,7 +27,9 @@ uses ctypes in '../../ctypes/ctypes.pas', {$ENDIF} FreeType in '../freetype.pas', - UFont in '../../../base/UFont.pas', + UFont in 'UFont.pas', + //UFont in '../../../base/UFont.pas', + UUnicodeUtils in '../../../base/UUnicodeUtils.pas', math, sysutils; @@ -41,7 +43,7 @@ const //FONT_FILE = 'C:/Windows/Fonts/Arial.ttf'; //FONT_FILE = 'C:/Windows/Fonts/SimSun.ttf'; //FONT_FILE = 'eurostarregularextended.ttf'; - FONT_FILE = 'FreeSans.ttf'; + FONT_FILE = '../../../../game/fonts/FreeSans/FreeSans.ttf'; var OurFont: TScalableFont; @@ -129,11 +131,11 @@ begin // Really Nice Perspective Calculations glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); - //OurFont := TFTScalableFont.Create(FONT_FILE, 64); + OurFont := TFTScalableFont.Create(FONT_FILE, 64, 0.03); //OurFont := TFTFont.Create(FONT_FILE, 128); - OurFont := TFTScalableOutlineFont.Create(FONT_FILE, 64, 0.05); + //OurFont := TFTScalableOutlineFont.Create(FONT_FILE, 64, 0.03); //OurFont.UseKerning := false; - TFTScalableOutlineFont(OurFont).SetOutlineColor(1, 0, 0); + //TFTScalableOutlineFont(OurFont).SetOutlineColor(1, 0, 0, 1); //OurFont := TOutlineFont.Create(FONT_FILE, 32, 2); //OurFont.LineSpacing := OurFont.LineSpacing * 0.5; @@ -183,7 +185,7 @@ begin //OurFont.SetOutlineColor(0.5, 0.5, 0.5); //OurFont.ReflectionSpacing := -4; //OurFont.UseKerning := false; - OurFont.Height := 64;//cnt2; + OurFont.Height := 150;//cnt2; //OurFont.Reset; //OurFont.Aspect := 2; @@ -191,7 +193,7 @@ begin bounds := OurFont.BBox(msg); //glRectf(bounds.Left, OurFont.Ascender, bounds.Right, OurFont.Ascender-OurFont.Height); - glColor3f(1, 1, 1); + glColor4f(1, 1, 1, 1); //OurFont.ReflectionSpacing := 0; OurFont.Print(msg); diff --git a/unicode/src/lib/freetype/demo/engine-test.lpi b/unicode/src/lib/freetype/demo/engine-test.lpi index 6cbfe1eb..45483a56 100644 --- a/unicode/src/lib/freetype/demo/engine-test.lpi +++ b/unicode/src/lib/freetype/demo/engine-test.lpi @@ -28,14 +28,14 @@ - - - - - - - - + + + + + + + + @@ -139,13 +139,22 @@ - - - - - - - + + + + + + + + + + + + + + + + diff --git a/unicode/src/lib/freetype/freetype.pas b/unicode/src/lib/freetype/freetype.pas index dd8a141e..6aaa3b59 100644 --- a/unicode/src/lib/freetype/freetype.pas +++ b/unicode/src/lib/freetype/freetype.pas @@ -55,7 +55,7 @@ uses const {$IF Defined(MSWINDOWS)} - ft_lib = 'libfreetype-6.dll'; + ft_lib = 'freetype6.dll'; {$ELSEIF Defined(DARWIN)} ft_lib = 'libfreetype.dylib'; {$LINKLIB libfreetype} @@ -1813,6 +1813,12 @@ const pixel_height : FT_UInt ) : FT_Error; cdecl; external ft_lib name 'FT_Set_Pixel_Sizes'; +const + FT_ANGLE_PI = 180 shl 16; + FT_ANGLE_2PI = FT_ANGLE_PI * 2; + FT_ANGLE_PI2 = FT_ANGLE_PI div 2; + FT_ANGLE_PI4 = FT_ANGLE_PI div 4; + implementation diff --git a/unicode/src/lib/freetype/ftglyph.inc b/unicode/src/lib/freetype/ftglyph.inc index 577e448b..0d4acc99 100644 --- a/unicode/src/lib/freetype/ftglyph.inc +++ b/unicode/src/lib/freetype/ftglyph.inc @@ -214,6 +214,29 @@ out aglyph: FT_Glyph ): FT_Error; cdecl; external ft_lib name 'FT_Get_Glyph'; + (*************************************************************************) + (* *) + (* *) + (* FT_Glyph_Copy *) + (* *) + (* *) + (* A function used to copy a glyph image. Note that the created *) + (* @FT_Glyph object must be released with @FT_Done_Glyph. *) + (* *) + (* *) + (* source :: A handle to the source glyph object. *) + (* *) + (* *) + (* target :: A handle to the target glyph object. 0~in case of *) + (* error. *) + (* *) + (* *) + (* FreeType error code. 0~means success. *) + (* *) + function FT_Glyph_Copy(source: FT_Glyph; + var target: FT_Glyph ): FT_Error; + cdecl; external ft_lib name 'FT_Glyph_Copy'; + {$ENDIF TYPE_DECL} {$IFDEF TYPE_DECL} diff --git a/unicode/src/lib/freetype/ftimage.inc b/unicode/src/lib/freetype/ftimage.inc index a6babc98..9255c422 100644 --- a/unicode/src/lib/freetype/ftimage.inc +++ b/unicode/src/lib/freetype/ftimage.inc @@ -61,6 +61,8 @@ y : FT_Pos; end; + PFT_VectorArray = ^FT_VectorArray; + FT_VectorArray = array[0 .. (MaxInt div SizeOf(FT_Vector))-1] of FT_Vector; (*************************************************************************) (* *) @@ -261,14 +263,14 @@ const (* *) 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 *) + 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 *) + points: PFT_VectorArray; (* the outline's points *) + tags: PByteArray; (* the points flags *) + contours: PFT_ShortArray; (* the contour end points *) - flags: FT_Int; (* outline masks *) + flags: FT_Int; (* outline masks *) end; {$ELSE TYPE_DECL} diff --git a/unicode/src/lib/freetype/fttypes.inc b/unicode/src/lib/freetype/fttypes.inc index c77dd1e8..a64432e6 100644 --- a/unicode/src/lib/freetype/fttypes.inc +++ b/unicode/src/lib/freetype/fttypes.inc @@ -86,7 +86,13 @@ (* values 1 and 0 represent true and false, respectively. *) (* *) FT_Bool = cuchar; - +{$ENDIF TYPE_DECL} +{$IFNDEF TYPE_DECL} +const + FT_FALSE = 0; + FT_TRUE = 1; +{$ENDIF !TYPE_DECL} +{$IFDEF TYPE_DECL} (*************************************************************************) (* *) @@ -123,6 +129,8 @@ FT_Short = csshort; PFT_Short = ^FT_Short; + PFT_ShortArray = ^FT_ShortArray; + FT_ShortArray = array[0 .. (MaxInt div SizeOf(FT_Short))-1] of FT_Short; (*************************************************************************) (* *) -- cgit v1.2.3