SRL Archive - OSR Help

Creating a font set for a different game


Foundry

2013-09-13 23:32:40

So I'm trying to create a font set for a game that uses multiple colors in each letter.

For example, look at this lowercase "a":
[ATTACH=CONFIG]22203[/ATTACH]

It has various shades of white and a solid background color. I know in the tutorial that I've read on making the custom set it says to make the letter white and the background/mask black, but I'm stuck on what to do from here as there are various shades of white and I don't know which ones to fill in.

Itankbots

2013-09-14 01:01:45

Ive never made a font set, but i believe the whole purpose of the "mask", is that it does just that. it acts as a filter, since its white on black background, it is like the image for the Letter, which makes up the font set.

Then the actual function you use to search for the letters/word, is where it adds the colour. Searchs for the colour in the image of the fontset.

Take for example BMW's Uptext fix for rs3

function IsMouseoverTextEx(Text, TextType:string): Boolean;
var
x, y, Color: Integer;
begin
Color := 0;
case Lowercase(TextType) of
'action', 'white': Color:= 12378347;
'object', 'cyan': Color:= 16776960;
'npc', 'yellow': Color:= 65535; /// Colours are here, which he stores as the var texttype
'f2pitem', 'pale blue': Color:= 13750712;
'p2pitem', 'orange': Color:= 2131675;
end;
if (Color = 0) then
begin
WriteLn('WARNING! ' + TextType + ' is not a valid TextType!');
Exit;
end;
GetMousePos(x, y);
Result := IsTextInAreaEx(0, 0, 798, 598, x, y, Text, 5, 'UpCharsEx', False, False, 0, 4, Color); /// Here is where he calls in the font set 'upcharsex' Which is the "mask" set.
end;



The rest of the function is pretty self explaintory.

I hope that helps some :x Im having a hard time trying to figure out how to explain it Lol

edit: make sure to scroll sideways inside the simba code to read the comments i made

Foundry

2013-09-14 09:29:52

Thanks, I understand what you're saying.

bgtemp

2013-09-17 04:14:51

multiple colors in each letter.

The script posted above will work only if all letters are in one ,single color.


I have some experience with making font similar to your sample. Basically,I read text using function:

GetTextAtExWrap(xs, ys, xe, ye, 0, 4, 4, Color, Tol,fontName ); 

as you see it searches for colors in the range of tolerance. So use ACA ,find best color and tolerance ,which will fit all (or most) colors in your font.

Step II: Now you want to make your own font set. Yes ,OCR needs b&w mask ,so you must transform your multi-color letter into solid white letter.
All you need to do is simple TPA search (with color and tolerance previously found in ACA) on your text. Then debug this TPA in debug window. Vuala! You have now black and white text, so you can make screenshot and font set from that.

   FindColorsTolerance(TPA,Color,xs,ys,xe,ye,Tol);
bmp:=CreateBitmap(xe+1,ye+1);
DrawTPABitmap(bmp,TPA,clwhite);
debugbitmap(bmp);

I hope it's all clear.