Upon finding that importing your own fonts into Codea’s font library simply isn’t possible, I wanted to challenge any of you professional Codea coders out there with lot’s of free time to create a one class function that looks something like this:

function text(string,x,y,size,textmode)
--Code goes here

Within this function there should preferably be clearly marked sprite inputs for each basic character (A-Z, 0-9, and all of the punctuation characters). The whole idea for this function is to make something that enables a person to design their own font set in the form of a series of sprites, each with a character in that font set, and then insert each of these characters into the appropriate sprite plugins within the function’s output. This person could then hypothetically be able to call this function any number of times with the string they want drawn, that string’s x and y position, that string’s size, and the strings textmode (CENTER, or CORNER), which would draw the appropriate sprites lined up to form the text he entered while following the parameters he set. An example of this function being called would look like this:


This would not only help me but a lot of other people who wish to include text with custom fonts in their projects that really follow their design style. This alone shouldn’t be an easy task, but if any of you really wanted to make the project more challenging or improve the functions variety, another parameter that could be added to the function would be: linewidth, which would determine how long a single line of text could be, for those who want to write multi-lined paragraphs. Any input is appreciated.

Just to be clear, this code does not have to be limited to within one functions parameters. Any number of tables and loops could be added and any number of global variables can be defined if necessary. But again it would be preferable if this code could be limited to just one class, since the idea of this function is to be able to integrate it via copy and paste into another project.

You can use custom fonts in Codea. There are several apps on the store that allow you to install new system fonts (they do this by adding a profile). Although these fonts won’t show up in the font picker, you can still type their name in manually and use them. In fact, there are a number of system fonts that don’t show up in the font picker, such as DIN Alternate and DIN Condensed.

Eg: font("DINAlternate-Bold") not in the font picker, but it is a system font available to be used.

There are several apps that install new fonts on the iPad. I use one called FondFonts. You drag and drop the new font onto FondFonts in iTunes file sharing, then in the app you install the font as a new system profile on the iPad. It also lets you browse the system fonts (though it only lets you see a text sample for the custom fonts, not the system one, which is annoying), which is when I realised that the Codea font picker doesn’t have all the system fonts.

@yojimbo2000 That is a much simpler alternative, thanks. I was under the misconception that you could not do this based on an old discussion I found on these forums.