AVLTree for TFreeTypeFont add glyphs every time want to render them.
Original Reporter info from Mantis: mamrezo
-
Reporter name: Muhammad Reza Zare
Original Reporter info from Mantis: mamrezo
- Reporter name: Muhammad Reza Zare
Description:
AVLTree for TFreeTypeFont add glyphs every time want to render them.
I`m using BGRABitmap to render forms in fpGUI,
After a while just looking for memory usage of and compare to fpGUI native canvas!
And any invalidate of forms cause of increasing memory usage!
Another thing That closing App cause of hanging it, Pause of the app in debug mode guide me to the freeing the AVLTree nodes, Nodes of the TFreeTypeFont.
A simple trace showed me that GetGlyph just adds any glyph again on the tree! Because of the added glyphs sorts by the AVLTree logic not by Index key of the TFreeTypeFont objects!
I set an onCompare method for AVLTree and problem solved!
The code you can find here :
https://forum.lazarus.freepascal.org/index.php/topic,45503.0.html
Steps to reproduce:
Try to Draw text with noGUI with BGRABitmap and Freetype based on LazUtil
Any glyph of the font will add every time of a character will draw.
Mantis conversion info:
- Mantis ID: 35627
- OS: ArchLinux
- OS Build: 5.0.13-arch1-1-A
- Platform: FPC 3.3.1 svn AMD64
- Version: 2.1 (SVN)
- Fixed in revision: r61291 (#5b5ad757)