[kmscon-devel] Setting Font Name & Size

David Herrmann dh.herrmann at gmail.com
Mon May 12 23:09:39 PDT 2014


Hi

On Tue, May 13, 2014 at 6:30 AM, John Magolske <listmail at b79.net> wrote:
> Hi,
>
> I'm trying to sort out how to go about setting font name & size. Could
> the name be picked from the output of `fc-list`? For example, to use
> the Terminus 18 font:
>
>     % fc-list | grep Terminus | grep 18
>     /usr/share/fonts/X11/misc/ter-u18b_iso-8859-1.pcf.gz: Terminus:style=Bold
>     /usr/share/fonts/X11/misc/ter-u18b_unicode.pcf.gz: Terminus:style=Bold
>     /usr/share/fonts/X11/misc/ter-u18n_unicode.pcf.gz: Terminus:style=Regular
>     /usr/share/fonts/X11/misc/ter-u18n_iso-8859-1.pcf.gz: Terminus:style=Regular
>
> I tried this:
>
>     # kmscon --font-name Terminus --font-size 18
>
> Which launched kmscon using Terminus, but at a size larger than 18
> pixels tall. Realizing "font-size" here is in points, I set "font-dpi"
> as well, trying a value of 72:
>
>     # kmscon --font-name Terminus --font-size 18 --font-dpi 72
>
> Ok, that seems to set it to an 18 pixel height. Is there a way to
> specify Regular / Bold? Some guesses (that didn't work):
>
>     # kmscon --font-name Terminus:style=Bold --font-size 18
>     # kmscon --font-name Terminus B --font-size 18

Use: --font-name "Terminus Bold"
(mind the quotes)

> Also, I have a certain 9x20 bdf font I'd like to use, so I copied
> it to /usr/share/fonts/X11/misc and ran what I thought were the
> appropriate commands:
>
>     # cp sgiscreen-9x20.bdf /usr/share/fonts/X11/misc
>     # cd /usr/share/fonts/X11/misc
>     # mkfontdir
>     # cat fonts.dir | grep sgi
>     # sgiscreen-9x20.pcf sgiscreen-9x20
>     # fc-cache .
>     # fc-list | grep sgi
>     #
>
> fc-cache is not seeing it, but it does show up in fc-scan:
>
>     # fc-scan .
>     [...]
>     Pattern has 20 elts (size 32)
>         family: "sgiscreen-9x20"(s)
>         style: "Regular"(s)
>         slant: 0(i)(s)
>         weight: 80(i)(s)
>         width: 100(i)(s)
>         pixelsize: 13(f)(s)
>         spacing: 100(i)(s)
>         foundry: "unknown"(s)
>         antialias: False(s)
>         file: "/usr/share/fonts/X11/misc/sgiscreen-9x20.bdf"(s)
>         index: 0(i)(s)
>         outline: False(s)
>         scalable: False(s)
>         charset:
>     (s)
>         lang: (s)
>         fontversion: 0(i)(s)
>         fontformat: "BDF"(s)
>         decorative: False(s)
>         hash: "sha256:93790602774ac93f6f25513db530d9b03d3860918c7975eeaa66838cf959c43d"(s)
>         postscriptname: "sgiscreen-9x20"(s)
>
> a few attempts to load it:
>
>     # kmscon --font-name sgiscreen-9x20
>     # kmscon --font-name sgiscreen-9x20 --font-size 20 --font-dpi 72
>
> ...does not load. I'm wondering what directory to drop this bdf file
> in and what commands to run to have it recognized & loaded by kmscon.

It highly depends on the font-backend you use. The default is "pango",
in which case it's the same you would use to configure GTK+ or most of
your browsers. I don't know the internal name of that font, so I
cannot tell you, but I'd try something like: --font-name sgiscreen
(just that, no other options)

To test pango itself, try this:
  pango-view --font="Terminus Bold" kmscon/docs/unicode-test.txt

You can use any text-file, but kmscon provides a nice example with
lots of less-common unicode symbols.

Thanks
David


More information about the kmscon-devel mailing list