GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

Personally I would prefer to program in Python (cleaner code), but nobody has that on his PC. Well, most people don't. Nice thing of Java (Processing) is that I don't need to load/add/import anything. It works right out of the box.

Hmmm... dilemma

Python is used more in other programs (Blender, GIMP, Inkscape), maybe I will just stick with Python. Is a better long term investment. :)
"Mmmm, your eyes are so beautiful."
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

Java sucks because i said already, you cant make this and that. I would even prefer JavaScript over Java if you wanna to display it on a website. Although i hate JS too for its compatibility problems... so i prefer PHP even if you cant do realtime crap with it, you dont need to.

PHP isnt slow, you dont need to work on pixel-by-pixel-level, there is a library called GD which is enough fast for a thing like this. And i think it even supports TTF fonts or etc.

Programming language syntax doesnt matter for the user who uses the product, so stop thinking in that way.

I dont think its necessary for the user to display the written text in real time. Its not that a big deal if you get it wrong once, you can fix it easily, and rarely you need to fix anything.
Personally I would prefer to program in Python (cleaner code), but nobody has that on his PC
Again, PHP doesnt need anything installed, it works as if it was normal JPG or PNG image.
Nice thing of Java (Processing) is that I don't need to load/add/import anything. It works right out of the box.
Java doesnt work right out of the box. I just had to install XP when my HDD crashed, so i didnt have java installed. with PHP its practically the same, you dont have to install anything if you own a server already, they probably have GD library there. you could ask Sektor to use his server, or Vike's server.

If you can install python on a basic web-server then thats great, but i dont think it has such a functionality as PHP does "out of the box".

I could make the PHP code for ya if you send the font files.
User avatar
Sektor
Boss
Boss
Posts: 1453
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Sektor »

It's good to have applications that work offline too. The server and your internet connection will go down sometimes.
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

My point is that if hes offering a web application, it shouldnt be Java when PHP is much better in it.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

You are right, for a web app like this, PHP is the way to go. But what if I want the program to work offline, than Java is not that bad? Python thought is better, I just looked at a comparison page and they are right. To get something done in Java it takes you 5x more time than in Python. Anyway, if you want to help, I will stick this time with php. :-)

The way I currently create the image, is this way:

First all the letters are separate (exported from gta2). Than I look at each one to see the width and than drop it in one image. Result is this:
alphabet_normal.png
alphabet_normal.png (4.03 KiB) Viewed 25982 times
After that I make a multi array that will contain info about this image. Each index number will represent the characters integer value. So for example, if the array is called alphabet_normal. alphabet_normal[97] will correspond to the letter 'a'. Than the first index of the index is the x position in the image and the second index is the width.

So alphabet_normal[97][0] gives 60, (that is 60 pixels from the left from the image). alphabet_normal[97][1] gives 12 (width of the letter a).

The height is all 25 for normal font, 64 for large font etc.

This is the data array for normal font:
[mis]{0,0}, //0
{0,0}, //1
{0,0}, //2
{0,0}, //3
{0,0}, //4
{0,0}, //5
{0,0}, //6
{0,0}, //7
{0,0}, //8
{0,0}, //9
{0,0}, //10
{0,0}, //11
{0,0}, //12
{0,0}, //13
{0,0}, //14
{0,0}, //15
{0,0}, //16
{0,0}, //17
{0,0}, //18
{0,0}, //19
{0,0}, //20
{0,0}, //21
{0,0}, //22
{0,0}, //23
{0,0}, //24
{0,0}, //25
{0,0}, //26
{0,0}, //27
{0,0}, //28
{0,0}, //29
{0,0}, //30
{0,0}, //31
{0,9}, //32
{9,6}, //33
{15,11}, //34
{0,0}, //35
{26,12}, //36
{38,11}, //37
{0,0}, //38
{49,6}, //39
{55,9}, //40
{64,9}, //41
{73,12}, //42
{0,0}, //43
{85,6}, //44
{91,11}, //45
{102,6}, //46
{108,12}, //47
{120,12}, //48
{132,9}, //49
{141,12}, //50
{153,12}, //51
{165,13}, //52
{178,12}, //53
{190,12}, //54
{202,12}, //55
{214,12}, //56
{226,12}, //57
{238,6}, //58
{244,6}, //59
{0,0}, //60
{0,0}, //61
{0,0}, //62
{250,11}, //63
{261,6}, //64
{267,11}, //65
{278,11}, //66
{289,11}, //67
{300,11}, //68
{311,11}, //69
{322,11}, //70
{333,11}, //71
{344,11}, //72
{355,8}, //73
{363,12}, //74
{375,13}, //75
{388,11}, //76
{399,16}, //77
{415,11}, //78
{426,11}, //79
{437,11}, //80
{448,11}, //81
{459,11}, //82
{470,11}, //83
{481,10}, //84
{491,11}, //85
{502,12}, //86
{514,16}, //87
{530,11}, //88
{541,12}, //89
{553,10}, //90
{0,0}, //91
{0,0}, //92
{0,0}, //93
{0,0}, //94
{563,11}, //95
{0,0}, //96
{574,11}, //97
{585,11}, //98
{596,11}, //99
{607,11}, //100
{618,11}, //101
{629,11}, //102
{640,11}, //103
{651,11}, //104
{662,6}, //105
{668,8}, //106
{676,13}, //107
{689,6}, //108
{695,16}, //109
{711,11}, //110
{722,11}, //111
{733,11}, //112
{744,11}, //113
{755,11}, //114
{766,11}, //115
{777,9}, //116
{786,11}, //117
{797,12}, //118
{809,16}, //119
{825,12}, //120
{837,11}, //121
{848,10}, //122
{0,0}, //123
{0,0}, //124
{0,0}, //125
{858,13}, //126
{0,0}, //127
{0,0}, //128
{0,0}, //129
{0,0}, //130
{0,0}, //131
{0,0}, //132
{0,0}, //133
{0,0}, //134
{0,0}, //135
{0,0}, //136
{0,0}, //137
{0,0}, //138
{0,0}, //139
{0,0}, //140
{0,0}, //141
{0,0}, //142
{0,0}, //143
{0,0}, //144
{0,0}, //145
{0,0}, //146
{0,0}, //147
{0,0}, //148
{0,0}, //149
{0,0}, //150
{0,0}, //151
{0,0}, //152
{0,0}, //153
{0,0}, //154
{0,0}, //155
{0,0}, //156
{0,0}, //157
{0,0}, //158
{0,0}, //159
{0,0}, //160
{0,0}, //161
{0,0}, //162
{0,0}, //163
{0,0}, //164
{0,0}, //165
{0,0}, //166
{0,0}, //167
{0,0}, //168
{0,0}, //169
{0,0}, //170
{0,0}, //171
{0,0}, //172
{0,0}, //173
{0,0}, //174
{0,0}, //175
{0,0}, //176
{0,0}, //177
{0,0}, //178
{0,0}, //179
{0,0}, //180
{0,0}, //181
{0,0}, //182
{0,0}, //183
{0,0}, //184
{0,0}, //185
{0,0}, //186
{0,0}, //187
{0,0}, //188
{0,0}, //189
{0,0}, //190
{871,11}, //191
{882,11}, //192
{893,11}, //193
{904,11}, //194
{0,0}, //195
{915,11}, //196
{0,0}, //197
{926,16}, //198
{942,11}, //199
{953,11}, //200
{964,11}, //201
{975,11}, //202
{986,11}, //203
{997,9}, //204
{1006,9}, //205
{1015,11}, //206
{1026,10}, //207
{0,0}, //208
{1036,11}, //209
{1047,11}, //210
{1058,11}, //211
{1069,11}, //212
{0,0}, //213
{1080,11}, //214
{0,0}, //215
{0,0}, //216
{1091,11}, //217
{1102,11}, //218
{1113,11}, //219
{1124,11}, //220
{0,0}, //221
{0,0}, //222
{1135,12}, //223
{1147,11}, //224
{1158,11}, //225
{1169,11}, //226
{0,0}, //227
{1180,11}, //228
{0,0}, //229
{1191,17}, //230
{1208,11}, //231
{1219,11}, //232
{1230,11}, //233
{1241,11}, //234
{1252,11}, //235
{1263,8}, //236
{1271,8}, //237
{1279,10}, //238
{1289,10}, //239
{0,0}, //240
{1299,11}, //241
{1310,11}, //242
{1321,11}, //243
{1332,11}, //244
{0,0}, //245
{1343,11}, //246
{0,0}, //247
{0,0}, //248
{1354,11}, //249
{1365,11}, //250
{1376,11}, //251
{1387,11}, //252
{0,0}, //253
{0,0}, //254
{0,0}, //255
{0,0}, //256
{0,0}, //257
{0,0}, //258
{0,0}, //259
{1398,12}, //260
{1410,12}, //261
{1422,12}, //262
{1434,12}, //263
{0,0}, //264
{0,0}, //265
{0,0}, //266
{0,0}, //267
{0,0}, //268
{0,0}, //269
{0,0}, //270
{0,0}, //271
{0,0}, //272
{0,0}, //273
{0,0}, //274
{0,0}, //275
{0,0}, //276
{0,0}, //277
{0,0}, //278
{0,0}, //279
{1446,12}, //280
{1458,12}, //281
{0,0}, //282
{0,0}, //283
{0,0}, //284
{0,0}, //285
{0,0}, //286
{0,0}, //287
{0,0}, //288
{0,0}, //289
{0,0}, //290
{0,0}, //291
{0,0}, //292
{0,0}, //293
{0,0}, //294
{0,0}, //295
{0,0}, //296
{0,0}, //297
{0,0}, //298
{0,0}, //299
{0,0}, //300
{0,0}, //301
{0,0}, //302
{0,0}, //303
{0,0}, //304
{0,0}, //305
{0,0}, //306
{0,0}, //307
{0,0}, //308
{0,0}, //309
{0,0}, //310
{0,0}, //311
{0,0}, //312
{0,0}, //313
{0,0}, //314
{0,0}, //315
{0,0}, //316
{0,0}, //317
{0,0}, //318
{0,0}, //319
{0,0}, //320
{1470,12}, //321
{1482,7}, //322
{1489,12}, //323
{1501,12}, //324
{0,0}, //325
{0,0}, //326
{0,0}, //327
{0,0}, //328
{0,0}, //329
{0,0}, //330
{0,0}, //331
{0,0}, //332
{0,0}, //333
{0,0}, //334
{0,0}, //335
{0,0}, //336
{0,0}, //337
{0,0}, //338
{0,0}, //339
{0,0}, //340
{0,0}, //341
{0,0}, //342
{0,0}, //343
{0,0}, //344
{0,0}, //345
{1513,12}, //346
{1525,12}, //347
{0,0}, //348
{0,0}, //349
{0,0}, //350
{0,0}, //351
{0,0}, //352
{0,0}, //353
{0,0}, //354
{0,0}, //355
{0,0}, //356
{0,0}, //357
{0,0}, //358
{0,0}, //359
{0,0}, //360
{0,0}, //361
{0,0}, //362
{0,0}, //363
{0,0}, //364
{0,0}, //365
{0,0}, //366
{0,0}, //367
{0,0}, //368
{0,0}, //369
{0,0}, //370
{0,0}, //371
{0,0}, //372
{0,0}, //373
{0,0}, //374
{0,0}, //375
{0,0}, //376
{1537,11}, //377
{1548,11}, //378
{1559,11}, //379
{1570,11}, //380
{0,0}, //381
{0,0}, //382
{0,0}, //383
{0,0}, //38[/mis]

Because it is in this form, it is very easy to get the pixel data into a new image. :)
"Mmmm, your eyes are so beautiful."
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

This is the data array for normal font:
Why is there 385 indexes in that array? ascii has 256 characters only o_O im not sure how should i read this array...
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

Polish letters go further than 256. For example the z with the ' to the left is 380 (the last one). But that is all bonus, the first 256 are good enough.

What is the problem with the array?

User enters a string. The characters have an integer value. If the value is 97 (the letter 'a'), just use that for the array index. The second part (alphabet[97][0]) of the index gives the x position in the image, the third the width (alphabet[97][1]).
"Mmmm, your eyes are so beautiful."
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

WHAT? gta2 supports unicode (or wtf is it if its more than 256)? no way... o_O

Here is quick test:
http://epicgta2.omnitude.net/gta2text/? ... +end!+%3AD
Results:
Image

Edits: added textarea and transparency with epic background texture (not "burn" in the image).
here is the "background.png" file:
background.png
background.png
background.png (233 Bytes) Viewed 25967 times
gta2text.php:

Code: Select all

<?php

// set headers:
header("Content-type: image/png");

if($_GET['text'] == ""){
	$text = "usage: ?text=something";
}else{
	$text = $_GET['text'];
}
$text = trim($text); // remove extra whitespace like newlines etc from start/end.

$font_height = 25; // normal font height.

$poswidth = array(0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,9, 9,6, 15,11, 0,0, 26,12, 38,11, 0,0,
49,6, 55,9, 64,9, 73,12, 0,0, 85,6, 91,11, 102,6, 108,12, 120,12, 132,9, 141,12, 153,12, 165,13, 178,12, 190,12,
202,12, 214,12, 226,12, 238,6, 244,6, 0,0, 0,0, 0,0, 250,11, 261,6, 267,11, 278,11, 289,11, 300,11, 311,11, 
322,11, 333,11, 344,11, 355,8, 363,12, 375,13, 388,11, 399,16, 415,11, 426,11, 437,11, 448,11, 459,11, 470,11,
481,10, 491,11, 502,12, 514,16, 530,11, 541,12, 553,10, 0,0, 0,0, 0,0, 0,0, 563,11, 0,0, 574,11, 585,11, 596,11,
607,11, 618,11, 629,11, 640,11, 651,11, 662,6, 668,8, 676,13, 689,6, 695,16, 711,11, 722,11, 733,11, 744,11, 
755,11, 766,11, 777,9, 786,11, 797,12, 809,16, 825,12, 837,11, 848,10, 0,0, 0,0, 0,0, 858,13, 0,0, 0,0, 0,0, 
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 871,11, 882,11, 893,11, 
904,11, 0,0, 915,11, 0,0, 926,16, 942,11, 953,11, 964,11, 975,11, 986,11, 997,9, 1006,9, 1015,11, 1026,10, 0,0,
1036,11, 1047,11, 1058,11, 1069,11, 0,0, 1080,11, 0,0, 0,0, 1091,11, 1102,11, 1113,11, 1124,11, 0,0, 0,0, 
1135,12, 1147,11, 1158,11, 1169,11, 0,0, 1180,11, 0,0, 1191,17, 1208,11, 1219,11, 1230,11, 1241,11, 1252,11, 
1263,8, 1271,8, 1279,10, 1289,10, 0,0, 1299,11, 1310,11, 1321,11, 1332,11, 0,0, 1343,11, 0,0, 0,0, 1354,11, 
1365,11, 1376,11, 1387,11, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1398,12, 1410,12, 1422,12, 1434,12, 0,0, 0,0, 0,0,
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1446,12, 1458,12, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1470,12, 1482,7, 1489,12, 1501,12, 0,0, 0,0, 0,0, 0,0, 
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1513,12, 1525,12, 0,0, 0,0,
0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 
0,0, 0,0, 0,0, 0,0, 0,0, 1537,11, 1548,11, 1559,11, 1570,11, 0,0, 0,0, 0,0, 0,0);

// calculate resulting image size:
$width = 0; // resulting image sizes will be set to these,
$height = 0;
$xpos = 0; // currently looped chars pixel positions,
$ypos = 0;
$len = strlen($text);
for($p = 0; $p < $len; $p++){
	$val = ord($text[$p]); // get char numeric value.
	$charwidth = $poswidth[$val*2+1];
	// process newlines:
	if($text[$p] == "\n"){
		$ypos += $font_height;
		$xpos = 0;
	}
	if($charwidth == 0){
		continue; // skip chars that cant be rendered.
	}
	$xpos += $charwidth;
	// find max image width (added $charwidth previously):
	if($xpos > $width){
		$width = $xpos;
	}
}
$height = $ypos+$font_height; // add $font_height here because there is no last "\n" char (was trimmed).


// load font:
$font = imagecreatefrompng("gta2font_normal.png");
imagealphablending($font, true);

// render image:
$im = imagecreatetruecolor($width, $height);
imagealphablending($im, false);
imagesavealpha($im, true);
$bgcolor = imagecolorallocatealpha($im, 239,239,239, 127); // 127 = full transparency.
imagefilledrectangle($im, 0, 0, $width, $height, $bgcolor);

$xpos = 0;
$ypos = 0;
for($p = 0; $p < $len; $p++){
	$val = ord($text[$p]); // get char numeric value.
	$charwidth = $poswidth[$val*2+1];
	// process newlines:
	if($text[$p] == "\n"){
		$ypos += $font_height;
		$xpos = 0;
	}
	if($charwidth == 0){
		continue; // skip chars that cant be rendered.
	}
	$charpos = $poswidth[$val*2];
	imagecopy($im, $font, $xpos, $ypos, $charpos, 0, $charwidth, $font_height);
	$xpos += $charwidth;
	// find max image width (added $charwidth previously):
	if($xpos > $width){
		$width = $xpos;
	}
}


imagepng($im); // output PNG image

// free resources:
imagedestroy($im);
imagedestroy($font);

?>
index.php:

Code: Select all

<?php


if($_GET['text'] != ""){
	$text = $_GET['text'];
}else{
	$text = "";
}

print"<form method=\"get\" action=\"\">
	<textarea name=\"text\" rows=\"8\" cols=\"70\">".htmlspecialchars($text)."</textarea><br>
	<input type=\"submit\" value=\"Textify!\">
</form>";

if($text != ""){
	$textraw = rawurlencode($text);
	print"<br><img src=\"gta2text.php?text=$textraw\" style=\"background-image:url('background.png'); padding:10px\">";
}


?>
Edit: did some code tests to see what crashed this page with syntax highlighter.... seems like array() cant have more than ~400 elements in it :shock:
Last edited by T.M. on 30 Nov 2011, 16:49, edited 25 times in total.
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

SEKTOR: i couldnt post the syntax highlighted code at all! the whole page stopped responding, didnt show the whole page at all until i changed to

Code: Select all

 tags.
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

Nice work! [respect]

Would have taken me ages to find all the functions. I like the effect you added to make it look like a real image with alpha.

The required code is actually pretty small, did not expect that. Al thought mine for Java version is also just 70 lines.

The colouring might be a pain in the a$$. You see, the correct way to get the colour is by a colour filter like in GIMP (or Photoshop etc.). I was not able to get that working because it requires converting to HSL (or it was HSV). It is possible to look in the GIMP source online and see the function they are using, but I'm having trouble finding it.
"Mmmm, your eyes are so beautiful."
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

Image

Cool, that you can even add it on to the forum. Problem is -> high bandwidth usage... [bribe]
"Mmmm, your eyes are so beautiful."
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

Hmm, i dont think the coloring will be a problem: just create all possible font colors into separate PNG files like the font is now (there cant be that many possible colors it would make problems), and to reduce the load on the PHP script, you would only load the needed fonts at that image.

Im not sure why do you need a photoshop for coloring. GTA2 uses palettes for all the sprites, you just change the palet. no need for HSV/HSL or whatsoever weird tricks. Unless thats what you want?!

I think i could make it possible to use a paletted and transparent PNG ? im not sure. But i can easily make colorized PNG (256 colors palette) without using slow any functions etc.

I dont think the bandwidth is a problem, not that many people read these forums. Of course you shouldnt be hotlinking on a popular website ^^
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

I wanted to use a filter because people perhaps also want to use their own unique colour. If you skip that "function", yeah, it's better to use a palette. Perhaps the nicest way would be to do it like in my version 3 or like the forums do it: "[2]GTA[16]2" this would generate a white GTA and a (russian) red 2.

I will see if I can give you the 17 "basic" colours used around the gta2 community.

//edit: Here is also the large font:
alphabet_large.png
the array:

[mis]int[][] alphabet_large_array =
{
{0,0}, //0
{0,0}, //1
{0,0}, //2
{0,0}, //3
{0,0}, //4
{0,0}, //5
{0,0}, //6
{0,0}, //7
{0,0}, //8
{0,0}, //9
{0,0}, //10
{0,0}, //11
{0,0}, //12
{0,0}, //13
{0,0}, //14
{0,0}, //15
{0,0}, //16
{0,0}, //17
{0,0}, //18
{0,0}, //19
{0,0}, //20
{0,0}, //21
{0,0}, //22
{0,0}, //23
{0,0}, //24
{0,0}, //25
{0,0}, //26
{0,0}, //27
{0,0}, //28
{0,0}, //29
{0,0}, //30
{0,0}, //31
{0,27}, //32
{27,17}, //33
{44,30}, //34
{0,0}, //35
{74,32}, //36
{0,0}, //37
{0,0}, //38
{106,18}, //39
{124,22}, //40
{146,24}, //41
{0,0}, //42
{0,0}, //43
{170,17}, //44
{187,18}, //45
{205,17}, //46
{0,0}, //47
{222,32}, //48
{254,22}, //49
{276,32}, //50
{308,31}, //51
{339,35}, //52
{374,30}, //53
{404,31}, //54
{435,29}, //55
{464,32}, //56
{496,32}, //57
{528,18}, //58
{546,17}, //59
{0,0}, //60
{0,0}, //61
{0,0}, //62
{563,31}, //63
{0,0}, //64
{594,33}, //65
{627,32}, //66
{659,31}, //67
{690,31}, //68
{721,26}, //69
{747,27}, //70
{774,32}, //71
{806,32}, //72
{838,17}, //73
{855,30}, //74
{885,36}, //75
{921,27}, //76
{948,39}, //77
{987,32}, //78
{1019,31}, //79
{1050,31}, //80
{1081,32}, //81
{1113,31}, //82
{1144,30}, //83
{1174,28}, //84
{1202,32}, //85
{1234,32}, //86
{1266,39}, //87
{1305,33}, //88
{1338,33}, //89
{1371,32}, //90
{0,0}, //91
{0,0}, //92
{0,0}, //93
{0,0}, //94
{0,0}, //95
{1403,18}, //96
{0,0}, //97
{0,0}, //98
{0,0}, //99
{0,0}, //100
{0,0}, //101
{0,0}, //102
{0,0}, //103
{0,0}, //104
{0,0}, //105
{0,0}, //106
{0,0}, //107
{0,0}, //108
{0,0}, //109
{0,0}, //110
{0,0}, //111
{0,0}, //112
{0,0}, //113
{0,0}, //114
{0,0}, //115
{0,0}, //116
{0,0}, //117
{0,0}, //118
{0,0}, //119
{0,0}, //120
{0,0}, //121
{0,0}, //122
{0,0}, //123
{0,0}, //124
{0,0}, //125
{1421,37}, //126
{0,0}, //127
{0,0}, //128
{0,0}, //129
{0,0}, //130
{0,0}, //131
{0,0}, //132
{0,0}, //133
{0,0}, //134
{0,0}, //135
{0,0}, //136
{0,0}, //137
{0,0}, //138
{0,0}, //139
{0,0}, //140
{0,0}, //141
{0,0}, //142
{0,0}, //143
{0,0}, //144
{0,0}, //145
{0,0}, //146
{0,0}, //147
{0,0}, //148
{0,0}, //149
{0,0}, //150
{0,0}, //151
{0,0}, //152
{0,0}, //153
{0,0}, //154
{0,0}, //155
{0,0}, //156
{0,0}, //157
{0,0}, //158
{0,0}, //159
{0,0}, //160
{1458,17}, //161
{0,0}, //162
{0,0}, //163
{0,0}, //164
{0,0}, //165
{0,0}, //166
{0,0}, //167
{0,0}, //168
{0,0}, //169
{0,0}, //170
{0,0}, //171
{0,0}, //172
{0,0}, //173
{0,0}, //174
{0,0}, //175
{0,0}, //176
{0,0}, //177
{0,0}, //178
{0,0}, //179
{0,0}, //180
{0,0}, //181
{0,0}, //182
{0,0}, //183
{0,0}, //184
{0,0}, //185
{0,0}, //186
{0,0}, //187
{0,0}, //188
{0,0}, //189
{0,0}, //190
{1475,31}, //191
{1506,32}, //192
{1538,33}, //193
{1571,33}, //194
{0,0}, //195
{1604,33}, //196
{0,0}, //197
{1637,46}, //198
{1683,31}, //199
{1714,26}, //200
{1740,25}, //201
{1765,34}, //202
{1799,26}, //203
{1825,22}, //204
{1847,22}, //205
{1869,34}, //206
{1903,22}, //207
{0,0}, //208
{1925,32}, //209
{1957,32}, //210
{1989,31}, //211
{2020,33}, //212
{0,0}, //213
{2053,32}, //214
{0,0}, //215
{0,0}, //216
{2085,31}, //217
{2116,31}, //218
{2147,33}, //219
{2180,31}, //220
{0,0}, //221
{0,0}, //222
{2211,33}, //223
{0,0}, //224
{0,0}, //225
{0,0}, //226
{0,0}, //227
{0,0}, //228
{0,0}, //229
{0,0}, //230
{0,0}, //231
{0,0}, //232
{0,0}, //233
{0,0}, //234
{0,0}, //235
{0,0}, //236
{0,0}, //237
{0,0}, //238
{0,0}, //239
{0,0}, //240
{0,0}, //241
{0,0}, //242
{0,0}, //243
{0,0}, //244
{0,0}, //245
{0,0}, //246
{0,0}, //247
{0,0}, //248
{0,0}, //249
{0,0}, //250
{0,0}, //251
{0,0}, //252
{0,0}, //253
{0,0}, //254
{0,0}, //255
{0,0}, //256
{0,0}, //257
{0,0}, //258
{0,0}, //259
{2244,33}, //260
{0,0}, //261
{2277,31}, //262
{0,0}, //263
{0,0}, //264
{0,0}, //265
{0,0}, //266
{0,0}, //267
{0,0}, //268
{0,0}, //269
{0,0}, //270
{0,0}, //271
{0,0}, //272
{0,0}, //273
{0,0}, //274
{0,0}, //275
{0,0}, //276
{0,0}, //277
{0,0}, //278
{0,0}, //279
{2308,32}, //280
{0,0}, //281
{0,0}, //282
{0,0}, //283
{0,0}, //284
{0,0}, //285
{0,0}, //286
{0,0}, //287
{0,0}, //288
{0,0}, //289
{0,0}, //290
{0,0}, //291
{0,0}, //292
{0,0}, //293
{0,0}, //294
{0,0}, //295
{0,0}, //296
{0,0}, //297
{0,0}, //298
{0,0}, //299
{0,0}, //300
{0,0}, //301
{0,0}, //302
{0,0}, //303
{0,0}, //304
{0,0}, //305
{0,0}, //306
{0,0}, //307
{0,0}, //308
{0,0}, //309
{0,0}, //310
{0,0}, //311
{0,0}, //312
{0,0}, //313
{0,0}, //314
{0,0}, //315
{0,0}, //316
{0,0}, //317
{0,0}, //318
{0,0}, //319
{0,0}, //320
{2340,27}, //321
{0,0}, //322
{2367,32}, //323
{0,0}, //324
{0,0}, //325
{0,0}, //326
{0,0}, //327
{0,0}, //328
{0,0}, //329
{0,0}, //330
{0,0}, //331
{0,0}, //332
{0,0}, //333
{0,0}, //334
{0,0}, //335
{0,0}, //336
{0,0}, //337
{0,0}, //338
{0,0}, //339
{0,0}, //340
{0,0}, //341
{0,0}, //342
{0,0}, //343
{0,0}, //344
{0,0}, //345
{2399,29}, //346
{0,0}, //347
{0,0}, //348
{0,0}, //349
{0,0}, //350
{0,0}, //351
{0,0}, //352
{0,0}, //353
{0,0}, //354
{0,0}, //355
{0,0}, //356
{0,0}, //357
{0,0}, //358
{0,0}, //359
{0,0}, //360
{0,0}, //361
{0,0}, //362
{0,0}, //363
{0,0}, //364
{0,0}, //365
{0,0}, //366
{0,0}, //367
{0,0}, //368
{0,0}, //369
{0,0}, //370
{0,0}, //371
{0,0}, //372
{0,0}, //373
{0,0}, //374
{0,0}, //375
{0,0}, //376
{2428,32}, //377
{0,0}, //378
{2460,32}, //379
{0,0}, //380
{0,0}, //381
{0,0}, //382
{0,0}, //383
{0,0}, //38
};[/mis]
"Mmmm, your eyes are so beautiful."
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

Perhaps the nicest way would be to do it like in my version 3 or like the forums do it: "[2]GTA[16]2" this would generate a white GTA and a (russian) red 2.
How does GTA2 do it? i think its the best way(?)
I will see if I can give you the 17 "basic" colours used around the gta2 community.
Only tell the palet numbers, i can then take the palet from bil.sty and use that image (extracted from stytool) to generate the correct colored fonts myself. Edit: oh wait, i would need the original font sprites from bil.sty as well (not a problem though). how did you generate your font PNG images? did you change their order somehow?
User avatar
elypter
Immortal
Posts: 1119
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by elypter »

tm you can extract them in a row in sty tool, afaik even in correct order

if you want to allow custom colors other than the existing ones from gta2, you can let your script generate the palet.

btw i made a blue version of the capital big orange font which i use on most of my maps. you can use this one too.

about the palet numbers of the existing fonts: i have them in a textfile in either resource pakx or jed pakx
yur sa'nok ngeyä
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

@elypter, great! paste? :D

@Cuban-Pete, how come the normal font has a lot of padding there in y-axis? the multiline looks a bit too "paddy", so i removed some pixels, now its 23 instead of 25 pixels in height. did you guess this padding or is it like that in gta2 too? (i noticed the large font doesnt have ANY padding).
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

The colours I use in the editor are all from the community (most Polish forum - clan colours). naming can be seen on screenshot from version 3 txt2gta (first post in forum)

I took the image below and took the custom colours from it. It's in RGB.

first colour is border
second colour is highlight
third colour is "normal" inside colour
r.png
r.png (1.62 KiB) Viewed 25950 times

Code: Select all

Color number:   1
60,56,8,
172,145,86,
141,112,52,

Color number:   2
64,53,36,
179,149,100,
140,116,78,

Color number:   3
91,91,91,
255,255,255,
199,199,199,

Color number:   4
58,74,91,
162,208,255,
126,162,199,

Color number:   5
53,68,84,
149,191,234,
116,149,183,

Color number:   6
0,55,91,
0,153,255,
0,119,199,

Color number:   7
91,91,39,
255,255,110,
199,199,86,

Color number:   8
91,58,28,
255,163,79,
199,127,62,

Color number:   9
84,72,91,
236,203,255,
184,158,199,

Color number:   10
91,35,6,
255,99,18,
199,77,14,

Color number:   11
35,91,9,
97,255,24,
76,199,19,

Color number:   12
91,75,39,
255,210,109,
199,164,85,
This is not really a palette, but more colours you don't need (besides the (8,7,5) for the "black" shadow).
"Mmmm, your eyes are so beautiful."
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by Cuban-Pete »

T.M. wrote:@Cuban-Pete, how come the normal font has a lot of padding there in y-axis? the multiline looks a bit too "paddy", so i removed some pixels, now its 23 instead of 25 pixels in height. did you guess this padding or is it like that in gta2 too? (i noticed the large font doesnt have ANY padding).
I only adjusted (fixed reflection bugs) the font cosmetically, as far as I remember I left the height as gta2 original. But you/we are free of course to change it to more centered.
"Mmmm, your eyes are so beautiful."
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

the font has more than 3 colors, but i only need to generate that one color myself, i found a good way to do it already; just draw the highlight color with 42% opacity over the font color.

Btw i noticed you made error when you fixed the fonts: you drew with 0,0,0 color instead of 7,7,7 ! (fucks up paletting) i am not sure if i can fix it (my image editing software doesnt save PNG properly with transparency always). ill try though.
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 Font Topic - TXT2GTA2 (Version 3 Released!)

Post by T.M. »

you only pasted 12 font colors, not 18 as in the image! although i could take the colors myself from that image too.
Post Reply