Font preview in host properties is broken after 154ac2b #20800

Closed
opened 2026-01-31 07:24:25 +00:00 by claunia · 0 comments
Owner

Originally created by @alabuzhev on GitHub (Nov 12, 2023).

Originally assigned to: @lhecker on GitHub.

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

Actual Behavior

Preview is rendered using some fallback raster font:

not_okay


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 154ac2b916. Commenting that line fixes the issue:
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?

Originally created by @alabuzhev on GitHub (Nov 12, 2023). Originally assigned to: @lhecker on GitHub. ### 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?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20800