From 788ae16a47c2bd345ee1542b0bd6e4b2278258f6 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 18 May 2007 14:50:52 +0000 Subject: * Added a new UTF8 Utils unit with some handy functions. * Modified TFEdit to be UTF8 friendly. Needs testing. * Modified the WidgetTest - Edit Fields form to show UTF8 text in the TFEdit component for testing. --- gfx/x11/gfx_x11.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gfx/x11/gfx_x11.pas') diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas index 7128c4bf..1deba25a 100644 --- a/gfx/x11/gfx_x11.pas +++ b/gfx/x11/gfx_x11.pas @@ -621,6 +621,7 @@ function TX11Canvas.TextExtent(const AText: String): TSize; var {$IFDEF XftSupport} extents : TXGlyphInfo; + WideText: WideString; {$ELSE} Direction, FontAscent, FontDescent: LongInt; CharStruct: TXCharStruct; @@ -634,7 +635,9 @@ begin else begin {$IFDEF XftSupport} - XftTextExtents8(GFApplication.Handle, FFontStruct.FontData, PChar(AText), Length(AText), extents); + WideText := Utf8Decode(AText); +// XftTextExtents8(GFApplication.Handle, FFontStruct.FontData, PChar(AText), Length(AText), extents); + XftTextExtents16(GFApplication.Handle, FFontStruct.FontData, PChar(WideText), Length(WideText), extents); Result.cx := extents.xOff; Result.cy := extents.yOff; {$ELSE} -- cgit v1.2.3-70-g09d2