Giter Club home page Giter Club logo

Comments (9)

acid-bong avatar acid-bong commented on May 27, 2024

God, I'm so dumb. The solution was just to tweak the line height and the glyph offset. Hope it'll help such pedantic folks like me

from victor-mono.

rubjo avatar rubjo commented on May 27, 2024

It’s not dumb. I’ve spent a long time myself adjusting and testing alignment and rendering of various glyphs in various apps and scenarios. Powerline glyphs are surprisingly hard to get 100% perfect in all apps and font sizes, as is evident from many other fonts as well. Glad you found something that works for you.

from victor-mono.

Finii avatar Finii commented on May 27, 2024

Well, there is something peculiar with the vertical metrics. I just look at the ttf variant.

Using font-line [1] these vertical metrics are reported:

Baseline to basline distance: 1550
Including a gap of: 200

$ font-line report ~/Downloads/VictorMono/VictorMonoAll/TTF/VictorMono-Regular.ttf
=== /home/fini/Downloads/VictorMono/VictorMonoAll/TTF/VictorMono-Regular.ttf ===
Version 1.550
SHA1: 9bcd4916de5aaa1692b21673ae73338de3ce4535

::::::::::::::::::::::::::::::::::::::::::::::::::
  Metrics
::::::::::::::::::::::::::::::::::::::::::::::::::
[head] Units per Em:   1100
[head] yMax:           1306
[head] yMin:          -529
[OS/2] CapHeight:      800
[OS/2] xHeight:        618
[OS/2] TypoAscender:   1100
[OS/2] TypoDescender: -250
[OS/2] WinAscent:      1100
[OS/2] WinDescent:     250
[hhea] Ascent:         1100
[hhea] Descent:       -250

[hhea] LineGap:        200
[OS/2] TypoLineGap:    200

::::::::::::::::::::::::::::::::::::::::::::::::::
  Ascent to Descent Calculations
::::::::::::::::::::::::::::::::::::::::::::::::::
[hhea] Ascent to Descent:              1350
[OS/2] TypoAscender to TypoDescender:  1350
[OS/2] WinAscent to WinDescent:        1350

::::::::::::::::::::::::::::::::::::::::::::::::::
  Delta Values
::::::::::::::::::::::::::::::::::::::::::::::::::
[hhea] Ascent to [OS/2] TypoAscender:       0
[hhea] Descent to [OS/2] TypoDescender:     0
[OS/2] WinAscent to [OS/2] TypoAscender:    0
[OS/2] WinDescent to [OS/2] TypoDescender:  0

::::::::::::::::::::::::::::::::::::::::::::::::::
  Baseline to Baseline Distances
::::::::::::::::::::::::::::::::::::::::::::::::::
hhea metrics: 1550
typo metrics: 1550
win metrics:  1550

[OS/2] fsSelection USE_TYPO_METRICS bit set: True

If we look at the Powerline glyph E0B0:

image

The three points are at (-1, 1110); (-1, -340); (600, 385)

That means that the vertical height of that glyph is 1450. The right point is right in the middle ((1110 - 340) / 2 = 385).

So far so good. But 1450 is neither 1550 (baseline to baseline with gap) nor 1350 (pure height without counting gap).
The top seems to be matching if one assumes that the gap is always on the bottom (which it is not, some applications put it on top or half on top and half on bottom):
Ascenders = 1100, Highest point in E0B0 = 1110 (a bit of overlap is always good with Powerline glyphs).
But the Descenders = -250, Lowest point in E0B0 = -340.
a) Thats a bit much for overlap, and it is not symmetric top and bottom.
b) Or a bit too short if we take the gap of 200 into account: Descenders + Gap = -450; Lowest point in E0B0 = -340

There definitively is some design issue. Which is the intended baseline to baseline distance? Does the Powerline glyphs are that same height?

Lets have a magnified look into @acid-bong's image

image

First thing to notice is that the terminal emulator ignores the gap value. If it would respect it the space below the g would be much bigger.

image

As counterexample here Xfct, but the same is true for Gnome Terminal, tilix, kitty - who all respect the gap value.
Notice the different bottom below the branch icon, the bottom of the Poweline triangle, etc. Of course 'normal' apllications as Writer also do respect the gap.

image

Interesting is also the example on the website which shows the font without the gap as very vertically condensed. Is that the intended look? But why then the gap value in the font files?

Powerline glyphs are surprisingly hard to get 100% perfect in all apps and font sizes

Especially if you have a gap in the font instead of distributing that as 'ordinary' space to the ascenders and descenders.

My conclusion is

  • Having a gap makes the baseline to baseline distance application dependent - which is problematic if some glyphs (i.e. the powerline glyphs) have to more or less match the line height.
  • The existing Powerline glyphs are either too tall or too small, depending on the application's choice of 'I ignore the gap'

from victor-mono.

rubjo avatar rubjo commented on May 27, 2024

Thanks for investingating this – these days I don't have the time to look into how this could be fixed and be sure I'm not introducing some other issues. Maybe trying the files from the Google Fonts repo (https://github.com/rubjo/victor-mono-font/releases/tag/v1.561) would help or yield different results for you.

from victor-mono.

Finii avatar Finii commented on May 27, 2024

Ah, thank you for pointing that out. I used the font from the 'main webpage'.

This looks better, the gap has been dropped 🎉

$ font-line report VictorMono-Regular.ttf
=== VictorMono-Regular.ttf ===
Version 1.561; ttfautohint (v1.8.4.7-5d5b);gftools[0.9.30]
SHA1: 77e6eb14adefc7725a46901a36514ff7d774d9a0

::::::::::::::::::::::::::::::::::::::::::::::::::
  Metrics
::::::::::::::::::::::::::::::::::::::::::::::::::
[head] Units per Em:   1000
[head] yMax:           1306
[head] yMin:          -529
[OS/2] CapHeight:      800
[OS/2] xHeight:        618
[OS/2] TypoAscender:   1100
[OS/2] TypoDescender: -250
[OS/2] WinAscent:      1306
[OS/2] WinDescent:     529
[hhea] Ascent:         1100
[hhea] Descent:       -250

[hhea] LineGap:        0
[OS/2] TypoLineGap:    0

::::::::::::::::::::::::::::::::::::::::::::::::::
  Ascent to Descent Calculations
::::::::::::::::::::::::::::::::::::::::::::::::::
[hhea] Ascent to Descent:              1350
[OS/2] TypoAscender to TypoDescender:  1350
[OS/2] WinAscent to WinDescent:        1835

image

The Powerline-triangle's top is at 1110 , the ascenders is 1100, that matches.
The bottom is at -340, the descenders is -250.

You would just need to scale (vertically compress) the glyph , so that the lower point is at (-1, -260) and recenter the right-center point. -260 to have the same overlap of 10 as on the top.

And also the other 3 Powerline glyphs. I guess that is all that would be needed.

from victor-mono.

Finii avatar Finii commented on May 27, 2024

Ah, the gap has been fixed here:

rubjo/victor-mono-font@642f2f2

I could PR adapted Powerline glyphs in that repo maybe, to make it easier for you?

from victor-mono.

rubjo avatar rubjo commented on May 27, 2024

Sure - thanks!

from victor-mono.

Finii avatar Finii commented on May 27, 2024

Will the changes from victor-mono-font be backported here, or is that the new the-real-repo?
What I mean: Which is the reference repo?

I ask because I would otherwise update Nerd Fonts to take the 1.561 font.

Edit:

The victor-mono-font has no Oblique, just Italic 🤔
Will the oblique style be dropped? I can not imagine that. But why is it missing 🤔

from victor-mono.

rubjo avatar rubjo commented on May 27, 2024

A very good question :D The Google Fonts repo was originally made to satisfy their requirements, tests and so on (and the fact that they only accept regular or italic, not regular/oblique/italic, which is something I want to keep for the main repo, seeing as some enjoy the italics, others hate them with a passion). Along with technical requirements that were a result of me just sloppily wanting to draw a font that worked for me and not really knowing much about the process or wanting to consider hundreds of fontbakery issues.

So, now:

  • this repo has the original font in three styles (as well as the web site)
  • the victor-mono-font has a few new glyphs, along with lots of fixes and adjustments on weights, metrics etc to make GF's tests more happy

Provided I find the time, I'll probably backport most of the changes from victor-mono-font to here, but for now, it's probably best if you use https://github.com/rubjo/victor-mono-font/releases/tag/v1.562 for a Nerd Font PR.

from victor-mono.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.