PDA

View Full Version : Text formatting



BigBMan
03-09-2011, 07:20 AM
Can you point me to an explanation of what formatting options are available with text rendering? I notice the "'7" for Bold. Are there other options?

Seth
03-09-2011, 01:05 PM
The text formatting codes all change the color. Open the .txt file with the associated font to see what the colors and codes are.

For instance, RTbareBones/media/interface/font_trajan.txt has this:



`format code specifications for inline font formatting (SANSI for those that remember the BBS days)

//add_format_color|<character code>,r,g,b

add_format_color|0|255, 255, 255|//default

add_format_color|2|0, 160, 0|//dark green
add_format_color|3|0, 160, 160|//dark cyan
add_format_color|4|160, 0, 0|//dark red
add_format_color|5|160, 0, 114|//dark purple
add_format_color|6|150, 144, 0|//brown
add_format_color|7|160, 160, 160|//gray
add_format_color|8|132, 108, 70|//dark brown
add_format_color|9|0, 0,255|//dark brown
add_format_color|0|0, 255,0|//bright green
add_format_color|!|0, 255,255|//bright cyan
add_format_color|@|232, 0,0|//bright red
add_format_color|#|232, 0,166|//bright purple
add_format_color|$|255, 255,0|//bright yellow

These are encoded into the .rtfont file when rtpack.exe builds in the update_media.bat. (btw I'll add something to the wiki about making new fonts if anybody ever needs it.. the font_trajan.bmfc file can be opened by BMFont, a free font tool, could be used as an example)

So, example of doing some colors:

GetFont(FONT_SMALL)->DrawScaled(0, 0, "white `2Green `3Cyan `4Red `5Purp ");

Pro tip: doing `` will "undo" the last color change, they work like a stack, ie: "`2Green green green... `3Cyan! ``back to green".