refpad is a reference Notepad-like Unicode text editor. It is meant to explore the problem space of editing and displaying multi-lingual Unicode text and present simple solutions through the implementation of a textbox-in-a-window editor. It is also used as an example project to showcase version 2 of the kb_text_shape API.
refpad does not try to handle large amounts of text: there are hard limits for total text length and line count, and the entirety of the text is shapen and laid out every frame.
refpad supports multilingual and multi-style text, including mixed left-to-right and right-to-left text. A hardcoded list of fonts, which are included in this repository, is loaded on startup, and kb_text_shape is responsible for choosing the appropriate font to display each part of the text. Selecting and loading system fonts is out of scope for this project.
refpad supports a number of standard text editor actions:
Escape: exit the programLeft: move to previous graphemeRight: move to next graphemeUp: move to previous lineDown: move to next lineCtrl+Left: move to previous wordCtrl+Right: move to next wordCtrl+Up: move to previous paragraphCtrl+Down: move to next paragraphHome: move to the beginning of the lineEnd: move to the end of the linePageUp: move up the height of a screenPageDown: move down the height of a screenShift: hold while moving to selectBackspace: delete one codepoint before the cursorDelete: delete one grapheme after the cursorCtrl+Backspace: delete one word before the cursorCtrl+Delete: delete one word after the cursorCtrl+A: select allCtrl+C: copy to clipboardCtrl+V: paste from clipboardCtrl+X: cut to clipboardCtrl+Z: undoCtrl+Y: redoCtrl+Plus: increase font sizeCtrl+Minus: decrease font size
refpad also has several actions meant for exploring text editor functionality:
Ctrl+R: toggle display of newline charactersCtrl+W: toggle line wrappingCtrl+B: toggle bold style on selectionCtrl+I: toggle italic style on selection
refpad uses SDL3. This repository contains pre-built binaries of SDL3 for Windows. On Linux, you will need to have installed the development version of the library in order to compile the editor.
Furthermore, refpad uses the stb_truetype and kb_text_shape single-header libraries.
SDL3 and stb_truetype are used to open a window and render text on Windows and Linux. They could, in theory, be replaced with other backends. kb_text_shape, on the other hand, is used in the core of the editor.
On Windows: build.bat
On Linux: sh build.sh