aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/QuartzTextStyle.h
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa/QuartzTextStyle.h')
-rw-r--r--cocoa/QuartzTextStyle.h54
1 files changed, 20 insertions, 34 deletions
diff --git a/cocoa/QuartzTextStyle.h b/cocoa/QuartzTextStyle.h
index 12cc0e0b2..8572f5270 100644
--- a/cocoa/QuartzTextStyle.h
+++ b/cocoa/QuartzTextStyle.h
@@ -10,72 +10,60 @@
#include "QuartzTextStyleAttribute.h"
-class QuartzTextStyle
-{
+class QuartzTextStyle {
public:
- QuartzTextStyle()
- {
+ QuartzTextStyle() {
fontRef = NULL;
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
characterSet = 0;
}
- QuartzTextStyle(const QuartzTextStyle &other)
- {
+ QuartzTextStyle(const QuartzTextStyle &other) {
// Does not copy font colour attribute
fontRef = static_cast<CTFontRef>(CFRetain(other.fontRef));
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
characterSet = other.characterSet;
}
- ~QuartzTextStyle()
- {
- if (styleDict != NULL)
- {
+ ~QuartzTextStyle() {
+ if (styleDict != NULL) {
CFRelease(styleDict);
styleDict = NULL;
}
- if (fontRef)
- {
+ if (fontRef) {
CFRelease(fontRef);
fontRef = NULL;
}
}
- CFMutableDictionaryRef getCTStyle() const
- {
+ CFMutableDictionaryRef getCTStyle() const {
return styleDict;
}
- void setCTStyleColor(CGColor *inColor)
- {
+ void setCTStyleColor(CGColor *inColor) {
CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColor);
}
- float getAscent() const
- {
+ float getAscent() const {
return static_cast<float>(::CTFontGetAscent(fontRef));
}
- float getDescent() const
- {
+ float getDescent() const {
return static_cast<float>(::CTFontGetDescent(fontRef));
}
- float getLeading() const
- {
+ float getLeading() const {
return static_cast<float>(::CTFontGetLeading(fontRef));
}
- void setFontRef(CTFontRef inRef, int characterSet_)
- {
+ void setFontRef(CTFontRef inRef, int characterSet_) {
fontRef = inRef;
characterSet = characterSet_;
@@ -83,19 +71,17 @@ public:
CFRelease(styleDict);
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
}
- CTFontRef getFontRef()
- {
+ CTFontRef getFontRef() {
return fontRef;
}
- int getCharacterSet()
- {
+ int getCharacterSet() {
return characterSet;
}