diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-07-24 14:33:00 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-03 16:19:24 +0200 |
commit | 7ff4621100b3df7ba9b336ac60204da4b548e642 (patch) | |
tree | 4c9349521044a5c39861385abaa40f10987d982b /src/plugins/platforms/cocoa/qpaintengine_mac.mm | |
parent | 86789a48f73ed2d39cce3ff6596e71cb64e547e7 (diff) |
Add QFont strategy to disable subpixel antialiasing
This patch adds the option to disable subpixel antialiasing on QFont
basis. This can be useful when painting to offscreen surfaces. On OS X
this option disables the aggressive LCD font smoothing, which can be
necessary for certain fonts it may otherwise ruin.
Task-number: QTBUG-40396
Change-Id: I1664b636520ae63ee1503b5df7436748106b9f5c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qpaintengine_mac.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qpaintengine_mac.mm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index f4cd071ab7..d48cbdfac8 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -1084,6 +1084,10 @@ void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem if (textAA != lineAA) CGContextSetShouldAntialias(d->hd, textAA); + const bool smoothing = textAA && !(fe->fontDef.styleStrategy & QFont::NoSubpixelAntialias); + if (d->disabledSmoothFonts == smoothing) + CGContextSetShouldSmoothFonts(d->hd, smoothing); + if (ti.glyphs.numGlyphs) { switch (fe->type()) { case QFontEngine::Mac: @@ -1100,6 +1104,9 @@ void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem if (textAA != lineAA) CGContextSetShouldAntialias(d->hd, !textAA); + if (smoothing == d->disabledSmoothFonts) + CGContextSetShouldSmoothFonts(d->hd, !d->disabledSmoothFonts); + updatePen(oldPen); updateBrush(oldBrush, oldBrushOrigin); } |