1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-16 14:25:02 -05:00

OCRBench updated. Fix in FontLoader.

This commit is contained in:
Merlijn Wajer 2010-05-09 22:46:26 +02:00
parent 469d9d02e5
commit c8103490d8
3 changed files with 11 additions and 5 deletions

View File

@ -96,7 +96,7 @@ begin
// DS + .. + DS because InitOCR wants the directory of the Fonts, not UpChars // DS + .. + DS because InitOCR wants the directory of the Fonts, not UpChars
// only. // only.
C.MOCR.InitTOCR(FontPath + DS); C.MOCR.InitTOCR(FontPath + DS);
C.MOCR.SetFonts(C.MOCR.GetFonts); //C.MOCR.SetFonts(C.MOCR.GetFonts);
t:=gettickcount; t:=gettickcount;
@ -125,6 +125,7 @@ begin
Form1.Image1.Picture.SaveToFile(OCRDebugPath + 'ocrbench.bmp'); Form1.Image1.Picture.SaveToFile(OCRDebugPath + 'ocrbench.bmp');
{$ENDIF} {$ENDIF}
bmp.OnDestroy:=nil;
bmp.Free; bmp.Free;
C.Free; C.Free;
Application.ProcessMessages; Application.ProcessMessages;

View File

@ -36,7 +36,7 @@ interface
implementation implementation
uses uses
MufasaTypes,MufasaBase,FileUtil; MufasaTypes,MufasaBase,FileUtil, strutils;
procedure TGenericLoader.AddPath(path: string); procedure TGenericLoader.AddPath(path: string);
var var
@ -101,6 +101,8 @@ implementation
function TGenericLoader.VerifyPath(Path: string): string; function TGenericLoader.VerifyPath(Path: string): string;
begin begin
if (@path = nil) or (path = '') then
exit('');
Result := Path; Result := Path;
if (Result[Length(Result)] <> DS) then if (Result[Length(Result)] <> DS) then
begin; begin;

View File

@ -41,9 +41,6 @@ type
private private
Client: TObject; Client: TObject;
FFonts: TMFonts; FFonts: TMFonts;
{$IFDEF OCRDEBUG}
debugbmp: TMufasaBitmap;
{$ENDIF}
function GetFonts:TMFonts; function GetFonts:TMFonts;
procedure SetFonts(const NewFonts: TMFonts); procedure SetFonts(const NewFonts: TMFonts);
public public
@ -71,6 +68,8 @@ type
property Fonts : TMFonts read GetFonts write SetFonts; property Fonts : TMFonts read GetFonts write SetFonts;
{$IFDEF OCRDEBUG} {$IFDEF OCRDEBUG}
procedure DebugToBmp(bmp: TMufasaBitmap; hmod,h: integer); procedure DebugToBmp(bmp: TMufasaBitmap; hmod,h: integer);
public
debugbmp: TMufasaBitmap;
{$ENDIF} {$ENDIF}
end; end;
@ -156,16 +155,20 @@ begin
{$ENDIF} {$ENDIF}
if FFonts.LoadFont(dirs[i], false) then if FFonts.LoadFont(dirs[i], false) then
begin begin
{$IFDEF FONTDEBUG}
fonts_loaded := fonts_loaded + dirs[i] + ', '; fonts_loaded := fonts_loaded + dirs[i] + ', ';
{$ENDIF}
result := true; result := true;
end; end;
end; end;
{$IFDEF FONTDEBUG}
if length(fonts_loaded) > 2 then if length(fonts_loaded) > 2 then
begin begin
writeln(fonts_loaded); writeln(fonts_loaded);
setlength(fonts_loaded,length(fonts_loaded)-2); setlength(fonts_loaded,length(fonts_loaded)-2);
TClient(Self.Client).WriteLn('Loaded fonts: ' + fonts_loaded); TClient(Self.Client).WriteLn('Loaded fonts: ' + fonts_loaded);
end; end;
{$ENDIF}
If DirectoryExists(path + 'UpChars') then If DirectoryExists(path + 'UpChars') then
FFonts.LoadFont('UpChars', true); // shadow FFonts.LoadFont('UpChars', true); // shadow
end; end;