Commit b46a907b authored by Stephan Binner's avatar Stephan Binner
Browse files

Fallback for calculated unrealistic font width.

svn path=/trunk/kdebase/konsole/; revision=170135
parent 2cbc28a1
......@@ -229,12 +229,21 @@ void TEWidget::fontChange(const QFont &)
{
QFontMetrics fm(font());
font_h = fm.height() + m_lineSpacing;
// waba TEWidget 1.123:
// "Base character width on widest ASCII character. This prevents too wide
// characters in the presence of double wide (e.g. Japanese) characters."
int fw;
font_w = 1;
for(int i=0;i<128;i++) {
if( isprint(i) && font_w < (fw = fm.width(i)))
font_w = fw;
}
if (font_w>200) // don't trust unrealistic value, fallback to QFontMetrics::maxWidth()
font_w=fm.maxWidth();
if (font_w<1)
font_w=1;
font_a = fm.ascent();
//printf("font: %s\n", font().toString().latin1());
//printf("fixed: %s\n", font().fixedPitch() ? "yes" : "no");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment