aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/QuartzTextLayout.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2017-06-08 14:51:06 +1000
committerNeil <nyamatongwe@gmail.com>2017-06-08 14:51:06 +1000
commit69870956666618aa5c8194abf6fb2967fa14d064 (patch)
tree918076df19a01bab706645855f6bcea635bb52ff /cocoa/QuartzTextLayout.h
parent37508011503a9e6b451759197754bbd04869a230 (diff)
downloadscintilla-mirror-69870956666618aa5c8194abf6fb2967fa14d064.tar.gz
Indented consistently by using astyle.
Diffstat (limited to 'cocoa/QuartzTextLayout.h')
-rw-r--r--cocoa/QuartzTextLayout.h73
1 files changed, 32 insertions, 41 deletions
diff --git a/cocoa/QuartzTextLayout.h b/cocoa/QuartzTextLayout.h
index 33869ae6e..033859529 100644
--- a/cocoa/QuartzTextLayout.h
+++ b/cocoa/QuartzTextLayout.h
@@ -16,39 +16,33 @@
#include "QuartzTextStyle.h"
-class QuartzTextLayout
-{
+class QuartzTextLayout {
public:
- /** Create a text layout for drawing on the specified context. */
- explicit QuartzTextLayout( CGContextRef context )
- {
+ /** Create a text layout for drawing on the specified context. */
+ explicit QuartzTextLayout(CGContextRef context) {
mString = NULL;
mLine = NULL;
stringLength = 0;
- setContext(context);
- }
+ setContext(context);
+ }
- ~QuartzTextLayout()
- {
- if ( mString != NULL )
- {
+ ~QuartzTextLayout() {
+ if (mString != NULL) {
CFRelease(mString);
mString = NULL;
}
- if ( mLine != NULL )
- {
+ if (mLine != NULL) {
CFRelease(mLine);
mLine = NULL;
}
- }
+ }
- inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r )
- {
- CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false );
- if (!str)
- return;
+ inline void setText(const UInt8 *buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle &r) {
+ CFStringRef str = CFStringCreateWithBytes(NULL, buffer, byteLength, encoding, false);
+ if (!str)
+ return;
- stringLength = CFStringGetLength(str);
+ stringLength = CFStringGetLength(str);
CFMutableDictionaryRef stringAttribs = r.getCTStyle();
@@ -60,14 +54,13 @@ public:
CFRelease(mLine);
mLine = ::CTLineCreateWithAttributedString(mString);
- CFRelease( str );
- }
+ CFRelease(str);
+ }
- /** Draw the text layout into the current CGContext at the specified position.
- * @param x The x axis position to draw the baseline in the current CGContext.
- * @param y The y axis position to draw the baseline in the current CGContext. */
- void draw( float x, float y )
- {
+ /** Draw the text layout into the current CGContext at the specified position.
+ * @param x The x axis position to draw the baseline in the current CGContext.
+ * @param y The y axis position to draw the baseline in the current CGContext. */
+ void draw(float x, float y) {
if (mLine == NULL)
return;
@@ -78,31 +71,29 @@ public:
// And finally, draw!
::CTLineDraw(mLine, gc);
- }
+ }
- float MeasureStringWidth()
- {
+ float MeasureStringWidth() {
if (mLine == NULL)
return 0.0f;
return static_cast<float>(::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL));
}
- CTLineRef getCTLine() {
- return mLine;
- }
+ CTLineRef getCTLine() {
+ return mLine;
+ }
- CFIndex getStringLength() {
- return stringLength;
- }
+ CFIndex getStringLength() {
+ return stringLength;
+ }
- inline void setContext (CGContextRef context)
- {
- gc = context;
- }
+ inline void setContext(CGContextRef context) {
+ gc = context;
+ }
private:
- CGContextRef gc;
+ CGContextRef gc;
CFAttributedStringRef mString;
CTLineRef mLine;
CFIndex stringLength;