summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
index c528f2721..e6352af2a 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
@@ -618,15 +618,22 @@ void Fl_Quartz_Graphics_Driver::ADD_SUFFIX(draw, _CoreText)(const char *str, int
CFRelease(ctline);
}
+// Skip over bold/italic/oblique qualifiers part of PostScript font names
+// Example:
+// input: '-Regular_Light-Condensed'
+// return: '_Light-Condensed'
+//
static char *skip(char *p, int& derived)
{
- if (memcmp(p, "-BoldItalic", 11) == 0) { p += 11; derived = 3; }
- else if (memcmp(p, "-BoldOblique", 12) == 0) { p += 12; derived = 3; }
- else if (memcmp(p, "-Bold", 5) == 0) {p += 5; derived = 1; }
- else if (memcmp(p, "-Italic", 7) == 0) {p += 7; derived = 2; }
- else if (memcmp(p, "-Oblique", 8) == 0) {p += 8; derived = 2; }
- else if (memcmp(p, "-Regular", 8) == 0) {p += 8; }
- else if (memcmp(p, "-Roman", 6) == 0) {p += 6; }
+ // 0 5 10
+ // | | |
+ if (strncmp(p, "-BoldItalic", 11) == 0) { p += 11; derived = 3; }
+ else if (strncmp(p, "-BoldOblique", 12) == 0) { p += 12; derived = 3; }
+ else if (strncmp(p, "-Bold", 5) == 0) { p += 5; derived = 1; }
+ else if (strncmp(p, "-Italic", 7) == 0) { p += 7; derived = 2; }
+ else if (strncmp(p, "-Oblique", 8) == 0) { p += 8; derived = 2; }
+ else if (strncmp(p, "-Regular", 8) == 0) { p += 8; }
+ else if (strncmp(p, "-Roman", 6) == 0) { p += 6; }
return p;
}