Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-10-2009, 06:29 AM   #1 (permalink)
Divine avenger
 
Johanovski's Avatar
 
Join Date: Nov 2009
Location: Vic, Catalunya (Spain)
Posts: 320
Johanovski is on a distinguished road
Default Adding fonts to my app

Hi all!

I'm developing a game and I want to include some fonts in it (not included with the iPhone). How can I do this? I have both .otf and .ttf fonts, wich format is preferred? Once fonts are included is there anything that I have to do before printing text with these fonts? I'm working in an OpenGL ES project and I'm writing text through the Texture2D class, wich calls a method for drawing a string and processes the font like this:

************************************************** ***********

- (id) initWithString: (NSString* )string dimensions: (CGSize)dimensions alignmentUITextAlignment)alignment fontName: (NSString* )name fontSize: (CGFloat)size
{
NSUInteger width,
height,
i;
CGContextRef context;
void* data;
CGColorSpaceRef colorSpace;
UIFont * font;


font = [UIFont fontWithName:name size:size];

(... some code ...)

[string drawInRect:CGRectMake(0, 0, dimensions.width, dimensions.height) withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:alignment];

(... some code ...)

************************************************** ***********

The question is: a new font will be processed with this method, even after included in my resources directory?

Thanks in advance!
Johanovski is offline   Reply With Quote
Reply

Bookmarks

Tags
add, fonts, texture2d

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 344
12 members and 332 guests
akacaj, alexP, ClerurcifeDer, Duncan C, givensur, glenn_sayers, guusleijsten, JmayLive, NetGuru, Punkjumper, whitey99, yys
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:42 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0