What parameters should I use in a Linux system? The program always complains whatever I feed it. Not a good demo program IMO.
If you are in the correct example project, The "LazFreeTypeTest"
You can use mine one:[I'd just passed one thing as three time]
"/usr/share/fonts/TTF/DejaVuSans.ttf" "/usr/share/fonts/TTF/DejaVuSans.ttf" "/usr/share/fonts/TTF/DejaVuSans.ttf"
Maybe a stupid question but how does the OnCompare handler help with memory consumption?
FGlyphTable.OnCompare := @GlyphTableOnCompare;
It's simple, As I know the AVLTree sort and makes a tree base on the difference of the added Data,
And not need to mention that the TAVLTree have not any idea about our Data/Object we trying to add.
When you set GlyphTableOnCompare, You'd just learn it how to measure them, sort them and put them the right position on the tree!
In the other hand, When the glyphs get right position on the tree we can find them with GetGlyphs, But without GlyphTableOnCompare they(The Glyphs) are put somewhere unknown and looking inside a messed up place got you nothing.
After all, GetGlyph tries to find the right glyph inside the tree based on logic that not implemented, when it failed, tries to add it
again thas it.
function TFreeTypeFont.GetGlyph(Index: integer): TFreeTypeGlyph;
var
node: TAvlTreeNode;
lGlyph: TFreeTypeGlyph;
begin
if not CheckInstance then
begin
result := nil;
exit;
end;
node := FindGlyphNode(Index);//Tries to find glyph base on index, But it failes cause on glyphs compared and sorted by FontFaceName!
if node = nil then
begin
lGlyph := TFreeTypeGlyph.Create(self, Index);//So It will add more times as ever as program darw a glyph!
FGlyphTable.Add(lGlyph);
end else
lGlyph := TFreeTypeGlyph(node.Data);
result := lGlyph;
end;