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

Use better (longer) lifetime as possible for Font #22

Merged
merged 1 commit into from Jun 13, 2016

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented Jun 13, 2016

Lifetime of a font object given by FontCollection::font_at is same as that of SharedBytes which FontCollection contains.

This change enables Font to exist without FontCollection.
example:

let font = {
    let font_data = include_bytes!("Arial Unicode.ttf");
    let collection = FontCollection::from_bytes(font_data.to_vec());
    collection.font_at(0).unwrap()
};

Lifetime of a font object given by `FontCollection::font_at` is
same as that of `SharedBytes` which `FontCollection` contains.
@dylanede
Copy link
Contributor

Yep, sounds reasonable. Thanks!

@dylanede dylanede merged commit 5dcc869 into redox-os:master Jun 13, 2016
@lo48576 lo48576 deleted the use-better-lifetime branch June 13, 2016 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants