How mugli/avro-keyboard works
1. Repository shape
- This is a Delphi-based Windows desktop product centered on Avro Keyboard, a Bangla IME (input method editor).
- The repo is organized as a multi-project suite: the main keyboard app, a standalone spell checker, and three companion tools for layout editing, skin design, and Unicode-to-Bijoy conversion.
2. Main runtime application
- The primary executable lives under **Keyboard and Spell checker/Avro_Keyboard.***.
- Its job is to run in the background, hook keyboard input, interpret keystrokes according to the selected Bangla typing mode, and emit the resulting text into the active Windows application.
3. Input capture and text conversion pipeline
- The core data flow is: Windows keyboard hook → key/code interpretation → layout or phonetic conversion → insertion into target window.
- Relevant units include KeyboardHook.pas, KeyboardFunctions.pas, VirtualKeyCode.pas, KeyboardLayoutLoader.pas, uRegExPhoneticSearch.pas, and uAutoCorrect.pas.
- The app supports both fixed keyboard layouts and phonetic typing, which are handled by separate conversion and search utilities.
4. Typing modes and conversion engines
- The product contains multiple conversion strategies:
- Phonetic Bangla typing via regex-based phonetic builders/search.
- Fixed layout typing via layout files loaded from assets/keyboard-layouts.
- Unicode/Bijoy-style transformations via dedicated converter code.
- Shared character tables and language-specific logic are in units such as BanglaChars.pas, Phonetic_RegExp_Constants.pas, and the conversion classes under Classes/.
5. Persistent settings and installation model
- Configuration is stored through registry/XML setting helpers like uRegistrySettings.pas and clsRegistry_XMLSetting.pas.
- The README’s PortableOn compiler define indicates two deployment modes:
- Standard install: uses persistent system integration.
- Portable: avoids machine-wide state where possible.
- This distinction matters architecturally because several features depend on Windows registry and system integration.
6. System integration boundary
- The main app includes code for window/process handling, admin elevation, and font installation.
- Units such as uWindowHandlers.pas, uProcessHandler.pas, u_Admin.pas, and u_VirtualFontInstall.pas indicate tight integration with Windows desktop behavior and installed fonts.
- This is not a browser-based or cross-platform app; it is a Windows-native IME with OS-level hooks.
7. Spell checker as a separate executable
- The SpellChecker/ folder is its own project with its own dpr and forms.
- It has a separate runtime boundary from the keyboard app, but shares the same language domain and some registry/settings concepts.
- Core responsibilities include dictionary lookup, candidate generation, and popup/editor UI for spell correction.
8. Spell-checking data flow
- The spell checker uses a combination of:
- Dictionary storage and custom dictionaries
- Phonetic matching
- Edit-distance / similarity ranking
- Important units include uCustomDictionary.pas, uDBase.pas, uSpellEditDistanceSearch.pas, uRegExPhoneticSearch_Spell.pas, clsSpellPhoneticSuggestionBuilder.pas, uSimilarSort_Spell.pas, and Levenshtein.pas.
- The included assets/Database.db3 and assets/autodict.dct suggest packaged dictionary data and auto-dictionary behavior.
9. UI layer of the main application
- The main app’s user-facing pieces are mostly Delphi forms under Forms/.
- These cover settings and auxiliary dialogs such as:
- options/configuration
- auto-correct
- macro/shortcut editing
- update notifications
- layout preview/viewer
- conflict and encoding warnings
- about/splash/top bar
- The UI is a control layer over the typing engine rather than the primary business logic.
10. Layout system and assets
- Keyboard layouts are not hardcoded only; they are represented as external assets in **assets/keyboard-layouts/*.avrolayout**.
- The main app includes layout management and conversion helpers such as clsGenericLayoutModern.pas, clsGenericLayoutOld.pas, clsLayout.pas, and clsSkinLayoutConverter.pas.
- This makes layout definitions a first-class content boundary separate from the executable code.
11. Skinning and visual customization
- The app supports customizable skins from **assets/skins/*.avroskin**.
- Rendering and theme support are handled by loaders and converters such as SkinLoader.pas, WindowsDarkMode.pas, and skin-related forms/classes.
- The Skin Designer project is a separate tool for authoring these skin assets, indicating a clean separation between runtime UI and skin asset creation.
12. Companion editors/tools
- Layout Editor is a separate project for editing keyboard layout files and likely validates/converts layout definitions.
- Skin Designer builds and previews skin packages.
- Unicode to ascii converter is another utility project focused on converting Unicode Bangla text to Bijoy/ASCII-style output.
- These tools operate on the same domain assets but are distinct executables, which is important for an architecture diagram.
13. Shared classes and reusable domain logic
- The Classes/ and Units/ folders in the main app hold the reusable implementation behind the forms.
- They include phonetic builders, abbreviation handling, file/version helpers, image handlers, command-line helpers, and update download logic.
- The overall architecture is “thin UI, rich shared domain logic, multiple small executables” rather than a monolithic single-form app.
14. Packaging and documentation assets
- The assets/docs, assets/fonts, assets/images, assets/icons, and assets/database folders show that the product ships with bundled help content, images, fonts, and data.
- Those assets are consumed at runtime by the main app and companion editors, and they also form part of the installer/runtime packaging boundary.
15. Build and project organization
- The repo is a Delphi project group (WholeProject.groupproj) with multiple .dpr/.dproj targets.
- ProjectDefines.inc controls build-time behavior such as portable mode and debug logging.
- From an architecture perspective, build-time defines materially affect runtime integration, persistence, and diagnostics.
Main entry points: Avro_Keyboard.dpr Keyboard app · WholeProject.groupproj Project group · KeyboardFunctions.pas Key engine · AvroSpell.dpr Spell app
Components 24
Main app
Primary keyboard IME runtime and shared engine code.
- Keyboard app · Primary Avro Keyboard executable.
Keyboard and Spell checker/Avro_Keyboard.dpr - Keyboard hook · Windows keyboard interception and event capture.
Keyboard and Spell checker/Units/KeyboardHook.pas - Key engine · Key interpretation and keyboard behavior utilities.
Keyboard and Spell checker/Units/KeyboardFunctions.pas - Key codes · Virtual key constants and translation helpers.
Keyboard and Spell checker/Units/VirtualKeyCode.pas - Layout loader · Loads and applies external keyboard layout definitions.
Keyboard and Spell checker/Units/KeyboardLayoutLoader.pas - Phonetic search · Regex-based phonetic matching for Bangla typing.
Keyboard and Spell checker/Units/uRegExPhoneticSearch.pas - Auto-correct · Automatic correction and suggestion behavior.
Keyboard and Spell checker/Units/uAutoCorrect.pas - Settings store · Registry-backed and XML-backed application settings.
Keyboard and Spell checker/Units/uRegistrySettings.pas - System integration · Process, window, admin, and font-install integration.
Keyboard and Spell checker/Units/uWindowHandlers.pas - Skin loader · Loads skins and visual customization for the keyboard UI.
Keyboard and Spell checker/Units/SkinLoader.pas - Main UI · Settings, dialogs, layout preview, and runtime UI forms.
Keyboard and Spell checker/Forms/ufrmOptions.pas
Spell checker
Separate spelling runtime with dictionary and ranking pipeline.
- Spell app · Standalone spell checker executable.
Keyboard and Spell checker/SpellChecker/AvroSpell.dpr - Spell UI · Spell editor, popup, and options UI.
Keyboard and Spell checker/SpellChecker/ufrmSpell.pas - Dictionary store · Custom dictionary and packaged database access.
Keyboard and Spell checker/SpellChecker/uCustomDictionary.pas - Phonetic match · Phonetic search and suggestion builder for spelling.
Keyboard and Spell checker/SpellChecker/uRegExPhoneticSearch_Spell.pas - Ranking · Edit-distance and similarity ordering for candidates.
Keyboard and Spell checker/SpellChecker/uSpellEditDistanceSearch.pas
Companion tools
Standalone editors and converters built from the same domain.
- Layout editor · Standalone editor for keyboard layouts.
Layout Editor/LayoutEditor.dpr - Skin designer · Standalone authoring tool for Avro skin assets.
Skin Designer/SkinDesigner.dpr - Bijoy converter · Unicode Bangla to Bijoy/ASCII conversion utility.
Unicode to ascii converter/Unicode_to_Bijoy.dpr
Assets
Packaged layouts, skins, docs, data, and runtime resources.
- Keyboard layouts · Packaged Avro keyboard layout files used at runtime.
assets/keyboard-layouts/Avro Easy.avrolayout - Skins · Packaged visual themes for the runtime and designer.
assets/skins/Avro Classic.avroskin - Docs · Bundled help and user documentation.
assets/docs/Overview.pdf - Packaged data · Bundled database and autodictionary data.
assets/Database.db3
Other components
- Project group · Build entrypoint that ties all executables together.
WholeProject.groupproj
Connections 26
- Project group → Keyboard app: builds · Project group includes the main keyboard executable.
- Project group → Spell app: builds · Project group includes the spell checker executable.
- Project group → Layout editor: builds · Project group includes the layout editor tool.
- Project group → Skin designer: builds · Project group includes the skin designer tool.
- Project group → Bijoy converter: builds · Project group includes the Unicode-to-Bijoy converter.
- Keyboard app → Keyboard hook: runs · Main executable starts the keyboard hook pipeline.
- Keyboard hook → Key codes: interprets · Captured events are mapped through virtual key codes.
- Key codes → Key engine: feeds · Key codes drive typing behavior and interpretation.
- Key engine → Layout loader: uses · Fixed-layout typing is resolved through loaded layouts.
- Key engine → Phonetic search: uses · Phonetic typing uses regex-based search and builders.
- Key engine → Auto-correct: applies · Typing flow can trigger autocorrect behavior.
- Layout loader → Keyboard layouts: loads · Runtime loads external .avrolayout files.
- Keyboard app → Settings store: persists · Main app stores user and integration settings.
- Keyboard app → System integration: integrates · Main app performs OS-level window, process, admin, and font actions.
- Keyboard app → Skin loader: themes · Main app loads skins for runtime UI.
- Keyboard app → Main UI: shows · Forms layer provides options, dialogs, and previews.
- Main UI → Skins: references · UI and preview features use packaged skins.
- Main UI → Docs: helps · User-facing dialogs connect to bundled documentation.
- Spell app → Dictionary store: loads · Spell checker reads dictionary data and custom dictionaries.
- Spell app → Phonetic match: matches · Spell checker generates phonetic candidates.
- Phonetic match → Ranking: ranks · Candidate generation is ordered by distance/similarity.
- Ranking → Dictionary store: scores · Ranking is applied against dictionary-backed candidates.
- Spell app → Spell UI: shows · Spell checker exposes popup and editor UI.
- Layout editor → Keyboard layouts: edits · Layout editor works on keyboard layout assets.
- Skin designer → Skins: creates · Skin designer produces avroskin assets.
- Bijoy converter → Packaged data: uses · Converter may rely on packaged language data.