浏览代码

Font size support added

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45236 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 14 年之前
父节点
当前提交
320a1b149a
共有 3 个文件被更改,包括 15 次插入8 次删除
  1. 1 3
      display/d.barscale/draw_scale.c
  2. 13 4
      display/d.barscale/main.c
  3. 1 1
      display/d.barscale/options.h

+ 1 - 3
display/d.barscale/draw_scale.c

@@ -57,7 +57,7 @@ static const struct scale
     }
 };
 
-int draw_scale(int toptext)
+int draw_scale(int toptext, int size)
 {
     double meters;
     double line_len;
@@ -66,13 +66,11 @@ int draw_scale(int toptext)
     double t, b, l, r;
     int pt, pb, pl, pr;
     int i;
-    int size;
     double xarr[5], yarr[5];
     double seg_len;
     const struct scale *scales = all_scales[use_feet];
 
     /* Establish text size */
-    size = 14;
     D_text_size(size, size);
 
     D_setup_unity(0);

+ 13 - 4
display/d.barscale/main.c

@@ -12,7 +12,7 @@
  *               Hamish Bowman <hamish_b yahoo.com>, 
  *               Jan-Oliver Wagner <jan intevation.de>
  * PURPOSE:      displays a barscale on graphics monitor
- * COPYRIGHT:    (C) 1999-2007 by the GRASS Development Team
+ * COPYRIGHT:    (C) 1999-2011 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -41,9 +41,10 @@ int draw = 0;
 int main(int argc, char **argv)
 {
     struct GModule *module;
-    struct Option *opt1, *opt2, *opt3;
+    struct Option *opt1, *opt2, *opt3, *fsize;
     struct Flag *feet, *top, *linescale, *northarrow, *scalebar;
     struct Cell_head W;
+    int fontsize;
 
     /* Initialize the GIS calls */
     G_gisinit(argv[0]);
@@ -90,6 +91,14 @@ int main(int argc, char **argv)
     opt3->description =
 	_("The screen coordinates for top-left corner of label ([0,0] is top-left of frame)");
 
+    fsize = G_define_option();
+    fsize->key = "fontsize";
+    fsize->type = TYPE_INTEGER;
+    fsize->required = NO;
+    fsize->answer = "14";
+    fsize->options = "1-72";
+    fsize->description = _("Font size for gridline coordinate labels");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -113,7 +122,7 @@ int main(int argc, char **argv)
 
     sscanf(opt3->answers[0], "%lf", &east);
     sscanf(opt3->answers[1], "%lf", &north);
-
+    fontsize = atoi(fsize->answer);
 
     if (D_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
@@ -129,7 +138,7 @@ int main(int argc, char **argv)
     color2 = D_parse_color(opt2->answer, 0);
 
     /* Draw the scale */
-    draw_scale(top->answer);
+    draw_scale(top->answer, fontsize);
 
     D_close_driver();
 

+ 1 - 1
display/d.barscale/options.h

@@ -9,4 +9,4 @@ extern int do_bar;
 extern int draw;
 
 /* draw_scale.c */
-int draw_scale(int toptext);
+int draw_scale(int toptext, int fontsize);