Mac Carbon |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Mar 01, 2007 12:39 am Post subject: CFString, Unicode & ascii text |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Mar 01, 2007 12:55 am Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Apr 10, 2007 11:18 pm Post subject: |
|
|
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 ." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Wed Apr 11, 2007 4:44 pm Post subject: |
|
|
#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 |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Sat Apr 21, 2007 8:05 pm Post subject: |
|
|
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 |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Sun Apr 22, 2007 6:00 pm Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Sep 30, 2007 11:35 pm Post subject: |
|
|
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 |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Sat Oct 27, 2007 7:10 pm Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Nov 01, 2007 6:45 pm Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Apr 23, 2008 1:56 pm Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Apr 23, 2008 3:44 pm Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jun 11, 2008 10:54 pm Post subject: |
|
|
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 |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Thu Jun 12, 2008 3:27 pm Post subject: |
|
|
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 |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Jan 30, 2018 3:56 pm Post subject: |
|
|
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 |
|
|
|