Skip to content

Commit 79ffce3

Browse files
committed
feat: add RL Small font
1 parent e0d7d5a commit 79ffce3

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

osrs/rsclient.simba

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,11 @@ var
344344
pt: TPoint;
345345
b: TBox;
346346
tpa: TPointArray;
347+
font: ^TPixelFont;
347348
begin
349+
if Self.Client <> ERSClient.OFFICIAL then
350+
Exit;
351+
348352
pt := Target.MouseXY;
349353
with Self._Bounds() do
350354
begin
@@ -359,10 +363,13 @@ begin
359363

360364
tpa := tpa.Cluster(6,4).SortFromFirstPointX(pt).First;
361365
b.X2 := tpa.Bounds().X2;
362-
case Self.Client of
363-
ERSClient.OFFICIAL: Result := OCR.RecognizeShadow(b, RSFonts.PLAIN_12, 0);
364-
ERSClient.RUNELITE, ERSClient.LEGACY: Result := OCR.RecognizeShadow(b, RSFonts.PLAIN_11, 0);
366+
367+
case RSClient.Client of
368+
ERSClient.OFFICIAL: font := @RSFonts.PLAIN_12;
369+
ERSClient.RUNELITE: font := @RSFonts.SMALL;
365370
end;
371+
372+
Result := OCR.RecognizeShadow(b, font^, 0);
366373
end;
367374

368375

utils/ocr.simba

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ begin
135135
Result := Self.Engine.Locate(img, font, Text);
136136
end;
137137

138+
138139
var
139140
(*
140141
## OCR variable
@@ -148,6 +149,7 @@ type
148149
Record containing pre-loaded RuneScape fonts and common text colors.
149150
*)
150151
TRSFonts = record
152+
SMALL,
151153
PLAIN_11, PLAIN_12,
152154
BOLD, BOLD_SHADOW,
153155
QUILL_8, QUILL,
@@ -173,6 +175,8 @@ Record containing pre-loaded RuneScape fonts and common text colors.
173175

174176
procedure TRSFonts.Load();
175177
begin
178+
Self.SMALL := OCR.Engine.LoadFont(Self.PATH + 'Small', 4);
179+
176180
Self.PLAIN_11 := OCR.Engine.LoadFont(Self.PATH + 'Plain 11', 4);
177181
Self.PLAIN_12 := OCR.Engine.LoadFont(Self.PATH + 'Plain 12', 4);
178182

0 commit comments

Comments
 (0)