Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by salsa

How I create fonts with accent characters, such as:

é, á, ä, ì

???

1 decade ago by aclelland

I took a brief look at the font class, it looks like it expects the first char to be a space and then keeps going until it reaches the end of the image (by default the letter ~)

Since unicode chars tend to have very high indexes and you don't want to have to maintain an image with over 1000 chars I think one possible solution is to manually create an image with the unicode letters in it, you could do this in photoshop, paint, etc.

The game will expect the 1st letter after ~ to be an ¡ (ASCII: 128) which means you can add code into the font::draw method which translates character é (233) to ¡(128)

font.js line 48
var c = text.charCodeAt(i);
switch( c )
{
   case 233: c = 128;break;  
}

This will cause the draw method to draw your é. I've nottested this but it's roughly how I used to deal with cyrillic letters when I programmed J2ME games.
Page 1 of 1
« first « previous next › last »