[Lazarus] Lazarus Equivalent of GetCharABCWidths API call

Hess, Philip J pjhess at purdue.edu
Sun Feb 17 21:03:27 CET 2008


Hi Dominique,

The portable equivalent is in LclIntf, but it's not implemented in all widgetsets. Last fall I was playing around with this function for Carbon. Not sure where I left it but here's what I came up with. Maybe you could implement it for non-win32 widgetsets.

Thanks.

function TCarbonWidgetSet.GetCharABCWidths(DC: HDC; p2, p3: UINT;
  const ABCStructs): Boolean;
type
  TABCArray = array[0..255] of TABC;
  PABCArray = ^TABCArray;
var
  ABCPtr   : PABCArray;
  CharNum  : Integer;
  CharStr  : string;
  CharSize : TSize;
begin
  ABCPtr := PABCArray(@ABCStructs);
  for CharNum := p2 to p3 do
    begin
    CharStr := Chr(CharNum);
    GetTextExtentPoint(DC, PChar(CharStr), 1, CharSize);
    ABCPtr^[CharNum-p2].abcA := 0;
    ABCPtr^[CharNum-p2].abcB := CharSize.cx;
    ABCPtr^[CharNum-p2].abcC := 0;
    end;
  Result := True;
end;


-----Original Message-----
From: lazarus-bounces at lazarus.freepascal.org on behalf of Dominique Louis
Sent: Sun 2/17/2008 1:40 PM
To: General mailing list
Subject: [Lazarus] Lazarus Equivalent of GetCharABCWidths API call
 
Hi All,
   What is the portable equivalent of the Win32 GetCharABCWidths API call?

Would Canvas.TextWidth be enough?

Thanks,


Dominique.
_______________________________________________
Lazarus mailing list
Lazarus at lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3362 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080217/ca24460d/attachment-0007.bin>


More information about the Lazarus mailing list