Skip to content

add TextBuffer #452

Open
Open

Description

There's FrameBuffer but no TextBuffer.

Activity

  1. bjorn3 commented on Aug 13, 2024

    @bjorn3
    Contributor

    If you boot using BIOS, you can use VGA text mode to directly feed text to the GPU. Bowever in the case of UEFI, GOP (the UEFI replacement for the VGA and VESA device interfaces) only supports setting up framebuffers. Because of this the kernel has to turn text into pixels itself. For consistency the bootloader crate only provides a framebuffer interface, even on BIOS where it could technically provide a text mode interface.

  2. bjorn3 commented on Nov 10, 2024

    @bjorn3
    Contributor

    Parsing and rendering of regular vector fonts is very complex (and slow inside a kernel due to needing to use soft floats there) and almost certainly not what you want in the kernel. (it has lead to countless of kernel exploits in the case of windows for example) Rather you likely want to use a pre-rasterized font instead. There are several crates that contain pre-rasterized fonts like noto_sans_mono_bitmap (containing Noto Sans Mono) Or you can use the mono_font module of the embedded-graphics crate.

  3. bjorn3 commented on Nov 10, 2024

    @bjorn3
    Contributor

    There are two separate big problems with rendering vector fonts in the kernel:

    • It is slow. This is because vector font rendering depends on floats and inside a kernel you generally can't use the hardware float support and are forced to use the much slower software implementation of floats (softfloat) instead.
    • It is insecure. The common font formats are really complex and even contain several languages that are complex enough to have a pokemon clone programmed entirely in it (https://www.coderelay.io/fontemon.html) or, with HarfBuzz's new wasm shaper, run an actual LLM inside the font (https://fuglede.github.io/llama.ttf/). For web fonts, web browsers do a significant amount of work to sanitize potentially malicious fonts.

    These two problems are entirely separate, but both are reasons you don't want to process vector fonts inside the kernel and should rather use a pre-rasterized bitmap font instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions