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
54.68k stars 3.65k forks source link

Misalignment of Powerline Glyphs for Code New Roman Font Family #296

Closed icp1994 closed 1 year ago

icp1994 commented 6 years ago

๐Ÿ—น Requirements

๐ŸŽฏ Subject of the issue

I have tried both the variations - double-width and single-width - but the glyph in the prompt seems to be out of alignment (image below for reference) . I don't have the issue with other patched fonts like Fantasque Sans Mono or Mononoki etc. I have also tried two different emulators (termite and alacritty) just to be sure. I didn't manually patch any of the fonts, just curl-ed them from the repo.

๐Ÿ”ง Your Setup

โ˜… Optional

2cusjqe

ylmrx commented 5 years ago

I'm having the same problem here. Sad, because it's the best looking font at most size (just my tastes).

ryanoasis commented 5 years ago

@icp1994 thanks for the report. Powerline characters are notorious for aligning

KTibow commented 2 years ago

Is this a dead repo? I'm experiencing the same thing 3 years later (Ubuntu, default terminal, Caskaydia Cove).

Finii commented 2 years ago

@KTibow Well, this is fixed (at least for Caskaydia (*)) with #593. I guess it will be merged soon :grimacing:, won't it @ryanoasis?

The change is very small; if you can self-patch, maybe that is an option. Otherwise if you are solely interested in a patched Cascadia Code, there is https://github.com/adam7/delugia-code (which uses Nerd Font's font-patcher with #593 applied).

(*) I do not mention Code New Roman in the PR, not sure it would fix that, it certainly looks similar, but maybe the metrics in the source font are not right.

KTibow commented 2 years ago

The original PL variant and Delugia seem to work better, other than one weird thing: The font size can create misalignment. Here's what Delugia PL/Cascadia Code PL looks like at 12: image But at 10, I can see some misalignment (zoom in on the rounded corners): image

(On Gnome Terminal on Ubuntu)

Finii commented 2 years ago

Ubu, gnome terminal (i guess) Will check that. Probably rounding error.

ryanoasis commented 2 years ago

Is this a dead repo?

No. Are you asking because of the number of unresolved issues?

I'm experiencing the same thing 3 years later (Ubuntu, default terminal, Caskaydia Cove). @KTibow Well, this is fixed (at least for Caskaydia (*)) with #593

Yeah, I believe for at least Caskaydia this may/probably be fixed with you with the latest changes in master now.

I guess it will be merged soon grimacing, won't it @ryanoasis?

Merged!

(*) I do not mention Code New Roman in the PR, not sure it would fix that, it certainly looks similar, but maybe the metrics in the source font are not right.

Just tested this out and yeah it does not seem to make any improvement on that font in particular, as expected.

KTibow commented 2 years ago

I was just asking given the date the issue was opened. Anyway, it's fixed now (in cascadia code).

ryanoasis commented 2 years ago

@KTibow okay great, sure.

This issue should remain open unfortunately, as Code New Roman problem still exists.

Finii commented 2 years ago

The fix just honors the 'we have correct metrics' flag that fonts can set.

Code New Roman does not set it: image

So what we use is the guestimate mechanism. This needs some deeper dive into it. We could of course add an option to the config files, but that would not fix it for ad-hoc font-patcher use.

Need to punch in the numbers in a calculator and see why the guestimate is wrong.

Finii commented 2 years ago

Patched font: image

There is kind of a problem with the font - already in the sourcefont - that some letters are higher than the bounding box. Here in the example the รœ protrudes into the line above. The guesstimate accordingly centers the triangular stuff around that - too high - letters-space.

image

Finii commented 2 years ago

Ah, font patcher has an option for these fonts:

image

It's all good if you specify -l:

parser.add_argument('-l', '--adjust-line-height', [...]
help='Whether to adjust line heights (attempt to center powerline separators more evenly)')

It forces the WIN values (1884, -514) into HHEA (1521, -572, gap 350) but leaves the TYPO untouched? And removes the gap, of course.... image

There are several ways out of this... which need 'political' decisions :-D

Finii commented 2 years ago

Maybe @ryanoasis can remember why this is not the default.

a610ef8770ddfd Adds flag for adjusting line height (not by default)

Other related commits are

Switches from hhea to win :sob:: fec7b20 Various improvements for mono-space generation

Sets hhea-gap to zero: 9770856 Zero out linegap values to allow power line glyphs to fill properly

Here is a list of all Code New Roman glyphs in the 'base range' that protrude out of the hhea/typo ascent-descent range. They all protrude to the top (not bottom as assumed in 9770856).

I have no application that shows the original Code New Roman in a correct way (i.e. A-ring ร…within the allotted space), is there an application on Windows that (still) uses win instead of typo values?

Name            bb ymin  bb ymax
--------------------------------
Oslash             -215    1522
napostrophe           0    1559
Amacron               0    1616
Emacron               0    1616
Imacron               0    1616
Omacron             -18    1616
Umacron             -18    1616
bar                -410    1638
brokenbar          -410    1638
Aacute                0    1659
Acircumflex           0    1659
Adieresis             0    1659
Agrave                0    1659
Cacute              -16    1659
Ccaron              -16    1659
Ccircumflex         -16    1659
Dcaron                0    1659
Eacute                0    1659
Ecaron                0    1659
Ecircumflex           0    1659
Edieresis             0    1659
Egrave                0    1659
Gcircumflex         -18    1659
Hcircumflex           0    1659
Iacute                0    1659
Icircumflex           0    1659
Idieresis             0    1659
Igrave                0    1659
Jcircumflex           0    1659
Lacute                0    1659
Nacute                0    1659
Ncaron                0    1659
Oacute              -18    1659
Ocircumflex         -18    1659
Odieresis           -18    1659
Ograve              -18    1659
Ohungarumlaut       -18    1659
Racute                0    1659
Rcaron                0    1659
Sacute              -18    1659
Scaron              -18    1659
Scircumflex         -18    1659
Tcaron                0    1659
Uacute              -18    1659
Ucircumflex         -18    1659
Udieresis           -18    1659
Ugrave              -18    1659
Uhungarumlaut       -18    1659
Wcircumflex           0    1659
Yacute                0    1659
Ycircumflex           0    1659
Ydieresis             0    1659
Zacute                0    1659
Zcaron                0    1659
Abreve                0    1665
Ebreve                0    1665
Gbreve              -18    1665
Ibreve                0    1665
Obreve              -18    1665
Ubreve              -18    1665
Atilde                0    1671
Itilde                0    1671
Ntilde                0    1671
Otilde              -18    1671
Utilde              -18    1671
Cdotaccent          -16    1679
Edotaccent            0    1679
Gdotaccent          -18    1679
Idotaccent            0    1679
Zdotaccent            0    1679
hcircumflex           0    1710
lacute               -6    1720
Aring                 0    1740
Uring               -18    1740
Finii commented 1 year ago

Fixed via

(and some following fixups)

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.