JTalton's picture

Fonts - Yet again

Windows XP
I converted my application over from using TAO.SDL and the SDL TTF library for rendering fonts to using the OpenTK fonts.
The OpenTK fonts don't have the correct pixel precision and the look blurry. Also the bottom of the font is getting cut off.
Am I missing a setting? I did find that if I change the font size to 8.25 instead of 9.0 the bottom of the font does not get cut off.

SDL Version

OpenTK Version (Updated with fixes resulting from this thread)

Program.cs3.13 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

The bluriness is a known issue (the glyphs are not snapped to the pixel grid), which will be corrected in the next version.

I'm looking into the font size issue. IIRC, glyph size is always rounded up, however I haven't really tested with fractional sizes.

the Fiddler's picture

Ok, I've finally commited the code that fixes the bluriness. Can you please checkout the latest source and see how things are looking now?

I'm still working on the size issue.

Edit: I haven't been able to reproduce the size issue with the latest code. Could you please test if it still occurs?

JTalton's picture


I'll check it out as soon as I can and let you know.

BTW I just have to say once again, how great I think the OpenTK project is. Thanks for putting so much work and thought into it.

JTalton's picture

I currently get an error when building on my XP box. I'll give my other box a try later to see if it is an environment thing. - UPDATE: Other machine shows the same problem.

C:\opentk\Build>build net
Building OpenTK using .Net
[!] Match returned no files: .\OpenTK.Utilities.dll.config
Creating NAnt build files
...Creating project: Build
...Creating project: Examples
...Creating project: OpenTK
...Creating project: Bind
...Creating project: OpenTK.Utilities

Unhandled Exception: System.InvalidOperationException: No process is associated
with this object.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_ProcessName()
at OpenTK.Build.Project.ExecuteProcess(String path, String args)
at OpenTK.Build.Project.Main(String[] args)

the Fiddler's picture

Make sure nant is in your path! Alternatively, type build vs and use the visual studio solution to build OpenTK.

I'm going to revamp the build system once nant 0.86 is released - the Build.exe script is a little icky.

JTalton's picture

Looks good. Screen shot posted.

I'll test out the measurement functions another night.


the Fiddler's picture

Indeed, looks much better. Out of curiosity, is cleartype enabled on your PC?

JTalton's picture

I enabled cleartype and it did not seem to make a difference.

the Fiddler's picture

Thanks for testing. That's normal I think - cleartype is disabled for sizes smaller than 10em to improve readability (compare the first and third screenshots).

I'm working on a more comprehensive font test now, to help weed out any remaining gremlins from this code. Did you notice any pixels getting cut off?

JTalton's picture

There are some pixels still being cut off at different font sizes. Screen shot attached.
Also the font measurements are still a little off.