diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2013-06-18 15:43:28 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2013-06-18 15:43:28 (GMT) |
commit | 118ea25f9d581de6fc2c57dde7b8737cbba6faf4 (patch) | |
tree | c1ade88f6cc1de44c3eab0d7190a57d80e44a236 /src/FbTk/XftFontImp.hh | |
parent | 1f24e6decdc1b34b46565f4e9b76a4b6fa91a063 (diff) | |
download | fluxbox-118ea25f9d581de6fc2c57dde7b8737cbba6faf4.zip fluxbox-118ea25f9d581de6fc2c57dde7b8737cbba6faf4.tar.bz2 |
Speedup overlong text detection
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.
Diffstat (limited to 'src/FbTk/XftFontImp.hh')
-rw-r--r-- | src/FbTk/XftFontImp.hh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/FbTk/XftFontImp.hh b/src/FbTk/XftFontImp.hh index fd24762..bd02722 100644 --- a/src/FbTk/XftFontImp.hh +++ b/src/FbTk/XftFontImp.hh | |||
@@ -51,7 +51,7 @@ private: | |||
51 | bool m_utf8mode; | 51 | bool m_utf8mode; |
52 | 52 | ||
53 | std::string m_name; | 53 | std::string m_name; |
54 | int m_angle; | 54 | unsigned int m_maxlength; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | } // end namespace FbTk | 57 | } // end namespace FbTk |