Skip to content

Commit

Permalink
Replace tesseract by fake OCR
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorais-ledger committed Jul 7, 2023
1 parent 4763d24 commit b9c4264
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 207 deletions.
3 changes: 2 additions & 1 deletion speculos/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ def main(prog=None):
automation_server=automation_server,
transport=args.usb,
fonts_path=pkg_resources.resource_filename(__name__, "/fonts"),
api_level=args.apiLevel)
api_level=args.apiLevel,
model=args.model)

button = None
if args.button_port:
Expand Down
93 changes: 16 additions & 77 deletions speculos/mcu/bagl_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
} bagl_font_character_t;
'''

Font = namedtuple(
"Font", "font_id font_name bpp char_height baseline_height char_kerning first_char last_char characters bitmap")
Font = namedtuple("Font", "font_id bpp char_height baseline_height char_kerning first_char last_char characters bitmap")
FontCharacter = namedtuple("FontCharacter", "char_width bitmap_byte_count bitmap_offset")

bitmapLUCIDA_CONSOLE_6PT_8H = [
Expand Down Expand Up @@ -3061,89 +3060,29 @@
]

FONTS = [
Font(
BAGL_FONT_OPEN_SANS_REGULAR_11px,
"bagl_font_open_sans_regular_11px",
1, 12, 9, 0,
0x0020, 0x007F,
charactersOPEN_SANS_REGULAR_11PX,
bitmapOPEN_SANS_REGULAR_11PX),
Font(
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px,
"bagl_font_open_sans_extrabold_11px",
1, 12, 9, 0, 0x0020, 0x007F,
charactersOPEN_SANS_EXTRABOLD_11PX,
bitmapOPEN_SANS_EXTRABOLD_11PX),
Font(
BAGL_FONT_OPEN_SANS_LIGHT_16px,
"bagl_font_open_sans_light_16px",
1, 18, 13, 0,
0x0020, 0x007F,
charactersOPEN_SANS_LIGHT_16PX,
bitmapOPEN_SANS_LIGHT_16PX),
Font(
BAGL_FONT_LUCIDA_CONSOLE_8PX,
None,
1, 8, 16, 0,
0x0020, 0x00ff,
charactersLUCIDA_CONSOLE_6PT_8H,
Font(BAGL_FONT_LUCIDA_CONSOLE_8PX, 1, 8, 16, 0, 0x0020, 0x00ff, charactersLUCIDA_CONSOLE_6PT_8H,
bitmapLUCIDA_CONSOLE_6PT_8H),
Font(
BAGL_FONT_OPEN_SANS_LIGHT_16_22PX,
None,
4, 22, 16, 0,
0x0020, 0x007f,
charactersOPEN_SANS_LIGHT_16_22PX,
Font(BAGL_FONT_OPEN_SANS_LIGHT_16_22PX, 4, 22, 16, 0, 0x0020, 0x007f, charactersOPEN_SANS_LIGHT_16_22PX,
bitmapOPEN_SANS_LIGHT_16_22PX),
Font(
BAGL_FONT_OPEN_SANS_REGULAR_8_11PX,
None,
4, 11, 8, 0,
0x0020, 0x007f,
charactersOPEN_SANS_REGULAR_8_11PX,
Font(BAGL_FONT_OPEN_SANS_REGULAR_8_11PX, 4, 11, 8, 0, 0x0020, 0x007f, charactersOPEN_SANS_REGULAR_8_11PX,
bitmapOPEN_SANS_REGULAR_8_11PX),
Font(
BAGL_FONT_OPEN_SANS_REGULAR_10_13PX,
None,
4, 14, 10, 0,
0x0020, 0x007F,
charactersOPEN_SANS_REGULAR_10_13PX,
Font(BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 4, 14, 10, 0, 0x0020, 0x007F, charactersOPEN_SANS_REGULAR_10_13PX,
bitmapOPEN_SANS_REGULAR_10_13PX),
Font(
BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX,
None,
4, 14, 10, 0,
0x0020, 0x007f,
charactersOPEN_SANS_SEMIBOLD_10_13PX,
Font(BAGL_FONT_OPEN_SANS_EXTRABOLD_11px, 1, 12, 9, 0, 0x0020, 0x007F, charactersOPEN_SANS_EXTRABOLD_11PX,
bitmapOPEN_SANS_EXTRABOLD_11PX),
Font(BAGL_FONT_OPEN_SANS_REGULAR_11px, 1, 12, 9, 0, 0x0020, 0x007F, charactersOPEN_SANS_REGULAR_11PX,
bitmapOPEN_SANS_REGULAR_11PX),
Font(BAGL_FONT_OPEN_SANS_LIGHT_16px, 1, 18, 13, 0, 0x0020, 0x007F, charactersOPEN_SANS_LIGHT_16PX,
bitmapOPEN_SANS_LIGHT_16PX),
Font(BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX, 4, 14, 10, 0, 0x0020, 0x007f, charactersOPEN_SANS_SEMIBOLD_10_13PX,
bitmapOPEN_SANS_SEMIBOLD_10_13PX),
Font(
BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX,
None,
4, 11, 8, 0,
0x0020, 0x007f,
charactersOPEN_SANS_SEMIBOLD_8_11PX,
Font(BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 4, 11, 8, 0, 0x0020, 0x007f, charactersOPEN_SANS_SEMIBOLD_8_11PX,
bitmapOPEN_SANS_SEMIBOLD_8_11PX),
Font(
BAGL_FONT_OPEN_SANS_REGULAR_11_14PX,
None,
4, 16, 12, 0,
0x0020, 0x007f,
charactersOPEN_SANS_REGULAR_11_14PX,
Font(BAGL_FONT_OPEN_SANS_REGULAR_11_14PX, 4, 16, 12, 0, 0x0020, 0x007f, charactersOPEN_SANS_REGULAR_11_14PX,
bitmapOPEN_SANS_REGULAR_11_14PX),
Font(
BAGL_FONT_OPEN_SANS_SEMIBOLD_11_16PX,
None,
4, 16, 12, 0,
0x0020, 0x007f,
charactersOPEN_SANS_SEMIBOLD_11_16PX,
Font(BAGL_FONT_OPEN_SANS_SEMIBOLD_11_16PX, 4, 16, 12, 0, 0x0020, 0x007f, charactersOPEN_SANS_SEMIBOLD_11_16PX,
bitmapOPEN_SANS_SEMIBOLD_11_16PX),
Font(
BAGL_FONT_SYMBOLS_0,
None,
4, 16, 16, 0,
0x0000, 0x0006,
charactersSYMBOLS_0,
bitmapSYMBOLS_0)
Font(BAGL_FONT_SYMBOLS_0, 4, 16, 16, 0, 0x0000, 0x0006, charactersSYMBOLS_0, bitmapSYMBOLS_0)
]


Expand Down
Loading

0 comments on commit b9c4264

Please sign in to comment.