So I tried getting using ATSUI to get the font information, but I
can't seem to get that to draw anything:

        ATSUFindFontFromName(REALCString(fontName),
strlen(REALCString(fontName)), kFontFullName, kFontNoPlatform,
kFontNoScript, kFontNoLanguage, &fontID);
        ATSFontRef atsFontRef = FMGetATSFontRefFromFont(fontID);
        CGFontRef cgFont = CGFontCreateWithPlatformFont(&atsFontRef);
        CGContextSetFont (myContext, cgFont);
        CGContextSetFontSize(myContext, fontSize);
        CGContextSetTextDrawingMode(myContext, kCGTextStrokeClip);
        CFRelease(cgFont);
        cgFont = NULL;
        
        CGContextShowTextAtPoint(myContext, x, r.bottom - y,
REALCString(text) , strlen(REALCString(text)));

I would also still like to know what I should be using instead of
REALCString if REALCString is going to cause problems.

--Seth



On Wed, Nov 17, 2010 at 4:59 PM, Real Basic <[email protected]> wrote:
> I'll look into ATSUI again.
>
> So if REALCString and passing the C String can make trouble, what
> should I be passing instead?
>
> --Seth
>
>
> On Wed, Nov 17, 2010 at 4:19 PM, Christian Schmitz
> <[email protected]> wrote:
>>
>> Am 17.11.2010 um 21:04 schrieb Real Basic:
>>
>>> CGContextSelectFont (myContext, REALCString(fontName),fontSize,
>>> kCGEncodingMacRoman);
>>
>> Well, a REALstring could be in unicode encoding, so using REALCString and 
>> passing the C String can make trouble.
>>
>>> CGContextShowTextAtPoint(myContext, x, r.bottom - y, REALCString(text)
>>> , strlen(REALCString(text)));
>>
>> CGContextShowTextAtPoint is more for debug output than for real world 
>> application usage.
>> You'd better use ATSUI or something else to get a better drawing. Especially 
>> a better font handling with automatically substitution.
>>
>> Greetings
>> Christian
>>
>> --
>> See you in Atlanta (USA) at the REAL Studio Summit 2011
>>
>> Registration and details here:
>> http://arbpmembers.org/real-studio-summit-2011/
>>
>>
>>
>> _______________________________________________
>> Unsubscribe or switch delivery mode:
>> <http://www.realsoftware.com/support/listmanager/>
>>
>> Search the archives:
>> <http://support.realsoftware.com/listarchives/lists.html>
>>
>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to