[GRASS-dev] Re: North Arrow updates
Hamish
hamish_nospam at yahoo.com
Wed Dec 13 00:54:07 EST 2006
Michael Barton wrote:
> It seems like a good idea to be able to set the text
> size too. Is there a variable/command to do this?
grab the font control from panel_label.tcl
lib/ogsf/gsd_objs.c:
/**************************************************************
* Function to draw North Arrow takes OpenGL coords and size
*************************************************************/
int gsd_north_arrow (float *pos2, float len, GLuint fontbase,
unsigned long arw_clr, unsigned long text_clr) {
So yes, there is C support for setting a dynamic font.
Right now the nviz north arrow and scale text is hardcoded as 18pt
in nviz/src/draw.c:
FontBase = load_font(TOGL_BITMAP_HELVETICA_18);
but
nviz/src/label.c uses the same thing to set the font from the controls:
sprintf(font, "%s", argv[2]);
size = (int) atoi(argv[3]);
..
/* Print the label */
FontBase = load_font(font);
which are the second and third arguments passed to Nplace_label
($font and $Nv_(labelFontSize)). So mimic panel_label and then it's just
a quick modification to draw.c to use the variable value instead of the
hardcoded one.
Hamish
More information about the grass-dev
mailing list