[GRASS-dev] figureing out fonts - part 3 correction

Hamish hamish_nospam at yahoo.com
Tue May 1 03:17:55 EDT 2007


Glynn Clements wrote:
> The mkftcap script will generate a freetypecap file containing all
> .ttf files found in its hard-coded list of directories. The user may
> subsequently edit the file.

patch attached, for your consideration.
(run without needing a fake mapset, add copyright and file header)

Can "^*" be added to promote a consistent non-romans default font (if
found)? eg. Helvetica, Vera, or something common (sans).

How well does it deal with spaces in font path names?


> For binary distributions, the mkftcap script will need to be run on
> the target system after installation, or the user will need to create
> the file by other means.

shall we add the running of the script to this part of lib/init/init.sh
  # First time user - GISRC is defined in the GRASS script
  if [ ! -f "$GISRC" ] ; then
    ...

and add a rescan button to Michael's new GUI default font picker tool?


> Any fonts which are added after the freetypecap file is created won't
> appear until the file is explicitly updated.

for this we could add a hint in the d.font help page to run
"$GISBASE/etc/mkftcap" from the GRASS prompt.

> IOW, there can be fonts which are installed but which aren't listed in
> the freetypecap file. This may be an explicit choice on the user's
> part, or it may be an oversight. If you could guarantee that all fonts
> were listed in that file, there wouldn't be any need to support
> specifying fonts by an absolute path.

so Michael's new GUI font picker tool could have three entries:

//////////////////
// <> stoke font [pulldown list of the usual suspects]
// <> (registered) TTF [pulldown list parsed from freetypecap] [Rescan]
// <> Browse filesystem for TTF file
//
// Selected font: [____]    [Set as Default]
/////////////////



Hamish
-------------- next part --------------
Index: tools/mkftcap/mkftcap
===================================================================
RCS file: /home/grass/grassrepository/grass6/tools/mkftcap/mkftcap,v
retrieving revision 1.2
diff -u -r1.2 mkftcap
--- tools/mkftcap/mkftcap	30 Apr 2007 19:35:13 -0000	1.2
+++ tools/mkftcap/mkftcap	1 May 2007 07:00:24 -0000
@@ -1,10 +1,24 @@
 #!/bin/sh
 
-if  [ -z "$GISBASE" ]
-then
-	echo "You must be in GRASS GIS to run this program" >&2
-	exit 1
-fi
+# CODE PROVENIENCE:
+#  ADD AUTHORSHIP AND COPYRIGHT INFO HERE
+#
+
+# header info
+cat << EOF
+# FreeType2 definition file
+# Generated on $HOSTNAME at `date`
+#
+# FORMAT:
+#	font:fontpath:charset[:color:size]:description
+#	*default_font:fontpath:charset[:color:size]:description
+#
+# NOTE:
+#	It does not allow spaces, tabs, and multiple lines in one font.
+#	description is never used.
+#	DO NOT ADD A DEFAULT FONT IN THE CVS VERSION. :-)
+#
+EOF
 
 for dir in /usr/lib/X11/fonts /usr/share/X11/fonts /usr/share/fonts \
     "$HOME/Library/Fonts" /Library/Fonts /System/Library/Fonts \
@@ -16,4 +30,3 @@
 	| sed 's/.ttf:/:/'
     fi
 done
-


More information about the grass-dev mailing list