|
10 | 10 | #include "../../types/inc/Viewport.hpp" |
11 | 11 | #include "../../inc/unicode.hpp" |
12 | 12 | #include "../../inc/DefaultSettings.h" |
| 13 | +#include <VersionHelpers.h> |
13 | 14 |
|
14 | 15 | #pragma hdrstop |
15 | 16 |
|
@@ -191,7 +192,16 @@ DxEngine::~DxEngine() |
191 | 192 | SwapChainDesc.BufferCount = 2; |
192 | 193 | SwapChainDesc.SampleDesc.Count = 1; |
193 | 194 | SwapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED; |
194 | | - SwapChainDesc.Scaling = DXGI_SCALING_NONE; |
| 195 | + |
| 196 | + // DXGI_SCALING_NONE is only valid on Windows 8+ |
| 197 | + if (IsWindows8OrGreater()) |
| 198 | + { |
| 199 | + SwapChainDesc.Scaling = DXGI_SCALING_NONE; |
| 200 | + } |
| 201 | + else |
| 202 | + { |
| 203 | + SwapChainDesc.Scaling = DXGI_SCALING_STRETCH; |
| 204 | + } |
195 | 205 |
|
196 | 206 | switch (_chainMode) |
197 | 207 | { |
@@ -886,7 +896,7 @@ void DxEngine::_InvalidOr(RECT rc) noexcept |
886 | 896 |
|
887 | 897 | // Get the baseline for this font as that's where we draw from |
888 | 898 | DWRITE_LINE_SPACING spacing; |
889 | | - RETURN_IF_FAILED(_dwriteTextFormat->GetLineSpacing(&spacing)); |
| 899 | + RETURN_IF_FAILED(_dwriteTextFormat->GetLineSpacing(&spacing.method, &spacing.height, &spacing.baseline)); |
890 | 900 |
|
891 | 901 | // Assemble the drawing context information |
892 | 902 | DrawingContext context(_d2dRenderTarget.Get(), |
@@ -1248,9 +1258,9 @@ float DxEngine::GetScaling() const noexcept |
1248 | 1258 | FontInfo& pfiFontInfo, |
1249 | 1259 | int const iDpi) noexcept |
1250 | 1260 | { |
1251 | | - Microsoft::WRL::ComPtr<IDWriteTextFormat2> format; |
| 1261 | + Microsoft::WRL::ComPtr<IDWriteTextFormat> format; |
1252 | 1262 | Microsoft::WRL::ComPtr<IDWriteTextAnalyzer1> analyzer; |
1253 | | - Microsoft::WRL::ComPtr<IDWriteFontFace5> face; |
| 1263 | + Microsoft::WRL::ComPtr<IDWriteFontFace1> face; |
1254 | 1264 |
|
1255 | 1265 | return _GetProposedFont(pfiFontInfoDesired, |
1256 | 1266 | pfiFontInfo, |
@@ -1352,12 +1362,12 @@ float DxEngine::GetScaling() const noexcept |
1352 | 1362 | // - style - Normal, italic, etc. |
1353 | 1363 | // Return Value: |
1354 | 1364 | // - Smart pointer holding interface reference for queryable font data. |
1355 | | -[[nodiscard]] Microsoft::WRL::ComPtr<IDWriteFontFace5> DxEngine::_FindFontFace(const std::wstring& familyName, |
| 1365 | +[[nodiscard]] Microsoft::WRL::ComPtr<IDWriteFontFace1> DxEngine::_FindFontFace(const std::wstring& familyName, |
1356 | 1366 | DWRITE_FONT_WEIGHT weight, |
1357 | 1367 | DWRITE_FONT_STRETCH stretch, |
1358 | 1368 | DWRITE_FONT_STYLE style) const |
1359 | 1369 | { |
1360 | | - Microsoft::WRL::ComPtr<IDWriteFontFace5> fontFace; |
| 1370 | + Microsoft::WRL::ComPtr<IDWriteFontFace1> fontFace; |
1361 | 1371 |
|
1362 | 1372 | Microsoft::WRL::ComPtr<IDWriteFontCollection> fontCollection; |
1363 | 1373 | THROW_IF_FAILED(_dwriteFactory->GetSystemFontCollection(&fontCollection, false)); |
@@ -1394,9 +1404,9 @@ float DxEngine::GetScaling() const noexcept |
1394 | 1404 | [[nodiscard]] HRESULT DxEngine::_GetProposedFont(const FontInfoDesired& desired, |
1395 | 1405 | FontInfo& actual, |
1396 | 1406 | const int dpi, |
1397 | | - Microsoft::WRL::ComPtr<IDWriteTextFormat2>& textFormat, |
| 1407 | + Microsoft::WRL::ComPtr<IDWriteTextFormat>& textFormat, |
1398 | 1408 | Microsoft::WRL::ComPtr<IDWriteTextAnalyzer1>& textAnalyzer, |
1399 | | - Microsoft::WRL::ComPtr<IDWriteFontFace5>& fontFace) const noexcept |
| 1409 | + Microsoft::WRL::ComPtr<IDWriteFontFace1>& fontFace) const noexcept |
1400 | 1410 | { |
1401 | 1411 | try |
1402 | 1412 | { |
@@ -1508,7 +1518,7 @@ float DxEngine::GetScaling() const noexcept |
1508 | 1518 |
|
1509 | 1519 | fontFace = face; |
1510 | 1520 |
|
1511 | | - THROW_IF_FAILED(textFormat->SetLineSpacing(&lineSpacing)); |
| 1521 | + THROW_IF_FAILED(textFormat->SetLineSpacing(lineSpacing.method, lineSpacing.height, lineSpacing.baseline)); |
1512 | 1522 | THROW_IF_FAILED(textFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR)); |
1513 | 1523 | THROW_IF_FAILED(textFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP)); |
1514 | 1524 |
|
|
0 commit comments