Thank you. That at least got my test function to return the font name,
however, I am still having issues with fonts in general. Some fonts
draw, some fonts draw blocks or weird character and some fonts draw
nothing at all.

I got this line of code from Apple's Quarzt 2D Text web page:

CGContextSelectFont (myContext, REALCString(fontName),fontSize,
kCGEncodingMacRoman);
CGContextShowTextAtPoint(myContext, x, r.bottom - y, REALCString(text)
, strlen(REALCString(text)));

Most fonts seem to work with this, but not all. Take Helvetica for
example. Most of the Helvetica fonts draw, however Helvetica Neue
Condensed Black and Bold do not draw anything.

Also, with this code, Webdings and Wingdings# draw squares. But if I
change the code to:

CGContextSelectFont (myContext, REALCString(fontName),fontSize,
kCGEncodingFontSpecific);
CGContextShowTextAtPoint(myContext, x, r.bottom - y, REALCString(text)
, strlen(REALCString(text)));

then the 'ding fonts print correctly, but the rest of the fonts show
odd characters. Neue Condensed Black and Bold still draw nothing.

I have a feeling that this is a text encoding issue. Is there
something additional that I need to do to REALCString(text) before
issuing CGShowText?

--Seth


On Tue, Nov 16, 2010 at 3:40 PM, Theodore H. Smith <[email protected]> wrote:
> This is how I get a shell path from a folderitem.
>
>        REALString s = 0;
>        if ( ! REALGetPropValueString( fol, "ShellPath", &s ) ) {
>                return 0;
>        }
>
>        // do work on "s".
>
> On 16 Nov 2010, at 20:00, [email protected] 
> wrote:
>
>> From: Real Basic <[email protected]>
>> Subject:
>> To: REALbasic Plugins <[email protected]>
>> Message-ID:
>>       <[email protected]>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Thanks.
>>
>> I got the number based properties to work (font size, forecolor, etc),
>> but I'm having issues with g.TextFont.
>>
>> The code I'm using is:
>>
>> REALGetPropValue((REALobject)context, "TextFont", &fontName);
>> REALGetPropValue((REALobject)context, "TextSize", &fontSize);
>> CGContextSelectFont (myContext, &fontName, fontSize, kCGEncodingMacRoman);
>>
>> But this doesn't appear to work. So I wrote another function that
>> would just returns the graphic objects font name:
>>
>> char SKSFontNamefunc(REALgraphics context)
>> {
>>       char fontName;
>>       REALGetPropValue((REALobject)context, "TextFont", &fontName);
>>
>>       return fontName;
>> }
>>
>> But this routine always returns blank.
>>
>> The issue is probably my lack of font knowledge, my lack of c string
>> knowledge or both. Ultimately, I am trying to set the font of my
>> CGContext to the same font as the graphics object.
>
> --
> http://elfdata.com/plugin/
> "String processing, done right"
>
>
>
> _______________________________________________
> 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