[GRASS-SVN] r61588 - grass/trunk/display/d.rast.num

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 12 11:14:32 PDT 2014


Author: wenzeslaus
Date: 2014-08-12 11:14:32 -0700 (Tue, 12 Aug 2014)
New Revision: 61588

Modified:
   grass/trunk/display/d.rast.num/main.c
Log:
d.rast.num: add font name, path and charset (now possible to change font), no font size since this is automatic

Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c	2014-08-12 15:15:06 UTC (rev 61587)
+++ grass/trunk/display/d.rast.num/main.c	2014-08-12 18:14:32 UTC (rev 61588)
@@ -60,7 +60,8 @@
     struct Colors colors;
     struct GModule *module;
     struct _opt {
-	struct Option *map, *grid_color, *text_color, *prec;
+	struct Option *map, *grid_color, *text_color, *prec,
+	    *font, *path, *charset;
     } opt;
     struct _flg {
 	struct Flag *text_color, *align;
@@ -113,7 +114,29 @@
     flg.text_color->key = 'f';
     flg.text_color->description = _("Get text color from cell color value");
     flg.text_color->guisection = _("Colors");
-    
+
+    opt.font = G_define_option();
+    opt.font->key = "font";
+    opt.font->type = TYPE_STRING;
+    opt.font->required = NO;
+    opt.font->description = _("Font name");
+    opt.font->guisection = _("Font settings");
+
+    opt.path = G_define_standard_option(G_OPT_F_INPUT);
+    opt.path->key = "path";
+    opt.path->required = NO;
+    opt.path->description = _("Path to font file");
+    opt.path->gisprompt = "old_file,font,file";
+    opt.path->guisection = _("Font settings");
+
+    opt.charset = G_define_option();
+    opt.charset->key = "charset";
+    opt.charset->type = TYPE_STRING;
+    opt.charset->required = NO;
+    opt.charset->description =
+	_("Text encoding (only applicable to TrueType fonts)");
+    opt.charset->guisection = _("Font settings");
+
     /* Check command line */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
@@ -198,6 +221,14 @@
       	G_fatal_error(_("No graphics device selected. "
 			"Use d.mon to select graphics device."));
     
+    if (opt.font->answer)
+	D_font(opt.font->answer);
+    else if (opt.path->answer)
+	D_font(opt.path->answer);
+
+    if (opt.charset->answer)
+	D_encoding(opt.charset->answer);
+    
     D_setup2(0, 0, t, b, l, r);
 
     D_ns = fabs(D_get_u_to_d_yconv());



More information about the grass-commit mailing list