[Slackbuilds-users] proposed addition to doinst template

Luiz Carlos Ramos lramos.prof at yahoo.com.br
Sat Sep 29 13:30:25 UTC 2018


I'm not used to reply in this list, but I keep watching the message
flow... let me add a suggestion.

This addition could be added as a function, that is, it would be like

update_font_index() {
  if [ -x /usr/bin/mkfontdir -o -x /usr/X11R6/bin/mkfontdir ]; then
    ( cd /usr/share/fonts/misc
      mkfontscale .
      mkfontdir -e /usr/share/fonts/encodings \
        -e /usr/share/fonts/encodings/large .
  if [ -x /usr/bin/fc-cache ]; then
    /usr/bin/fc-cache -f

That is, it's the same code, but encapsulated as a function. This
function could be in the template for all packages. If a specific
package needs to do it, it could simply add one line to the "main"

# Update the X font indexes:

IMHO, this makes things more clear for folks who will maintain the code.
That is, the task to be done would be synthesized in that one line in
the install step (the call to "update_font_index"); and the way it's
done is coded in the function itself. Someone who needs to code the same
thing in a new slackbuild could copy the template and add one line to
the "main" procedure.

Only my 2 cents,


Luiz Carlos Ramos
lramos.prof at yahoo.com.br

On Fri, Sep 28, 2018 at 07:26:34PM -0400, B Watson wrote:
> Any build that installs non-TTF fonts in the global font path
> (/usr/share/fonts/*) should include this in doinst.sh:
> # Update the X font indexes:
> if [ -x /usr/bin/mkfontdir -o -x /usr/X11R6/bin/mkfontdir ]; then
>   ( cd /usr/share/fonts/misc
>     mkfontscale .
>     mkfontdir -e /usr/share/fonts/encodings -e
> /usr/share/fonts/encodings/large .
>   )
> fi
> if [ -x /usr/bin/fc-cache ]; then
>   /usr/bin/fc-cache -f
> fi
> The above was taken from one of Pat's font-* packages (it's included in
> multiple ones).
> Change the "fonts/misc" to e.g. "fonts/100dpi" or whatever your package
> actually installs fonts to (if multiple subdirs, mkfontscale and mkfontdir
> will have to be run in all of them).
> Ideally, packages won't install fonts.dir files at all, but Pat's font-*
> packages do (and then immediately overwrite them via the doinst.sh).
> For those not familiar with it, fonts.dir is a list of all the installed
> fonts in a directory. If a font is present, but not mentioned in
> fonts.dir, "old-style" X apps (ones that don't use fontconfig) won't be
> able to use that font.
> For a specific example of a SBo build that needs this, see libdockapp. It
> installs 2 fonts in /usr/share/fonts/misc, and includes a fonts.dir
> that only lists those 2 fonts. After installing this package, other apps
> (e.g. xterm) have problems loading fonts, depending on what font they're
> configured to use.
> _______________________________________________
> SlackBuilds-users mailing list
> SlackBuilds-users at slackbuilds.org
> https://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users
> Archives - https://lists.slackbuilds.org/pipermail/slackbuilds-users/
> FAQ - https://slackbuilds.org/faq/

More information about the SlackBuilds-users mailing list