Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CFString, Unicode & ascii text

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Carbon
Mac Carbon  
Author Message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Mar 01, 2007 12:39 am    Post subject: CFString, Unicode & ascii text Reply with quote

Non ASCII characters in CFString litteral, HELP!

"I am puzzled by this warning in some programs. I am French and use a lot
of accented chars. Worse, although these accented chars get typed correctly
in my source code files, when they are sent programatically for ex. to some
TextField they appear as garbage."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Mar 01, 2007 12:55 am    Post subject: Reply with quote

Spy++ on mac

"Look in ControlDefinitions.h Are you using
CreateEditUnicodeTextControl() and CFStringRefs?

And is you are still using Dialog Manager, you can put them in your
dialogs with CNTL resources, once you know that:
kControlEditUnicodeTextProc = 912,
kControlEditUnicodeTextPasswordProc = 914 "
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Apr 10, 2007 11:18 pm    Post subject: Reply with quote

Carbon List: Re: Basic CFRelease() Questions

"Don't be afraid to use it, but remember you can NOT use 8-bit ASCII characters
with it, for example the TM or Copyright characters. If you need those in a CFString,
use CFStringCreateWithCString(), pass kCFStringEncodingMacRoman, and pray Smile."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Wed Apr 11, 2007 4:44 pm    Post subject: Reply with quote

#include <CFString.h>

CFSTR - CFString Reference

Declared as: CFStringRef CFSTR (const char *cStr);

"Creates an immutable string from a constant compile-time string."

Code:
#ifdef __CONSTANT_CFSTRINGS__
#define CFSTR(cStr)  ((CFStringRef) __builtin___CFStringMakeConstantString ("" cStr ""))
#else
#define CFSTR(cStr)  __CFStringMakeConstantString("" cStr "")
#endif


"CFSTR(), not being a "Copy" or "Create" function, does not return a new
reference for you. So, you should not release the return value."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Sat Apr 21, 2007 8:05 pm    Post subject: Reply with quote

ADC: CFStringCreateWithBytes()

Code:
CFStringRef CFStringCreateWithBytes (
 CFAllocatorRef   alloc,
 const UInt8     *bytes,
 CFIndex          numBytes,
 CFStringEncoding encoding,
 Boolean          isExternalRepresentation
);

"This function handles character data in an 'external representation'
format by interpreting any BOM (byte order marker) character and
performing any necessary byte swapping."

CFStringEncoding - CFString Reference

Code:
typedef UInt32 CFStringEncoding;

"This type is used to define the constants for the built-in encodings (see
'Built-in String Encodings' for a list) and for platform-dependent encodings
(see 'External String Encodings')."

Code:
enum {
   kCFStringEncodingMacRoman = 0,
   kCFStringEncodingWindowsLatin1 = 0x0500,
   kCFStringEncodingISOLatin1 = 0x0201,
   kCFStringEncodingNextStepLatin = 0x0B01,
   kCFStringEncodingASCII = 0x0600,
   kCFStringEncodingUnicode = 0x0100,
   kCFStringEncodingUTF8 = 0x08000100,
   kCFStringEncodingNonLossyASCII = 0x0BFF,
   
   kCFStringEncodingUTF16   = 0x0100,
   kCFStringEncodingUTF16BE = 0x10000100,
   kCFStringEncodingUTF16LE = 0x14000100,
   kCFStringEncodingUTF32   = 0x0c000100,
   kCFStringEncodingUTF32BE = 0x18000100,
   kCFStringEncodingUTF32LE = 0x1c000100

} CFStringBuiltInEncodings;
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Sun Apr 22, 2007 6:00 pm    Post subject: Reply with quote

ADC: Good old TextEdit Reference and a list of a few more Deprecated
Control Manager Functions
.

"You should use MLTE to replace TextEdit functions in your existing applications.
For more information, see Handling Unicode Text Editing With MLTE."


CreateEditUnicodeTextControl() - Control Manager Reference

Code:
OSStatus CreateEditUnicodeTextControl (
   WindowRef     window,
   const Rect   *boundsRect,
   CFStringRef   text,
   Boolean       isPassword,
   const ControlFontStyleRec *style,
   ControlRef   *outControl
);


HandleControlClick() - Control Manager Reference

Code:
ControlPartCode HandleControlClick (
   ControlRef inControl,
   Point inWhere,
   EventModifiers inModifiers,
   ControlActionUPP inAction
);
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Sep 30, 2007 11:35 pm    Post subject: Reply with quote

CSCopyMachineName - Memory Management Utilities Reference

"Returns a reference to the CFString that represents the computer name."

CFStringRef CSCopyMachineName ();

CSCopyUserName - Memory Management Utilities Reference

"Returns a reference to the CFString that represents the user name."

CFStringRef CSCopyUserName (Boolean useShortName);
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Sat Oct 27, 2007 7:10 pm    Post subject: Reply with quote

adc - Supporting Unicode Input in Applications

"In this Apple event model of text event handling, your application calls
WaitNextEvent() and passes low-level keyboard events to the Text Services
Manager through the function TSMEvent()."

"If your application does not currently support the Text Services Manager,
you should first implement support for the Text Services Manager."


Text Services Manager

"TSMEven() no longer needs to be called, so it is not included in Carbon."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Nov 01, 2007 6:45 pm    Post subject: Reply with quote

adc - GetApplicationTextEncoding - Application Manager Reference

Code:
TextEncoding GetApplicationTextEncoding (
   void
);

"Your application needs to use the application text encoding when it creates a
CFString from text stored in Resource Manager resources. Typically the text
uses a Mac encoding such as MacRoman or MacJapanese. For more information,
see Programming With the Text Encoding Conversion Manager."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Apr 23, 2008 1:56 pm    Post subject: Reply with quote

adc - TXNDrawCFStringTextBox - Multilingual Text Engine Reference

Code:
OSStatus TXNDrawCFStringTextBox (
   CFStringRef iText,
   Rect       *ioBox,
   ATSUStyle   iStyle,
   const TXNTextBoxOptionsData *iOptions
);

"You can use the TXNDrawCFStringTextBox function to display mono-style
Unicode text. You do not need to initialize MLTE to use this function because
it uses Apple Type Services for Unicode Imaging (ATSUI) directly."


* ATSUStyle - ATSUI Reference

* Attribute Tags - ATSUI Reference

"Specify attributes that can be applied to a style object, a text layout object,
or a line in a text layout object."


Code:
typedef struct OpaqueATSUStyle *ATSUStyle;

* TXNTextBoxOptionsData - Multilingual Text Engine Reference
Code:
struct TXNTextBoxOptionsData {
   TXNTextBoxOptions optionTags;
   Fract   flushness;
   Fract   justification;
   Fixed   rotation;
   void   *options;
};
typedef struct TXNTextBoxOptionsData TXNTextBoxOptionsData;

"flushness - Indicates whether text should be displayed flush left, flush right,
or centered in the text box. You should use one of the line justification con-
stants defined in ATSUnicode.h. The possible values are kATSUStartAlignment,
kATSUEndAlignment, and kATSUCenterAlignment."


Last edited by delovski on Sat May 24, 2008 10:16 pm; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Apr 23, 2008 3:44 pm    Post subject: Reply with quote

adc - ATSUCreateStyle - ATSUI Reference

Code:
OSStatus ATSUCreateStyle (
   ATSUStyle *oStyle
);

"To make changes to the default style attribute values, you can call the
function ATSUSetAttributes(). To set font features and font variations,
call the functions ATSUSetFontFeatures() and ATSUSetVariations(),
respectively.

To dispose of a style object, call the function ATSUDisposeStyle."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jun 11, 2008 10:54 pm    Post subject: Reply with quote

adc - ATSUDrawText - ATSUI Reference

Code:
OSStatus ATSUDrawText (
   ATSUTextLayout iTextLayout,
   UniCharArrayOffset iLineOffset,
   UniCharCount iLineLength,
   ATSUTextMeasurement iLocationX,
   ATSUTextMeasurement iLocationY
);

"The ATSUDrawText function renders a range of text at a specified
location in a QuickDraw graphics port or Quartz graphics context. This
function renders text to the first soft line break it encounters."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Thu Jun 12, 2008 3:27 pm    Post subject: Reply with quote

adc - GetThemeTextDimensions - Deprecated Appearance Manager Functions

Code:
OSStatus GetThemeTextDimensions (
 CFStringRef    inString,
 ThemeFontID    inFontID,
 ThemeDrawState inState,
 Boolean        inWrapToWidth,
 Point         *ioBounds,
 SInt16        *outBaseline
);

"GetThemeTextDimensions measures the given string using the font and
drawing state you specify. It always reports the actual height and baseline.
It sometimes reports the actual width. It can measure a string that wraps.
It is unicode savvy, although only partially so under CarbonLib."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Jan 30, 2018 3:56 pm    Post subject: Reply with quote

the list - Retrieving font nums to use with TextFont

"My experience with trying to nurse a Carbon-based program through the
font mess is that you need to have a multiple API approach."
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Carbon All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group