terminus-font: update and build raw fonts for wscons(4)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

terminus-font: update and build raw fonts for wscons(4)

Stuart Henderson
Contrary to the advice in faq 7, it is possible to load a new font if
you have console on a drm device, but there are restrictions on font
size that must be followed.

This builds raw variants of some of the Terminus fonts and adds a readme
showing how to use them. I've updated to a newer version of Terminus
while there (I could split into two commits if preferred but it's simple
enough that it doesn't seem necessary).

Thanks to fcambus@ for clues on this!

Index: Makefile
===================================================================
RCS file: /cvs/ports/fonts/terminus-font/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- Makefile 16 Nov 2017 03:33:09 -0000 1.13
+++ Makefile 15 Mar 2019 14:59:57 -0000
@@ -2,7 +2,7 @@
 
 COMMENT = fixed width fonts especially for long hacking sessions
 
-DISTNAME = terminus-font-4.46
+DISTNAME = terminus-font-4.47
 CATEGORIES = fonts x11
 
 HOMEPAGE = http://terminus-font.sourceforge.net/
@@ -23,7 +23,7 @@ CONFIGURE_STYLE = simple
 NO_TEST = Yes
 USE_X11 = Yes
 
-ALL_TARGET = pcf pcf-8bit
+ALL_TARGET = pcf pcf-8bit raw
 
 FONTDIR = ${PREFIX}/share/fonts/terminus
 
@@ -50,5 +50,11 @@ do-install:
  ${INSTALL_DATA_DIR} ${FONTDIR}
  ${INSTALL_DATA} ${WRKSRC}/*.pcf.gz ${FONTDIR}
  ${INSTALL_DATA} ${WRKBUILD}/fonts.alias ${FONTDIR}/fonts.alias-terminus
+
+ ${INSTALL_DATA_DIR} ${PREFIX}/share/misc/pcvtfonts
+ ${INSTALL_DATA} ${WRKBUILD}/fonts.alias ${FONTDIR}/fonts.alias-terminus
+ cd ${WRKSRC}; for i in *.raw; do \
+ ${INSTALL_DATA} $$i ${PREFIX}/share/misc/pcvtfonts/$${i%.raw}; \
+ done
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/fonts/terminus-font/distinfo,v
retrieving revision 1.6
diff -u -p -r1.6 distinfo
--- distinfo 4 Aug 2017 16:59:39 -0000 1.6
+++ distinfo 15 Mar 2019 14:59:57 -0000
@@ -1,2 +1,2 @@
-SHA256 (terminus-font-4.46.tar.gz) = TilDPlaZt23x9cmpbxIozM+OqKFnkc/vBj8rhQbHW80=
-SIZE (terminus-font-4.46.tar.gz) = 590210
+SHA256 (terminus-font-4.47.tar.gz) = DxsgWIjk4mqUh490a4Vmplw+N0KzPPmk5lF2RtVlEpc=
+SIZE (terminus-font-4.47.tar.gz) = 620344
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Makefile 15 Mar 2019 14:59:57 -0000
@@ -0,0 +1,46 @@
+$OpenBSD$
+
+Build raw files for wsfontload.
+
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -4,6 +4,7 @@ BIN = ./bin
+
+ UCS2ANY = $(INT) $(BIN)/ucstoany.$(EXT)
+ BDF2PSF = $(INT) $(BIN)/bdftopsf.$(EXT)
++BDF2RAW = $(INT) $(BIN)/bdftopsf.$(EXT) -r
+ UCS2X11 = $(INT) $(BIN)/ucstoany.$(EXT) -f
+ BDF2PCF = bdftopcf
+
+@@ -56,6 +57,11 @@ PSF_VGAW_KOI8_UV = ter-u14v.psf ter-u16v.psf
+ PSF_VGAW_XOS4_2  = ter-v14v.psf ter-v16v.psf
+ PSF_VGAW = $(PSF_VGAW_8859_1) $(PSF_VGAW_8859_2) $(PSF_VGAW_8859_7) $(PSF_VGAW_8859_9) $(PSF_VGAW_MS_1251) $(PSF_VGAW_8859_13) $(PSF_VGAW_8859_16) $(PSF_VGAW_IBM_437) $(PSF_VGAW_KOI8_RV) $(PSF_VGAW_BG_MIK) $(PSF_VGAW_PT_154) $(PSF_VGAW_KOI8_UV) $(PSF_VGAW_XOS4_2)
+
++RAW_8859_1  = $(subst .psf,.raw,$(PSF_8859_1))
++RAW_VGAW_8859_1  = $(subst .psf,.raw,$(PSF_VGAW_8859_1))
++RAW = $(RAW_8859_1)
++RAW_VGAW = $(RAW_VGAW_8859_1)
++
+ PCF_8859_1  = ter-112n.pcf ter-112b.pcf ter-114n.pcf ter-114b.pcf ter-116n.pcf ter-116b.pcf ter-118n.pcf ter-118b.pcf ter-120n.pcf ter-120b.pcf ter-122n.pcf ter-122b.pcf ter-124n.pcf ter-124b.pcf ter-128n.pcf ter-128b.pcf ter-132n.pcf ter-132b.pcf
+ PCF_8859_2  = ter-212n.pcf ter-212b.pcf ter-214n.pcf ter-214b.pcf ter-216n.pcf ter-216b.pcf ter-218n.pcf ter-218b.pcf ter-220n.pcf ter-220b.pcf ter-222n.pcf ter-222b.pcf ter-224n.pcf ter-224b.pcf ter-228n.pcf ter-228b.pcf ter-232n.pcf ter-232b.pcf
+ PCF_8859_5  = ter-512n.pcf ter-512b.pcf ter-514n.pcf ter-514b.pcf ter-516n.pcf ter-516b.pcf ter-518n.pcf ter-518b.pcf ter-520n.pcf ter-520b.pcf ter-522n.pcf ter-522b.pcf ter-524n.pcf ter-524b.pcf ter-528n.pcf ter-528b.pcf ter-532n.pcf ter-532b.pcf
+@@ -131,6 +137,9 @@ DUP_KOI8_UV = dup/cntrl.dup dup/ascii-h.dup dup/koi8.d
+ DUP_KOI8_U  = dup/cntrl.dup dup/ascii-h.dup dup/koi8.dup
+ DUP_XOS4_2  = dup/vgagr.dup dup/xos4-2.dup
+
++$(RAW_8859_1) $(RAW_VGAW_8859_1): ter-1%.raw : ter-u%.bdf $(VGA_8859_1) $(DUP_8859_1)
++ $(UCS2ANY) $< $(REG_8859_1) $(VGA_8859_1) | $(BDF2RAW) -o $@ $(DUP_8859_1)
++
+ $(PSF_8859_1) $(PSF_VGAW_8859_1): ter-1%.psf : ter-u%.bdf $(VGA_8859_1) $(DUP_8859_1)
+ $(UCS2ANY) $< $(REG_8859_1) $(VGA_8859_1) | $(BDF2PSF) -o $@ $(DUP_8859_1)
+
+@@ -202,6 +211,8 @@ install-psf-ref: README
+
+ uninstall-psf-ref:
+ rm -f $(DESTDIR)$(psfref)
++
++raw: $(RAW) $(RAW_VGAW)
+
+ # X11 Window System
+
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/fonts/terminus-font/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -r1.4 PLIST
--- pkg/PLIST 4 Aug 2017 16:59:39 -0000 1.4
+++ pkg/PLIST 15 Mar 2019 14:59:57 -0000
@@ -1,5 +1,6 @@
 @comment $OpenBSD: PLIST,v 1.4 2017/08/04 16:59:39 sthen Exp $
 @pkgpath x11/terminus-font
+share/doc/pkg-readmes/${PKGSTEM}
 share/fonts/
 @fontdir share/fonts/terminus/
 share/fonts/terminus/fonts.alias-terminus
@@ -255,3 +256,23 @@ share/fonts/terminus/ter-x28b.pcf.gz
 share/fonts/terminus/ter-x28n.pcf.gz
 share/fonts/terminus/ter-x32b.pcf.gz
 share/fonts/terminus/ter-x32n.pcf.gz
+share/misc/pcvtfonts/
+share/misc/pcvtfonts/ter-112n
+share/misc/pcvtfonts/ter-114b
+share/misc/pcvtfonts/ter-114n
+share/misc/pcvtfonts/ter-114v
+share/misc/pcvtfonts/ter-116b
+share/misc/pcvtfonts/ter-116n
+share/misc/pcvtfonts/ter-116v
+share/misc/pcvtfonts/ter-118b
+share/misc/pcvtfonts/ter-118n
+share/misc/pcvtfonts/ter-120b
+share/misc/pcvtfonts/ter-120n
+share/misc/pcvtfonts/ter-122b
+share/misc/pcvtfonts/ter-122n
+share/misc/pcvtfonts/ter-124b
+share/misc/pcvtfonts/ter-124n
+share/misc/pcvtfonts/ter-128b
+share/misc/pcvtfonts/ter-128n
+share/misc/pcvtfonts/ter-132b
+share/misc/pcvtfonts/ter-132n
Index: pkg/README
===================================================================
RCS file: pkg/README
diff -N pkg/README
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/README 15 Mar 2019 14:59:57 -0000
@@ -0,0 +1,28 @@
+$OpenBSD: README.template,v 1.6 2018/09/04 13:40:26 ajacoutot Exp $
+
++-------------------------------------------------------------------------------
+| Running ${PKGSTEM} on OpenBSD
++-------------------------------------------------------------------------------
+
+Use with wscons(4)
+==================
+Raw versions of some Terminus fonts are included; these can be loaded with
+wsfontload(8) for use in OpenBSD's wscons(4) text-mode console.
+
+For consoles on a drm(4) device, a font may only be loaded if it matches
+the size of the current console font. For displays with a width above
+1920 and belove 3840 pixels, rasops(9) will select a 16x32 font which
+can be replaced with one of the "ter-132*" fonts. (Terminus does not
+have a 32x64 font to match the size used by default on wider displays).
+
+This can be loaded and configured like so:
+
+$ wsfontload -N ter-132n -w 16 -h 32 /usr/local/share/misc/pcvtfonts/ter-132n
+$ wsconsctl display.font=ter-132n
+
+To return to the default console font:
+
+$ wsconsctl display.font="Spleen 16x32"
+
+The final letter of the filename relates to the weight; n=normal, b=bold,
+v="VGA weight".

Reply | Threaded
Open this post in threaded view
|

Re: terminus-font: update and build raw fonts for wscons(4)

Frederic Cambus
On Fri, Mar 15, 2019 at 03:01:41PM +0000, Stuart Henderson wrote:

> Contrary to the advice in faq 7, it is possible to load a new font if
> you have console on a drm device, but there are restrictions on font
> size that must be followed.
>
> This builds raw variants of some of the Terminus fonts and adds a readme
> showing how to use them. I've updated to a newer version of Terminus
> while there (I could split into two commits if preferred but it's simple
> enough that it doesn't seem necessary).
>
> Thanks to fcambus@ for clues on this!

This looks good to me, a few nitpicks inline below.

With those addressed, OK fcambus@.

> Index: pkg/README
> ===================================================================
> RCS file: pkg/README
> diff -N pkg/README
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ pkg/README 15 Mar 2019 14:59:57 -0000
> @@ -0,0 +1,28 @@
> +$OpenBSD: README.template,v 1.6 2018/09/04 13:40:26 ajacoutot Exp $
> +
> ++-------------------------------------------------------------------------------
> +| Running ${PKGSTEM} on OpenBSD
> ++-------------------------------------------------------------------------------
> +
> +Use with wscons(4)
> +==================
> +Raw versions of some Terminus fonts are included; these can be loaded with
> +wsfontload(8) for use in OpenBSD's wscons(4) text-mode console.
> +
> +For consoles on a drm(4) device, a font may only be loaded if it matches
> +the size of the current console font. For displays with a width above
> +1920 and belove 3840 pixels, rasops(9) will select a 16x32 font which
            ^^^^^^

You have a typo here: s/belove/below.

> +can be replaced with one of the "ter-132*" fonts. (Terminus does not
> +have a 32x64 font to match the size used by default on wider displays).
> +
> +This can be loaded and configured like so:
> +
> +$ wsfontload -N ter-132n -w 16 -h 32 /usr/local/share/misc/pcvtfonts/ter-132n
                                        ^^^^^^^^^^

portcheck complains about an hardcoded path here :)

> +$ wsconsctl display.font=ter-132n
> +
> +To return to the default console font:
> +
> +$ wsconsctl display.font="Spleen 16x32"

Both wsfontload and wsconsctl must be run as root, so maybe we should
change $ to # for the prompts?

Reply | Threaded
Open this post in threaded view
|

Re: terminus-font: update and build raw fonts for wscons(4)

Stuart Henderson
On 2019/03/15 19:45, Frederic Cambus wrote:
> This looks good to me, a few nitpicks inline below.
> With those addressed, OK fcambus@.
>
> > +For consoles on a drm(4) device, a font may only be loaded if it matches
> > +the size of the current console font. For displays with a width above
> > +1920 and belove 3840 pixels, rasops(9) will select a 16x32 font which
>             ^^^^^^
> You have a typo here: s/belove/below.

Thanks, fixed in my tree.

> > +can be replaced with one of the "ter-132*" fonts. (Terminus does not
> > +have a 32x64 font to match the size used by default on wider displays).
> > +
> > +This can be loaded and configured like so:
> > +
> > +$ wsfontload -N ter-132n -w 16 -h 32 /usr/local/share/misc/pcvtfonts/ter-132n
>                                         ^^^^^^^^^^
> portcheck complains about an hardcoded path here :)

And this.

> > +$ wsconsctl display.font=ter-132n
> > +
> > +To return to the default console font:
> > +
> > +$ wsconsctl display.font="Spleen 16x32"
>
> Both wsfontload and wsconsctl must be run as root, so maybe we should
> change $ to # for the prompts?

That isn't currently the case. If the kernel is changed to require
this I'll happily switch it over.

What do you think Daniel, is this ok with you?

Reply | Threaded
Open this post in threaded view
|

Re: erminus-font: update and build raw fonts for wscons(4)

LÉVAI Dániel
Stuart Henderson @ 2019-03-15T22:33:31 +0100:
[...]
> What do you think Daniel, is this ok with you?

Yes, thank you for taking care of this!


Daniel