diff options
author | nyamatongwe <devnull@localhost> | 2011-07-10 15:41:22 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-07-10 15:41:22 +1000 |
commit | 9a895fdf8e524734e35795536d6fb24f83209cb6 (patch) | |
tree | 72864e359c9fd7c938897130857e33ea073a2b20 | |
parent | 223a0dab88ad13670a9214a70f49ba0c56f4ac01 (diff) | |
download | scintilla-mirror-9a895fdf8e524734e35795536d6fb24f83209cb6.tar.gz |
If requested font can't be created use same font without bold or italic.
If that fails, use Monaco.
-rw-r--r-- | cocoa/QuartzTextStyleAttribute.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cocoa/QuartzTextStyleAttribute.h b/cocoa/QuartzTextStyleAttribute.h index 41582e8ec..3171ca446 100644 --- a/cocoa/QuartzTextStyleAttribute.h +++ b/cocoa/QuartzTextStyleAttribute.h @@ -43,13 +43,28 @@ public: // create a font and then a copy of it with the sym traits CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL); fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask); - CFRelease(iFont); + if (fontid) + { + CFRelease(iFont); + } + else + { + // Traits failed so use base font + fontid = iFont; + } } else { // create the font, no traits fontid = ::CTFontCreateWithName(fontName, size, NULL); } + + if (!fontid) + { + // Failed to create requested font so use font always present + fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL); + } + } CTFontRef getFontID() |