diff options
author | nyamatongwe <unknown> | 2011-07-10 11:24:11 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-07-10 11:24:11 +1000 |
commit | 3214eed6cb64d02cba6b90631a7013a872994bd6 (patch) | |
tree | 6bde95c673f3a069ec247208a6d7b189f31c447b /cocoa/QuartzTextLayout.h | |
parent | d6680887f548b139a2337277cad67543c0c3ab5f (diff) | |
download | scintilla-mirror-3214eed6cb64d02cba6b90631a7013a872994bd6.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 |