On Mon, Sep 02, 2024 at 09:00:04AM +0200, Hiltjo Posthuma wrote:
> 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
> >     @@ -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
> 

In fact, you could just specify fallback fonts in the font pattern string,
like so:

        static char *font = "Input Mono, Sarasa Term J, Unifont:pixelsize=13";

You could also override it in your FontConfig font config, if you have
the patience to deal with the syntax...

        <match><test name="prgname"><string>st</string></test>
                <edit name="family" mode="delete_all"/>
                <edit name="family" mode="append"><string>Input 
Sans</string></edit>
                <edit name="family" mode="append"><string>Sarasa Term 
J</string></edit>
                <edit name="family" 
mode="append"><string>Unifont</string></edit>
                <edit name="pixelsize" mode="assign"><int>13</int></edit>
        </match>

-- 
Storkman

Reply via email to