Skip to content
David Baucum edited this page Apr 23, 2026 · 1 revision

Architecture: Font & Character Set System

LinApple implements a dual font system to manage both the historically accurate Apple II text display and the modern, high-resolution user interface (debugger, file browser).

1. The Apple II Character Set (Hardware-Accurate)

The fonts used by the virtual Apple II to render text and lo-res graphics modes are strictly emulated as bitmapped character ROMs.

File Assets (res/charset40_*.png)

LinApple provides multiple character sets depending on the machine type and region:

  • charset40_IIplus.xpm: The original 128x128 bitmap for the Apple ][ and ][+, featuring the classic upper-case-only font.
  • charset40.xpm: The standard US character set for the Apple //e and Enhanced //e, supporting lower-case characters.
  • International Sets: charset40_british, charset40_french, and charset40_german are used when the keyboard language is changed.

The Euro-ROM & Rocker Switch

European Apple //e models featured a physical "rocker switch" that could swap between the US and local character sets.

  • Bitmapped Implementation: Euro-ROM character sets are 256x128 pixels. The top 128 pixels contain the US set, and the bottom 128 pixels contain the localized set.
  • LinApple Toggle (Shift+F6): This shortcut toggles the g_KeyboardRockerSwitch flag, causing the video core to offset its font lookup into the bottom half of the bitmap.

Rendering Pipeline

The video core (src/apple2/Video.cpp) synthesizes text in real-time:

  1. Scanner Lookup: The video scanner reads a byte from memory (e.g., $0400).
  2. Soft-Switch Check: The core checks if ALTCHARSET is enabled and which language bank is active.
  3. Bit Blitting: The scanner uses SOFTSTRECH_MONO to blit the 7x8 character glyph from the loaded XPM into the output pixel buffer.

2. The User Interface Font (Debugger & Menus)

The debugger, status area, and file browser use a separate, higher-resolution font system to ensure legibility outside of the 40-column emulation.

File Assets (res/font.xpm)

The UI font is a 256x256 XPM bitmap loaded by the Asset Manager (src/core/asset.cpp) into assets->font.

  • Formatting: The font is a monospaced grid where each character is indexed by its ASCII value.
  • Rendering: Tier 1 utilities like font_print and font_print_centered (src/frontends/sdl3/Frame.cpp) use this bitmap to draw text over the emulator screen or in the debugger window.

Features

  • Colorization: The UI font is stored as a monochrome mask. The font_print utility applies a color (e.g., Green for the debugger, White for help screens) during the blitting process.
  • Scaling: Tier 1 can apply scaling factors to the UI font, allowing for "Headline" text (1.5x scale) or standard status text.

Summary of Interaction

  • Tier 4 (Hardware): Manages the charset40 selection and real-time blitting for Apple II text modes.
  • Tier 1 (User I/O): Uses the font.xpm asset to draw the emulator's own menus and status overlays.
  • Asset Manager: Coordinates the loading of these bitmaps from the host file system during Linapple_Init.

Back: Integrated Debugger | Home: Architecture Overview

Clone this wiki locally