Truetype Font Wrapping Patch
Andrew Seales
andrew.seales at ED.AC.UK
Fri Jun 17 07:06:07 EDT 2005
Hi,
We've been using Minnesota Map Server in a live WMS service for a few
months now and we have found it to be an excellent piece of software. We
have found what seems to be a small problem though. We tried using the
WRAP command inside of LAYER to specify that a text string should wrap
to the next line when it encounters a certain symbol but for some reason
we couldn't get this to work when using truetype fonts. I had a look a
the code and it seems that the line wrapping code in the bitmap font
section wasn't in the truetype font code in mapgd.c. When I added the
code into the truetype font section, then the line wrapping command
worked fine. I've attached a patch of the fix for version 4.6.0.
This is the relevant section of the mapfile:
LAYER
NAME "Copyright"
METADATA
"wms_title" "Copyright"
"wms_srs" "EPSG:27700"
"wms_extent" "0.0 0.0 700000.0 1300000.0"
END
STATUS DEFAULT
TRANSFORM FALSE
TYPE ANNOTATION
POSTLABELCACHE TRUE
FEATURE
POINTS
2 5
END
TEXT '© Crown copyright/database right 2004.|An Ordnance
Survey/EDINA supplied service.'
END
CLASS
STYLE
SYMBOL "copy_box_os"
COLOR 255 255 255
SIZE 30
END
LABEL
BACKGROUNDCOLOR 0 255 255
COLOR 0 0 0
#OUTLINECOLOR 255 255 255
TYPE TRUETYPE
FONT arial
SIZE 7
ANTIALIAS TRUE
PARTIALS TRUE
POSITION CR
WRAP "|"
END
END
MINSCALE 1000.0
MAXSCALE 25000.0
PROJECTION
"init=epsg:27700"
END
END # End copyright
Regards,
--
Andrew Seales
EDINA tel: +44 (0) 131 651 1430
Edinburgh University fax: +44 (0) 131 650 3308
Main Library Building url: http://edina.ac.uk
George Square email: andrew.seales at ed.ac.uk
Edinburgh EH8 9LJ
-------------- next part --------------
--- mapgd.c 2005-06-17 11:23:23.000000000 +0100
+++ mapgd.c 2005-06-17 11:23:41.000000000 +0100
@@ -2744,6 +2744,13 @@
}
}
+ if ( label->wrap != '\0' ) {
+ char strWrap[2];
+ strWrap[0] = label->wrap;
+ strWrap[1] = '\0';
+ string = gsub( string, strWrap, "\r\n" );
+ }
+
gdImageStringFT(img, bbox, ((label->antialias)?(label->color.pen):-(label->color.pen)), font, size, angle_radians, x, y, string);
if( gdImageTrueColor(img) )
More information about the mapserver-dev
mailing list