Report correct font underline position on OS X
Text was sometimes drawn without a proper gap between the baseline and underline. [ChangeLog][Text][OS X] Fixed underline position. Change-Id: I9b28d1ac39e18e8d98de92b354a1d635100853a9 Task-number: QTBUG-33708 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>bb10
parent
1d5c29da59
commit
b4b829d928
|
|
@ -216,6 +216,7 @@ void QCoreTextFontEngine::init()
|
|||
avgCharWidth = QFontEngine::averageCharWidth();
|
||||
|
||||
underlineThickness = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont));
|
||||
underlinePos = -QFixed::fromReal(CTFontGetUnderlinePosition(ctfont));
|
||||
|
||||
cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000;
|
||||
|
||||
|
|
@ -764,6 +765,11 @@ QFixed QCoreTextFontEngine::lineThickness() const
|
|||
return underlineThickness;
|
||||
}
|
||||
|
||||
QFixed QCoreTextFontEngine::underlinePosition() const
|
||||
{
|
||||
return underlinePos;
|
||||
}
|
||||
|
||||
QFontEngine::Properties QCoreTextFontEngine::properties() const
|
||||
{
|
||||
Properties result;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ public:
|
|||
bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; }
|
||||
|
||||
QFixed lineThickness() const Q_DECL_OVERRIDE;
|
||||
QFixed underlinePosition() const Q_DECL_OVERRIDE;
|
||||
|
||||
void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight);
|
||||
|
||||
|
|
@ -143,6 +144,7 @@ private:
|
|||
CGAffineTransform transform;
|
||||
QFixed avgCharWidth;
|
||||
QFixed underlineThickness;
|
||||
QFixed underlinePos;
|
||||
QFontEngine::FaceId face_id;
|
||||
mutable bool kerningPairsLoaded;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue