[mapserver-commits] r13250 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Mar 14 09:21:36 EDT 2012
Author: tbonfort
Date: 2012-03-14 06:21:36 -0700 (Wed, 14 Mar 2012)
New Revision: 13250
Modified:
trunk/mapserver/mapcairo.c
trunk/mapserver/mapdummyrenderer.c
trunk/mapserver/mapgd.c
trunk/mapserver/maplabel.c
trunk/mapserver/maprendering.c
trunk/mapserver/mapserver.h
trunk/mapserver/mapsymbol.c
Log:
Only do baseline adjustment on text, not on truetype symbols
Modified: trunk/mapserver/mapcairo.c
===================================================================
--- trunk/mapserver/mapcairo.c 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/mapcairo.c 2012-03-14 13:21:36 UTC (rev 13250)
@@ -456,7 +456,8 @@
#define CAIROLINESPACE 1.33
-int getTruetypeTextBBoxCairo(rendererVTableObj *renderer, char **fonts, int numfonts, double size, char *text, rectObj *rect, double **advances) {
+int getTruetypeTextBBoxCairo(rendererVTableObj *renderer, char **fonts, int numfonts, double size,
+ char *text, rectObj *rect, double **advances, int bAdjustBaseline) {
cairoCacheData *cache = MS_RENDERER_CACHE(renderer);
faceCacheObj* face = getFontFace(cache,fonts[0]);
@@ -524,11 +525,11 @@
rect->minx = px+extents.x_bearing;
rect->miny = py+extents.y_bearing;
rect->maxx = px+extents.x_bearing+extents.width;
- rect->maxy = py+1;
+ rect->maxy = py+(bAdjustBaseline?1:(extents.y_bearing+extents.height));
} else {
rect->minx = MS_MIN(rect->minx,px+extents.x_bearing);
rect->miny = MS_MIN(rect->miny,py+extents.y_bearing);
- rect->maxy = MS_MAX(rect->maxy,py+1);
+ rect->maxy = MS_MAX(rect->maxy,py+(bAdjustBaseline?1:(extents.y_bearing+extents.height)));
rect->maxx = MS_MAX(rect->maxx,px+extents.x_bearing+extents.width);
}
if(advances!=NULL)
@@ -537,12 +538,6 @@
previdx=glyph.index;
prevface = face;
}
- /*
- rect->minx = 0;
- rect->miny = 0;
- rect->maxx = 1;
- rect->maxy = 1;
- */
return MS_SUCCESS;
}
Modified: trunk/mapserver/mapdummyrenderer.c
===================================================================
--- trunk/mapserver/mapdummyrenderer.c 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/mapdummyrenderer.c 2012-03-14 13:21:36 UTC (rev 13250)
@@ -166,7 +166,8 @@
/*...*/
/* helper functions */
-int getTruetypeTextBBoxDummy(rendererVTableObj *renderer, char **fonts, int numfonts, double size, char *string,rectObj *rect, double **advances) {
+int getTruetypeTextBBoxDummy(rendererVTableObj *renderer, char **fonts, int numfonts, double size,
+ char *string,rectObj *rect, double **advances, int bAdjustBaseline) {
msSetError(MS_RENDERERERR,"getTruetypeTextBBox not implemented","getTruetypeTextBBox()");
return MS_FAILURE;
}
Modified: trunk/mapserver/mapgd.c
===================================================================
--- trunk/mapserver/mapgd.c 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/mapgd.c 2012-03-14 13:21:36 UTC (rev 13250)
@@ -833,7 +833,7 @@
return MS_SUCCESS;
}
-int getTruetypeTextBBoxGD(rendererVTableObj *renderer, char **fonts, int numfonts, double size, char *string, rectObj *rect, double **advances) {
+int getTruetypeTextBBoxGD(rendererVTableObj *renderer, char **fonts, int numfonts, double size, char *string, rectObj *rect, double **advances, int bAdjustBaseline) {
#ifdef USE_GD_FT
int bbox[8];
char *error;
Modified: trunk/mapserver/maplabel.c
===================================================================
--- trunk/mapserver/maplabel.c 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/maplabel.c 2012-03-14 13:21:36 UTC (rev 13250)
@@ -965,13 +965,14 @@
#endif
}
-int msGetTruetypeTextBBox(rendererVTableObj *renderer, char* fontstring, fontSetObj *fontset, double size, char *string, rectObj *rect, double **advances) {
+int msGetTruetypeTextBBox(rendererVTableObj *renderer, char* fontstring, fontSetObj *fontset,
+ double size, char *string, rectObj *rect, double **advances, int bAdjustbaseline) {
char *lookedUpFonts[MS_MAX_LABEL_FONTS];
int numfonts;
if(MS_FAILURE == msFontsetLookupFonts(fontstring, &numfonts, fontset, lookedUpFonts))
return MS_FAILURE;
if(renderer) {
- return renderer->getTruetypeTextBBox(renderer,lookedUpFonts,numfonts,size,string,rect,advances);
+ return renderer->getTruetypeTextBBox(renderer,lookedUpFonts,numfonts,size,string,rect,advances,bAdjustbaseline);
}
#ifdef USE_GD_FT
else {
@@ -1140,7 +1141,7 @@
msSetError(MS_MISCERR, "label has no true type font", "msGetLabelSize()");
return MS_FAILURE;
}
- return msGetTruetypeTextBBox(renderer,label->font,&(map->fontset),size,string,rect,advances);
+ return msGetTruetypeTextBBox(renderer,label->font,&(map->fontset),size,string,rect,advances,1);
} else if(label->type == MS_BITMAP){
if(renderer->supports_bitmap_fonts)
return msGetRasterTextBBox(renderer,MS_NINT(label->size),string,rect);
Modified: trunk/mapserver/maprendering.c
===================================================================
--- trunk/mapserver/maprendering.c 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/maprendering.c 2012-03-14 13:21:36 UTC (rev 13250)
@@ -326,7 +326,7 @@
} else {
rectObj rect;
if(MS_SUCCESS != renderer->getTruetypeTextBBox(renderer,&symbol->full_font_path,1,style->scale,
- symbol->character,&rect,NULL))
+ symbol->character,&rect,NULL,0))
return MS_FAILURE;
symbol_width=rect.maxx-rect.minx;
symbol_height=rect.maxy-rect.miny;
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/mapserver.h 2012-03-14 13:21:36 UTC (rev 13250)
@@ -2028,7 +2028,7 @@
MS_DLL_EXPORT int msFontsetLookupFonts(char* fontstring, int *numfonts, fontSetObj *fontset, char **lookedUpFonts);
MS_DLL_EXPORT char *msTransformLabelText(mapObj *map, labelObj *label, char *text);
-MS_DLL_EXPORT int msGetTruetypeTextBBox(rendererVTableObj *renderer, char* fontstring, fontSetObj *fontset, double size, char *string, rectObj *rect, double **advances);
+MS_DLL_EXPORT int msGetTruetypeTextBBox(rendererVTableObj *renderer, char* fontstring, fontSetObj *fontset, double size, char *string, rectObj *rect, double **advances, int bAdjustBaseline);
MS_DLL_EXPORT int msGetLabelSize(mapObj *map, labelObj *label, char *string, double size, rectObj *rect, double **advances);
@@ -2789,7 +2789,7 @@
/*...*/
/* helper functions */
- int (*getTruetypeTextBBox)(rendererVTableObj *renderer, char **fonts, int numfonts, double size, char *string, rectObj *rect, double **advances);
+ int (*getTruetypeTextBBox)(rendererVTableObj *renderer, char **fonts, int numfonts, double size, char *string, rectObj *rect, double **advances, int bAdjustBaseline);
int (*startLayer)(imageObj *img, mapObj *map, layerObj *layer);
int (*endLayer)(imageObj *img, mapObj *map, layerObj *layer);
Modified: trunk/mapserver/mapsymbol.c
===================================================================
--- trunk/mapserver/mapsymbol.c 2012-03-14 13:20:48 UTC (rev 13249)
+++ trunk/mapserver/mapsymbol.c 2012-03-14 13:21:36 UTC (rev 13250)
@@ -675,7 +675,7 @@
#ifdef USE_GD_FT
case(MS_SYMBOL_TRUETYPE):
- if(msGetTruetypeTextBBox(MS_MAP_RENDERER(symbolset->map),symbol->font,symbolset->fontset,size,symbol->character,&rect,NULL) != MS_SUCCESS)
+ if(msGetTruetypeTextBBox(MS_MAP_RENDERER(symbolset->map),symbol->font,symbolset->fontset,size,symbol->character,&rect,NULL,0) != MS_SUCCESS)
return(MS_FAILURE);
*width = MS_MAX(*width, rect.maxx - rect.minx);
More information about the mapserver-commits
mailing list