Browse Source

fl_set_fonts_xft had a lower case, rather than upper case "S" in the switch so would not detect the SuperBold font style correctly.

Also, do a bit of defensive clipping of the generated font name, in case we run off the end of the name buffer (if the input font name is infeasibly long...!)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9874 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/49/head
Ian MacArthur 12 years ago
parent
commit
55af432c2c
  1. 10
      src/fl_set_fonts_xft.cxx

10
src/fl_set_fonts_xft.cxx

@ -102,12 +102,16 @@ static void make_raw_name(char *raw, char *pretty) @@ -102,12 +102,16 @@ static void make_raw_name(char *raw, char *pretty)
nm2 = strchr(nm1, ',');
}
raw[0] = ' '; raw[1] = 0; // Default start of "raw name" text
strncat(raw, nm1, LOCAL_RAW_NAME_MAX);
strncat(raw, nm1, LOCAL_RAW_NAME_MAX-1); // only copy MAX-1 chars, we have already set cell 0
// Ensure raw is terminated, just in case the given name is infeasibly long...
raw[LOCAL_RAW_NAME_MAX-1] = 0;
#else // keep the first remaining name entry
char *nm2 = strchr(pretty, ',');
if(nm2) *nm2 = 0; // terminate name after first entry
raw[0] = ' '; raw[1] = 0; // Default start of "raw name" text
strncat(raw, pretty, LOCAL_RAW_NAME_MAX-1);
strncat(raw, pretty, LOCAL_RAW_NAME_MAX-1); // only copy MAX-1 chars, we have already set cell 0
// Ensure raw is terminated, just in case the given name is infeasibly long...
raw[LOCAL_RAW_NAME_MAX-1] = 0;
#endif
// At this point, the name is "marked" as regular...
if (style)
@ -154,7 +158,7 @@ static void make_raw_name(char *raw, char *pretty) @@ -154,7 +158,7 @@ static void make_raw_name(char *raw, char *pretty)
}
goto NEXT_STYLE;
case 's':
case 'S':
if (strncasecmp(style, "SuperBold", 9) == 0)
{
mods |= BOLD;

Loading…
Cancel
Save