diff options
author | nyamatongwe <unknown> | 2011-07-10 15:41:22 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-07-10 15:41:22 +1000 |
commit | d613cc3519af2ecb9ca0be9d6a1d1c5165b30e63 (patch) | |
tree | dd1102a35a6f29d01472dab8d2ffa8e213daf081 /cocoa/QuartzTextStyleAttribute.h | |
parent | a4db0db8ebc3e3a8cb9a18493bd88c99e6537bdd (diff) | |
download | scintilla-mirror-d613cc3519af2ecb9ca0be9d6a1d1c5165b30e63.tar.gz |
If requested font can't be created use same font without bold or italic.
If that fails, use Monaco.
Diffstat (limited to 'cocoa/QuartzTextStyleAttribute.h')
-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() |