Results 1 to 3 of 3

Thread: I need help using CL_Font with a System font on the Mac

  1. #1
    Serf
    Join Date
    Jul 2007
    Posts
    2

    Default I need help using CL_Font with a System font on the Mac

    I am trying to use a System font on the Mac with CL_Font, but I'm failing and I cannot find any sample code in the Examples.

    I am trying this:

    CL_Font fonta("/Library/Fonts/Apple Symbols.ttf", 12);
    printf("Just created fonta\n");
    if(bool())
    {
    printf("fonta is valid\n");
    }
    else
    {
    printf("fonta is NOT valid\n");
    }

    This results in the output:

    Just created fonta
    fonta is NOT valid

    Executable “LearningClanLib” has exited due to signal 10 (SIGBUS).

    Any working sample code would be much appreciated!

  2. #2
    Peasant
    Join Date
    Jul 2007
    Posts
    6

    Default

    Hi,
    I'm not sure (at least from what I've read in the tutorial) that this is what you're supposed to be doing (ie. I doubt you can load ttf directly, but you can use pregenerated bitmap fonts, although that means you'll lose some of the functionality, like good kerning etc). See http://clanlib.org/docs/clanlib-0.8....verview-1.html .

    Anyway, you've asked for a snippet, this is what I use (you need to create your own font.png, or use some of the font's supplied with the examples. Beware, there has to be a completely transparent vertical line between letter/glyphs. Hope this helps
    Code:
    CL_SpriteDescription glyphs_desc;
    
    glyphs_desc.add_alphaclipped_frames(CL_PNGProvider("gfx\\font.png"));	
    	
    CL_Sprite font_glyphs(glyphs_desc);
    
    font = CL_Font(font_glyphs, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789:;_-.,*~!@#$%^&*()[]<>?");

  3. #3
    Serf
    Join Date
    Jul 2007
    Posts
    2

    Default Using a system font versus creating my own font

    Thank you for your reply, Caesar.

    As the documentation you referred to says: "ClanLib makes it possible to create your own font in an image file OR [emphasis added] use existing system fonts." I want an example of using an existing system font, not of creating my own font. I haven't found any examples of this yet. Does everyone create their own font rather than use a system font?

Similar Threads

  1. New to Novashell: Is there a Battle System?
    By Joe Rossi in forum Novashell Game Creation System
    Replies: 2
    Last Post: 06-14-2007, 07:41 AM
  2. Browse system missing
    By Razor in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 01-24-2007, 09:32 AM
  3. Payment system
    By in forum Funeral Quest
    Replies: 0
    Last Post: 12-15-2002, 07:46 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •