diff --git a/lcl/interfaces/gtk2/gtk2winapi.inc b/lcl/interfaces/gtk2/gtk2winapi.inc index 854ad2e551..c1d2a55adc 100644 --- a/lcl/interfaces/gtk2/gtk2winapi.inc +++ b/lcl/interfaces/gtk2/gtk2winapi.inc @@ -5707,79 +5707,6 @@ begin end; end; -function TGtk2WidgetSet.GetTextExtentExPoint(DC: HDC; Str: PChar; Count, - MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize - ): Boolean; -var - layout: PPangoLayout; - i: Integer; - Rect: TPangoRectangle; - iter : PPangoLayoutIter; - - {pango_extents_to_pixels is available from pango 1.16, so we - must use theo's function to have proper result. - function taken from http://bugs.freepascal.org/view.php?id=16908. - } - procedure pango_extents_to_pixels_wa(inclusive:PPangoRectangle; - nearest:PPangoRectangle); - var - orig_x, orig_y: Integer; - begin - orig_x := nearest^.x; - orig_y := nearest^.y; - nearest^.x := PANGO_PIXELS(nearest^.x); - nearest^.y := PANGO_PIXELS(nearest^.y); - nearest^.width := PANGO_PIXELS(orig_x + nearest^.width ) - nearest^.x; - nearest^.height := PANGO_PIXELS(orig_y + nearest^.height) - nearest^.y; - end; - -begin - Result := IsValidDC(DC); - if Result then - with TGtkDeviceContext(DC) do - begin - if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil) then - layout := GetDefaultGtkFont(false) - else - layout := CurrentFont^.GDIFontObject; - pango_layout_set_text(layout, Str, Count); - if PartialWidths = nil then - pango_layout_get_pixel_size (layout, @Size.cx, @Size.cy) - else - begin - i := 0; - Size.cx := 0; - Size.cy := 0; - iter := pango_layout_get_iter(layout); - try - repeat - pango_layout_iter_get_char_extents(iter, @Rect); - pango_extents_to_pixels_wa(nil, @Rect); - inc(Size.cx, Rect.Width); - if MaxCount <> nil then - begin - if Size.cx <= MaxWidth then - begin - inc(MaxCount^); - PartialWidths[i] := Size.cx; - end else - begin - dec(Size.cx, Rect.Width); - break; - end; - end else - PartialWidths[i] := Size.cx; - if Size.cy < Rect.Height then - Size.cy := Rect.Height; - inc(i); - until not pango_layout_iter_next_char(iter); - finally - pango_layout_iter_free(iter); - end; - end; - end; -end; - {------------------------------------------------------------------------------ Function: GetTextExtentPoint Params: none diff --git a/lcl/interfaces/gtk2/gtk2winapih.inc b/lcl/interfaces/gtk2/gtk2winapih.inc index c362c6a9d0..3bb86af4fe 100644 --- a/lcl/interfaces/gtk2/gtk2winapih.inc +++ b/lcl/interfaces/gtk2/gtk2winapih.inc @@ -143,7 +143,6 @@ function GetSysColor(nIndex: Integer): DWORD; override; function GetSysColorBrush(nIndex: Integer): HBrush; override; function GetSystemMetrics(nIndex: Integer): Integer; override; function GetTextColor(DC: HDC) : TColorRef; override; -function GetTextExtentExPoint(DC: HDC; Str: PChar; Count, MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize): Boolean; override; function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override; function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override; function GetViewPortExtEx(DC: HDC; Size: PSize): Integer; override; diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index 571a316b9f..5325ad0b84 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -4021,57 +4021,6 @@ begin end; end; -{------------------------------------------------------------------------------ - Function: GetTextExtentExPoint - Params: http://msdn.microsoft.com/en-us/library/dd144935%28VS.85%29.aspx - Returns: True on success - ------------------------------------------------------------------------------} -function TQtWidgetSet.GetTextExtentExPoint(DC: HDC; Str: PChar; Count, - MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize - ): Boolean; -var - i: Integer; - w: Integer; - AStr: WideString; -begin - Result := False; - if not IsValidDC(DC) then Exit; - with TQtDeviceContext(DC) do - begin - AStr := GetUtf8String(Str); - if PartialWidths = nil then - begin - Size.cX := Font.Metrics.Width(@AStr, Count); - Size.cY := Font.Metrics.Height; - end else - begin - Size.cx := 0; - Size.cY := Font.Metrics.Height; - if MaxCount <> nil then - MaxCount^ := 0; - for i := 0 to Count - 1 do - begin - w := QFontMetrics_charWidth(Font.Metrics.FHandle, @AStr, i); - Inc(Size.cx, w); - if MaxCount <> nil then - begin - if Size.cx <= MaxWidth then - begin - inc(MaxCount^); - PartialWidths[i] := Size.cx; - end else - begin - Dec(Size.cx, w); - break; - end; - end else - PartialWidths[i] := Size.cx; - end; - end; - end; - Result := True; -end; - {------------------------------------------------------------------------------ Function: GetTextExtentPoint Params: none diff --git a/lcl/interfaces/qt/qtwinapih.inc b/lcl/interfaces/qt/qtwinapih.inc index d1ca4bb6f0..6fa033c0d2 100644 --- a/lcl/interfaces/qt/qtwinapih.inc +++ b/lcl/interfaces/qt/qtwinapih.inc @@ -129,7 +129,6 @@ function GetSysColor(nIndex: Integer): DWORD; override; function GetSysColorBrush(nIndex: Integer): HBrush; override; function GetSystemMetrics(nIndex: Integer): Integer; override; function GetTextColor(DC: HDC) : TColorRef; Override; -function GetTextExtentExPoint(DC: HDC; Str: PChar; Count, MaxWidth: Integer; MaxCount, PartialWidths: PInteger; var Size: TSize): Boolean; override; function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override; function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override; function GetViewPortExtEx(DC: HDC; Size: PSize): Integer; override;