[Include] Gametext/textdraw encoding fix
#1

After some testing I've found that you can use the following characters in gametext and textdraws:
А Б В Д Ж З И Й К Л М Н О П Т У Ф Ц Щ Ъ Ы Ь Я а б в д ж з и й к л м н о п т у ф ц щ ъ ы ь С с ї Ў °
but you need to convert your string's encoding first to what I am calling the GTASA charset. The fix I'm providing will convert from Windows-1252 which is what people usually have as their ANSI charset if their language is written with the above characters.
Код:
stock convert_encoding(string[])
{
	new original[50] = {192,193,194,196,198,199,200,201,202,203,204,205,206,207,210,211,212,214,217,218,219,220,223,224,225,226,228,230,231,232,233,234,235,236,237,238,239,242,243,244,246,249,250,251,252,209,241,191,161,176};
	new fixed[50] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,94,124};
	new len = strlen(string);
	for (new i; i < len; i++) {
		for(new j;j < 50;j++) {
			if(string[i] == original[j]) {
				string[i] = fixed[j];
				break;
			}
		}
	}
}
Example of usage:
Код:
convert_encoding(str);
GameTextForAll(str,5000,4);
So far I've only tested this only for strings from text files and command input as I don't like to write code containing non ASCII characters.

If you want to convert from another charset, you can use this list I compiled:
Код:
char	GTASA code point
А	128
Б	129
В	130
Д	131
Ж	132
З	133
И	134
Й	135
К	136
Л	137
М	138
Н	139
О	140
П	141
Т	142
У	143
Ф	144
Ц	145
Щ	146
Ъ	147
Ы	148
Ь	149
Я	150
а	151
б	152
в	153
д	154
ж	155
з	156
и	157
й	158
к	159
л	160
м	161
н	162
о	163
п	164
т	165
у	166
ф	167
ц	168
щ	169
ъ	170
ы	171
ь	172
С	173
с	174
ї	175
Ў	94
°	124
Hopefully this will help some of you. I'm aware it's not the most efficient function and doesn't even convert all of Windows-1252 but maybe if we're lucky someone better at coding than me will find it useful, rewrite it and share their solution.

Here's a screenshot of it in action:
http://i.imgur.com/T2Zzf.jpg
Reply
#2

The SS link is broken, and though not useful for me, this seems good..
Reply
#3

Good, I go test it.
Reply
#4

Works for me. Big thanks, mooman.

PS: Also gave you some rep for it.
Reply
#5

i am not sure why we need to use them mostly. Ye i know some languages have them characters in their sentences but still.

Anyway good attempt
Reply
#6

Wow, I've never knew that, thanks!
We use accent marks in Italian language and sometimes it looks very bad if you replace и with e' in textdraws.
Reply
#7

How about ąčęėįљųū characters?
Reply
#8

Those glyphs aren't in the GTASA font files so it's not possible AFAIK.
Reply
#9

can use in thai language
Reply
#10

Is it possible to use ©?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)