AtlasEngine: Improve debuggability (#17136)

This is some test code and natvis fixes that I used to trace down
an issue during font rendering.
This commit is contained in:
Leonard Hecker 2024-04-26 13:20:21 +02:00 коммит произвёл GitHub
Родитель 26900ca472
Коммит 8d67477a1a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 43 добавлений и 14 удалений

Просмотреть файл

@ -1242,7 +1242,7 @@ BackendD3D::AtlasGlyphEntry* BackendD3D::_drawGlyph(const RenderingPayload& p, c
DWRITE_RENDERING_MODE renderingMode{}; DWRITE_RENDERING_MODE renderingMode{};
DWRITE_GRID_FIT_MODE gridFitMode{}; DWRITE_GRID_FIT_MODE gridFitMode{};
THROW_IF_FAILED(fontFaceEntry.fontFace->GetRecommendedRenderingMode( THROW_IF_FAILED(fontFaceEntry.fontFace->GetRecommendedRenderingMode(
/* fontEmSize */ fontEmSize, /* fontEmSize */ glyphRun.fontEmSize,
/* dpiX */ 1, // fontEmSize is already in pixel /* dpiX */ 1, // fontEmSize is already in pixel
/* dpiY */ 1, // fontEmSize is already in pixel /* dpiY */ 1, // fontEmSize is already in pixel
/* transform */ nullptr, /* transform */ nullptr,
@ -1294,6 +1294,39 @@ BackendD3D::AtlasGlyphEntry* BackendD3D::_drawGlyph(const RenderingPayload& p, c
// The buffer now contains a grayscale alpha mask. // The buffer now contains a grayscale alpha mask.
#endif #endif
// This code finds the local font file path. Useful for debugging as it
// gets you the font.ttf <> glyphIndex pair to uniquely identify glyphs.
#if 0
std::vector<std::wstring> paths;
UINT32 numberOfFiles;
THROW_IF_FAILED(fontFaceEntry.fontFace->GetFiles(&numberOfFiles, nullptr));
wil::com_ptr<IDWriteFontFile> fontFiles[8];
THROW_IF_FAILED(fontFaceEntry.fontFace->GetFiles(&numberOfFiles, fontFiles[0].addressof()));
for (UINT32 i = 0; i < numberOfFiles; ++i)
{
wil::com_ptr<IDWriteFontFileLoader> loader;
THROW_IF_FAILED(fontFiles[i]->GetLoader(loader.addressof()));
void const* fontFileReferenceKey;
UINT32 fontFileReferenceKeySize;
THROW_IF_FAILED(fontFiles[i]->GetReferenceKey(&fontFileReferenceKey, &fontFileReferenceKeySize));
if (const auto localLoader = loader.try_query<IDWriteLocalFontFileLoader>())
{
UINT32 filePathLength;
THROW_IF_FAILED(localLoader->GetFilePathLengthFromKey(fontFileReferenceKey, fontFileReferenceKeySize, &filePathLength));
filePathLength++;
std::wstring filePath(filePathLength, L'\0');
THROW_IF_FAILED(localLoader->GetFilePathFromKey(fontFileReferenceKey, fontFileReferenceKeySize, filePath.data(), filePathLength));
paths.emplace_back(std::move(filePath));
}
}
#endif
const int scale = row.lineRendition != LineRendition::SingleWidth; const int scale = row.lineRendition != LineRendition::SingleWidth;
D2D1_MATRIX_3X2_F transform = identityTransform; D2D1_MATRIX_3X2_F transform = identityTransform;

Просмотреть файл

@ -124,7 +124,7 @@
</Type> </Type>
<Type Name="til::linear_flat_set&lt;*,*&gt;"> <Type Name="til::linear_flat_set&lt;*,*&gt;">
<DisplayString>{{ size={_load / $T2} }}</DisplayString> <DisplayString>{{ size={_load / $T3} }}</DisplayString>
<Expand> <Expand>
<ArrayItems> <ArrayItems>
<Size>_capacity</Size> <Size>_capacity</Size>
@ -161,22 +161,18 @@
</Type> </Type>
<Type Name="Microsoft::Console::Render::Atlas::BackendD3D::AtlasGlyphEntry"> <Type Name="Microsoft::Console::Render::Atlas::BackendD3D::AtlasGlyphEntry">
<DisplayString Condition="!_occupied">(empty)</DisplayString> <DisplayString Condition="occupied == 0">(empty)</DisplayString>
<DisplayString Condition="_occupied">{glyphIndex}</DisplayString> <DisplayString Condition="occupied != 0">{glyphIndex}</DisplayString>
</Type>
<Type Name="Microsoft::Console::Render::Atlas::BackendD3D::AtlasFontFaceEntryInner">
<DisplayString>{(void*)fontFace.m_ptr}, {lineRendition}</DisplayString>
<Expand>
<ExpandedItem>glyphs</ExpandedItem>
</Expand>
</Type> </Type>
<Type Name="Microsoft::Console::Render::Atlas::BackendD3D::AtlasFontFaceEntry"> <Type Name="Microsoft::Console::Render::Atlas::BackendD3D::AtlasFontFaceEntry">
<DisplayString Condition="!inner._Mypair._Myval2">(empty)</DisplayString> <DisplayString Condition="!fontFace.m_ptr">(empty)</DisplayString>
<DisplayString Condition="inner._Mypair._Myval2">{*inner._Mypair._Myval2}</DisplayString> <DisplayString Condition="fontFace.m_ptr">{*fontFace.m_ptr}</DisplayString>
<Expand> <Expand>
<ExpandedItem>*inner._Mypair._Myval2</ExpandedItem> <Item Name="Single Width" ExcludeView="simple">glyphs[0]</Item>
<Item Name="Double Width" ExcludeView="simple">glyphs[1]</Item>
<Item Name="Double Height Top" ExcludeView="simple">glyphs[2]</Item>
<Item Name="Double Height Bottom" ExcludeView="simple">glyphs[3]</Item>
</Expand> </Expand>
</Type> </Type>
</AutoVisualizer> </AutoVisualizer>