diff options
author | nyamatongwe <devnull@localhost> | 2011-07-10 11:24:11 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-07-10 11:24:11 +1000 |
commit | e1b4c6ddc6e2a980a7ffbf7c3f81ffc929c234d0 (patch) | |
tree | 12cb694c8e3ba499e5083774b0ecbe5d4cdc4d94 /cocoa/QuartzTextLayout.h | |
parent | 23c222e5a28c4bfd50e087ec1a85c392b9c4a1aa (diff) | |
download | scintilla-mirror-e1b4c6ddc6e2a980a7ffbf7c3f81ffc929c234d0.tar.gz |
Display and measure text in different encodings.
Diffstat (limited to 'cocoa/QuartzTextLayout.h')
-rw-r--r-- | cocoa/QuartzTextLayout.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cocoa/QuartzTextLayout.h b/cocoa/QuartzTextLayout.h index 033ac98fb..c789ed10f 100644 --- a/cocoa/QuartzTextLayout.h +++ b/cocoa/QuartzTextLayout.h @@ -24,6 +24,7 @@ public: { mString = NULL; mLine = NULL; + stringLength = 0; setContext(context); } @@ -41,12 +42,14 @@ public: } } - inline void setText( const UInt8* buffer, size_t byteLength, const QuartzTextStyle& r ) + inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r ) { - CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, kCFStringEncodingUTF8, false ); + CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false ); if (!str) return; + stringLength = CFStringGetLength(str); + CFMutableDictionaryRef stringAttribs = r.getCTStyle(); if (mString != NULL) @@ -89,6 +92,10 @@ public: return mLine; } + CFIndex getStringLength() { + return stringLength; + } + inline void setContext (CGContextRef context) { gc = context; @@ -98,6 +105,7 @@ private: CGContextRef gc; CFAttributedStringRef mString; CTLineRef mLine; + CFIndex stringLength; }; #endif |