Italic fonts are not fully drawn? #207

Closed
opened 2 years ago by tyang · 4 comments
tyang commented 2 years ago

Hey, thanks for your work, this tool is amazing.

It seems Italic fonts are not fully drawn on my linux box, there are some screenshots, editting foor.ini with emacs:

  1. foot (please not he top right corner of "COLSxROWS")
  2. alacritty (works fine)
  3. emacs gui (works fine)

I'm using Monego font (https://github.com/cseelus/monego).

I'm confused, could you please help me?

Thanks.

Hey, thanks for your work, this tool is amazing. It seems Italic fonts are not fully drawn on my linux box, there are some screenshots, editting foor.ini with emacs: 1. foot (please not he top right corner of "COLSxROWS") 2. alacritty (works fine) 3. emacs gui (works fine) I'm using Monego font (https://github.com/cseelus/monego). I'm confused, could you please help me? Thanks.
Owner

It looks like the italic glyphs are wider than the regular glyphs, causing foot to crop them.

Foot, unlike Alacritty, doesn't allow glyphs to overlap, or bleed into neighbouring cells. See #21 for a description of why this is done.

Alacritty does let glyphs overlap. While this may sound like a good idea at first, it does lead to issues like https://github.com/alacritty/alacritty/issues/118 ;)

Emacs GUI isn't a grid-based application in the same sense a terminal emulator is, and can probably render things differently.

You can verify if this is the case by starting foot from another terminal and watch the log output. You'll see something like:

info: terminal.c:626: cell width=7, height=15

Then, configure foot to use the italic version as the primary font (i.e. all text will be italic), and again watch the log output. If the cell dimensions are different, then the font isn't really monospaced.

If they are the same, then it could be that the font designer expects programs to calculate e.g. letter spacing differently, and we can try to look into that.

It looks like the italic glyphs are wider than the regular glyphs, causing foot to crop them. Foot, unlike Alacritty, doesn't allow glyphs to overlap, or bleed into neighbouring cells. See https://codeberg.org/dnkl/foot/issues/21#issuecomment-58770 for a description of _why_ this is done. Alacritty _does_ let glyphs overlap. While this may sound like a good idea at first, it does lead to issues like https://github.com/alacritty/alacritty/issues/118 ;) Emacs GUI isn't a grid-based application in the same sense a terminal emulator is, and can probably render things differently. You can verify if this is the case by starting foot from another terminal and watch the log output. You'll see something like: ``` info: terminal.c:626: cell width=7, height=15 ``` Then, configure foot to use the _italic_ version as the **primary** font (i.e. **all** text will be italic), and again watch the log output. If the cell dimensions are different, then the font isn't really monospaced. If they **are** the same, then it could be that the font designer expects programs to calculate e.g. letter spacing differently, and we can try to look into that.
Poster

Thanks for your information, it seems height & width of cell are the same, here are detailed output:

info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Regular.otf: size=22.00pt/29px, dpi=96.00
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Bold.otf: size=22.00pt/29px, dpi=96.00
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-BoldItalic.otf: size=22.00pt/29px, dpi=96.00
info: terminal.c:626: cell width=17, height=39
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00
info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00
info: terminal.c:626: cell width=17, height=39

If there are anything I can help, please let me know.

Thanks for your information, it seems height & width of cell are the same, here are detailed output: ``` info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Regular.otf: size=22.00pt/29px, dpi=96.00 info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Bold.otf: size=22.00pt/29px, dpi=96.00 info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00 info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-BoldItalic.otf: size=22.00pt/29px, dpi=96.00 info: terminal.c:626: cell width=17, height=39 ``` ``` info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00 info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00 info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00 info: fcft.c:675: /home/arthas/.local/share/fonts/Monego-Italic.otf: size=22.00pt/29px, dpi=96.00 info: terminal.c:626: cell width=17, height=39 ``` If there are anything I can help, please let me know.
Owner

I instrumented fcft to log metrics for individual glyphs. Here is the result:

Regular: all glyphs fit within the 'advance' width
info: fcft.c:696: /usr/share/fonts/monego/Monego-Regular.otf: size=22.00pt/28px, dpi=91.88
info: fcft.c:680: 'A': advance=17, bitmap width: 17, c-offset=0
info: fcft.c:680: 'M': advance=17, bitmap width: 17, c-offset=0
info: fcft.c:680: 'W': advance=17, bitmap width: 17, c-offset=0
info: fcft.c:680: '#': advance=17, bitmap width: 16, c-offset=0
info: fcft.c:680: 'f': advance=17, bitmap width: 14, c-offset=2

Bold: also looks ok
info: fcft.c:696: /usr/share/fonts/monego/Monego-Bold.otf: size=22.00pt/28px, dpi=91.88
info: fcft.c:680: 'A': advance=17, bitmap width: 18, c-offset=-1
info: fcft.c:680: 'M': advance=17, bitmap width: 16, c-offset=0
info: fcft.c:680: 'W': advance=17, bitmap width: 18, c-offset=-1
info: fcft.c:680: '#': advance=17, bitmap width: 16, c-offset=0
info: fcft.c:680: 'f': advance=17, bitmap width: 15, c-offset=1

Italic: too wide! Either because glyphs is too wide, or because its offset makes it too wide
info: fcft.c:696: /usr/share/fonts/monego/Monego-Italic.otf: size=22.00pt/28px, dpi=91.88
info: fcft.c:680: 'A': advance=17, bitmap width: 17, c-offset=0
info: fcft.c:680: 'M': advance=17, bitmap width: 21, c-offset=0
info: fcft.c:680: 'W': advance=17, bitmap width: 19, c-offset=2
info: fcft.c:680: '#': advance=17, bitmap width: 19, c-offset=1
info: fcft.c:680: 'f': advance=17, bitmap width: 17, c-offset=4

Bold+italic: too wide! And this one is even worse than the plain italic version
info: fcft.c:696: /usr/share/fonts/monego/Monego-BoldItalic.otf: size=22.00pt/28px, dpi=91.88
info: fcft.c:680: 'A': advance=17, bitmap width: 18, c-offset=-1
info: fcft.c:680: 'M': advance=17, bitmap width: 22, c-offset=0
info: fcft.c:680: 'W': advance=17, bitmap width: 20, c-offset=2
info: fcft.c:680: '#': advance=17, bitmap width: 20, c-offset=1
info: fcft.c:680: 'f': advance=17, bitmap width: 17, c-offset=6
  • "advance" is the same as the cell width.
  • bitmap width is actual width of the glyph
  • offset is how much the glyph is offseted from the current "pen" position when rendered.

What this tells us is that the characters from the regular font play nice; they all stay within the cell size.

Bolds also look mostly ok.

But the italics are bad. Several of the characters are much wider than a cell. This means they'll "flow" into the next character.

This font may be fine to use in a graphical editor, but most terminal emulators will struggle with it. I have some screenshots that shows various emulators dealing with it. While alacritty looks best, it too doesn't completely handle it.

In short: there isn't much we can do about it.

I instrumented fcft to log metrics for individual glyphs. Here is the result: ``` Regular: all glyphs fit within the 'advance' width info: fcft.c:696: /usr/share/fonts/monego/Monego-Regular.otf: size=22.00pt/28px, dpi=91.88 info: fcft.c:680: 'A': advance=17, bitmap width: 17, c-offset=0 info: fcft.c:680: 'M': advance=17, bitmap width: 17, c-offset=0 info: fcft.c:680: 'W': advance=17, bitmap width: 17, c-offset=0 info: fcft.c:680: '#': advance=17, bitmap width: 16, c-offset=0 info: fcft.c:680: 'f': advance=17, bitmap width: 14, c-offset=2 Bold: also looks ok info: fcft.c:696: /usr/share/fonts/monego/Monego-Bold.otf: size=22.00pt/28px, dpi=91.88 info: fcft.c:680: 'A': advance=17, bitmap width: 18, c-offset=-1 info: fcft.c:680: 'M': advance=17, bitmap width: 16, c-offset=0 info: fcft.c:680: 'W': advance=17, bitmap width: 18, c-offset=-1 info: fcft.c:680: '#': advance=17, bitmap width: 16, c-offset=0 info: fcft.c:680: 'f': advance=17, bitmap width: 15, c-offset=1 Italic: too wide! Either because glyphs is too wide, or because its offset makes it too wide info: fcft.c:696: /usr/share/fonts/monego/Monego-Italic.otf: size=22.00pt/28px, dpi=91.88 info: fcft.c:680: 'A': advance=17, bitmap width: 17, c-offset=0 info: fcft.c:680: 'M': advance=17, bitmap width: 21, c-offset=0 info: fcft.c:680: 'W': advance=17, bitmap width: 19, c-offset=2 info: fcft.c:680: '#': advance=17, bitmap width: 19, c-offset=1 info: fcft.c:680: 'f': advance=17, bitmap width: 17, c-offset=4 Bold+italic: too wide! And this one is even worse than the plain italic version info: fcft.c:696: /usr/share/fonts/monego/Monego-BoldItalic.otf: size=22.00pt/28px, dpi=91.88 info: fcft.c:680: 'A': advance=17, bitmap width: 18, c-offset=-1 info: fcft.c:680: 'M': advance=17, bitmap width: 22, c-offset=0 info: fcft.c:680: 'W': advance=17, bitmap width: 20, c-offset=2 info: fcft.c:680: '#': advance=17, bitmap width: 20, c-offset=1 info: fcft.c:680: 'f': advance=17, bitmap width: 17, c-offset=6 ``` * "advance" is the same as the cell width. * bitmap width is actual width of the glyph * offset is how much the glyph is offseted from the current "pen" position when rendered. What this tells us is that the characters from the regular font play nice; they all stay within the cell size. Bolds also look mostly ok. But the italics are bad. Several of the characters are **much** wider than a cell. This means they'll "flow" into the next character. This font may be fine to use in a graphical editor, but most terminal emulators will struggle with it. I have some screenshots that shows various emulators dealing with it. While alacritty looks best, it too doesn't completely handle it. In short: there isn't much we can do about it.
Poster

I see, thanks for your investigation.

I've been using Monaco/Monego font for a long time, maybe it's time to pick a new one.

Thanks again, please feel free to close it.

I see, thanks for your investigation. I've been using Monaco/Monego font for a long time, maybe it's time to pick a new one. Thanks again, please feel free to close it.
dnkl closed this issue 2 years ago
dnkl added the
wontfix
label 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.