Skip to content

Commit

Permalink
Merge branch 'branch-6-2' of https://github.com/mapserver/mapserver i…
Browse files Browse the repository at this point in the history
…nto intramaps
  • Loading branch information
szekerest committed Nov 5, 2012
2 parents c13dd6d + 2a2a4db commit 96a2b33
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions mapogr.cpp
Expand Up @@ -2634,21 +2634,28 @@ static int msOGRUpdateStyle(OGRStyleMgrH hStyleMgr, mapObj *map, layerObj *layer
const char *pszFontName = OGR_ST_GetParamStr(hLabelStyle,
OGRSTLabelFontName,
&bIsNull);
const char *pszName = CPLSPrintf("%s%s%s", pszFontName, pszBold, pszItalic);
/* replace spaces with hyphens to allow mapping to a valid hashtable entry*/
char* pszFontNameEscaped = NULL;
if (pszFontName != NULL) {
pszFontNameEscaped = strdup(pszFontName);
msReplaceChar(pszFontNameEscaped, ' ', '-');
}

const char *pszName = CPLSPrintf("%s%s%s", pszFontNameEscaped, pszBold, pszItalic);
bool bFont = true;

if (pszFontName != NULL && !bIsNull && pszFontName[0] != '\0') {
if (pszFontNameEscaped != NULL && !bIsNull && pszFontNameEscaped[0] != '\0') {
if (msLookupHashTable(&(map->fontset.fonts), (char*)pszName) != NULL) {
c->labels[0]->type = MS_TRUETYPE;
c->labels[0]->font = msStrdup(pszName);
if (layer->debug >= MS_DEBUGLEVEL_VVV)
msDebug("** Using '%s' TTF font **\n", pszName);
} else if ( (strcmp(pszFontName,pszName) != 0) &&
msLookupHashTable(&(map->fontset.fonts), (char*)pszFontName) != NULL) {
} else if ( (strcmp(pszFontNameEscaped,pszName) != 0) &&
msLookupHashTable(&(map->fontset.fonts), (char*)pszFontNameEscaped) != NULL) {
c->labels[0]->type = MS_TRUETYPE;
c->labels[0]->font = msStrdup(pszFontName);
c->labels[0]->font = msStrdup(pszFontNameEscaped);
if (layer->debug >= MS_DEBUGLEVEL_VVV)
msDebug("** Using '%s' TTF font **\n", pszFontName);
msDebug("** Using '%s' TTF font **\n", pszFontNameEscaped);
} else if (msLookupHashTable(&(map->fontset.fonts),"default") != NULL) {
c->labels[0]->type = MS_TRUETYPE;
c->labels[0]->font = msStrdup("default");
Expand All @@ -2658,6 +2665,8 @@ static int msOGRUpdateStyle(OGRStyleMgrH hStyleMgr, mapObj *map, layerObj *layer
bFont = false;
}

msFree(pszFontNameEscaped);

if (!bFont) {
c->labels[0]->type = MS_BITMAP;
c->labels[0]->size = MS_MEDIUM;
Expand Down

0 comments on commit 96a2b33

Please sign in to comment.