Results 1 to 5 of 5

Thread: Bug with get_text_size

  1. #1

    Default Bug with get_text_size

    It looks like CL_Font::get_text_size() is ignoring blank lines for me when handling multi-line text.

    I'm using ClanLib-2.2.0 compiled myself under Gentoo Linux.

  2. #2


    Confirmed in 2.2.1 in Ubuntu.

    CL_Font::get_text_size() works by adding the heights of the individual lines, which it obtains from CL_FontProvider::get_text_size(), and at least in the cases of FreeType (Display/Font/glyph_cache.cpp lines 95-98) and sprite fonts, the latter treats an empty string as 0x0 rather than 0xfont height.

    To keep empty strings 0x0 (which was evidently a deliberate choice so may well be required somewhere else) but count blank lines in multiline strings, add these 2 lines above Display/Font/font.cpp line 149:

    if ((line_size.width == 0) && (line_size.height == 0) && (lines.size() > 1)) // blank line
    line_size.height = fm.get_descent() + fm.get_ascent();

  3. #3


    Thanks for figuring out the details Rebecca

    I looked around a bit for the source of the problem myself but I figured it'd be faster for everyone if I just mentioned it on the forum

  4. #4


    Still present in 2.2.2, same patch works.

  5. #5
    ClanLib Developer
    Join Date
    May 2007


    Sorry another patch we have missed. Many apologies

    Patch applied to ClanLib 2.2 SVN (and ClanLib 2.3 SVN)

    If a ClanLib 2.2.3 release is important, let us know. Else we will wait for a month or two.

Similar Threads

  1. Bug in 2.1? CL_Font::get_text_size
    By Nightwind0 in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 01-20-2010, 10:14 PM



Posting Permissions

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