I think I get what you're trying to do, but those functions won't do what you expect.
The
EnableVariableWidth function makes it so each character width is reduced to the area in your font that isn't transparent. This has the effect of making the
spacing between characters be reduced where possible, and that allows to the text to look more natural, rather than
monospace like this... where every character takes up the same width.
SetCharacterWidth, should just set the width of spacing between a character manually. I admit, someone should have named this a bit nicer, since it has no effect on the actual width of the character, just how much "space" it occupies. The example for this is correct, at any rate. Character literals
are ints in Verge (since it has no char type). Character literals and string literals are different, with characters using
' single quotes and being converted into a number representing its ASCII code, while strings use
" double quotes. (To store a character from its integer code into a string, you use the
chr(int character) function to convert it back, so 'A' == 65, and chr(65) or chr('A') are the same as the string "A").
I have a feeling that your font images are the actual problem. They are probably
actually 12 pixels in size. Setting the "character width" of fonts will not stretch or shrink the font to a different size. This just used to determine how much
horizontal space to occupy for a character (which affects where the next characters within the same
PrintString appear). You won't see this at all if you draw one letter in a single
PrintString, but if you print a word or sentence, you'll notice this effect.
These are pixel fonts, and can only be drawn at one size. To make smaller or larger fonts, you need to actually create or find new font images.
The other method around this is to not
PrintString directly to the screen, but rather make an image with
NewImage beforehand, draw the text at normal size onto that image, and then
ScaleBlit or
RotScale it afterwards.
Hope that helps.
This message was last edited by the author on 2010-07-29 23:23:36