abyss616 Posted February 28, 2013 Share Posted February 28, 2013 Hi, i need to read text at specified coordinates, so i think GetTextAtEx will get the job done for me. But for some reason it do not work as i want. program New; var x, y, f,c,font : integer; s, name,test : string; flag:boolean; begin SetFontSmoothing(False); font:=LoadChars2('C:\Windows\Fonts\Arial\ariblk.ttf') //c:= LoadCharsFromFont2('C:\Windows\Fonts\Arial\ariblk.ttf', 10, False, False, False, False); s:=GetTextAtEx(1173, 80, 0, font, False, False, 0, 0, -1, 10, True, tr_AllChars); flag:=IsTextInAreaEx(1160, 80, 1135, 174,x,y,'Test',0,font,False,False,0,0,-1); end. What problems i have: 1) LoadChars2 Function ALWAYS returns -1, no matter what font i choose or i leave it blank 2) Everytime when it gets to GetTextAtEx i get this exception: Access violation at address 0040BA24 in module scar.exe. Read of Address 000000000 For additional information i am usin scara 3.35(tried 3.34 and 3.38) and windows 7 proffesional 32 bits version. Any help will be aprreciate. Thank you and have a nice day Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted March 1, 2013 Share Posted March 1, 2013 To load a Windows font use something like this: [sCAR]font := LoadCharsFromFont2('Arial Black', 10, False, False, False, False);[/sCAR] You use the name of the font rather than specifying the actual path to the font. Quote Link to comment Share on other sites More sharing options...
abyss616 Posted March 1, 2013 Author Share Posted March 1, 2013 To load a Windows font use something like this: [sCAR]font := LoadCharsFromFont2('Arial Black', 10, False, False, False, False);[/sCAR] You use the name of the font rather than specifying the actual path to the font. I already tried that, but still. no matter what font I specify it returns 0 every time. I assume it shouldnt be like that.. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted March 1, 2013 Share Posted March 1, 2013 No that is normal (just tried it). If you want to find out if your font is loading correctly try something like this: [sCAR]program New; var Font: Integer; B: TSCARBitmap; begin Font := LoadCharsFromFont2('Arial Black', 10, False, False, False, False); B := CreateBitmapFromText('Bixby rocks my world.', Font, clRed); DebugBitmap(B); B.Free(); FreeChars2(Font); end.[/sCAR] Quote Link to comment Share on other sites More sharing options...
abyss616 Posted March 1, 2013 Author Share Posted March 1, 2013 (edited) No that is normal (just tried it). If you want to find out if your font is loading correctly try something like this: [sCAR]program New; var Font: Integer; B: TSCARBitmap; begin Font := LoadCharsFromFont2('Arial Black', 10, False, False, False, False); B := CreateBitmapFromText('Bixby rocks my world.', Font, clRed); DebugBitmap(B); B.Free(); FreeChars2(Font); end.[/sCAR] I tried your example and it returns debug image with text Bixby rocks my world and its red. So fonts are working, right? P. S Sorry for picture below, at begining i thought that it doesnt work, thats why i added picture, but then i saw second window and edited my post, still couldnt remove picture. Edited March 1, 2013 by abyss616 Quote Link to comment Share on other sites More sharing options...