program project1;
{$mode objfpc}{$h+}
uses
Classes,
SysUtils,
EasyLazFreeType,
LazFreeTypeFontCollection;
var
s: string;
fc: TFreeTypeFontCollection;
lTTF: TFreeTypeFont;
begin
s := 'abc';
fc := TFreeTypeFontCollection.Create;
if not fc.AddFile('/data/devel/Wisa/fpcpackages/fppdf/tests/fonts/DejaVuSans.ttf') then
writeln('Failed to load font');
lTTF := fc.Family['DejaVu Sans'].Font[0].CreateFont;
// returns 8
writeln(Trunc(lTTF.TextWidth('$')));
// returns 23
writeln(Trunc(lTTF.TextWidth('abc')));
lTTF.Free;
fc.Free;
end.