[GRASS-user] Label difficulties

Ivan Shmakov oneingray at gmail.com
Wed Aug 29 01:38:09 EDT 2007

>>>>> "H" == Hamish  <hamish_nospam at yahoo.com> writes:


 >> The problem is that the "\n" in the text is showing up explicitly,
 >> as those two characters, rather then causing a new line in the
 >> labels.  So the labels have these extra characters and break in odd
 >> places.  This is the case both when viewing this layer in the Map
 >> display and the saved version.

 H> My guess is that is an oversight in that tool which hasn't been
 H> programmed in yet. '\n' should be processed by it into a newline.

 H> It's in gui/tcltk/gis.m/maplabels.tcl ~ line 433:

 > proc GmCLabels::display {}
 > ...
 >      "text" {
 >              set opt($id,1,ltxt) $val

 H> maybe a way to process the text string with formatting codes to
 H> newlines automatically? (tcl is string friendly, so search and
 H> replace shouldn't can't be too hard, although I've no idea how)

 > % set a {1\n2}
 > 1\n2
 > % set a "1\n2"
 > 1
 > 2

        It's rather simple:

% set a {1\n2}
% subst -nocommands -novariables $a

 H> Probably the linewrap and border box code in there needs updating
 H> too.

More information about the grass-user mailing list