freeType font not exactly pretty... which other options?

As mentioned on the example, the font rendering sometimes doesn’t look perfect. With an anti-aliased font, sometimes, a curve of the character is slightly cut. If someone would like to have a PERFECT typography, for curiosity, which option could consider? I presume using some commercial libraries, is there anyone recommended?

Thanks, chr

perfect typography = vector graphics, non !?

but seriously, can you post a screen shot of the problems you mention? We would like to see – You might try rendering the typeface as a larger size, and then scale down when you draw. This would add texture memory, but might make the font smoother and more pleasant.

We do believe that the anti-alieased rendering at large sizes is very good - the aliased stuff is not, but that is based on the free type patent issue with apple. But, we are happy if you send some screen shots so we can see what the error is.

ie,

  
  
myfont.loadFont(...., 64);   // we want 32, but do it at x2 size  
  
glPushMatrix();  
glTranslatef(200,200,0);  
glScalef(0.5f, 0.5f, 1);  
myfont.drawString("rendered larger, drawn half size, maybe nicer looking?", 0,0);  
glPopMatrix();  
  

maybe that helps?
take care!!

  • z

Hi Zach, I thought there were some known issues, despite yes, with big size the font looks gorgeous and tested with other sizes the font looks perfect. Anyway, here is the test I did with Helvetica Neue at 64, using basically the same app of the example (on the right the font at 1000 :wink: ) Inside the red circle the “imperfection”.

Thanks, chr

As you can see, the second line behaves a bit funny. I tested with the rescale trick and it doesn’t-help.

Thanks, chr

Hey, thanks for posting the pic!

The problem is the way openGL deals with the edges of textures when things are not lined up on whole pixels.

The reason this is happening only with new lines is that the line height is being calculated as a floating point value so only the second line is positioned on non whole pixels - a quick fix for now is to change

y -= lineHeight; //in file ofTrueTypeFont.cpp drawString()

to

y -= (int)lineHeight;

We will have this fixed for the next version which will be out very soon.

Hi Theo, actually it doesn’t seem to work. Are we talking about line 392 ?

(I’ve moved this to bugs, because I think we are talking about 2 bugs I describe below with type)…

I think that’s the line – I just tried changing it too, but I don’t see a difference. It may be graphics card / os dependent though, since I think we are talking about texture issues. On some graphics cards, there are slightly different ways of handling edges and clamping (see for example, nvidia’s control panel for options on texture conformance)…

my thought is that the we have two bugs:

a) slightly incorrect coordinate generation might be cropping the character on the top edges (thus the slightly cut off ‘n’). Didn’t notice that until you pointed it out, but it seems pretty fixable. We can take a look at the internal coordinates.

b) edge border blending issues give the edges of the texture a slight tint, that’s not so pretty.

we’ve had a lot of issues so far with non-power of 2 textures, border issues, etc, and we will look to completely fix them, perhaps using an opengl extension.

This is an important issue for us, because we are using textures very heavily throughout OF, so you can be sure that we will search for a fix.

thanks,
zach

Cheers Zach, if it may be helpful, my notebook videocard is a NVIDIA Quadro FX 350M

Good luck, chr

I guess it is a hardware thing because I see the exact same thing in your screenshot but after I (int) the lineHeight the cropping on the second line goes away. The idea being that you are making sure the second line is drawn on a whole pixel by removing the floating point part.

I also found that you can reproduce this bug for the entire string by setting the coordinates of the drawString command to a non whole value like: 100.5 600.25 then you see this both on the top edge and also the left edge as well.

But again maybe it is just with my graphics card.
As Zach said - this is a priority issue so we should have it fixed pretty soon.

Cool, because I’m a typography-freak :smiley:

nice work!

check out the new release, we think we’ve fixed the problems you’ve mentioned…

over n’ out - zach

Unfortunately I use Codewarrior :S

Which would be the recommended platform to develop in OF on Windows? I mean the one that will be always supported from the start? See now Codewarrior not supported yet. Will it be Dev C++?

Are the lib files and project files all the same and thus it would be enough to create the project file for the selected IDE to port, for instance, from Dev C++ to Codewarrior? I’m going to test tomorrow if this work, so I could also see if I can make it run with Eclipse.

Thanks, chr

hi,

I use codewarrior too - I just didn’t get around to building a 0.02 project in CW, in the hopes of getting a release out sooner. It’s getting pretty hard to support every compiler when we make a release or addon (it takes a long time to build it out), and to rebuild every example, etc. None of these things are automated on our end, so you can imagine how slow that can be. You can expect that we will always support:

– dev-cpp
– visual studio
– xcode

and that we will try to support (meaning, not always concurrent with main releases):

– codewarrior

and that we hope that other people in the community can take the code and support:

– eclipse
– linux
– anything else, code-blocks, etc

Since I am on CW, it shouldn’t be too long before I post a version 0.02 up. The addon (for opencv, for example) might come a little bit later this week.

take care!
zach

ps: Anyway, you can also just swap the ofTrueTypeFont in the newest release with the one in your CW project if you want to see the font fixes – that should be pretty simple.

Actually now it seems to be fine, it’s just all upside down :smiley:

Thanks zach, chr

haha

sorry! - I forgot that alot changed from 0.01 to 0.02

CW is coming soon, I hooked everything together yesterday, just need to plug in sample code and check it out …

next time we’ll try to release all compilers at once

take care!
zach

Also because I’m having a weird issue, that I’ll post later in the forum, I’m quite keen on trying VS2005, please let me know if you are aware of any quick start guide for beginners.

Cheers, chr