bracket-lib icon indicating copy to clipboard operation
bracket-lib copied to clipboard

Support ttf fonts

Open UkonnRa opened this issue 5 years ago • 3 comments

GNU Unifont has a full-featured TrueFont http://unifoundry.com/unifont/index.html

But right now bracket-lib cannot support ttf fonts.

For example, in unicode.rs:

bracket_terminal::embedded_resource!(TILE_FONT3, "../resources/unifont-13.0.03.ttf");

fn main() -> BError {
    bracket_terminal::link_resource!(TILE_FONT3, "resources/unifont-13.0.03.ttf");

    let context = BTermBuilder::new()
        .with_dimensions(80, 50)
        .with_tile_dimensions(16, 16)
        .with_title("Hello Minimal Bracket World")
        .with_font("unifont-13.0.03.ttf", 16, 16)
        .with_simple_console(80, 50, "unifont-13.0.03.ttf")
        .build()?;

    let gs: State = State {};

    main_loop(context, gs)
}

Will throw errors.

BTW, if I use the BMP version: http://unifoundry.com/pub/unifont/unifont-13.0.03/unifont-13.0.03.bmp

The loading time will be incredibly slow (more than 1min I think)

UkonnRa avatar Nov 16 '20 14:11 UkonnRa

I'll put this on my wish-list. I think I'd have to do a fair chunk of architecture work to support TTF well (as opposed to just drawing it a sprite sheet on load). TTF can get confusing because glyphs have different sizes - and the sprite fonts all assume that they are uniform.

thebracket avatar Nov 19 '20 19:11 thebracket

This would be great! I never opened an issue about it, but I've been thinking about TTF support since I first used bracket-lib.

pprobst avatar Dec 28 '20 19:12 pprobst

Would this rasterisation library help? ab-glyph

km19809 avatar Mar 14 '22 08:03 km19809