[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu
From: Christoph Feck <christoph () maxiom ! de>
Date: 2010-10-29 0:43:03
Message-ID: 20101029004303.2E6FBAC899 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1190821 by cfeck:
Fix font size calculation
Use a brute force method to handle the word wrapped texts
that are used by kanagram. Also make the hint text box
slightly taller to center better and have more room.
BUG: 219473
M +2 -2 kanagram/src/kanagram.cpp
M +9 -1 libkdeedu/kdeeduui/kedufontutils.cpp
--- trunk/KDE/kdeedu/kanagram/src/kanagram.cpp #1190820:1190821
@@ -364,11 +364,11 @@
f.setWeight(QFont::Bold);
p.setFont(f);
QString hint = m_game->getHint();
- int fontSize = fontUtils::fontSize(p, hint, int(250 * m_xRatio), int(100 * \
m_yRatio)); + int fontSize = fontUtils::fontSize(p, hint, int(250 * m_xRatio), \
int(110 * m_yRatio)); FixFontSize(fontSize);
f.setPointSize(fontSize);
p.setFont(f);
- p.drawText(int(694 * m_xRatio), int(330 * m_yRatio), int(250 * m_xRatio), \
int(100 * m_yRatio), + p.drawText(int(694 * m_xRatio), int(330 * m_yRatio), \
int(250 * m_xRatio), int(110 * m_yRatio), Qt::TextWordWrap | Qt::AlignCenter, hint);
}
--- trunk/KDE/kdeedu/libkdeedu/kdeeduui/kedufontutils.cpp #1190820:1190821
@@ -28,7 +28,15 @@
if (flags & DoNotAllowWordWrap) qtFlags = qtFlags & ~Qt::TextWordWrap;
aux1 = p.boundingRect(QRect(0, 0, w, h), qtFlags, s1);
if (aux1.width() == 0 || aux1.height() == 0) return -1;
- else if (aux1.width() > w || aux1.height() > h) size = qMin(w * size / \
aux1.width(), h * size / aux1.height()); + else if (aux1.width() > w || \
aux1.height() > h) { + if (flags & DoNotAllowWordWrap || aux1.height() == \
p.fontMetrics().height()) { + size = qMin(w * size / aux1.width(), h * \
size / aux1.height()); + } else {
+ // Word wrapping can completely change the
+ // layout of the text, so the above will not work.
+ size = size - 1;
+ }
+ }
else done = true;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic