Log in

View Full Version : Is there a way to custom GetTextAtEx to work differnt writing?



tom99
07-10-2010, 01:50 AM
Hi i was wondering if you can modify gettextatex to work with differnt kinds of writings such as arial or times new roman, or other custom grapich letters, switch out the images in font will that work, or can you create another folder in font witch woud be just like a new writings? could it practially be designed to work with any writings? if you can customise it, is it hard? or you just need to take 26 photos and copy it into a new folder in fonts and then just do
Result := IsTextAtEx(184, 34, 'textdisplayed', 30, you'recustomsymbols, True, False, 0, 0,
-1);

Is it that easy? if not then how you make it ?


a update that woud make it work with all known computer writings woud be really nice :D like andy, courier, georgia, ms sans sheif, times new roman and rest :D

tom99
07-19-2010, 01:41 PM
-Bump-

Shuttleu
07-19-2010, 01:45 PM
you would need to create a bmp for every character you are going to use
so
26 uppercase letters
26 lowercase letters
1 through to 0
and any symbols you are going to use

then load them into a integer

then use it like above

~shut

Wizzup?
07-19-2010, 02:16 PM
For default fonts, you can just load System fonts. Have a look at Simba/Tests/systemfont (or something like this)

weequ
07-19-2010, 04:47 PM
This for scar:

function LoadCharsFromFont2(fontname: string; fontsize: Integer; fontbold, fontitalic, fontunderline, fontstrike: Boolean): Integer;
Load characters from Windows font in memory.
Example:
c := LoadCharsFromFont2('Courier New', 10, False, False, False, False);

tom99
07-19-2010, 06:22 PM
When making bmps of the letters, does it need to be 100% accurate in order to work or can it be 1-3pixels in between each of them?

Incase it is, i got a method to get it accurate, open the letters in paint.NET, hold ctrl+ until fit the screen, turn on pixel grid, choose square from tools, mark the letter, ctrl+c then open a new document with ctrl+n then do ctrl+v, voila accurate letter.

Shuttleu
07-19-2010, 06:44 PM
well if the text is abc and there is a single line between each letter then add add a single line either before or after the letter

~shut

tom99
07-20-2010, 12:20 PM
Ive made 26 lowercase letters bmps now for testing, so what do i do next to make it asign each letter with scar ?

Shuttleu
07-20-2010, 12:24 PM
function LoadChars2(path: string): Integer;
so if the font was in 'C:/ExampleFont' then you would do
MyFont:= LoadChars2('C:/ExampleFont');

and MyFont would be a Integer

~shut

Wizzup?
07-20-2010, 12:27 PM
program new;
var
Font : TFont;
begin
Font := TFont.Create;
Font.Name := 'Courier New';
Font.Size := 10;
Font.Style := [];
LoadSystemFont(Font,'test');
DisplayDebugImgWindow(0,0);
DisplayDebugImgWindow(150,50);
DrawBitmapDebugImg(BitmapFromText('BMP[0] has not been freed','test'));
Font.free;
end.

tom99
07-20-2010, 12:35 PM
Do they need to be named from 65.bmp - 122.bmp or can i change that so its a-z ?

I tryed that script wizzup and its great but i woud also like to know how i can make my own fontset.

Wizzup?
07-20-2010, 12:37 PM
Do they need to be named from 65.bmp - 122.bmp or can i change that so its a-z ?

I tryed that script wizzup and its great but i woud also like to know how i can make my own fontset.

Use LoadFont.

tom99
07-20-2010, 12:46 PM
What am i doing wrong here ?
get type mismatch

var
myfont: extended;
begin
myfont:= LoadChars2('Fonts\myfont');
if(GetTextAtEx(16, 505,620, 573, 255, 'text', false, false, 0, 5, 0, 0)) then
writeln('Found text');
end.

Shuttleu
07-20-2010, 01:01 PM
myfont should be a Integer not a extended

~shut

tom99
07-20-2010, 02:06 PM
Also with integer i get same error message.

Shuttleu
07-20-2010, 02:14 PM
oh you mean at the line with GetTextAtEx?

its because your using it as a Boolean when it returns a string

do this
program New;
var
myfont: Integer;
TheText: string;
begin
MyFont:= LoadChars2('Fonts\myfont');
TheText:= GetTextAtEx({x}, {y}, {tol}, MyFont, False, False, 0, 3, {TextColor}, {TextLength}, True, tr_AllChars)
Writeln(TheText);
end.

just fill in the green bits

~shut

tom99
07-20-2010, 02:50 PM
That search for TheText ? and on textlength is there a option for unlimited or does it need to be same as the actual text its searching for? is it a option to make it ignore color?

i luffs yeww
07-20-2010, 02:55 PM
That searches for MyFont. It needs to be the same as the actual text, I think. If you don't know the length, have a for loop for that. (for i := 1 to 1000 do GetTextAtEx(x, y, Tol, MyFont, False, False, 0, 3, Col, i, True, tr_AllChars);.) No. You need to get the right color, I think.

tom99
07-20-2010, 03:13 PM
It execute but does nothing, also does it search at a point or area? if it only search on a point where shoud that be? just infront of first letter?

But like this it wont compile,

program textlocator;
var
myfont,text,i: Integer;
// TheText: string;
begin
MyFont:= LoadChars2('Fonts\myfont');
for i := 1 to 1000 do GetTextAtEx(61, 555, 200, text, False, False, 0, 3, 0, i, True, tr_AllChars)
Writeln(TheText);
end.

nvm forgot semicolon behind syntax doh (it executes) :)


It wont find any text

Shuttleu
07-20-2010, 03:18 PM
it searches at a point
the top left corner of the text

~shut

tom99
07-20-2010, 03:29 PM
I got the cords there but it dont find the text :S

I saved and then when i run it again i get this, LoadChars failed - folder "Fonts\MyFont" does not exist
Alltough it does exist.

k seems like scar dont know where its located on the comp, but even apppath+'Fonts\MyFont dont work, it loads but dont find any text :(

weequ
07-21-2010, 05:00 AM
I think you have to do like LoadChars2(AppPath + 'Fonts\MyFont\');

tom99
07-21-2010, 08:46 AM
I think you have to do like LoadChars2(AppPath + 'Fonts\MyFont\');

I did but, i see all the other fonts got a .svn folder with .svn-base files, is this something you need when you create a new?

i luffs yeww
07-21-2010, 05:34 PM
No.

tom99
07-21-2010, 05:37 PM
What is it for then? and have a.bmp-z.bmp on each letter shoud work ?

Shuttleu
07-21-2010, 05:57 PM
What is it for then? and have a.bmp-z.bmp on each letter shoud work ?
name them
97.bmp - 122.bmp

~shut