mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Direct2D: Revert to using grayscale text antialisaing exclusively
Reverts b12088a1f6
After some investigation, it appears that ClearType rendering is
unsuitable when
- the render target has translucent pixels underneath rendered text, or
- the render ouput is rotated, scaled, subpixel-translated, or otherwise
transformed before display.
This necessitates avoiding ClearType when rendering into transparent
bitmaps.
Unfortunately, a commmon use-case for transparent bitmaps is buffered
component images. Even if ClearType were enabled for opaque targets,
ClearType text could then end up displaying next to non-ClearType text
rendered to an intermediate texture, leading to an inconsistent
appearance.
There's also not a straightforward way of exposing a ClearType rendering
option in all of the places that it would be required, and a change of
this size is difficult to justify given that subpixel text rendering
controls would only have an effect on Windows.
This commit is contained in:
parent
735f99418c
commit
14d52769dc
2 changed files with 2 additions and 16 deletions
|
|
@ -347,7 +347,7 @@ public:
|
|||
|
||||
if (const auto hr = result.deviceContext->CreateSolidColorBrush (D2D1::ColorF (0.0f, 0.0f, 0.0f, 1.0f),
|
||||
result.colourBrush.resetAndGetPointerAddress());
|
||||
FAILED (hr))
|
||||
FAILED (hr))
|
||||
{
|
||||
jassertfalse;
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -348,21 +348,7 @@ struct Direct2DDeviceContext
|
|||
return {};
|
||||
}
|
||||
|
||||
const auto textAntialiasing = [&]
|
||||
{
|
||||
BOOL smoothingEnabled{};
|
||||
SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothingEnabled, 0);
|
||||
|
||||
if (! smoothingEnabled)
|
||||
return D2D1_TEXT_ANTIALIAS_MODE_ALIASED;
|
||||
|
||||
UINT smoothingKind{};
|
||||
SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothingKind, 0);
|
||||
return smoothingKind == FE_FONTSMOOTHINGCLEARTYPE ? D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE
|
||||
: D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE;
|
||||
}();
|
||||
|
||||
result->SetTextAntialiasMode (textAntialiasing);
|
||||
result->SetTextAntialiasMode (D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE);
|
||||
result->SetAntialiasMode (D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
result->SetUnitMode (D2D1_UNIT_MODE_PIXELS);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue