[mapserver-commits] r11082 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sat Mar 5 13:59:18 EST 2011


Author: tamas
Date: 2011-03-05 10:59:18 -0800 (Sat, 05 Mar 2011)
New Revision: 11082

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapdraw.c
Log:
Avoid the crash if anglemode 'FOLLOW' is specified with bitmap fonts. (#3379)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-03-05 17:44:17 UTC (rev 11081)
+++ trunk/mapserver/HISTORY.TXT	2011-03-05 18:59:18 UTC (rev 11082)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Avoid the crash if anglemode 'FOLLOW' is specified with bitmap fonts. (#3379)
+
 - Add argument check for processTemplate, processLegendTemplate and 
   processQueryTemplate in the C# bindings (#3699)
 

Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c	2011-03-05 17:44:17 UTC (rev 11081)
+++ trunk/mapserver/mapdraw.c	2011-03-05 18:59:18 UTC (rev 11082)
@@ -1524,6 +1524,10 @@
         msTransformShape(&annoshape, map->extent, map->cellsize, image);
 
         if(layer->class[c]->label.anglemode == MS_FOLLOW ) {
+          if (layer->class[c]->label.type != MS_TRUETYPE) {
+            msSetError(MS_MISCERR, "Angle mode 'FOLLOW' is supported only with truetype fonts.", "msDrawShape()");
+            return(MS_FAILURE);
+          }
           annopaths = msPolylineLabelPath(map,image,&annoshape, minfeaturesize, &(map->fontset), shape->text, &(layer->class[c]->label), layer->scalefactor, &numpaths, &regularLines, &numRegularLines);
         } else {
             annopoints = msPolylineLabelPoint(&annoshape, minfeaturesize, (layer->class[c]->label).repeatdistance, &angles, &lengths, &numpoints, layer->class[c]->label.anglemode);
@@ -1542,6 +1546,10 @@
       
       if (layer->class[c]->label.anglemode == MS_FOLLOW) 
       {
+        if (layer->class[c]->label.type != MS_TRUETYPE) {
+          msSetError(MS_MISCERR, "Angle mode 'FOLLOW' is supported only with truetype fonts.", "msDrawShape()");
+          return(MS_FAILURE);
+        }
         /* Determine the label path if it has not been computed above */
         if (bLabelNoClip == MS_FALSE) {
           if ( annopaths ) {
@@ -1562,6 +1570,10 @@
         {
           /* Bug #1620 implementation */
           if(layer->class[c]->label.anglemode == MS_FOLLOW) {
+            if (layer->class[c]->label.type != MS_TRUETYPE) {
+              msSetError(MS_MISCERR, "Angle mode 'FOLLOW' is supported only with truetype fonts.", "msDrawShape()");
+              return(MS_FAILURE);
+            }
             layer->class[c]->label.position = MS_CC; /* Force all label positions to MS_CC regardless if a path is computed */
 
             if( annopaths[i] ) {
@@ -1849,6 +1861,10 @@
       msTransformShape(&annoshape, map->extent, map->cellsize, image);
 
       if(layer->class[c]->label.anglemode == MS_FOLLOW) {
+        if (layer->class[c]->label.type != MS_TRUETYPE) {
+           msSetError(MS_MISCERR, "Angle mode 'FOLLOW' is supported only with truetype fonts.", "msDrawShape()");
+           return(MS_FAILURE);
+        }
         annopaths = msPolylineLabelPath(map,image,&annoshape, minfeaturesize, &(map->fontset), shape->text, &(layer->class[c]->label), layer->scalefactor, &numpaths, &regularLines, &numRegularLines);
       } else {
         annopoints = msPolylineLabelPoint(&annoshape, minfeaturesize, (layer->class[c]->label).repeatdistance, &angles, &lengths, &numpoints, layer->class[c]->label.anglemode);
@@ -1912,6 +1928,10 @@
 
       if (layer->class[c]->label.anglemode == MS_FOLLOW) 
       {
+        if (layer->class[c]->label.type != MS_TRUETYPE) {
+          msSetError(MS_MISCERR, "Angle mode 'FOLLOW' is supported only with truetype fonts.", "msDrawShape()");
+          return(MS_FAILURE);
+        }
         /* Determine the label path if it has not been computed above */
         if (bLabelNoClip == MS_FALSE) {
           if ( annopaths ) {
@@ -1931,10 +1951,16 @@
         for (i = 0; i < numpaths; i++)
         {
           /* Bug #1620 implementation */
-          if(layer->class[c]->label.anglemode == MS_FOLLOW) {
+            if(layer->class[c]->label.anglemode == MS_FOLLOW) {
             labelObj label;
+
+            if (layer->class[c]->label.type != MS_TRUETYPE) {
+              msSetError(MS_MISCERR, "Angle mode 'FOLLOW' is supported only with truetype fonts.", "msDrawShape()");
+              return(MS_FAILURE);
+            }
+
             layer->class[c]->label.position = MS_CC; /* Force all label positions to MS_CC regardless if a path is computed */
-            
+
             label = layer->class[c]->label;
             
             if(layer->labelcache) {



More information about the mapserver-commits mailing list