[GRASS-dev] d.font -l: please sort alphabetically
Paul Kelly
paul-grass at stjohnspoint.co.uk
Thu Jul 26 18:09:40 EDT 2007
On Thu, 26 Jul 2007, Markus Neteler wrote:
[...]
> GRASS 6.3.cvs (nc_spm_05):~ > d.font -l
> cyrilc
> gothgbt
> ...
> umeplus-p-gothic
> b018015l
> ...
> z003034l
> z003034l
> a010013l
> a010013l
> a010033l
> ...
>
>
> GRASS 6.3.cvs (nc_spm_05):~> d.font -L
> cyrilc|cyrilc|0|/home/neteler/grass63/dist.x86_64-unknown-linux-gnu/fonts/cyrilc.hmp|0|utf-8|
> gothgbt|gothgbt|0|/home/neteler/grass63/dist.x86_64-unknown-linux-gnu/fonts/gothgbt.hmp|0|utf-8|
> ...
> a_d_mono|A.D. MONO Regular|1|/usr/share/fonts/ttf/western/a_d_mono.ttf|0|utf-8|
> actionis|ActionIs Regular|1|/usr/share/fonts/ttf/decoratives/actionis.ttf|0|utf-8|
> Adventure|Adventure Normal|1|/usr/share/fonts/ttf/western/Adventure.ttf|0|utf-8|
> uming|AR PL ShanHeiSun Uni Regular|1|/usr/share/fonts/TTF/chinese/uming.ttf|0|utf-8|
> ukai|AR PL ZenKai Uni Medium|1|/usr/share/fonts/TTF/chinese/ukai.ttf|0|utf-8|
>
>
> This should include the updates from Paul today.
The stroke fonts don't have descriptive long names in the above example
(just a copy of the short name) - you may need to run "g.mkfontcap -o" to
overwrite your fontcap file. I changed it so it won't automatically
overwrite it when re-compiling, as I thought that was a bad idea in case
someone might have manually edited their file (e.g. to include only the
fonts they commonly used, in their preferred order ;)
But maybe sorting by short name is a better idea than long name, and it
should be up to the GUI to sort on long name if that's a better option for
it - the patch below will make the sort operate on the short name (you
will need to re-run g.mkfontcap -o again):
Index: general/g.mkfontcap/main.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/general/g.mkfontcap/main.c,v
retrieving revision 1.4
diff -u -r1.4 main.c
--- general/g.mkfontcap/main.c 26 Jul 2007 14:01:16 -0000 1.4
+++ general/g.mkfontcap/main.c 26 Jul 2007 22:01:56 -0000
@@ -195,8 +195,8 @@
return (aa->type > bb->type);
else
{
- const char *na = aa->longname;
- const char *nb = bb->longname;
+ const char *na = aa->name;
+ const char *nb = bb->name;
return G_strcasecmp(na, nb);
About the d.font -L output - I'd been thinking (shortly before Glynn
implemented it) that it might be quite neat to have some kind of
font_info() function that could be passed the name of a font from
R_font_list(), and it would return a GFONT_CAP struct (defined in
grass/freetypecap.h) with all the font info - and then d.font or other
programs could take the font info from the members of this struct and
format the output as they saw fit. But perhaps this would have been
over-complicated to implement in the existing driver structure - I'm
really not sure and also not sure how much use if any it would be for
other modules.
Paul
More information about the grass-dev
mailing list