mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Merge 8a7db025ef into bc7339fe07
This commit is contained in:
commit
e80832fe45
2 changed files with 31 additions and 1 deletions
|
|
@ -87,6 +87,17 @@
|
|||
#define JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING 0
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_ENABLE_DIRECT2D_CLEARTYPE_FONT_SMOOTHING
|
||||
|
||||
Setting this flag will *enable* Windows ClearType subpixel font antialiasing when using
|
||||
the Direct2D renderer, if preferred by the end user. This is off by default due to
|
||||
issues with transparency, certain compositions and transformations so make sure the
|
||||
output looks acceptable for your use cases.
|
||||
*/
|
||||
#ifndef JUCE_ENABLE_DIRECT2D_CLEARTYPE_FONT_SMOOTHING
|
||||
#define JUCE_ENABLE_DIRECT2D_CLEARTYPE_FONT_SMOOTHING 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_INCLUDE_PNGLIB_CODE
|
||||
#define JUCE_INCLUDE_PNGLIB_CODE 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -270,7 +270,26 @@ ComSmartPtr<ID2D1DeviceContext1> Direct2DDeviceContext::create (ComSmartPtr<ID2D
|
|||
return {};
|
||||
}
|
||||
|
||||
result->SetTextAntialiasMode (D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE);
|
||||
#if JUCE_ENABLE_DIRECT2D_CLEARTYPE_FONT_SMOOTHING
|
||||
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);
|
||||
#else
|
||||
result->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE);
|
||||
#endif
|
||||
|
||||
result->SetAntialiasMode (D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
|
||||
result->SetUnitMode (D2D1_UNIT_MODE_PIXELS);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue