Skip to content

Commit

Permalink
Pre-merge #10498 (bold)
Browse files Browse the repository at this point in the history
  • Loading branch information
DHowett committed Jul 1, 2021
2 parents de880b1 + 265bdc7 commit b68f203
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/renderer/dx/CustomTextLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,16 @@ try
{
const auto drawingContext = static_cast<const DrawingContext*>(clientDrawingContext);

const DWRITE_FONT_WEIGHT weight = _fontRenderData->DefaultFontWeight();
DWRITE_FONT_WEIGHT weight = _fontRenderData->DefaultFontWeight();
DWRITE_FONT_STYLE style = _fontRenderData->DefaultFontStyle();
const DWRITE_FONT_STRETCH stretch = _fontRenderData->DefaultFontStretch();

if (drawingContext->useBoldFont)
{
// TODO: "relative" bold?
weight = DWRITE_FONT_WEIGHT_BOLD;
}

if (drawingContext->useItalicFont)
{
style = DWRITE_FONT_STYLE_ITALIC;
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/dx/CustomTextRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Microsoft::Console::Render
renderTarget(renderTarget),
foregroundBrush(foregroundBrush),
backgroundBrush(backgroundBrush),
useBoldFont(false),
useItalicFont(false),
forceGrayscaleAA(forceGrayscaleAA),
dwriteFactory(dwriteFactory),
Expand All @@ -38,6 +39,7 @@ namespace Microsoft::Console::Render
ID2D1RenderTarget* renderTarget;
ID2D1SolidColorBrush* foregroundBrush;
ID2D1SolidColorBrush* backgroundBrush;
bool useBoldFont;
bool useItalicFont;
bool forceGrayscaleAA;
IDWriteFactory* dwriteFactory;
Expand Down
1 change: 1 addition & 0 deletions src/renderer/dx/DxRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,7 @@ CATCH_RETURN()
if (_drawingContext)
{
_drawingContext->forceGrayscaleAA = _ShouldForceGrayscaleAA();
_drawingContext->useBoldFont = textAttributes.IsBold();
_drawingContext->useItalicFont = textAttributes.IsItalic();
}

Expand Down

0 comments on commit b68f203

Please sign in to comment.