[GRASS-SVN] r73212 - grass/trunk/display/d.northarrow

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 31 06:43:00 PDT 2018


Author: neteler
Date: 2018-08-31 06:43:00 -0700 (Fri, 31 Aug 2018)
New Revision: 73212

Modified:
   grass/trunk/display/d.northarrow/main.c
Log:
d.northarrow: font, path and charset parameters added (#3516)

Modified: grass/trunk/display/d.northarrow/main.c
===================================================================
--- grass/trunk/display/d.northarrow/main.c	2018-08-31 13:35:23 UTC (rev 73211)
+++ grass/trunk/display/d.northarrow/main.c	2018-08-31 13:43:00 UTC (rev 73212)
@@ -32,7 +32,7 @@
 {
     struct GModule *module;
     struct Option *bg_color_opt, *fg_color_opt, *coords, *n_arrow, *fsize,
-        *width_opt, *rotation_opt, *lbl_opt, *text_color_opt;
+        *width_opt, *rotation_opt, *lbl_opt, *text_color_opt, *font, *path, *charset;
     struct Flag *no_text, *rotate_text, *rads;
     double east, north;
     double rotation;
@@ -120,8 +120,15 @@
     width_opt->answer = "0";
     width_opt->description = _("Line width");
 
+    font = G_define_option();
+    font->key = "font";
+    font->type = TYPE_STRING;
+    font->required = NO;
+    font->description = _("Font name");
+    font->guisection = _("Text");
+
     fsize = G_define_option();
-    fsize->key = "fontsize";
+    fsize->key = "fontsize"; /* size in d.text */
     fsize->type = TYPE_DOUBLE;
     fsize->required = NO;
     fsize->answer = "14";
@@ -129,11 +136,26 @@
     fsize->description = _("Font size");
     fsize->guisection = _("Text");
 
+    path = G_define_standard_option(G_OPT_F_INPUT);
+    path->key = "path";
+    path->required = NO;
+    path->description = _("Path to font file");
+    path->gisprompt = "old,font,file";
+    path->guisection = _("Font settings");
+
     no_text = G_define_flag();
     no_text->key = 't';
     no_text->description = _("Draw the symbol without text");
     no_text->guisection = _("Text");
 
+    charset = G_define_option();
+    charset->key = "charset";
+    charset->type = TYPE_STRING;
+    charset->required = NO;
+    charset->description =
+	_("Text encoding (only applicable to TrueType fonts)");
+    charset->guisection = _("Text");
+
     rotate_text = G_define_flag();
     rotate_text->key = 'w';
     rotate_text->description = _("Do not rotate text with symbol");
@@ -188,7 +210,6 @@
     else
         text_color = 0;
 
-
     line_width = atof(width_opt->answer);
     if (line_width < 0)
         line_width = 0;
@@ -197,6 +218,13 @@
 
     D_open_driver();
 
+    if (font->answer)
+	D_font(font->answer);
+    else if (path->answer)
+	D_font(path->answer);
+    if (charset->answer)
+	D_encoding(charset->answer);
+
     draw_n_arrow(east, north, rotation, lbl_opt->answer, rot_with_text,
                  fontsize, n_arrow->answer, line_width);
 



More information about the grass-commit mailing list