Curious text performance question...

This is a discussion on Curious text performance question... within the Game Programming forums, part of the General Programming Boards category; Would it be faster to use True Type Fonts? or Bitmap fonts? or use a pixel manipulation algorithm? I have ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    673

    Curious text performance question...

    Would it be faster to use True Type Fonts? or Bitmap fonts? or use a pixel manipulation algorithm?
    I have tried TTF and bitmap fonts. TTF seems to be fine for short strings (less than 255 in length). bitmap seems to be best for large strings. But i havent tried pixel manipulation yet. i was really just wondering if anyone here has used or thought of using pixel by pixel text?

    Thank you for any insight.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,473
    I'm not expert but if your concerns are only speed then Bitmap fonts would be the faster to render since the image is already present, whereas TT fonts or any kind of pixel manipulation forces the processor to first calculate the font shape and size before sending it for rendering.

    I would put these in the following order from faster to slower:

    - Bitmap
    - TT
    - pixel algo -> because you probably can't hope to do better than current outline fonts (as in TT) algos.

    However there's always a tradeoff. Bitmap fonts are not very flexible. Image files can become big if you need several typfaces each with several sizes. Even more so if you need to add symbols or dingbats to the typeface. And scaling of bitmap fonts is most often a no-no. They just look too ugly.

    TT uses almost no space. Only considerations are processing speed. It depends mostly on what is your application doing at the time it needs to display these fonts. But, really... they are so fast anyway, I hardly can see a problem with this.

    Pixel algos seems a bad choice all around.

    In the end,...
    You might as well use the facilities of whatever graphics library you are using which is almost guaranteed to be a better option than whatever else you decide.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    This would depend on a lot of things. Outline fonts (such as TrueType, MonoType, Adobe, etc) are generally slow to be generated, but drawing is the same. On the other hand, particularly in large sizes, the outline font looks better (smooth edges always). Bitmap fonts tend to look "jagged" when enlarged too much.

    The length of the string is probably affected by the size of the glyph-cache in the graphics driver - it's unlikely that you can change the size of this.

    Is this an embedded project? Because in my experience, a decent modern graphics card on a PC would draw most fonts fast enough that it doesn't matter much what you use.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Bitmap and true-type are no different. They both will be bitmaps whether they are generated by a paint progam or generated by Win32 API and written to a DC which then is turned into a bitmap.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Thank you all for your replies. I believe I will just use TTF then since speed shouldn't be an issue.
    Also another quick question.
    I know i have said something about this before but I am still unsure as to the implementation.

    When creating a rain effect should create a seperate rain entity for each droplet and just reposition it if it goes off screen? I hate trying to recreate weather. Thanks again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. database performance question
    By onefootswill in forum C# Programming
    Replies: 4
    Last Post: 12-28-2007, 05:27 PM
  2. Newbie question about C++ text
    By Queatrix in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2005, 01:55 PM
  3. just another text input question...
    By GGrrl in forum C++ Programming
    Replies: 2
    Last Post: 03-23-2003, 05:25 PM
  4. sorry about this question but I'm very curious (return)
    By Stealth in forum C++ Programming
    Replies: 4
    Last Post: 10-16-2001, 08:23 PM
  5. quick question about C Dos text menu pgm i was doing
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 09-16-2001, 10:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21