-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird fonts on Windows Server 2022 #11032
Comments
This looks it might be the same thing as #11017. |
This is wild that we got the same report 3 times in a week. @faxx1080 what font are you using in the Terminal? What DPI scaling? |
Hi Mike!
I was using the default font that comes with Windows Terminal, Cascadia
Code, and did not change any settings.
I was using 100% DPI scaling; unchanged from out of box defaults (in a
VMWare VM, running on a 96 DPI physical monitor).
|
**I'm not 100% sure it was Cascadia Code; it was whatever font is the default after installing the Appx package. Note that I did this on the out of box Administrator account which has UAC turned off. |
Okay this is wild. If you go into something like Microsoft Word, or anything that has a font picker, and go through that list, does "Cascadia Code" appear in that list? And does it appear in the dropdown list in the Terminal? We just got an internal report of the same thing that suggested that the font was uninstalled? |
I'm having the same issue on a recently installed, non-domain joined, Windows Server 2022 Standard (version 21H2, build 20348.202) VM. It sure seems like whatever the default font is just doesn't get installed. The WordPad doesn't show any Cascadia related fonts in the list. I installed the One more note. I had previously accidentally installed the |
WHAT THE That's WILDLY unexpected, but definitely explains why you're seeing what you're seeing. It doesn't make sense, but that at least explains it. The Cascadia family of fonts should be shipping in our package: terminal/src/cascadia/CascadiaPackage/Package.appxmanifest Lines 140 to 149 in 6268a47
But if they're not getting installed when you install the Terminal, then a bunch of stuff will break. We pretty consistently rely on those fonts existing. |
I notice in that same file, there's a Dependencies section that seems to only target terminal/src/cascadia/CascadiaPackage/Package.appxmanifest Lines 29 to 31 in 6268a47
|
Something interesting I noticed about the I also noticed that example includes the extension at the I too know zero about MSIX, so maybe none of this matters. |
That seems unlikely to me - #11041 looks like the same thing, and that wasn't on a Server SKU, and the internal report we had of this wasn't either. But I like where your head is at! We've had some notorious difficulty with the MSIX platform and our font in the past. In the last release, this actually just caused the Terminal to crash on startup if the font wasn't found. Now I suppose we survive, but find ourselves in a state where the font can't be found in XAML. We'll need to think about this. |
What the heck. That's a great observation |
So, shared fonts I believe were actually introduced with uap7 came around and promoted it to a package extension, so it didn't need to be tied to an application. It kept |
I believed that Windows.Desktop covered "all things where Windows presents as a normal desktop OS" (including Server), but we can validate that. That dependency, however, blocks installation if it is not present... |
Would one of you mind collecting a recursive export of the registry key |
That key exists, but is empty on my Server 2022 VM. Here's the export and a view from the regedit GUI.
The HKLM equiv path has plenty of font entries in it. Though none appear to be Cascadia related. |
A-HA! It looks like the "Shared Font" deployment helper (a deployment helper is something that runs when an MSIX is installed) isn't built into Windows Server. That's great for us to know. Thanks! |
The thing I don't totally understand is why our side-by-side font loader didn't load it. @miniksa might know more, or be able to troubleshoot it from here. We explicitly look for fonts in our own package and try to load them... This might suggest a root cause for the weird letter selection, if it's not working totally properly, or if we're doing font fallback with a collection that doesn't contain Cascadia. |
I was intrigued by this, so I span up a Windows Server 2022 VM and deployed the code from The I then copied the font into the remote deployment directory and got the weird font rendering. Adding in some simple Unfortunately I haven't had time to do any further debugging, but it looks like the issue is higher up in the application than the font loading. |
On a related note, the settings UI won't show the Cascadia font either, because it only loads the fonts from the system font collection. |
Nnnnnnnnnnnnnnnnnnnnn. OK. Thanks. |
OK I think I've got it. We need to change the way we handle the fallback to the font in the package. Instead of running this process where we check the system collection and then fallback and check the nearby collection... I believe we need to make it so there's just one merged collection of both and then use that ANYWHERE in the application where a collection is needed. So the _nearbyCollection is probably no longer a property of DxFontInfo as it has little to do with the chosen font and is more just a representation of the world. We just need to... on startup of the rendering pipeline... use EDIT: Oh and if we're not on Windows 10... then we have our _terminalCollection pointer as nullptr and dutifully pass that into all locations that ask for a collection and they'll resolve the system one since the fallback only works on 10+ anyway. |
If you do this, is it possible to ensure that the system fonts win over the nearby ones? Eventually, when we decouple Cascadia, we will be able to freeze down a "backup" version and we don't want it to defeat the system-installed version if it is newer. |
I am 78% sure that putting the System Font Set in first and then appending the package one next will make that be the order of priority. |
@fdwr... opinion on my shenanigans? |
@miniksa : Yes, a tie between two of the same font in the font set (or in the old hierarchical WWS collection) is broken by addition order, favoring earlier indices. (there was a brief bug in Win 8.1 selfhost where it was sometimes not fully deterministic if you overflowed the font collection cache size, but I fixed that, and it should AFAIK still behave with first-index-wins-the-tie)
Interesting screenshot. It seems the |
Excellent. Thank you.
Yes and yes. You're correct that my scaling algorithm is probably suboptimal here using a uniform aspect ratio and that the Terminal strongly avoids selecting proportional fonts under normal circumstances. |
I've been keeping up with this intermittently and really want to say a thank you!! to all I've learned about font edge cases here, as well as what's really changed since classic Windows (XP and up). Not being familiar with most (sadly) of the C++ code of terminal; I "solved" this on my VM by going into the appx directory, right clicking install on all the Cascadia Code fonts. But that's even worse than the above quick fix, since I needed admin for that, and that was a system-level change. But it did solve the issue! I also had a Windows 11 test nearby and installed Windows Terminal Preview there, and found that Cascadia Code works fine in the terminal and settings; as well as Notepad / Old Conhost, but doesn't appear in C:\Windows\Fonts; nor does it appear in the old Fonts control panel. |
@faxx1080: IIRC, the old fontext.dll enumerated the registry itself directly rather than going through GDI or DirectWrite. So it would not know about "per user" fonts, unless additional work was done to it 🤔. I think the shell verb "Install" (forget which OS version this happened) now installs fonts into |
This commit is a minimal fix in order to pass the `IDWriteFontCollection` we create out of .ttf files residing next to our binaries to the `IDWriteFontFallback::MapCharacters` call. The `IDWriteTextFormat` is used in order to carry the font collection over into `CustomTextLayout`. ## Validation * Put `JetBrainsMono-Regular.ttf` into the binary output directory * Modify `HKCU:\Console\*\FaceName` to `JetBrains Mono` * Launch OpenConsole.exe * OpenConsole uses JetBrains Mono ✔️ Closes #11032 Closes #11648
Problem was solved for me on 2 Server 2022 installs after installing the Cascadia Code fonts: https://github.com/microsoft/cascadia-code |
This commit is a minimal fix in order to pass the `IDWriteFontCollection` we create out of .ttf files residing next to our binaries to the `IDWriteFontFallback::MapCharacters` call. The `IDWriteTextFormat` is used in order to carry the font collection over into `CustomTextLayout`. ## Validation * Put `JetBrainsMono-Regular.ttf` into the binary output directory * Modify `HKCU:\Console\*\FaceName` to `JetBrains Mono` * Launch OpenConsole.exe * OpenConsole uses JetBrains Mono ✔️ Closes #11032 Closes #11648 (cherry picked from commit 131f5d2)
This commit is a minimal fix in order to pass the `IDWriteFontCollection` we create out of .ttf files residing next to our binaries to the `IDWriteFontFallback::MapCharacters` call. The `IDWriteTextFormat` is used in order to carry the font collection over into `CustomTextLayout`. ## Validation * Put `JetBrainsMono-Regular.ttf` into the binary output directory * Modify `HKCU:\Console\*\FaceName` to `JetBrains Mono` * Launch OpenConsole.exe * OpenConsole uses JetBrains Mono ✔️ Closes #11032 Closes #11648 (cherry picked from commit 131f5d2)
🎉This issue was addressed in #11764, which has now been successfully released as Handy links: |
🎉This issue was addressed in #11764, which has now been successfully released as Handy links: |
The original research for a solution all the way back in #11032 contained an unfortunate flaw. The nearby font loading code was written under the assumption that Cascadia is missing in the system font collection, leading to our issues. Adding nearby fonts last into the collection would thus ensure that we use the system fonts whenever possible, but only have nearby fonts as a fallback. This didn't work and we figured that we'd have to always prefer loading nearby fonts over system fonts. #12554 tried to achieve this, but failed to change the order in which the font set is built. In order to prefer nearby fonts over system ones, we have to add the system font collection last. ## PR Checklist * [x] Closes #11648 * [x] I work here * [x] Tests added/passed * [x] Embarrassment for my incompetence ## Validation Steps Performed * Put Jetbrains Mono into the AppX directory of the Debug build * Jetbrains Mono shows up in the font selector and is useable Additionally a more complex mini-test was built: Using FontForge I've cloned arial.ttf and removed all characters except for the letter "0". Afterwards I've build a custom font collection the same way we do it in Terminal, extracted a `FontFace` named "Arial" and called `IDWriteFont::HasCharacter` for the letter "1". Loading the system font collection first results in `TRUE` and loading it last results in `FALSE` (since my custom arial.ttf doesn't have the letter "1"). This confirms that we need to load the system font collection last.
The original research for a solution all the way back in #11032 contained an unfortunate flaw. The nearby font loading code was written under the assumption that Cascadia is missing in the system font collection, leading to our issues. Adding nearby fonts last into the collection would thus ensure that we use the system fonts whenever possible, but only have nearby fonts as a fallback. This didn't work and we figured that we'd have to always prefer loading nearby fonts over system fonts. #12554 tried to achieve this, but failed to change the order in which the font set is built. In order to prefer nearby fonts over system ones, we have to add the system font collection last. ## PR Checklist * [x] Closes #11648 * [x] I work here * [x] Tests added/passed * [x] Embarrassment for my incompetence ## Validation Steps Performed * Put Jetbrains Mono into the AppX directory of the Debug build * Jetbrains Mono shows up in the font selector and is useable Additionally a more complex mini-test was built: Using FontForge I've cloned arial.ttf and removed all characters except for the letter "0". Afterwards I've build a custom font collection the same way we do it in Terminal, extracted a `FontFace` named "Arial" and called `IDWriteFont::HasCharacter` for the letter "1". Loading the system font collection first results in `TRUE` and loading it last results in `FALSE` (since my custom arial.ttf doesn't have the letter "1"). This confirms that we need to load the system font collection last. (cherry picked from commit eeb8970) Service-Card-Id: 80641214 Service-Version: 1.13
The original research for a solution all the way back in #11032 contained an unfortunate flaw. The nearby font loading code was written under the assumption that Cascadia is missing in the system font collection, leading to our issues. Adding nearby fonts last into the collection would thus ensure that we use the system fonts whenever possible, but only have nearby fonts as a fallback. This didn't work and we figured that we'd have to always prefer loading nearby fonts over system fonts. #12554 tried to achieve this, but failed to change the order in which the font set is built. In order to prefer nearby fonts over system ones, we have to add the system font collection last. ## PR Checklist * [x] Closes #11648 * [x] I work here * [x] Tests added/passed * [x] Embarrassment for my incompetence ## Validation Steps Performed * Put Jetbrains Mono into the AppX directory of the Debug build * Jetbrains Mono shows up in the font selector and is useable Additionally a more complex mini-test was built: Using FontForge I've cloned arial.ttf and removed all characters except for the letter "0". Afterwards I've build a custom font collection the same way we do it in Terminal, extracted a `FontFace` named "Arial" and called `IDWriteFont::HasCharacter` for the letter "1". Loading the system font collection first results in `TRUE` and loading it last results in `FALSE` (since my custom arial.ttf doesn't have the letter "1"). This confirms that we need to load the system font collection last. (cherry picked from commit eeb8970) Service-Card-Id: 80641213 Service-Version: 1.12
Windows Terminal version (or Windows build number)
1.10.1933.0
Other Software
Fresh install of Windows Server 2022 Evaluation, straight from https://www.microsoft.com/en-us/evalcenter/. Did not yet check for updates.
Steps to reproduce
Install latest preview appxbundle using Add-AppxPackage.
Running Windows Server on VMWare Workstation 16.1.2 build-17966106.
Expected Behavior
This is how cascadia code normally looks.
Actual Behavior
This is what I got. Doesn't quite seem right.
The text was updated successfully, but these errors were encountered: