Skip to content

Commit

Permalink
Merge pull request #6276 from rouault/fix_msLoadFontSet_regression
Browse files Browse the repository at this point in the history
msLoadFontSet(): fix regression of 03a9670
  • Loading branch information
rouault committed Mar 27, 2021
2 parents 2b9a846 + a6553f0 commit 6acfe65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions maplabel.c
Expand Up @@ -818,15 +818,15 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)

char alias[64];
snprintf(alias, sizeof(alias), "%s", line);
char* ptr = strchr(alias, ' ');
char* ptr = strpbrk(alias, " \t");
if( !ptr )
continue;
*ptr = '\0';

const char* file1StartPtr = line + (ptr - alias);
file1StartPtr ++;
/* Skip leading spaces */
while( *file1StartPtr == ' ' )
while( isspace((int)*file1StartPtr) )
file1StartPtr ++;

if (!(*file1StartPtr) || !(*alias))
Expand All @@ -835,9 +835,12 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
char file1[MS_PATH_LENGTH];
snprintf(file1, sizeof(file1), "%s", file1StartPtr);
/* Remove trailing spaces */
ptr = strrchr(file1, ' ');
if( ptr )
ptr = file1 + strlen(file1) - 1;
while( ptr >= file1 && isspace((int)*ptr) )
{
*ptr = '\0';
--ptr;
}

bFullPath = 0;
#if defined(_WIN32) && !defined(__CYGWIN__)
Expand Down
4 changes: 2 additions & 2 deletions msautotest/wxs/etc/fonts.txt
@@ -1,2 +1,2 @@
Vera ./vera/Vera.ttf
VeraBd ./vera/VeraBd.ttf
Vera ./vera/Vera.ttf
VeraBd ./vera/VeraBd.ttf

0 comments on commit 6acfe65

Please sign in to comment.