ryanoasis / nerd-fonts

Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
https://NerdFonts.com
Other
53.84k stars 3.63k forks source link

Patched PragmataPro glyphs are being rendered sliced #682

Closed ToasterDEV closed 1 year ago

ToasterDEV commented 2 years ago

🎯 Subject of the issue

After trying to patch the PragmataPro family of fonts with the following command:

docker run -v /mnt/c/Users/ToasterDEV/OneDrive/Documents/Backups/Typography/PragmataPro:/in -v /mnt/c/Users/ToasterDEV/OneDrive/Documents/Backups/Typography/PragmataProNerdFonts/out:/out nerdfonts/patcher -l -w -c -s --progressbars --careful

The glyphs are successfully added, but are rendered halfway as shown in the attached screenshot, regardless of both the Windows compatibility or the single width flags being enabled while patching the font.

🔧 Your Setup

★ Optional

image

Finii commented 2 years ago

I do not have Pragmata Pro here, but I tried Pragmata Pro Bold Italic. I see no issue there: image

My guess would be that you use PragmataPro (without NF) and the symbols are added by the system from another font, not matching in width. I'm not sure how the windows fonts are mapped (?) into the virtual Linux. Do you see the issue when you use Writer or some other text processor directly on windows and type some text? Like I did for the screenshot above. The codes I used are uF74A and uF31B. Or copy and paste them from here:   and change the font.

ToasterDEV commented 2 years ago

Hey there!

My guess would be that you use PragmataPro (without NF) and the symbols are added by the system from another font, not matching in width. I'm not sure how the windows fonts are mapped (?) into the virtual Linux. Actually, the font is applied only from the Windows side, as the terminal emulator is packaged as an UWP app, so I just patched the original font using the cited command and saw the result regardless of if the console host was on the WSL VM or running under Windows.

Actually, the font is applied only from the Windows side, as the terminal emulator is packaged as an UWP app, so I just patched the original font using the cited command and saw the result regardless of if the console host was on the WSL VM or running under Windows.

Then again, when I'm using Caskaydia Cove NF the font does not show the same issue: image Patched PragmataPro image Patched Cascadia Code (Downloaded from site, not manually patched)

Do you see the issue when you use Writer or some other text processor directly on windows and type some text? Like I did for the screenshot above. The codes I used are uF74A and uF31B. Or copy and paste them from here:   and change the font.

I just tried changing my font in Sublime Text 4 within Windows and aside from oddly a difference in aliasing, the icons are rendering correctly.

image image

With Nerd Font patch

Comparison: image Patched image Unpatched

In this case, would it be an issue with the Terminal App itself, or is there something else I should be checking?

Thanks for the help!

ToasterDEV commented 2 years ago

Just found out some new stuff, perhaps something's broken with oh-my-posh, since the icons show up correctly when displaying some of the other themes. image image image image image image Given it seems the icons are rendering correctly, just not being shown fully, should I go over to the oh-my-posh devs and check with them whether there's an issue with the font or the theme?

Finii commented 2 years ago

Well, Cascadia does not include the sybols that we see here: image

Checked CascadiaMonoPL-Regular.otf of Release 2110.31 from MS's git repo, the blue box would be Ubuntu uF31B: image

So there is some magic font substitution at work.


Given your image image I believe you use the non-mono patched version.

I tried these two command lines

fontforge -script ../../font-patcher -l -w -c -s --careful PragmataPro\ Bold\ Italic.ttf
fontforge -script ../../font-patcher -w -c --careful PragmataPro\ Bold\ Italic.ttf

Which result in these two fonts:

Examining the fonts shows this: image The normal width seen with X is obviously 1060. The left logo is from the non-mono font (and is too big: 1816, like in your problematic cases), whiule the right logo has been scaled down to 1060 in the patching process.

So my conclusion here is that either you use the non-mono-patched version ;-> or the source font you use contains some glyphs that confuse our 'how wide is a capital letter' algorithm so that the logo is scaled too big. Against that assumption is that the logo width exactly matches the unscaled logo width.


whether there's an issue with the font or the theme?

I would first make sure the font is patched correctly. Use writer (or word or whatever) to write some text with the logo. The width of all chars MUST be the same for console use; use the mono patched font (as you said you did). If the icons are rendered wider than a capital X something is wrong with the patched font. (In your example above the two icons folder and ubuntu are as wide as four ordinary characters Hell)

Maybe check the rendered font with fontforge (Windows version is available). Open the patched font, open view Goto and search for ubuntu. Double click the small preview. Check the width on the ruler...

If you are sure that use use the mono patched font, and still the ubuntu logo is wider than X, the only viable solution I see is that someone has a look on your source font, why it confuses font-patcher. But that is of course problematic as it is not a free font :->

If fontforge on windows with your patched font shows that ubuntu is of the same width as X, but you problem persists in writer there is possibly something wrong with the fonts, try uninstalling all Pragmatas (patched and unpatched), reboot, and install just the patched version. That should work (cough). If it looks ok in writer (i.e. is monospaced: ubuntu is same width as X) but not in the ZSH or what is it? Only then it might be a powerline / theme / whatever problem.

Generally I would try to stick to one system first and make that work, the virtual Linux adds a lot of complexity I guess (never used that). So maybe first try with PowerShell or something directly on windows. Look out for 'too wide' symbols, that is what breaks your shell prompt.

Edit: Add unscaled width '1816'

ToasterDEV commented 2 years ago

Hello there!

Checked CascadiaMonoPL-Regular.otf of Release 2110.31 from MS's git repo, the blue box would be Ubuntu uF31B: image

So there is some magic font substitution at work.

The font I was referring to was downloaded from the following link: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CascadiaCode.zip Not the original one from Microsoft, but I see where the confusion could have come from, sorry.

If you are sure that use use the mono patched font, and still the ubuntu logo is wider than X, the only viable solution I see is that someone has a look on your source font, why it confuses font-patcher. But that is of course problematic as it is not a free font :->

Given that I'm converting the whole family folder and manually choosing the monospaced font, would it be an option to send over a copy of one of the files both pre and post patching for analysis?

the source font you use contains some glyphs that confuse our 'how wide is a capital letter' algorithm so that the logo is scaled too big. Against that assumption is that the logo width exactly matches the unscaled logo width.

Would this assumption still hold if I were to forego the --careful switch? I just tried to repatch anew without it and the same results appeared.

If fontforge on windows with your patched font shows that ubuntu is of the same width as X, but you problem persists in writer there is possibly something wrong with the fonts, try uninstalling all Pragmatas (patched and unpatched), reboot, and install just the patched version. That should work (cough). If it looks ok in writer (i.e. is monospaced: ubuntu is same width as X) but not in the ZSH or what is it? Only then it might be a powerline / theme / whatever problem.

Okay, just tried to look through both X and through FontForge, both show an edge to edge width of 1024pxˀ (Not sure if pixels or points) image image

The only thing that looked odd when checking on Sublime Text was that the Ubuntu glyph seemingly was two characters even though I specified single-width on the command (though perhaps this is a Unicode oddity instead of a bug with my setup) image

Generally I would try to stick to one system first and make that work, the virtual Linux adds a lot of complexity I guess (never used that). So maybe first try with PowerShell or something directly on windows. Look out for 'too wide' symbols, that is what breaks your shell prompt. The terminal emulator is the one handling the font in this case (Windows Terminal), but just to check I tried setting the same theme over with Windows PowerShell and the results are similar (though with a sliced Apple logo instead of the Windows logo for some reason)

image I'm assuming perhaps the same thing from the previous picture applies here, but honestly I'm not too sure if the problem lies within my powerline handler, given that Caskaydia Cove Nerd Font is able to render the glyphs without issue considering all else as equal.

At the moment my last resort would be to try and remove all variants of the font, then rebooting and installing only the patched versions as instructed, but I'll do that and report in the next comment to make sure I don't lose what I have already written.

Cheers!

ToasterDEV commented 2 years ago

Okay, returning from reboot and installing the fonts made with this command: docker run -v /mnt/c/Users/ToasterDEV/OneDrive/Documents/Backups/Typography/PragmataPro:/in -v /mnt/c/Users/ToasterDEV/OneDrive/Documents/Backups/Typography/PragmataProNerdFonts/out:/out nerdfonts/patcher -l -w -c -s --progressbars --careful It oddly seems to have fixed the icons! (albeit a bit smaller than expected, running without the single width switch leads to previous results.) image image

I'm puzzled that having the other fonts installed could have led to issues, but at least I can see the glyphs as expected now without any major setbacks.

Given that (from my understanding) the issue was on Windows' side (OS or Terminal), I'd like to close the issue, though I'm not entirely sure why the proposed solution worked at all, since that the same doesn't happen between Cascadia Code and Caskaydia Cove NF when both are installed at the same time, so I'm open to testing if it's still required.

Otherwise, I guess I'll go ahead and report the bug to the Windows Terminal team, and in the meantime I'd like to thank you for the help!

shogerr commented 2 years ago

Setting antialiasingMode to either grayscale or cleartype in the Windows Terminal settings may change the glyph rendering for you.

If I set antialiasingMode='aliased' I will end up seeing cutoff glyphs in the powerline for oh-my-posh.

Finii commented 2 years ago

I guess this could be haven been fixed by v2.2.2.

kierun commented 1 year ago

Just for information, I have patched PragmataPro as well and this is what I have:

screenshot

and

screenshot-1

I do not see any issues… ¯\_(ツ)_/¯

Finii commented 1 year ago

Thanks for checking. Did you use Windows Terminal?

The problem with these old-ish issues is that some might be because of the font and that has been fixed, but others might be caused by terminal program bugs, that were fixed now.

v2.3.0 brings some scaling changes, I hope that solves more issues. ;-) (of course ;-D )

kierun commented 1 year ago

The font was patched using #bbdb7377df so a little forward of v2.2.2… I guess the fix could be before that.

I did not try on Windows as I mainly use Linux.

It was just a “well, it worked for me…” which can be less than useful. Although, it does show that under my case, it did work, so it's a more tricky bug to find. Hopefully, v2.3.0 fixed it! :grinning:

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.