Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / July 2003



Tip: Looking for answers? Try searching our database.

ATSUDrawTextDraw and Command-Shift Characters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sanford Selznick - 04 Jul 2003 19:13 GMT
I'm drawing some unicode text with ATSUDrawText into a GrafPort.

I'm trying to draw command-shift as they appear in a menu.  (Flower and
Up Arrow.)

I create the string with:

 UniChar cchars[3] =
    { 0x2318, 0x21e7, theKeyChar };

 CFStringRef s =
    CFStringCreateWithCharacters(CFAllocatorGetDefault(), cchars, 3);

 DrawString(s, someRect);

But all I get are boxes where the command-shift should be.

All lower 128 characters are working well.  (A-Z, etc.)  I got the
numbers for command and shift from the character palette that is
available from the International control panel -> input menu.

What am I doing wrong?

Thanks,
 Sanford

Here's the code below, in case it's necessary:

----

// Include PowerPlant ATS Helpers
#include <UATSUI.h>

void CSomeClass::DrawString(CFStringRef inString, Rect rect)
{
 CGContextRef windowContext = NULL;
 volatile OSStatus err = noErr;
 
 GrafPtr port = UQDGlobals::GetCurrentPort();
 
 err = ::CreateCGContextForPort(port, &windowContext);
 if (err) {
   return;
 }
 
 err = ::SyncCGContextOriginWithPort(windowContext, port);
 if (err) {
   return;
 }
 
 LATSUIStyle style;
 
 UniChar unicode[1024] = {0};
 CFStringGetCharacters(
        inString,
        CFRangeMake(0, CFStringGetLength(inString)),
        unicode);

 LATSUITextLayout layout(
          unicode,
          kATSUFromTextBeginning,
          kATSUToTextEnd,
          CFStringGetLength(inString),
          style);
 
 CGContextSetAlpha(windowContext, 1.0);
 CGContextSetTextDrawingMode(windowContext, kCGTextFill);

 layout.SetCGContext(windowContext);

 layout.DrawOneLineAt(
            kATSUFromTextBeginning,
            kATSUToTextEnd,
            IntToFixed(rect.left),
            IntToFixed(rect.top - 23));
}
Sanford Selznick - 11 Jul 2003 16:06 GMT
> I'm drawing some unicode text with ATSUDrawText into a GrafPort.
>
> I'm trying to draw command-shift as they appear in a menu.  (Flower and
> Up Arrow.)

The solution was to use DrawThemeTextBox instead.

-Sanford
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.