about making a letter sprite

i wanna try to making a letter’s codea sprite on win7, its good on win7, but its not good on ipad, and i dont know how to upload it so that everyone could check it out to make some suggestions.
there is a download : http://pan.baidu.com/s/1mgC7EoK

Hi @techdojo, i love beer, thanks! I never tried to check what additional fonts are treated within xcode so far. But i’ve noted down the info.plist trick for future occurrences. Sooo, thank you too! :smiley:

What you need to do is create an image and then call setContext() to render to that image and then draw the letter multiple times.

So in your example you’d set the color to grey and then draw the letter a few times, offseting the x & y values a little to create the dropshadow. Then set the color to red and draw it again in the original place to create the stroke effect and then lastly set the color to white and reduce the size slightly to create the inner color.

You will probably want to set the textMode() to CENTRE to make lining up the images easier.

I used a similar method to draw my gradient text.

What I’d do is wrap all of the above into a function that you can call for each letter.

Hope this helps


@TechDojo - thanks, at first i tried your method and use italic font, i couldnt accomplish it, so i wanna use sprite and regular font.

Your method should work with any font.

@TechDojo - please tell the values for best elegance on hd ipad: if FontSize = 256, RimThickness = ,ShadowOffset = , and other vars.

@firewolf I’m not sure what you’re after, but is it like this. I tried your link above, but I didn’t see anything.

function setup()


function draw()

function letter(v,x,y)
    for z=1,10 do

@firewolf - sorry, that really depends on what effect your trying to achieve.
What I’d suggest is creating a test program where each of those are set via parameters and then when you’ve found ones that look nice then you’ll be able to copy down the values to use in your main project.

@dave1707 thanks, if i wanna add win7’s font into codea, does it work? like adding sprite into codea?

@TechDojo thanks, if i wanna add win7’s font into codea, does it work? like adding sprite into codea?

hi @firewolf, don’t know if this what you’re after and if suits @techdojo suggestions, but I usually add up custom fonts to codea with a third party app named AnyFont, you can grab it for 2 or 3 Euro on the appstore. It will allow you to install additional fonts straight away to your ipad without any mac/win sync. Mind that after installing a new font, you won’t be seeing it in the ipad font list, but it will be working either way if you type in the correct naming in the font() function. such as font(“bitdust”)

hope this helps

@deactive thanks, if i wanna add win7’s font to codea like adding sprite to codea, is it possible?

@deactive - DUDE! you’re a star, I’ve been looking for a way to add custom fonts to Codea for ages. Do you know if they appear ok when you do an xCode export or do you need to add them to the project yourself.

I’m surprised that Apple let this one through but I’m definitely getting this whilst I can!

As for compatibility - There is some code floating around that just calls font() with a text string like you suggest and through a bit of trial and error I discovered a few extra fonts that work like “Chalkduster” that I think is installed with Keynote.


I’ve brought Any Font and installed my custom font (.otf format) as per the tutorial.
I restarted Codea and the font is available if I access it via it’s name - instead of using the font picker.

I exported the app as an xCode project - the custom font is NOT included (not really surprised).

I opened the project in xCode and added the font as a resource in the Resource folder (in the same place as the default Codea ones.

Ran the project and my font wasn’t recognised :frowning:

After five minutes of tinkering I edited the -info.plist file and in the section “Fonts provided by application” I added an extra entry with the font file name and tried again.


Custom font’s IN Codea - and in my exported xCode project!!! #Result!

(yes this is a big deal for me - it was the only bone of contention with the designer!)

So @deactive - that’s one massive beer I owe you!