The attached diff attempts to do the following improvements
to the xfs initscript for performance and correctness:
The individual fixes are:
- Consider all .ttf, .ttc, .otf, .otc file extensions of any
combination of upper and/or lowercase in a font directory to be
a truetype or opentype font which ttmkfdir should handle.
Previously, only .ttf and .ttc fonts were handled. This is a
correctness fix.
- When determining wether or not mkfontdir and ttmkfdir need to
be called, ignore any fonts.cache files that might be present,
as they're metadata files, not fonts. This is both a
correctness and performance fix, as any non-font metadata files
found that aren't explicitly ignored, but are newer than
fonts.dir will unnecessarily trigger regeneration of fonts.dir
- When determining wether a directory contains non-truetype
fonts, ignore all ttf/ttc/otf/otc font types, not just ttf.
- If any fonts.dir files were recreated, it now calls fc-cache
afterward if fc-cache exists, in order to update all fontconfig
fonts.cache-* files
I've studied the regular expressions carefully and think that
they cleanly implement the above, however there could be a glitch
in there, so I'd like to get other people to review this change
before officially committing it to the next build of XFree86, as
a bad regex could result in rather serious font subsystem
breakage, so the more eyes who review this the better.
If you review the change and think it to be correct, please
respond with an "ACK" email to fedora-devel-list, along with
any comments and/or suggestions for futher improvements.
On a separate note from the above, there is one possible flaw
that was in the original initscript as well as my above proposal,
however I want this issue treated/considered separately from the
above, so please comment on each issue separately. The following
line:
if [ "$(ls |grep -iv
'\(fonts\.\(scale\|alias\|cache.*\)$\|.+\(\.[ot]t[cf]\|dir\)$\)')" !=
"" ]; then
In both the original initscript, and this updated one, the test
doesn't take into account wether or not the directory may contain
subdirectories for whatever reason. If the dir does contain
subdirs, the subdir name will pass the grep test, and cause
mkfontdir to be executed even if no font files are updated.
I'm thinking of changing this ls|grep test to be something
similar to the following, which explicitly tests for files only
and ignores dirs:
if [ "$(find . -type f -maxdepth=0 -not -regex
'.*fonts\.\(scale\|alias\|cache.*\)$' -and -not -iregex
'.+\(\.[ot]t[cf]\|dir\)$' != "" ]; then
It's ugly, but I believe it may do what we're looking for nicely.
Comments appreciated.
--
Mike A. Harris
ftp://people.redhat.com/mharris
OS Systems Engineer - XFree86 maintainer - Red Hat