Recent

Author Topic: Speed of text rendering?  (Read 939 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 2438
    • UVviewsoft
Speed of text rendering?
« on: June 10, 2024, 06:42:05 pm »
I want to know how much faster the BGRABitmap text renreding comparing to LCL one. On Linux gtk2/qt5.
(On Windows it is interesting too, but I guess that win32 API ExtTextOutW is very fast so BGRABitmap cannot be much faster.)

You can find benchmark project here, it is for pure LCL only yet:
https://github.com/Alexey-T/FreePascal-tests/tree/master/Canvas%20TextOut%20speed%20test

Thaddy

  • Hero Member
  • *****
  • Posts: 15202
  • Censorship about opinions does not belong here.
Re: Speed of text rendering?
« Reply #1 on: June 10, 2024, 07:04:40 pm »
Then measure it. Then you will know. That's usually how I do it.
Of course the national anthem of the U.S.A. was written by Jimi Hendrix, didn't you know that?

circular

  • Hero Member
  • *****
  • Posts: 4300
    • Personal webpage
Re: Speed of text rendering?
« Reply #2 on: June 10, 2024, 09:45:09 pm »
BGRABitmap default text rendering is slower than LCL rendering, because it is based on a call to the LCL with additional computation for texture or fine antialiasing.

However there are various text rendering methods that can have different speed:
- when using the vectorial text rendering of BGRAVectorize, the glyphs are cached as vectors.
- when using BGLFont, the glyphs are cached as textures.
- when using BGRAFreeType, the font is rendered natively using FreeType package of Lazarus.
Conscience is the debugger of the mind

TRon

  • Hero Member
  • *****
  • Posts: 2915
Re: Speed of text rendering?
« Reply #3 on: June 11, 2024, 04:22:07 am »
- when using BGRAFreeType, the font is rendered natively using FreeType package of Lazarus.
Is that a runtime option ? I just recently found out that Freetype will be used by BGRA (in case defined) at compilation time (f.e. nogui widgetset defines it).

AlexTP

  • Hero Member
  • *****
  • Posts: 2438
    • UVviewsoft
Re: Speed of text rendering?
« Reply #4 on: June 11, 2024, 05:57:28 am »
Quote
- when using BGRAFreeType, the font is rendered natively using FreeType package of Lazarus.
yes, this is the interest. Is this rendering faster than LCL one on Linux gtk2/qt5?

circular

  • Hero Member
  • *****
  • Posts: 4300
    • Personal webpage
Re: Speed of text rendering?
« Reply #5 on: June 14, 2024, 04:57:14 pm »
Good question. To test this, assign the FontRenderer property of a TBGRABitmap and compare times.

For LCL rendering, create each time a new instance from BGRAText.TLCLFontRenderer.

For FreeType, a new instance from BGRAFreeType.BGRAFreeTypeFontRenderer. Of course you will need a TTF file for this one.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018