Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source code pro renders to shrinked text #170

Open
l4l opened this issue Dec 20, 2020 · 1 comment
Open

Source code pro renders to shrinked text #170

l4l opened this issue Dec 20, 2020 · 1 comment

Comments

@l4l
Copy link
Contributor

l4l commented Dec 20, 2020

I'm not sure whether it's a raqote or font-kit issue, but with "Source Code Pro" font text renders to that:

out

and "DejaVu Sans" produces an expected result:

out

source code
[dependencies]
raqote = { git = "https://github.com/jrmuizel/raqote.git", rev = "74f0afa" }
font-kit = "0.10.0"
use font_kit::family_name::FamilyName;
use font_kit::properties::Properties;
use font_kit::source::SystemSource;
use raqote::*;

fn main() {
    let mut dt = DrawTarget::new(512, 128);

    dt.clear(SolidSource::from_unpremultiplied_argb(0xff, 0x0, 0x0, 0x0));

    // let font_name = "Source Code Pro".to_string();
    let font_name = "DejaVu Sans".to_string();
    let font = SystemSource::new()
        .select_best_match(&[FamilyName::Title(font_name)], &Properties::new())
        .unwrap()
        .load()
        .unwrap();

    let pos = Point::new(0.0, 64.0);
    let color = SolidSource::from_unpremultiplied_argb(0xff, 0xff, 0xff, 0xff);
    dt.draw_text(
        &font,
        16.0,
        "The brown fox jump over the lazy dog",
        pos,
        &Source::Solid(color),
        &DrawOptions::new(),
    );

    dt.write_png("out.png").unwrap();
}
@Speykious
Copy link

JetBrainsMono Nerd Font also renders in shrinked text, but FiraCode Mono Nerd Font doesn't. It's very random to me, but there must be an identifiable problem somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants