Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 717206 - media-fonts/terminus-font: OpenType bitmap font format
Summary: media-fonts/terminus-font: OpenType bitmap font format
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Fonts Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-04-12 10:19 UTC by Sergey 'L29Ah' Alirzaev
Modified: 2020-06-15 07:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
terminus-font-4.48.otb.patch (terminus-font-4.48.otb.patch,2.49 KB, patch)
2020-05-12 22:07 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey 'L29Ah' Alirzaev 2020-04-12 10:19:08 UTC
Since pango dropped support for non-opentype bitmap fonts <https://gitlab.gnome.org/GNOME/pango/issues/386>, and terminus-font is PCF, it should be converted to be able to continue using it in pango apps. <https://fedoraproject.org/wiki/BitmapFontConversion#Steps> has a guide on doing it for terminus, so i think an USE flag would be nice.

Reproducible: Always
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-12 22:07:11 UTC
It appears to be very easy:

--- terminus-font-4.48.ebuild	2020-05-12 22:58:31.000000000 +0100
+++ terminus-font-4.48-r1.ebuild	2020-05-12 22:58:31.000000000 +0100
@@ -3,3 +3,3 @@

-EAPI=6
+EAPI=7

@@ -14,4 +14,4 @@
 SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
-IUSE="a-like-o +center-tilde distinct-l +pcf +pcf-unicode-only +psf quote
+KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
+IUSE="a-like-o +center-tilde distinct-l otf +pcf +pcf-unicode-only +psf quote
 	ru-dv +ru-g ru-i ru-k"
@@ -21,2 +21,3 @@
 	virtual/awk
+	otf? ( x11-apps/fonttosfnt )
 	pcf? ( x11-apps/bdftopcf )"
@@ -68,2 +69,10 @@
 	[[ ${#args[@]} -gt 0 ]] && emake "${args[@]}"
+
+	# Follow https://fedoraproject.org/wiki/BitmapFontConversion#Steps:
+	# build ".otf" (bitmap-only) fonts out of .bdf ones
+	if use otf; then
+			# use unicode only bitmaps
+			fonttosfnt -v -b -c -g 2 -m 2 -o Terminus.otb      ter-u*n.bdf || die
+			fonttosfnt -v -b -c -g 2 -m 2 -o Terminus-Bold.otb ter-u*b.bdf || die
+	fi
 }
@@ -87,2 +96,3 @@

+	use otf && FONT_SUFFIX=otb
 	font_src_install

$ fc-list | fgrep Terminus
/usr/share/fonts/terminus/Terminus-Bold.otb: Terminus:style=Bold
/usr/share/fonts/terminus/Terminus.otb: Terminus:style=Regular
/usr/share/fonts/terminus/ter-x18n.pcf.gz: xos4 Terminus:style=Regular
...

And seems to work at least in Alacritty.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-12 22:07:45 UTC
Created attachment 638486 [details, diff]
terminus-font-4.48.otb.patch
Comment 3 Larry the Git Cow gentoo-dev 2020-06-14 13:29:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e863a522b0d023696bbe3cd5b41268e7c0acad71

commit e863a522b0d023696bbe3cd5b41268e7c0acad71
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-06-14 13:24:27 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-06-14 13:29:32 +0000

    media-fonts/terminus-font: install OpenType fonts with USE=otf
    
    Reported-by: Sergey 'L29Ah' Alirzaev
    Closes: https://bugs.gentoo.org/717206
    Package-Manager: Portage-2.3.100, Repoman-2.3.22
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 media-fonts/terminus-font/metadata.xml             |   3 +
 .../terminus-font/terminus-font-4.48-r1.ebuild     | 101 +++++++++++++++++++++
 2 files changed, 104 insertions(+)
Comment 4 Alexander Tsoy 2020-06-15 00:42:45 UTC
Sergei, thank you!

(In reply to Sergei Trofimovich from comment #1)
> And seems to work at least in Alacritty.
It works, but there is a spacing issue at font size 12. Same issue was discussed at [*], but it is not clear yet, what caused that. This could be a bug in media-libs/harfbuzz or x11-apps/fonttosfnt.

[*] https://bugzilla.redhat.com/show_bug.cgi?id=1753295
Comment 5 Alexander Tsoy 2020-06-15 01:26:37 UTC
(In reply to Alexander Tsoy from comment #4)
> ... but it is not clear yet, what caused that. This could be a
> bug in media-libs/harfbuzz or x11-apps/fonttosfnt.
bug #728308
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-15 07:43:55 UTC
(In reply to Alexander Tsoy from comment #5)
> (In reply to Alexander Tsoy from comment #4)
> > ... but it is not clear yet, what caused that. This could be a
> > bug in media-libs/harfbuzz or x11-apps/fonttosfnt.
> bug #728308

Thank you!

Yeah, wading through all the issues around cairo/pango/harfbuzz and bitmap font conversion my impression was that font conversion will not be 1-1 perfect.

The perfect solution would be to provide OTF fonts directly by terminus upstream. I sent an email upstream to see if it's feasible or if possible document a canonical way to convert the fonts to OpenType.