Summary: | x11-apps/fonttosfnt: fonts spacing issues | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Alexander Tsoy <alexander> |
Component: | Current packages | Assignee: | Gentoo X packagers <x11> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | slyfox |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://gitlab.freedesktop.org/xorg/app/fonttosfnt/-/merge_requests/7 | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=717206 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
bad.png
good.png terminus-font-4.48-r1.ebuild.patch |
Description
Alexander Tsoy
2020-06-15 01:23:10 UTC
Created attachment 644766 [details]
bad.png
Created attachment 644768 [details]
good.png
This is after applying patches from MR and rebuilding terminus-font.
Forgot to add that this is with font size 12. Other sizes may not be affected. https://bugzilla.redhat.com/show_bug.cgi?id=1753295#c92 Also https://gitlab.gnome.org/GNOME/pango/-/issues/386#note_567758 coaims something was fixed in cairo master. Don't know if gentoo/upstream has it in 1.16.0. I also asked Dimitar (Terminus fonts author) over email if it's expected for Terminus to have artifacts like that in a way we convert terminus. Tl;DR: yes, it's expected and we can somewhat improve our conversion logic. Pasting Dimitar's explanation: """ ... > Linux GUI font rendering libraries like pango are moving away from > freetype to harfbuzz. One of the side-effects is that pango stops > loading bitmap fonts in non-OpenType format: > https://gitlab.gnome.org/GNOME/pango/-/issues/386 > https://bugzilla.redhat.com/show_bug.cgi?id=1753295 [...] What is even worse, Pango 1.44 now returns floating point ascent and descent, instead of integer. The functions were always returning float, all right... but so far, without a fractional part. Which makes problems too, for example in Scintilla based editors such as SciTE and Geany (there is a quick and dirty fix). [...] > Currently Gentoo follows Fedora's suggestion and converts BDF to > OpenType as: > $ fonttosfnt -v -b -c -g 2 -m 2 -o Terminus.otb ter-u*n.bdf > $ fonttosfnt -v -b -c -g 2 -m 2 -o Terminus-Bold.otb ter-u*b.bdf > Done in https://bugs.gentoo.org/717206 > Fedora's suggestion: https://fedoraproject.org/wiki/BitmapFontConversion#Steps > > People report that fonttosfnt does not do a perfect job at that > and introduces unexpected spacing in some applications (gvim?): > https://bugs.gentoo.org/728308 1. fonttosfnt adds 0.5 to at least the logical (OpenType-scaled) character width, ascent and height. Haven't checked the physical (pixel) metrics yet. With some sizes/applications, the fonttosfnt converted fonts do indeed have extra wrong spacing, 1 pixel horizontal or vertical. It has other bugs too, but they don't seem important. 2. If you pack 2+ terminus sizes into a single .otb font file, KDE will (may? YMMV) use *only the first size*. 3. OTB has a single set of logical metrics. So, for example, the logical character width (which is relative to height) can never be correct for an .otb file including both 8x14 and 8x16. [...] > I'm not sure if it's an effect of application/harfbuzz bug (or > user misconfiguration, like extra hinting). fonttosfnt bug(s) plus Pango returning floating point metrics. [...] > Q 2. Would it be feasible for terminus package to also provide fonts in > OpenType format? (Worth adding to the F.A.Q?) Well I'll have to release OTB-s sooner or later. So yes. > Q 3. What is the best way to convert terminus to OpenType container > format today? Does 'fonttosfnt' do something sensible? [...] For each source file: fontforge -lang=ff -c "Open($1); ScaleToEm(1024); Generate($2)" source.bdf target.otb 1024 may or may not avoid Pango fractioning, don't know for sure. But it should be better that the default EM-s of FontForge (1000) and fonttosfnt (2048). For (non-terminus) Italic/Oblique fonts, insert "SetItalicAngle(...);" after ScaleToEm. """ I'll try the 'fontforge' conversion suggested by Dimitar on terminus. Quite a heavyweight dependency. Let's see if it gets better. (In reply to Sergei Trofimovich from comment #5) > 1. fonttosfnt adds 0.5 to at least the logical (OpenType-scaled) > character width, ascent and height. Haven't checked the physical (pixel) > metrics yet. With some sizes/applications, the fonttosfnt converted > fonts do indeed have extra wrong spacing, 1 pixel horizontal or > vertical. It has other bugs too, but they don't seem important. This should be fixed by the MR I mentioned in comment 0 The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=98a92c85d431a70f660f9dbd43b148e7c2afae2f commit 98a92c85d431a70f660f9dbd43b148e7c2afae2f Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-06-15 22:03:31 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-06-15 22:04:44 +0000 media-fonts/terminus-font: use fontforge for rescaling We tackle a few issues at once here: 1. Avoid 'fonttosfnt' when converting to .otb and use fontforge instead. 2. Use one .otb file per font 3. Attempt to avoid Pango's fractioning by using 1024 em Reported-by: Alexander Tsoy Bug: https://bugs.gentoo.org/728308 Package-Manager: Portage-2.3.101, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> .../terminus-font/terminus-font-4.48-r2.ebuild | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) (In reply to Larry the Git Cow from comment #7) > The bug has been referenced in the following commit(s): > > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > ?id=98a92c85d431a70f660f9dbd43b148e7c2afae2f > > commit 98a92c85d431a70f660f9dbd43b148e7c2afae2f > Author: Sergei Trofimovich <slyfox@gentoo.org> > AuthorDate: 2020-06-15 22:03:31 +0000 > Commit: Sergei Trofimovich <slyfox@gentoo.org> > CommitDate: 2020-06-15 22:04:44 +0000 > > media-fonts/terminus-font: use fontforge for rescaling > > We tackle a few issues at once here: > > 1. Avoid 'fonttosfnt' when converting to .otb and use fontforge instead. > 2. Use one .otb file per font > 3. Attempt to avoid Pango's fractioning by using 1024 em > > Reported-by: Alexander Tsoy > Bug: https://bugs.gentoo.org/728308 > Package-Manager: Portage-2.3.101, Repoman-2.3.22 > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> > > .../terminus-font/terminus-font-4.48-r2.ebuild | 128 Alexander, can you give 4.48-r2 a try? I wonder if it changes anything for you. Created attachment 644936 [details]
terminus-font-4.48-r1.ebuild.patch
Attached patch fixed the issue for me.
(In reply to Sergei Trofimovich from comment #8) > Alexander, can you give 4.48-r2 a try? I wonder if it changes anything for > you. Ooops, I missed new replies in this bug. =/ I'll give it a try shortly, (In reply to Alexander Tsoy from comment #9) > Created attachment 644936 [details] > terminus-font-4.48-r1.ebuild.patch > > Attached patch fixed the issue for me. But it still needs patched fonttosfnt, of course. (In reply to Sergei Trofimovich from comment #8) > Alexander, can you give 4.48-r2 a try? I wonder if it changes anything for > you. It works for me. Thanks! Should be in x11-apps/fonttosfnt-1.2.0. |