Bladeren bron

d.rast.num: add font name, path and charset (now possible to change font), no font size since this is automatic

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61588 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 10 jaren geleden
bovenliggende
commit
495cb6df3b
1 gewijzigde bestanden met toevoegingen van 33 en 2 verwijderingen
  1. 33 2
      display/d.rast.num/main.c

+ 33 - 2
display/d.rast.num/main.c

@@ -60,7 +60,8 @@ int main(int argc, char **argv)
     struct Colors colors;
     struct Colors colors;
     struct GModule *module;
     struct GModule *module;
     struct _opt {
     struct _opt {
-	struct Option *map, *grid_color, *text_color, *prec;
+	struct Option *map, *grid_color, *text_color, *prec,
+	    *font, *path, *charset;
     } opt;
     } opt;
     struct _flg {
     struct _flg {
 	struct Flag *text_color, *align;
 	struct Flag *text_color, *align;
@@ -113,7 +114,29 @@ int main(int argc, char **argv)
     flg.text_color->key = 'f';
     flg.text_color->key = 'f';
     flg.text_color->description = _("Get text color from cell color value");
     flg.text_color->description = _("Get text color from cell color value");
     flg.text_color->guisection = _("Colors");
     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 */
     /* Check command line */
     if (G_parser(argc, argv))
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 	exit(EXIT_FAILURE);
@@ -198,6 +221,14 @@ int main(int argc, char **argv)
       	G_fatal_error(_("No graphics device selected. "
       	G_fatal_error(_("No graphics device selected. "
 			"Use d.mon to select graphics device."));
 			"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_setup2(0, 0, t, b, l, r);
 
 
     D_ns = fabs(D_get_u_to_d_yconv());
     D_ns = fabs(D_get_u_to_d_yconv());