summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-04-10 14:48:34 +0000
committerGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-04-10 14:48:34 +0000
commitb44565fdd5a7d591159c594b1ee375e10845a595 (patch)
tree30d1b8c792be530538ed27d1acde9c2057da3947 /gfx
parent47cf5118b97d7964e9a8d2cca5deffeddfa43475 (diff)
downloadfpGUI-b44565fdd5a7d591159c594b1ee375e10845a595.tar.xz
* Fixed TFFixedLayout, TFDockedLayout implementations
* Updated the Layout demo and enabled all available layout managers. * Fixed the text clipping issue under Linux now that it uses Xft as default. * Fixed the Text Size issue under Linux now that it uses Xft. It report the wrong text size so the focus rectangle was draw wrong. * Adjust the scrollbar and combobox arrow button size to remove the tiny gap that appear below it.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/x11/gfx_x11.pas17
1 files changed, 14 insertions, 3 deletions
diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas
index d5f5dbc3..5fbd80a2 100644
--- a/gfx/x11/gfx_x11.pas
+++ b/gfx/x11/gfx_x11.pas
@@ -619,21 +619,31 @@ end;
function TX11Canvas.TextExtent(const AText: String): TSize;
var
+ {$IFDEF XftSupport}
+ extents : TXGlyphInfo;
+ {$ELSE}
Direction, FontAscent, FontDescent: LongInt;
CharStruct: TXCharStruct;
+ {$ENDIF}
begin
-// inherited;
if Length(AText) = 0 then
begin
Result.cx := 0;
Result.cy := 0;
- end else
+ end
+ else
begin
+ {$IFDEF XftSupport}
+ XftTextExtents8(GFApplication.Handle, FFontStruct.FontData, PChar(AText), Length(AText), extents);
+ Result.cx := extents.xOff;
+ Result.cy := extents.yOff;
+ {$ELSE}
XQueryTextExtents(GFApplication.Handle, XGContextFromGC(GC),
PChar(AText), Length(AText),
@Direction, @FontAscent, @FontDescent, @CharStruct);
Result.cx := CharStruct.Width;
Result.cy := CharStruct.Ascent + CharStruct.Descent;
+ {$ENDIF}
end;
end;
@@ -665,8 +675,9 @@ begin
// fnt := XftFontOpenName(GFApplication.Handle, XDefaultScreen(GFApplication.Handle), PChar('Sans-12'));
SetXftColor(FCurColor,fntColor);
// s := u8(AText);
+ XftDrawSetClip(FXftDraw, FRegion);
XftDrawString8(FXftDraw, fntColor, FFontStruct.FontData, APosition.x,
- Aposition.y + FFontStruct.GetAscent , PChar(AText),Length(AText));
+ Aposition.y + FFontStruct.GetAscent, PChar(AText), Length(AText));
// XftDrawString16(FXftDraw, fntColor, fnt, APosition.x, Aposition.y * 3, @s[1], Length16(s));
// XftFontClose(GFApplication.Handle, fnt);
{$ELSE}