Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Test of stb_truetype to replace FreeType  (Read 8305 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Test of stb_truetype to replace FreeType
« on: October 14, 2009, 11:34:17 am »
Hi

I've added code in the SFML 2 branch to use stb_truetype instead of FreeType. The code is not activated by default, you have to uncomment the "#define SFML_USE_STBTT" at the beginning of src/SFML/Graphics/FontLoader.cpp to enable it.

I'd like to know what you think of it, i.e. is the quality worse / the same / better than with FreeType. Personnally I feel like the quality is slightly worse, but I did only a few tests :)

Thanks
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Test of stb_truetype to replace FreeType
« Reply #1 on: October 14, 2009, 01:19:14 pm »
Fontsizes aren't taken into account on my system. Besides of that, the strings look good. ;)

Unfortunately I had some minor issues with compiling:
Code: [Select]
In file included from FontLoader.cpp:438:
../../SFML/Graphics/stb_truetype/stb_truetype.h:547: error: comma at end of enumerator list
../../SFML/Graphics/stb_truetype/stb_truetype.h:554: error: comma at end of enumerator list
../../SFML/Graphics/stb_truetype/stb_truetype.h:561: error: comma at end of enumerator list
../../SFML/Graphics/stb_truetype/stb_truetype.h:571: error: comma at end of enumerator list
../../SFML/Graphics/stb_truetype/stb_truetype.h:581: error: comma at end of enumerator list


I guess Microsoft compilers don't complain about that, eh? ;)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Test of stb_truetype to replace FreeType
« Reply #2 on: October 14, 2009, 02:11:27 pm »
Quote
Fontsizes aren't taken into account on my system

Really?
I noticed a difference in the height of rendered characters between FreeType and stb_truetype, but it was not ignored.

Quote
Unfortunately I had some minor issues with compiling

There are several warnings in this library, I guess the author can fix them quickly if I ask him to ;)

However I got no error. I even thought that the standard explicitely allowed a comma after the last value of an enum. After a quick Google search, I found that C99 allows it and that the next C++ standard will allow it as well.

Quote
I guess Microsoft compilers don't complain about that, eh?

Yet, I have checked the "disable language extensions" option :evil:
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Test of stb_truetype to replace FreeType
« Reply #3 on: October 14, 2009, 03:43:14 pm »
Quote from: "Laurent"
Really?
I noticed a difference in the height of rendered characters between FreeType and stb_truetype, but it was not ignored.

No, not really. ;) I did some more checks and stb_truetype fails to load a specific TTF file. I uploaded it here.

Btw, is there a special reason why you're switching font backends?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Test of stb_truetype to replace FreeType
« Reply #4 on: October 14, 2009, 04:01:02 pm »
Quote
Btw, is there a special reason why you're switching font backends?

I like removing such big dependencies.
stb_truetype is one single file in public domain, that can be included directly into SFML. I love that :)

But of course I won't switch until I'm sure that I can get exactly the same features, same quality and no bug.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Test of stb_truetype to replace FreeType
« Reply #5 on: October 14, 2009, 05:04:40 pm »
Quote from: "Laurent"
stb_truetype is one single file in public domain, that can be included directly into SFML. I love that :)

I agree with that. :)

Quote
But of course I won't switch until I'm sure that I can get exactly the same features, same quality and no bug.

The quality looks good, but maybe it's not compatible with all types of truetype fonts (warning, dangerous superficial knowledge ;)).

 

anything