Repository: microsoft/terminal
File: src/renderer/dx/DxFontRenderData.cpp (C++)

Code before:

        _textFormatMap.emplace(_ToMapKey(weight, style, stretch), std::move(textFormat));
        return textFormat;
    }
    else
    {
        return textFormatIt->second;
    }
}

[[nodiscard]] Microsoft::WRL::ComPtr<IDWriteFontFace1> DxFontRenderData::FontFaceWithAttribute(DWRITE_FONT_WEIGHT weight,
                                                                                               DWRITE_FONT_STYLE style,
                                                                                               DWRITE_FONT_STRETCH stretch)
{
    const auto fontFaceIt = _fontFaceMap.find(_ToMapKey(weight, style, stretch));
    if (fontFaceIt == _fontFaceMap.end())
    {
        DxFontInfo fontInfo = _defaultFontInfo;
        fontInfo.SetWeight(weight);
        fontInfo.SetStyle(style);
        fontInfo.SetStretch(stretch);

        std::wstring fontLocaleName = UserLocaleName();
        Microsoft::WRL::ComPtr<IDWriteFontFace1> fontFace = fontInfo.ResolveFontFaceWithFallback(_dwriteFactory.Get(), fontLocaleName);

        _fontFaceMap.emplace(_ToMapKey(weight, style, stretch), std::move(fontFace));
        return fontFace;
    }
    else
    {
        return fontFaceIt->second;
    }
}

// Routine Description:
// - Updates the font used for drawing
// Arguments:
// - desired - Information specifying the font that is requested
// - actual - Filled with the nearest font actually chosen for drawing
// - dpi - The DPI of the screen
// Return Value:
// - S_OK or relevant DirectX error
[[nodiscard]] HRESULT DxFontRenderData::UpdateFont(const FontInfoDesired& desired, FontInfo& actual, const int dpi) noexcept
{
    try
    {
        _userLocaleName.clear();
        _textFormatMap.clear();
        _fontFaceMap.clear();
        _boxDrawingEffect.Reset();


Review comment (suggestion):
I am a classic dumbass

WE RETURN IT RIGHT AFTER WE MOVE FROM IT

DERP

```suggestion
        _fontFaceMap.emplace(_ToMapKey(weight, style, stretch), fontFace);
```

Code after:

        _textFormatMap.emplace(_ToMapKey(weight, style, stretch), textFormat);
        return textFormat;
    }
    else
    {
        return textFormatIt->second;
    }
}

[[nodiscard]] Microsoft::WRL::ComPtr<IDWriteFontFace1> DxFontRenderData::FontFaceWithAttribute(DWRITE_FONT_WEIGHT weight,
                                                                                               DWRITE_FONT_STYLE style,
                                                                                               DWRITE_FONT_STRETCH stretch)
{
    const auto fontFaceIt = _fontFaceMap.find(_ToMapKey(weight, style, stretch));
    if (fontFaceIt == _fontFaceMap.end())
    {
        DxFontInfo fontInfo = _defaultFontInfo;
        fontInfo.SetWeight(weight);
        fontInfo.SetStyle(style);
        fontInfo.SetStretch(stretch);

        std::wstring fontLocaleName = UserLocaleName();
        Microsoft::WRL::ComPtr<IDWriteFontFace1> fontFace = fontInfo.ResolveFontFaceWithFallback(_dwriteFactory.Get(), fontLocaleName);

        _fontFaceMap.emplace(_ToMapKey(weight, style, stretch), fontFace);
        return fontFace;
    }
    else
    {
        return fontFaceIt->second;
    }
}

// Routine Description:
// - Updates the font used for drawing
// Arguments:
// - desired - Information specifying the font that is requested
// - actual - Filled with the nearest font actually chosen for drawing
// - dpi - The DPI of the screen
// Return Value:
// - S_OK or relevant DirectX error
[[nodiscard]] HRESULT DxFontRenderData::UpdateFont(const FontInfoDesired& desired, FontInfo& actual, const int dpi) noexcept
{
    try
    {
        _userLocaleName.clear();
        _textFormatMap.clear();
        _fontFaceMap.clear();
        _boxDrawingEffect.Reset();