Open hpjansson opened 5 years ago
I was always ignoring that error message but nothing went wrong actually.
Maybe I should write a PCF font exporter instead of using fontforge?
PCF would be nice. I don't know how much work it is, though. It might be possible to do bitmap embeddings in TTF too.
The problem I'm seeing right now is that VTE puts vertical space between the characters, and mlterm adds horizontal space for some reason. So maybe the font dimensions/kerning is underspecified somehow.
I had to do this:
diff --git a/tools/fontgen/chafa8x8.py b/tools/fontgen/chafa8x8.py
index 2905f30..344499e 100755
--- a/tools/fontgen/chafa8x8.py
+++ b/tools/fontgen/chafa8x8.py
@@ -293,8 +293,6 @@ def mainGenFont(argv: List[str]):
glyph.importOutlines('chafa8x8_svg/%d.svg' % i)
glyph.left_side_bearing = 0
glyph.right_side_bearing = 0
- glyph.width = 0
- glyph.vwidth = 0
# font.save('chafa8x8.sfd')
font.generate(ag.ttf)
font.close()
to make the font loader work correctly. Otherwise it gets the glyph x size wrong. I don't know why it's there, though.
I had to do this:
diff --git a/tools/fontgen/chafa8x8.py b/tools/fontgen/chafa8x8.py index 2905f30..344499e 100755 --- a/tools/fontgen/chafa8x8.py +++ b/tools/fontgen/chafa8x8.py @@ -293,8 +293,6 @@ def mainGenFont(argv: List[str]): glyph.importOutlines('chafa8x8_svg/%d.svg' % i) glyph.left_side_bearing = 0 glyph.right_side_bearing = 0 - glyph.width = 0 - glyph.vwidth = 0 # font.save('chafa8x8.sfd') font.generate(ag.ttf) font.close()
to make the font loader work correctly. Otherwise it gets the glyph x size wrong. I don't know why it's there, though.
Me neither -- I've forgotten the reason why the width is set as 0. But I remember back at that time I had a difficult time working around the character kerning/spacing issue in different terminals. They must be some workarounds that worked for the issue at that time.
Just for record. The above weird zero width issue is fixed in https://github.com/hpjansson/chafa/commit/e1e9f723acbbe2b6460469b1ce9e976f9d20752c That is a temporary hack to mitigate vertical/horizontal gaps in VTE terminals. We can improve it in the future.
Fwiw i find bdf format convenient, allows text editing. And converting to pcf with xfonts-utils: /usr/bin/bdftopcf
The BDF font writer is here: https://github.com/hpjansson/chafa/commit/48f57019fd56e21e5cbdec91e7f95af3c5779649 But it seems that Unicode support range is an issue:
$ bdftopcf -o chafa8x8.pcf chafa8x8.bdf
[...]
BDF Error on line 105340: char 'U+0x101075' has encoding too large (1052789)
BDF Error on line 105365: char 'U+0x101076' has encoding too large (1052790)
BDF Error on line 105390: char 'U+0x101077' has encoding too large (1052791)
BDF Error on line 105415: char 'U+0x101078' has encoding too large (1052792)
BDF Error on line 105440: char 'U+0x101079' has encoding too large (1052793)
BDF Warning on line 105463: No characters with valid encodings
Fontforge can correctly read the resulting file. But the 0x100000
range is not supported for this format...
Could one of the lower PUA ranges work?
@cdluminate
This is probably not a showstopper, but may be worth looking into anyway:
When I run
chafa8x8.py GenA
, it prints the following:The last one looks like an error message from fontforge. The resulting TTF seems ok from a quick look with ttfdump, though, so it's likely mostly cosmetic.