[Slackbuilds-users] proposed addition to doinst template
Ricardo J. Barberis
ricardo at palmtx.com.ar
Sat Sep 29 22:51:49 UTC 2018
Hello all!
While we're at it, how about passing the dir to the function (and some basic
error control)?
update_font_index() {
if [ -x /usr/bin/mkfontdir -o -x /usr/X11R6/bin/mkfontdir ]; then
( cd $1 &&
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
}
Then you can call it for every needed dir:
(...)
# Update the X font indexes:
update_font_index /usr/share/fonts/misc
update_font_index /usr/share/fonts/100dpi
(...)
Cheers!
El Sábado 29/09/2018 a las 10:30, Luiz Carlos Ramos via SlackBuilds-users
escribió:
> Hello,
>
> 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 .
> )
> fi
> if [ -x /usr/bin/fc-cache ]; then
> /usr/bin/fc-cache -f
> fi
> }
>
> 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"
> script:
>
> (...)
> # Update the X font indexes:
> update_font_index
> (...)
>
> 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,
>
> thanks,
>
> 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.
--
Ricardo J. Barberis
Usuario Linux Nº 250625: http://counter.li.org/
Usuario LFS Nº 5121: http://www.linuxfromscratch.org/
Senior SysAdmin / IT Architect - www.DonWeb.com
More information about the SlackBuilds-users
mailing list