mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Direct2D: Match system preferences for text antialiasing
This commit is contained in:
parent
340f531c71
commit
b12088a1f6
1 changed files with 15 additions and 1 deletions
|
|
@ -348,7 +348,21 @@ struct Direct2DDeviceContext
|
|||
return {};
|
||||
}
|
||||
|
||||
result->SetTextAntialiasMode (D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE);
|
||||
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->SetAntialiasMode (D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
result->SetUnitMode (D2D1_UNIT_MODE_PIXELS);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue