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

Transforming text produces incorrect results #145

Open
Riateche opened this issue Jun 26, 2020 · 2 comments · May be fixed by #146
Open

Transforming text produces incorrect results #145

Riateche opened this issue Jun 26, 2020 · 2 comments · May be fixed by #146

Comments

@Riateche
Copy link

This is a modification of the text example:

use font_kit::family_name::FamilyName;
use font_kit::properties::{Properties, Weight};
use font_kit::source::SystemSource;
use raqote::*;

fn main() {
    let mut dt = DrawTarget::new(300, 100);
    dt.clear(SolidSource::from_unpremultiplied_argb(
        0xff, 0xcf, 0xcf, 0xcf,
    ));

    let font = SystemSource::new()
        .select_best_match(
            &[FamilyName::Title("Roboto".into())],
            &Properties::new().weight(Weight::MEDIUM),
        )
        .unwrap()
        .load()
        .unwrap();
    println!("{:?}", font);

    dt.set_transform(&Transform::create_translation(50.0, 0.0));
    //dt.set_transform(&Transform::create_rotation(euclid::Angle::degrees(15.0)));
    
    dt.draw_text(
        &font,
        30.,
        "label1",
        Point::new(0., 30.),
        &Source::Solid(SolidSource::from_unpremultiplied_argb(255, 0, 180, 0)),
        &DrawOptions::new(),
    );

    dt.write_png("out.png").unwrap();
}

If translation is applied, the text clips:
out_translation

If rotation is applied, the result is broken:
out_rotation

This is reproducible on version 0.8 and current master.

Translation works correctly in 0.7:
out_translation_07

Rotation is incorrect in 0.7, but in a different way:
out_rotation_07

@jrmuizel
Copy link
Owner

It looks like this was caused by #126

jrmuizel added a commit that referenced this issue Jun 28, 2020
@jrmuizel jrmuizel linked a pull request Jun 28, 2020 that will close this issue
jrmuizel added a commit that referenced this issue Jul 1, 2020
jrmuizel added a commit that referenced this issue Jul 1, 2020
@Riateche
Copy link
Author

Riateche commented Sep 7, 2020

Any update on this?

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

Successfully merging a pull request may close this issue.

2 participants