Skip to content
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

Patched Terminess fonts still blurry #1329

Closed
3 tasks done
Slabity opened this issue Aug 1, 2023 · 22 comments · Fixed by #1571
Closed
3 tasks done

Patched Terminess fonts still blurry #1329

Slabity opened this issue Aug 1, 2023 · 22 comments · Fixed by #1571
Milestone

Comments

@Slabity
Copy link

Slabity commented Aug 1, 2023

🗹 Requirements

  • I have searched the issues for my issue and found nothing related and/or helpful
  • I have searched the FAQ for help
  • I have searched the Wiki for help

(Note that there are some older issues reported for this, but are locked for being stale)

🎯 Subject of the issue

Experienced behavior:
Decided to try using the patched Terminess fonts again since #329 was patched, but the font still looks blurry.

Here's a screenshot of the current, patched font at 10px:

image

Expected behavior:

Here's a screenshot of the unpatched font, also at 10px:

image

(Note the size doesn't affect the blurriness, it's blurry at all sizes).

Also, it looks fine when I patch it manually myself (this one is 8px though):

image

Example symbols:
Pretty much all of them.

🔧 Your Setup

  • Which font are you using (e.g. Anonymice Powerline Nerd Font Complete.ttf)?
    • TerminessNerdFont-Regular.ttf
  • Where did you get the file from (download link, self patched, source downloaded from link...)
    • Cloned directly from here
  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)?
    • alacritty, but screenshots are from font-manager
  • Are you using OS X, Linux or Windows? And which specific version or distribution?
    • NixOS, a Linux distribution

★ Screenshots (Optional)

Posted above in behavior sections

@Slabity
Copy link
Author

Slabity commented Aug 1, 2023

I'm mostly creating this issue because I can patch the fonts manually, but I can't seem to figure out how to fix the actual repo to get clean bitmap fonts. I think it might be the same issue as #1174 for AnonymousPro, but I'm not sure what the fix in #1175 actually does to resolve it.

I wouldn't be surprised if a few other bitmap fonts are having the same issue.

@Finii
Copy link
Collaborator

Finii commented Aug 2, 2023

Thanks for reporting. Can you provide the output of the patcher with --debug 2 which will help me see some detail.

I'm mostly creating this issue because I can patch the fonts manually

How do you do that?

The AnonymousPro issue was that we used a font without bitmaps as source, of course there are no bitmaps than in the patched version. Changing to a AnonymousPro-with-bitmaps resulted in a patched AnonymousPro with bitmaps 😬

The unpatched Terminus source we use seems to have bitmaps...:

image

and so does the patched font...:

image

@Slabity
Copy link
Author

Slabity commented Aug 2, 2023

@Finii - Sure, I can replicate this by using the ter-u12n.otb file that came in the terminus-font-4.49.1 package that NixOS provides and just ran nerd-font-patcher ter-u12n.otb without any extra options:

[nix-shell:~]$ cp /nix/store/r3hizlibf6bv79ydaxyd9chfsp1783yl-terminus-font-4.49.1/share/fonts/terminus/ter-u12n.otb .

[nix-shell:~]$ chmod +w ter-u12n.otb

[nix-shell:~]$ nerd-font-patcher ter-u12n.otb
No configfile given, skipping configfile related actions
Nerd Fonts Patcher v2.2.2 (3.0.5) executing

Adding 59 Glyphs from Seti-UI + Custom Set
╢████████████████████████████████████████╟ 100%
Adding 198 Glyphs from Devicons Set
╢████████████████████████████████████████╟ 100%

Done with Patch Sets, generating font...

Changing lowestRecPPEM from 8 to 12

Generated: Terminess Regular Nerd Font in './Terminess Regular Nerd Font.otb'

And the result is this:

image

Note that I have tried playing with my system's fontconfig settings and toggling anti-aliasing and hinting in any combination didn't make it any better.

Maybe the difference is using the TerminessTTF as the base? I could try using that and see what happens.

EDIT: Can't seem to run with that debug option: nerd-font-patcher: error: unrecognized arguments: --debug 2 (same with --debug=2)

@Finii
Copy link
Collaborator

Finii commented Aug 2, 2023

Can't seem to run with that debug option

Your patcher is too old Nerd Fonts Patcher v2.2.2 (3.0.5) executing, current is v3.0.2 (4.4.2).

@Finii
Copy link
Collaborator

Finii commented Aug 2, 2023

I guess (gut feeling) that alacritty uses the outlines in the font if they are available and uses the bitmaps only if there are no outlines? The ttf font does have bitmaps and outlines, the otb is just bitmaps?

@Slabity
Copy link
Author

Slabity commented Aug 2, 2023

Can't seem to run with that debug option

Your patcher is too old Nerd Fonts Patcher v2.2.2 (3.0.5) executing, current is v3.0.2 (4.4.2).

Huh, the fonts themselves are v3.0.2 in NixOS, but not the patcher. That's odd. I'll take a look and try to get the patcher updated for this distro.

I guess (gut feeling) that alacritty uses the outlines in the font if they are available and uses the bitmaps only if there are no outlines? The ttf font does have bitmaps and outlines, the otb is just bitmaps?

The screenshots are actually from font-manager, not alacritty, so it doesn't seem to be just a single program. I'll try again with both TerminessTTF and Terminess Powerline and see if either of those have the same issue. At least, after I update the patcher.

@Slabity
Copy link
Author

Slabity commented Aug 2, 2023

Alright, so apparently we did have 3.0.2 in Nixpkgs, but I mistakenly used an out of date version. Here is the output of the current one:

$ nerd-font-patcher --debug 2 ter-u12n.otb
Nerd Fonts Patcher v3.0.2 (4.4.0) (ff 20230101)
DEBUG: Naming mode 1
DEBUG: Monospace check: Panose says "monospaced"; glyph-width-mono True
DEBUG: Final font cell dimensions 512 w x 1024 h
DEBUG: 150/160 box drawing glyphs will be replaced
Adding 180 Glyphs from Seti-UI + Custom Set
╢████████████████████████████████████████╟ 100%
Adding 6 Glyphs from Heavy Angle Brackets Set
╢████████████████████████████████████████╟ 100%
Adding 160 Glyphs from Box Drawing Set
╢████████████████████████████████████████╟ 100%
Adding 198 Glyphs from Devicons Set
╢████████████████████████████████████████╟ 100%
Done with Patch Sets, generating font...
DEBUG: =====> Family (ID 1)      ok       (19 <=31): Terminess Nerd Font
DEBUG: =====> SubFamily (ID 2)   ok       ( 7 <=31): Regular
DEBUG: =====> Fullname (ID 4)    ok       (19 <=63): Terminess Nerd Font
DEBUG: =====> PSN (ID 6)         ok       (19 <=63): TerminessNF-Regular
DEBUG: Preserving bitmaps (12,)
   Terminess Nerd Font
   \===> 'TerminessNerdFont-Regular.otb'

Oddly enough, now the output seems to be blurry:

image

I do notice that the font sizes are not integer based. For some reason I can only select 8.2, 8.7, 9.2, 9.7, 10.2, etc. Perhaps related? (Note, I can "force" 10px, but doesn't make any difference, still has that slight blur)

The fact that the output of v2.2.2 did not look blurry is also interesting, and perhaps provides a bit more info on what the issue might be?

EDIT: I get the same blurry result when patching TerminusTTF. Here's the debug output:

$ nerd-font-patcher --debug 2 TerminusTTF.ttf
Nerd Fonts Patcher v3.0.2 (4.4.0) (ff 20230101)
DEBUG: Naming mode 1
The glyph named Tcommaaccent is mapped to U+021A.
But its name indicates it should be mapped to U+0162.
The glyph named tcommaaccent is mapped to U+021B.
But its name indicates it should be mapped to U+0163.
The glyph named Delta is mapped to U+0394.
But its name indicates it should be mapped to U+2206.
The glyph named Omega is mapped to U+03A9.
But its name indicates it should be mapped to U+2126.
DEBUG: Monospace check: Panose says "monospaced"; glyph-width-mono True
INFO: Redistributing line gap of 90 (45 top and 45 bottom)
DEBUG: Extended glyphs wider bounding box than basic glyphs
DEBUG: Final font cell dimensions 500 w x 1090 h
DEBUG: 150/160 box drawing glyphs will be replaced
Adding 180 Glyphs from Seti-UI + Custom Set
╢████████████████████████████████████████╟ 100%
Adding 6 Glyphs from Heavy Angle Brackets Set
╢████████████████████████████████████████╟ 100%
Adding 160 Glyphs from Box Drawing Set
╢████████████████████████████████████████╟ 100%
Adding 198 Glyphs from Devicons Set
╢████████████████████████████████████████╟ 100%
Done with Patch Sets, generating font...
DEBUG: =====> Family (ID 1)      ok       (19 <=31): Terminess Nerd Font
DEBUG: =====> SubFamily (ID 2)   ok       ( 7 <=31): Regular
DEBUG: =====> Fullname (ID 4)    ok       (19 <=63): Terminess Nerd Font
DEBUG: =====> PSN (ID 6)         ok       (11 <=63): TerminessNF
DEBUG: Preserving bitmaps (12, 14, 16, 18, 20, 22, 24, 28, 32)
DEBUG: Tweaking 1/1
   Terminess Nerd Font
   \===> 'TerminessNerdFont-Regular.ttf'

Let me know if you'd like any other information or anything I should try.

@Finii
Copy link
Collaborator

Finii commented Aug 2, 2023

Thanks for the investigation!

I do notice that the font sizes are not integer based. For some reason I can only select 8.2, 8.7, 9.2, 9.7, 10.2, etc

That is, in font manager? Which font-manager is it, I believe there are multiple different almost same-named ones ;-)

I must confess I personally never use bitmap fonts and my knowledge about bitmap fonts is centuries old (i.e. before ttf and / or when X was more or less bitmap fonts only). But I will try to find something out. In the light of the changed selectable sizes I fear it might be fontforge has yet another bug.

@Finii
Copy link
Collaborator

Finii commented Aug 2, 2023

Hmm, looks similar but slightly different 😬

image

Edit:

Ahh, dark theme...

image

@Slabity
Copy link
Author

Slabity commented Aug 2, 2023

The font-manager package in Nixpkgs appears to be version 0.8.8 of FontManager/font-manager. I think all of those screenshots might be the same app with different themes. I'm specifically using arc-dark, while the two you have might be the default light and dark themes.

Though I can confirm the same result in alacritty as well, so it's not just the GTK applications. Here's the two versions side-by-side:

image

There's a difference in both the characters and the spacing from the looks of it. I'm not certain both font-manager and alacritty use the same font-rendering backend, but if you know of another app I should try I can do that as well.

EDIT: Also, just in case it might have been an issue with the nerdfonts package in Nixpkgs, I can also confirm the blurriness exists on the patched font directly from the Git repo itself.

@Slabity
Copy link
Author

Slabity commented Aug 2, 2023

Just to add another datapoint for a different font renderer, here is Firefox rendering the different versions of the font. Only the Nerd Fonts version has the blur:

image

Not sure what other apps I can use to see if it's a rendering issue or not. Unfortunately my knowledge of how fonts, font rendering, and how the font patcher works is next to nothing.

@herself
Copy link

herself commented Dec 6, 2023

Found this issue while having the same exact problem as OP, managed to figure a workaround. I'll post it in case someone else stumbles here:

  • Get font patcher
  • Get the latest Terminus TTF for Windows (non-Windows version produces the same effect as above) from https://files.ax86.net/terminus-ttf/
  • Patch that TTF
  • ????
  • Profit

2023-12-06-010411

Had to change the font.offset.y to -2 in Alacritty to achieve the same effect and adjust the exact font size according to the table below, but at this point I'm just glad it works 😸

    12 px or 9 pt
    14 px or 10.5 pt
    16 px or 12 pt
    18 px or 13.5 pt
    20 px or 15 pt
    22 px or 16.5 pt
    24 px or 18 pt
    28 px or 21 pt
    32 px or 24 pt

@Finii Finii added this to the v3.2.0 milestone Dec 6, 2023
@Finii
Copy link
Collaborator

Finii commented Dec 6, 2023

Thanks for the feedback @herself I will look into it before 3.2.

Finii added a commit that referenced this issue Mar 30, 2024
[why]
The outlines in Terminus 4.49.2 are rather weird. Autoconverted but not
too nice.

[how]
Update to 4.49.3 as tis has much better outlines.

Fixes: #1329

Suggested-by: Wiesław Herr @herself
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii mentioned this issue Mar 30, 2024
2 tasks
Finii added a commit that referenced this issue Mar 30, 2024
[why]
The outlines in Terminus 4.49.2 are rather weird. Autoconverted but not
too nice.

[how]
Update to 4.49.3 as tis has much better outlines.

Fixes: #1329

Suggested-by: Wiesław Herr @herself
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator

Finii commented Mar 30, 2024

@allcontributors please add @Slabity for bug

Copy link
Contributor

@Finii

I've put up a pull request to add @Slabity! 🎉

@Finii
Copy link
Collaborator

Finii commented Mar 30, 2024

In fact I do not really know if that solves @Slabity blurryness problem.
At least the outlines are broken in the version we had.

It can also be a hinting problem, if the embedded bitmaps are not used.
Ah, yes, the font seems to be unhinted:

image

If your problem persists I can try and throw ttfautohint unto the font, and then you can try that font.
Please let me know :-)

@Finii
Copy link
Collaborator

Finii commented Mar 30, 2024

Ah yes...

image

Hmm, but ... of course the original also has no hints, so that should not be the problem.
Maybe the bitmap part of the font is still broken.
And/or the renderer switches to outlines if not all glyphs are available as bitmaps.
My knowledge of bitmap fonts is not very good (next to nonexisting)

You use alacritty, I guess I have that installed (i.e. have it self-built somewhere, lets see)

image

testing

On my machine even the unpatched font is unsharp in alacritty:

image

Interestingly alacritty ignores the system wide hinting and antialiasing setting. Turned off everything system wide, see how bad the window titles and tilix text window looks now, but alacritty does what it wants 🙄

image

tbc

@Finii
Copy link
Collaborator

Finii commented Mar 30, 2024

Alacritty seems to have 'a problem' when a font is not all-bitmaps it will switch to LCD subpixel rendering and there is no way to prevent that?

See for example

Maybe they fixed it in the meantime, but not having an option to influence antialiasing (subpixel rendering) is a strange choice.

If this is the problem we can not do anything about it. You can patch your alacritty source like described in the linked Issue, to turn the unwanted antialiasing off and get sharp glyphs back. If that works at all.

I guess bitmap fonts and patching just does not blend very well.

hasecilu pushed a commit to hasecilu/nerd-fonts that referenced this issue Apr 3, 2024
[why]
The outlines in Terminus 4.49.2 are rather weird. Autoconverted but not
too nice.

[how]
Update to 4.49.3 as tis has much better outlines.

Fixes: ryanoasis#1329

Suggested-by: Wiesław Herr @herself
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Slabity
Copy link
Author

Slabity commented Jun 13, 2024

@Finii - I don't think this is fixed. I'm seeing the same results on v3.2.1

@rck
Copy link

rck commented Sep 12, 2024

@Finii I also think this isn't fixed in v3.2.1. Noticed it on alacritty, but I see the same in Gnome "console" in NixOS

@misuzu
Copy link

misuzu commented Sep 12, 2024

Here's Terminus vs Terminess Nerd Font (3.2.1) on NixOS:
2024-09-12-174522_1278x710_scrot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants