In the case where a user (say, like me (-: ) installs other rpms containing truetype fonts that happen to install to the same location as ttfonts does, the ttfonts package upon removal does the following undesirable things: 1. removes /usr/share/fonts/default/TrueType from xfs's fontpath 2. leaves behind fonts.scale and fonts.dir files that contain stale data. Also, an enhancement suggestion: 3. use xftcache when appropriate. In order to complish this, I suggest modifying ttfonts %postun script as follows... For shorthand, I'll use a macro %define ttfontdir /usr/share/fonts/default/TrueType %postun cd %{ttfontdir} if [ "x$(find . -name "*.ttf" 2>/dev/null)" != "x" ]; then # stuff left-over, reconfig ttmkfdir >fonts.scale 2>/dev/null ||: mkfontdir 2>/dev/null ||: xftcache %{ttfontdir} 2>/dev/null ||: else # we're empty rm -f encodings.dir XftCache chkfontpath -q -r %{ttfontdir} ||: fi # trigger for xftcache in case XFree>=4.1.0 is installed after we are %triggerin -- XFree86 >= 4.1.0 xftcache %{ttfontdir} ||:
It's fixed in ttfonts-1.0-5. You will find it in next rawhide release.
We've got a buglet left over from this change. I now get an error when I: rpm -e ttfonts Error: can't change to /usr/share/fonts/default/TrueType To avoid this problem, we can try postponing the cd until after it is verified that ttfontdir is not empty: %postun if [ "$1" = "0" ]; then if [ "x$(find %{ttfontdir} -name "*.ttf" 2>/dev/null)" != "x" ]; then # stuff left-over, reconfig cd %{ttfontdir} ttmkfdir >fonts.scale 2>/dev/null ||: mkfontdir 2>/dev/null ||: xftcache %{ttfontdir} 2>/dev/null ||: else # we're empty rm -f %{ttfontdir}/encodings.dir chkfontpath -q -r %{ttfontdir} ||: fi fi (I also removed the rm -f XftCache since it is now owned by this package per bug #58129)
Fixed in 1.0-9
The %trigger XFree86 xftcache fails for rh8 since xftcache is no longer included (in favor of Xft2's fc-cache). Perhaps it would be best to either remove the trigger altogether *or* change the trigger to first try to run/use fc-cache then xftcache if the former is not available. On a slightly different, but related issue, perhaps all this font-postprocessing should be included in some external font helper application, something akin to type1inst, but for ttf fonts, then all you'd need to put in %post would be: ttfhelper (or whatever you'd want to call it). That way, all ttf font packages could share a single, unified post-processor... and you'd not have to rebuild every ttf font package when/if you ever want/need to modify %post.
It just occurred to me that the ttfonts package doesn't actually exist anymore in rh8... and that the existing ttfonts-* packages don't have the trigger anyway. Nevermind... (-: