Bladeren bron

--- Merging r19673 into '.':
U packages/fcl-image/src/fpimage.pp
U packages/fcl-image/src/fpimgcanv.pp
--- Merging r19766 into '.':
U packages/fcl-image/src/fpcanvas.pp
U packages/fcl-image/src/fpcanvas.inc
--- Merging r19767 into '.':
G packages/fcl-image/src/fpcanvas.pp
G packages/fcl-image/src/fpcanvas.inc
--- Merging r19876 into '.':
U ide/fpdebug.pas
--- Merging r19879 into '.':
U packages/x11/fpmake.pp
A packages/x11/src/xft.pas
U packages/x11/src/xrender.pp
A packages/x11/src/fontconfig.pas
--- Merging r19882 into '.':
U packages/x11/Makefile.fpc

# revisions: 19673,19766,19767,19876,19879,19882
------------------------------------------------------------------------
r19673 | sekelsenmat | 2011-11-23 22:14:06 +0100 (Wed, 23 Nov 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-image/src/fpimage.pp
M /trunk/packages/fcl-image/src/fpimgcanv.pp

Advances TFPImageCanvas.FImage and TFPMemoryImage.FData to protected to allow more useful descendents to be created, see bug #20341
------------------------------------------------------------------------
------------------------------------------------------------------------
r19766 | sekelsenmat | 2011-12-07 08:37:11 +0100 (Wed, 07 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-image/src/fpcanvas.inc
M /trunk/packages/fcl-image/src/fpcanvas.pp

fcl-image: Adds a new object-oriented and extensible approach to regions and add more text/drawing methods from TCanvas
------------------------------------------------------------------------
------------------------------------------------------------------------
r19767 | sekelsenmat | 2011-12-07 08:50:59 +0100 (Wed, 07 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-image/src/fpcanvas.inc
M /trunk/packages/fcl-image/src/fpcanvas.pp

fpcanvas: Adds TextExtent
------------------------------------------------------------------------
------------------------------------------------------------------------
r19876 | pierre | 2011-12-19 14:03:25 +0100 (Mon, 19 Dec 2011) | 1 line
Changed paths:
M /trunk/ide/fpdebug.pas

Avoid interactive query when resetting file
------------------------------------------------------------------------
------------------------------------------------------------------------
r19879 | sekelsenmat | 2011-12-21 15:51:42 +0100 (Wed, 21 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/x11/fpmake.pp
A /trunk/packages/x11/src/fontconfig.pas
A /trunk/packages/x11/src/xft.pas
M /trunk/packages/x11/src/xrender.pp

Adds initial Xft and fontconfig headers
------------------------------------------------------------------------
------------------------------------------------------------------------
r19882 | sekelsenmat | 2011-12-22 13:18:55 +0100 (Thu, 22 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/x11/Makefile.fpc

Updates the makefile.fpc for fontconfig
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20055 -

marco 13 jaren geleden
bovenliggende
commit
8302e54cc0

+ 2 - 0
.gitattributes

@@ -6792,6 +6792,7 @@ packages/x11/Makefile svneol=native#text/plain
 packages/x11/Makefile.fpc svneol=native#text/plain
 packages/x11/fpmake.pp svneol=native#text/plain
 packages/x11/src/cursorfont.pp svneol=native#text/plain
+packages/x11/src/fontconfig.pas svneol=native#text/pascal
 packages/x11/src/keysym.pp svneol=native#text/plain
 packages/x11/src/randr.inc svneol=native#text/plain
 packages/x11/src/x.pp svneol=native#text/plain
@@ -6800,6 +6801,7 @@ packages/x11/src/xcms.pp svneol=native#text/plain
 packages/x11/src/xf86dga.pp svneol=native#text/plain
 packages/x11/src/xf86dga1.inc svneol=native#text/plain
 packages/x11/src/xf86vmode.pp svneol=native#text/plain
+packages/x11/src/xft.pas svneol=native#text/pascal
 packages/x11/src/xi.pp svneol=native#text/plain
 packages/x11/src/xinerama.pp svneol=native#text/plain
 packages/x11/src/xkb.pp svneol=native#text/plain

+ 2 - 0
ide/fpdebug.pas

@@ -685,7 +685,9 @@ begin
   else
     begin
       HasExe:=false;
+      reset_command:=true;
       Command('file');
+      reset_command:=false;
     end;
 end;
 

+ 36 - 4
packages/fcl-image/src/fpcanvas.inc

@@ -18,7 +18,6 @@
 constructor TFPCustomCanvas.Create;
 begin
   inherited create;
-  FClipRect := Rect(-1,-1,-1,-1);
   FClipping := false;
   FRemovingHelpers := false;
   FHelpers := TList.Create;
@@ -127,7 +126,8 @@ end;
 
 function TFPCustomCanvas.GetClipRect: TRect;
 begin
-  Result:=FClipRect;
+  if FClipRegion = nil then Result := Bounds(0, 0, 0, 0)
+  else Result:=FClipRegion.GetBoundingRect();
 end;
 
 function TFPCustomCanvas.CreateFont : TFPCustomFont;
@@ -254,8 +254,13 @@ begin
 end;
 
 procedure TFPCustomCanvas.SetClipRect(const AValue: TRect);
+var
+  lNewRegion: TFPRectRegion;
 begin
-  FClipRect:=AValue;
+  lNewRegion := TFPRectRegion.Create;
+  lNewRegion.Rect := AValue;
+  if FClipRegion <> nil then FClipRegion.Free;
+  FClipRegion := lNewRegion;
 end;
 
 procedure TFPCustomCanvas.SetPenPos(const AValue: TPoint);
@@ -317,6 +322,21 @@ begin
 end;
 
 function TFPCustomCanvas.GetTextHeight (text:string) : integer;
+begin
+  Result := TextHeight(Text);
+end;
+
+function TFPCustomCanvas.GetTextWidth (text:string) : integer;
+begin
+  Result := TextWidth(Text);
+end;
+
+function TFPCustomCanvas.TextExtent(const Text: string): TSize;
+begin
+  GetTextSize(Text, Result.cx, Result.cy);
+end;
+
+function TFPCustomCanvas.TextHeight(const Text: string): Integer;
 begin
   if Font is TFPCustomDrawFont then
     result := TFPCustomDrawFont(Font).GetTextHeight (text)
@@ -324,7 +344,7 @@ begin
     result := DoGetTextHeight (Text);
 end;
 
-function TFPCustomCanvas.GetTextWidth (text:string) : integer;
+function TFPCustomCanvas.TextWidth(const Text: string): Integer;
 begin
   if Font is TFPCustomDrawFont then
     result := TFPCustomDrawFont(Font).GetTextWidth (text)
@@ -332,6 +352,18 @@ begin
     result := DoGetTextWidth (Text);
 end;
 
+procedure TFPCustomCanvas.Arc(ALeft, ATop, ARight, ABottom, Angle16Deg,
+  Angle16DegLength: Integer);
+begin
+
+end;
+
+procedure TFPCustomCanvas.Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX,
+  EY: Integer);
+begin
+
+end;
+
 procedure TFPCustomCanvas.DoMoveTo (x,y:integer);
 begin
 end;

+ 37 - 3
packages/fcl-image/src/fpcanvas.pp

@@ -17,7 +17,7 @@ unit FPCanvas;
 
 interface
 
-uses Math, sysutils, classes, FPImage;
+uses Math, sysutils, classes, FPImage, Types;
 
 const
   PatternBitCount = sizeof(longword) * 8;
@@ -193,6 +193,21 @@ type
     function MaxSupport : double; override;
   end;
 
+  TFPCustomRegion = class
+  public
+    function GetBoundingRect: TRect; virtual; abstract;
+    function IsPointInRegion(AX, AY: Integer): Boolean; virtual; abstract;
+  end;
+
+  { TFPRectRegion }
+
+  TFPRectRegion = class(TFPCustomRegion)
+  public
+    Rect: TRect;
+    function GetBoundingRect: TRect; override;
+    function IsPointInRegion(AX, AY: Integer): Boolean; override;
+  end;
+
   { TFPCustomCanvas }
 
   TFPCustomCanvas = class(TPersistent)
@@ -218,7 +233,7 @@ type
     FDefaultBrush, FBrush : TFPCustomBrush;
     FDefaultPen, FPen : TFPCustomPen;
     FPenPos : TPoint;
-    FClipRect : TRect;
+    FClipRegion : TFPCustomRegion;
     function DoCreateDefaultFont : TFPCustomFont; virtual; abstract;
     function DoCreateDefaultPen : TFPCustomPen; virtual; abstract;
     function DoCreateDefaultBrush : TFPCustomBrush; virtual; abstract;
@@ -277,11 +292,16 @@ type
     function CreatePen : TFPCustomPen;
     function CreateBrush : TFPCustomBrush;
     // using font
-    procedure TextOut (x,y:integer;text:string);
+    procedure TextOut (x,y:integer;text:string); virtual;
     procedure GetTextSize (text:string; var w,h:integer);
     function GetTextHeight (text:string) : integer;
     function GetTextWidth (text:string) : integer;
+    function TextExtent(const Text: string): TSize; virtual;
+    function TextHeight(const Text: string): Integer; virtual;
+    function TextWidth(const Text: string): Integer; virtual;
     // using pen and brush
+    procedure Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer); virtual;
+    procedure Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); virtual;
     procedure Ellipse (Const Bounds:TRect);
     procedure Ellipse (left,top,right,bottom:integer);
     procedure EllipseC (x,y:integer; rx,ry:longword);
@@ -322,6 +342,7 @@ type
     property Interpolation : TFPCustomInterpolation read FInterpolation write FInterpolation;
     property Colors [x,y:integer] : TFPColor read GetColor write SetColor;
     property ClipRect : TRect read GetClipRect write SetClipRect;
+    property ClipRegion : TFPCustomRegion read FClipRegion write FClipRegion;
     property Clipping : boolean read GetClipping write SetClipping;
     property PenPos : TPoint read FPenPos write SetPenPos;
     property Height : integer read GetHeight write SetHeight;
@@ -427,6 +448,19 @@ begin
     end;
 end;
 
+{ TFPRectRegion }
+
+function TFPRectRegion.GetBoundingRect: TRect;
+begin
+  Result := Rect;
+end;
+
+function TFPRectRegion.IsPointInRegion(AX, AY: Integer): Boolean;
+begin
+  Result := (AX >= Rect.Left) and (AX <= Rect.Right) and
+    (AY >= Rect.Top) and (AY <= Rect.Bottom);
+end;
+
 {$i FPHelper.inc}
 {$i FPFont.inc}
 {$i FPPen.inc}

+ 1 - 1
packages/fcl-image/src/fpimage.pp

@@ -165,11 +165,11 @@ type
 
   TFPMemoryImage = class (TFPCustomImage)
     private
-      FData : PFPIntegerArray;
       function GetInternalColor(x,y:integer):TFPColor;override;
       procedure SetInternalColor (x,y:integer; const Value:TFPColor);override;
       procedure SetUsePalette (Value:boolean);override;
     protected
+      FData : PFPIntegerArray;
       procedure SetInternalPixel (x,y:integer; Value:integer); override;
       function GetInternalPixel (x,y:integer) : integer; override;
     public

+ 1 - 2
packages/fcl-image/src/fpimgcanv.pp

@@ -21,9 +21,8 @@ uses FPPixlCanv, FPImage, classes;
 
 type
   TFPImageCanvas = class (TFPPixelCanvas)
-  private
-    FImage : TFPCustomImage;
   protected
+    FImage : TFPCustomImage;
     procedure SetColor (x,y:integer; const AValue:TFPColor); override;
     function  GetColor (x,y:integer) : TFPColor; override;
     procedure SetHeight (AValue : integer); override;

+ 1 - 1
packages/x11/Makefile.fpc

@@ -7,7 +7,7 @@ name=x11
 version=2.6.1
 
 [target]
-units=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode
+units=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr xf86dga xf86vmode xft fontconfig
 
 [require]
 libc=y

+ 6 - 1
packages/x11/fpmake.pp

@@ -93,7 +93,12 @@ begin
           AddUnit('xshm');
         end;
     T:=P.Targets.AddUnit('xv.pp');
-
+    T:=P.Targets.AddUnit('fontconfig.pas');
+    T.Dependencies.AddUnit('xlib');
+    T:=P.Targets.AddUnit('xft.pas');
+    T.Dependencies.AddUnit('xlib');
+    T.Dependencies.AddUnit('xrender');
+    T.Dependencies.AddUnit('fontconfig');
 
 {$ifndef ALLPACKAGES}
     Run;

+ 269 - 0
packages/x11/src/fontconfig.pas

@@ -0,0 +1,269 @@
+{*
+ * fontconfig/fontconfig/fontconfig.h
+ *
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *}
+unit fontconfig;
+
+{$mode objfpc}{$H+}
+{$packrecords c}
+
+interface
+
+uses
+  Classes, SysUtils, X, XLib, Xutil, ctypes;
+
+const
+  {$IF Defined(DARWIN)}
+    fclib = 'libfontconfig.dylib';
+    {$LINKLIB libfontconfig}
+  {$ELSE}
+    fclib = 'libfontconfig.so';
+  {$IFEND}
+
+//#define FcPublic
+
+type
+  FcChar8 = cuchar;
+  PFcChar8 = ^FcChar8;
+  FcChar16 = cushort;
+  FcChar32 = cuint;
+  FcBool = cint;
+
+const
+{*
+ * Current Fontconfig version number.  This same number
+ * must appear in the fontconfig configure.in file. Yes,
+ * it'a a pain to synchronize version numbers like this.
+ *}
+
+  FC_MAJOR	= 2;
+  FC_MINOR	= 8;
+  FC_REVISION = 0;
+
+  FC_VERSION = ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION));
+
+{*
+ * Current font cache file format version
+ * This is appended to the cache files so that multiple
+ * versions of the library will peacefully coexist
+ *
+ * Change this value whenever the disk format for the cache file
+ * changes in any non-compatible way.  Try to avoid such changes as
+ * it means multiple copies of the font information.
+ *}
+
+  FC_CACHE_VERSION   = '3';
+
+  FcTrue	=	1;
+  FcFalse	=	0;
+
+const
+  FC_FAMILY =          'family';	//* String */
+  FC_STYLE =           'style';		//* String */
+  FC_SLANT =           'slant';		//* Int */
+  FC_WEIGHT =	       'weight';	//* Int */
+  FC_SIZE =	           'size';      //* Double */
+  FC_ASPECT =	       'aspect';	//* Double */
+  FC_PIXEL_SIZE =      'pixelsize';     //* Double */
+  FC_SPACING =	       'spacing';	//* Int */
+  FC_FOUNDRY =	       'foundry';	//* String */
+  FC_ANTIALIAS =       'antialias';	//* Bool (depends) */
+  FC_HINTING =	       'hinting';	//* Bool (true) */
+  FC_HINT_STYLE	=      'hintstyle';	//* Int */
+  FC_VERTICAL_LAYOUT = 'verticallayout';//* Bool (false) */
+  FC_AUTOHINT =	       'autohint';	//* Bool (false) */
+  FC_GLOBAL_ADVANCE =  'globaladvance';	//* Bool (true) */
+  FC_WIDTH=	       'width';		//* Int */
+  FC_FILE =	       'file';		//* String */
+  FC_INDEX =	       'index';		//* Int */
+  FC_FT_FACE =	       'ftface';	//* FT_Face */
+  FC_RASTERIZER =      'rasterizer';	//* String */
+  FC_OUTLINE =	       'outline';	//* Bool */
+  FC_SCALABLE =	       'scalable';	//* Bool */
+  FC_SCALE =	       'scale';		//* double */
+  FC_DPI =             'dpi';		//* double */
+  FC_RGBA =            'rgba';		//* Int */
+  FC_MINSPACE =	       'minspace';	//* Bool use minimum line spacing */
+  FC_SOURCE =	       'source';	//* String (X11, freetype) */
+  FC_CHARSET =	       'charset';	//* CharSet */
+  FC_LANG =            'lang';		//* String RFC 3066 langs */
+  FC_FONTVERSION =     'fontversion';	//* Int from 'head' table */
+  FC_FULLNAME =	       'fullname';	//* String */
+  FC_FAMILYLANG =      'familylang';	//* String RFC 3066 langs */
+  FC_STYLELANG =       'stylelang';	//* String RFC 3066 langs */
+  FC_FULLNAMELANG =    'fullnamelang';	//* String RFC 3066 langs */
+  FC_CAPABILITY =      'capability';	//* String */
+  FC_FONTFORMAT =      'fontformat';	//* String */
+  FC_EMBOLDEN =	       'embolden';	//* Bool - true if emboldening needed*/
+  FC_EMBEDDED_BITMAP = 'embeddedbitmap';//* Bool - true to enable embedded bitmaps */
+  FC_DECORATIVE =      'decorative';	//* Bool - true if style is a decorative variant */
+  FC_LCD_FILTER =      'lcdfilter';	//* Int */
+
+  //FC_CACHE_SUFFIX		    ".cache-"FC_CACHE_VERSION
+  //FC_DIR_CACHE_FILE	    "fonts.cache-"FC_CACHE_VERSION
+  //FC_USER_CACHE_FILE	    ".fonts.cache-"FC_CACHE_VERSION
+
+  // Adjust outline rasterizer */
+  FC_CHAR_WIDTH =      'charwidth'; // Int */
+  FC_CHAR_HEIGHT =      'charheight'; // Int */
+  FC_MATRIX =          'matrix';    //* FcMatrix */
+
+  FC_WEIGHT_THIN = 0;
+  FC_WEIGHT_EXTRALIGHT =    40;
+  FC_WEIGHT_ULTRALIGHT =    FC_WEIGHT_EXTRALIGHT;
+  FC_WEIGHT_LIGHT =	    50;
+  FC_WEIGHT_BOOK =	    75;
+  FC_WEIGHT_REGULAR =	    80;
+  FC_WEIGHT_NORMAL =	    FC_WEIGHT_REGULAR;
+  FC_WEIGHT_MEDIUM =	    100;
+  FC_WEIGHT_DEMIBOLD =	    180;
+  FC_WEIGHT_SEMIBOLD =	    FC_WEIGHT_DEMIBOLD;
+  FC_WEIGHT_BOLD = 200;
+  FC_WEIGHT_EXTRABOLD =	    205;
+  FC_WEIGHT_ULTRABOLD =	    FC_WEIGHT_EXTRABOLD;
+  FC_WEIGHT_BLACK =	    210;
+  FC_WEIGHT_HEAVY =	    FC_WEIGHT_BLACK;
+  FC_WEIGHT_EXTRABLACK =    215;
+  FC_WEIGHT_ULTRABLACK =    FC_WEIGHT_EXTRABLACK;
+
+  FC_SLANT_ROMAN =	    0;
+  FC_SLANT_ITALIC =	    100;
+  FC_SLANT_OBLIQUE =	    110;
+
+  FC_WIDTH_ULTRACONDENSED =    50;
+  FC_WIDTH_EXTRACONDENSED =    63;
+  FC_WIDTH_CONDENSED =	    75;
+  FC_WIDTH_SEMICONDENSED =    87;
+  FC_WIDTH_NORMAL =	    100;
+  FC_WIDTH_SEMIEXPANDED =   113;
+  FC_WIDTH_EXPANDED =	    125;
+  FC_WIDTH_EXTRAEXPANDED =  150;
+  FC_WIDTH_ULTRAEXPANDED =  200;
+
+  FC_PROPORTIONAL =	    0;
+  FC_DUAL =		    90;
+  FC_MONO = 100;
+  FC_CHARCELL =	    110;
+
+  //* sub-pixel order */
+  FC_RGBA_UNKNOWN =	    0;
+  FC_RGBA_RGB =	    1;
+  FC_RGBA_BGR =	    2;
+  FC_RGBA_VRGB =	    3;
+  FC_RGBA_VBGR =	    4;
+  FC_RGBA_NONE =	    5;
+
+  // hinting style */
+  FC_HINT_NONE =        0;
+  FC_HINT_SLIGHT =      1;
+  FC_HINT_MEDIUM =      2;
+  FC_HINT_FULL =        3;
+
+  // LCD filter */
+  FC_LCD_NONE =	    0;
+  FC_LCD_DEFAULT =	    1;
+  FC_LCD_LIGHT =	    2;
+  FC_LCD_LEGACY =	    3;
+
+type
+  TFcType = Byte; // In C was a enum
+
+const
+  FcTypeVoid         = 0;
+  FcTypeInteger      = 1;
+  FcTypeDouble       = 2;
+  FcTypeString       = 3;
+  FcTypeBool         = 4;
+  FcTypeMatrix       = 5;
+  FcTypeCharSet      = 6;
+  FcTypeFTFace       = 7;
+  FcTypeLangSet      = 8;
+
+type
+  TFcMatrix = record
+    xx, xy, yx, yy: double;
+  end;
+
+//#define FcMatrixInit(m)	((m)->xx = (m)->yy = 1, \
+//			 (m)->xy = (m)->yx = 0)
+
+{*
+ * A data structure to represent the available glyphs in a font.
+ * This is represented as a sparse boolean btree.
+ *}
+
+  TFcCharSet = record
+    dummy : integer;
+  end;
+  PFcCharSet = ^TFcCharSet;
+
+  TFcObjectType = record
+    object_: PChar;
+    type_: TFcType;
+  end;
+
+  TFcConstant = record
+    name: PFcChar8;
+    object_: PChar;
+    value: cint;
+  end;
+
+  TFcResult = (
+    FcResultMatch, FcResultNoMatch, FcResultTypeMismatch, FcResultNoId,
+    FcResultOutOfMemory);
+
+  TFcPattern = record
+    dummy : integer;
+  end;
+
+  PFcPattern = ^TFcPattern;
+  PPFcPattern = ^PFcPattern;
+
+  TFcLangSet = record
+    dummy : integer;
+  end;
+
+  TFcValue = record
+    type_: TFcType;
+    (*union {
+	const FcChar8	*s;
+	int		i;
+	FcBool		b;
+	double		d;
+	const FcMatrix	*m;
+	const FcCharSet	*c;
+	void		*f;
+	const FcLangSet	*l;
+    } u;*)
+  end;
+
+  TFcFontSet = packed record
+    nfont : integer;
+    sfont : integer;
+    fonts : PPFcPattern;
+  end;
+  PFcFontSet = ^TFcFontSet;
+
+implementation
+
+end.
+

+ 126 - 0
packages/x11/src/xft.pas

@@ -0,0 +1,126 @@
+{ Original C header:
+ * include/X11/Xft/Xft.h.  Generated from Xft.h.in by configure.  */
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *}
+{
+    Initial Pascal headers obtained from:
+    fpGUI  -  Free Pascal GUI Toolkit
+
+    Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+    distribution, for details of the copyright.
+
+    See the file COPYING.modifiedLGPL, included in this distribution,
+    for details about redistributing fpGUI.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+    Headers extended and modified by Felipe Monteiro de Carvalho in 2011
+
+    Description:
+      Xft interface functions
+}
+unit xft;
+
+{$mode objfpc}{$H+}
+{$packrecords c}
+
+interface
+
+uses
+  Classes, SysUtils, X, XLib, Xutil, ctypes, fontconfig, xrender;
+
+//#include FT_FREETYPE_H
+//#include <fontconfig/fontconfig.h>
+//#include <X11/extensions/Xrender.h>
+
+const
+  {$IF Defined(DARWIN)}
+    libXft = 'libXft.dylib';
+    {$linklib Xft}
+  {$ELSE}
+    libXft = 'libXft.so';
+  {$IFEND}
+
+{* Current Xft version number, set from version in the Xft configure.ac file. *}
+  XFT_MAJOR = 2;
+  XFT_MINOR = 2;
+  XFT_REVISION = 0;
+
+  XFT_VERSION = ((XFT_MAJOR * 10000) + (XFT_MINOR * 100) + (XFT_REVISION));
+  XftVersion = XFT_VERSION;
+
+  XFT_CORE = 'core';
+  XFT_RENDER	=	'render';
+  XFT_XLFD	=	'xlfd';
+  XFT_MAX_GLYPH_MEMORY ='maxglyphmemory';
+  XFT_MAX_UNREF_FONTS =	'maxunreffonts';
+  
+type
+// extern FT_Library	_XftFTlibrary;
+
+  TXftFontInfo = record end;
+
+  TPicture = longword;
+
+  TXftDraw = record end;
+  PXftDraw = ^TXftDraw;
+
+  TXftFont = record
+   ascent   : cint;
+   descent  : cint;
+   height   : cint;
+   max_advance_width : cint;
+   ptr1     : PFcCharSet;
+   ptr2     : PFcPattern;
+  end;
+  PXftFont = ^TXftFont;
+
+  TXftColor = record
+    pixel : culong;
+    color : TXRenderColor;
+  end;
+              
+function  XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; external libXft;
+procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; external libXft;
+procedure XftDrawDestroy(draw : PXftDraw); cdecl; external libXft;
+function  XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; external libXft;
+function  XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; external libXft;
+procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; external libXft;
+procedure XftDrawStringUtf8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external libXft;
+procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external libXft;
+procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external libXft;
+procedure XftTextExtentsUtf8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external libXft;
+procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external libXft;
+procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external libXft;
+//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; external libXft;
+//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; external libXft;
+procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; external libXft;
+function  XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; external libXft;
+function  XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; external libXft;
+procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; external libXft;
+
+implementation
+
+end.
+

+ 16 - 7
packages/x11/src/xrender.pp

@@ -1,7 +1,9 @@
 unit xrender;
+
 interface
+
 uses
-  x,xlib;
+  x, xlib, ctypes;
 
 {$ifndef os2}
   {$LinkLib c}
@@ -133,6 +135,13 @@ type
         colormap : TColormap;
      end;
 
+   TXRenderColor = record
+     red   : cushort;
+     green : cushort;
+     blue  : cushort;
+     alpha : cushort;
+   end;
+
 const
    PictFormatID = 1 shl 0;
    PictFormatType = 1 shl 1;
@@ -198,12 +207,12 @@ type
 
    PXGlyphInfo = ^TXGlyphInfo;
    TXGlyphInfo = record
-        width : word;
-        height : word;
-        x : smallint;
-        y : smallint;
-        xOff : smallint;
-        yOff : smallint;
+        width : cushort;
+        height : cushort;
+        x : cshort;
+        y : cshort;
+        xOff : cshort;
+        yOff : cshort;
      end;
 
 function XRenderQueryExtension(dpy:PDisplay; event_basep:Plongint; error_basep:Plongint):TBoolResult;cdecl;external libX11;