aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/TextUtils.cc
AgeCommit message (Collapse)AuthorFilesLines
2013-06-18Speedup overlong text detectionMathias Gumz1-23/+54
Detecting very long window titles is done via FbTk::TextUtils::doAlignment(). Instead of removing one char from the title at a time to see if it fits into a given 'max_width', we now use a binary-search like approach to get faster to the right value. This massively improves the speed for windows with (arbitrary) long window titles (see bug #1090, javascript document.title = new Array(4999).join("."); leads to massive waiting for fluxbox to detect that this window has a very long title). In addition to that Xft returns 'wrapped' shorts ('integer overflows') for long texts: XGlpyhInfo.xOff is declared as signed short, it's able to hold ~32k pixels. A monospace font with font-size 10 produces an integer overflow after 3276 chars / glyphs, thus rendering the check if (text_width < max_width) { /* ... */ } pointless and leading rendering the whole title. By calculating some kind of upper limit for a pseudo-wide glyph ("WW") and strictly cutting off the input string at that limit prevents this issue.
2008-04-21some fixes for gcc 3.4Thomas Orgis1-1/+1
2008-01-15split Text.hh into Orientation.hh and TextUtils.{cc,hh}Mathias Gumz1-0/+87