Re: [hackers] [PATCH 1/1] Add support for user-defined fallback fonts

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Mon, 2 Sep 2024 09:00:04 +0200

On Sun, Sep 01, 2024 at 05:48:06PM -0700, Eric Pruitt wrote:
> On Sat, Aug 31, 2024 at 01:12:20PM +0200, Robert Bilski wrote:
> > > + /* CJK Fonts */
> > > + "VL Gothic:pixelsize=12:antialias=true:autohint=true",
> > > + "WenQuanYi Micro Hei:pixelsize=12:antialias=true:autohint=true",
> >
> > Should these be included? Other tools (dwm, dmenu) include a single, default
> > entry in the array. These two might not even be installed.
>
> I don't care if the maintainers choose to remove the additional fonts,
> but I would note the existing default of Liberation Mono might not be
> installed, either. Even if a font isn't installed, it doesn't matter.
> Unmodified st still works if you specify a font that does not exist, and
> the same applies with my patch applied:
>
> st$ vim config.def.h
> st$ git diff
> diff --git a/config.def.h b/config.def.h
> index 2cd740a..f8cd502 100644
> --- a/config.def.h
> +++ b/config.def.h
> _AT_@ -5,7 +5,7 @@
> *
> * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
> */
> -static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
> +static char *font = "DOES NOT EXIST:pixelsize=12:antialias=true:autohint=true";
> static int borderpx = 2;
>
> /*
> st$ make
> cp config.def.h config.h
> c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig` `pkg-config --cflags freetype2` -DVERSION=\"0.9.2\" -D_XOPEN_SOURCE=600 -O1 -c st.c
> c99 -I/usr/X11R6/include `pkg-config --cflags fontconfig` `pkg-config --cflags freetype2` -DVERSION=\"0.9.2\" -D_XOPEN_SOURCE=600 -O1 -c x.c
> c99 -o st st.o x.o -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft `pkg-config --libs fontconfig` `pkg-config --libs freetype2`
> st$ ./st -e true
> st$ echo $?
> 0
>
> Eric
>

But in most cases/distros with "Liberation Mono" it will use a monospace font.
Also fontconfig allows to map the name (or other conditions) to an other font.

-- 
Kind regards,
Hiltjo
Received on Mon Sep 02 2024 - 09:00:04 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 02 2024 - 09:00:44 CEST