Font named "Osaka\x81\x7c\x93\x99\x95\x9d"

Discussion in 'Mac Programming' started by idelovski, Oct 23, 2008.

  1. idelovski macrumors regular

    Joined:
    Sep 11, 2008
    #1
    In Carbon,

    using some code that deals with fonts I got "Osaka\x81\x7c\x93\x99\x95\x9d" as a font name. Is there some document describing such names and how to properly use them? Should I filter them out and how?

    For example, I had trouble converting it to CFString. CFStringCreateWithBytes() returns NULL when I pass that name.

    Googling around didn't help too much, although there are few sightings of "Osaka\x81\x7c\x93\x99\x95\x9d" string on the web.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Looks like you're not dealing with a unicode string properly. Can you post some code?
     
  3. Littleodie914 macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #3
    Yea you're definitely getting some hexadecimal code chunked on the end there. I wish I had more information for you, but without seeing what you're trying to do, I think that's all we can conclude! :)
     
  4. idelovski thread starter macrumors regular

    Joined:
    Sep 11, 2008
    #4
    I think I got it.

    Code:
    char * fontName = "Osaka\x81\x7c\x93\x99\x95\x9d";
    int    strLen = strlen (fontName);
    This returns NULL:
    cfStr = CFStringCreateWithBytes (NULL, (const UInt8 *) fontName, strLen, kTextEncodingWindowsLatin2, FALSE);

    And this returns a proper CFString:
    cfStr = CFStringCreateWithBytes (NULL, (const UInt8 *) fontName, strLen, kTextEncodingISOLatin2, FALSE);

    I'm on Tiger.
     

Share This Page