Results 1 to 4 of 4

Thread: Blurry fonts?

  1. #1
    Squire
    Join Date
    Mar 2011
    Posts
    18

    Default Blurry fonts?

    When I create a system font from Arial of size '16' (or anything less than 18 infact) the text is drawn blurry like this:



    ...but when the size is 18 or over, it appears fine:



    Does anybody else know what this could be? Thanks.

    Edit: Infact, it isn't just when the size is under 18, it is blurry on a variety of sizes. It just happens to be fine on the size 18.

  2. #2
    Squire
    Join Date
    Mar 2011
    Posts
    18

    Default

    I've fixed it by using ints as the x and y position of the text instead of floats.

    Sorry guys, thanks anyway aha.

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    It is still a bug. (unfortunately, I don't have time at the moment to find a solution)

    It seems the bug is in both ClanLib 2.2, and ClanLib 2.3 (development)

    ClanLib 2.2 images:





    ClanLib 2.3 images: (note the fonts use sub pixel rendering)






    (Also note, there is no plan to release ClanLib 2.3 this year, the API is still unstable)

  4. #4
    Master Sorcerer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    The only way to avoid blurry fonts is to force the text output to always use integer coordinates. The blur is caused by the fragment shader sampling the glyph texture between two texels and depending on the filtering setting it will either do a linear blend or an even more rough rendering with nearest.

    To always avoid rendering blurry fonts we could cast the position to integers, but it would need to be done in a way so the modelview matrix won't cause it to become uneven again by i.e. applying a scale or rotation. The problem with doing that is that text will no longer scale/rotate in a 100% linear fashion and I'm not sure if some depend on that or not. I think the easiest way to implement a modelview safe cast would be to do it in the vertex shader.

    Overall I think this issue is fairly low priority though. We already know an easy workaround that works for most people (cast to int before calling the text draw routines).

Similar Threads

  1. Linux fonts [0.9]
    By kbluck in forum Official ClanLib SDK Forums
    Replies: 10
    Last Post: 09-25-2008, 11:48 AM
  2. ClanLib 0.9 OpenGL Fonts
    By rombust in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 09-05-2008, 11:45 AM
  3. my fonts are really grainy
    By babyvegas in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-11-2008, 04:07 PM
  4. ClanLib gui and fonts
    By LonelyStar in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 04-28-2008, 07:52 AM
  5. Fonts & Graphics
    By AllenJB in forum Game development
    Replies: 1
    Last Post: 09-16-2006, 12:00 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •