Repository: microsoft/terminal (language: cpp)

Issue:
Font preview in host properties is broken after 154ac2b
### Windows Terminal version

Latest source

### Windows build number

10.0.19045.3448

### Other Software

_No response_

### Steps to reproduce

1. Open the solution.
2. Build Conhost/Host.EXE
3. Run it.
4. Open host properties (Alt+Space, P)
5. Switch to Font tab
6. Select Consolas, Courier New, Lucida Console, or any raster font.
7. Look at the preview below.

### Expected Behavior

Preview is rendered using the selected font:

![okay](https://github.com/microsoft/terminal/assets/11453922/edb195d4-4003-4b36-91ac-9a0d85242f50)



### Actual Behavior

Preview is rendered using some fallback raster font:

![not_okay](https://github.com/microsoft/terminal/assets/11453922/697e08c9-925b-4a1c-878d-058a9fe9ed8d)


-----
### Observations
1. Removing the built console.dll and using the system one works as expected.
2. Some other TrueType fonts, e.g. all Cascadias and asians, are rendered as expected.
3. Looks like it stopped working after 154ac2b9160177c079f1a93436a0b6240761c5a2. Commenting that line fixes the issue:
```DIFF
diff --git a/src/propsheet/misc.cpp b/src/propsheet/misc.cpp
index 054eef961..312669f41 100644
--- a/src/propsheet/misc.cpp
+++ b/src/propsheet/misc.cpp
@@ -400,7 +400,7 @@ CreateBoldFont:
      */
     if (FontInfo[nFont].hFont != nullptr)
     {
-        DeleteObject(FontInfo[nFont].hFont);
+        //DeleteObject(FontInfo[nFont].hFont);
     }
     FontInfo[nFont].hFont = hFont;
     FontInfo[nFont].Family = tmFamily;
```
Apparently the font object is still used at this point and should be deleted later?


Discussion / hints:

Fix patch:
diff --git a/src/propsheet/misc.cpp b/src/propsheet/misc.cpp
index 054eef96121..9d8abcaf05a 100644
--- a/src/propsheet/misc.cpp
+++ b/src/propsheet/misc.cpp
@@ -398,10 +398,6 @@ int AddFont(
     /*
      * Store the font info
      */
-    if (FontInfo[nFont].hFont != nullptr)
-    {
-        DeleteObject(FontInfo[nFont].hFont);
-    }
     FontInfo[nFont].hFont = hFont;
     FontInfo[nFont].Family = tmFamily;
     FontInfo[nFont].Size = SizeActual;


Test patch: