OSX: implement QFontMetrics::maxWidth().
CoreText doesn't seem to provide us with a "maximum advance" value, but 0 is really wrong, it leads to QLineEdit::minimumSizeHint() being 0 since it's based on maxWidth(). It even led to a negative min width with setTextMargins(-1, 0, -1, 0). Change-Id: I4faf8ecfb6d91e9dff66ec63651d003014503cb4 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
parent
5f6284a98b
commit
edd436a268
@ -353,7 +353,10 @@ QFixed QCoreTextFontEngine::averageCharWidth() const
|
||||
|
||||
qreal QCoreTextFontEngine::maxCharWidth() const
|
||||
{
|
||||
return 0;
|
||||
// ### FIXME: 'W' might not be the widest character, but this is better than nothing
|
||||
const glyph_t glyph = glyphIndex('W');
|
||||
glyph_metrics_t bb = const_cast<QCoreTextFontEngine *>(this)->boundingBox(glyph);
|
||||
return bb.xoff.toReal();
|
||||
}
|
||||
|
||||
qreal QCoreTextFontEngine::minLeftBearing() const
|
||||
|
Loading…
Reference in New Issue
Block a user