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

Add UfoDataRequest #53

Merged
merged 8 commits into from
Mar 23, 2021
Merged

Add UfoDataRequest #53

merged 8 commits into from
Mar 23, 2021

Conversation

ctrlcctrlv
Copy link
Contributor

@ctrlcctrlv ctrlcctrlv commented Sep 9, 2020

This makes it so I can do this in MFEQ's Qmetadata:

fn main() {
    ..
    let ufo = Ufo::with_fields(UfoDataRequest::from_bool(false)).load_ufo(matches.value_of("UFO").unwrap());
    ..
}

That MFEQ module will never need all the glyph and kerning parsing this tool does; so all it does is slow things down substantially, especially with the 125MB UFO for TT2020 Style F. I know Rust maintainers are rather picky, so if you don't like this idea, just let me know, I'm happy to maintain my own Norad version, I already maintain a personal .glif parser because I need Skia-friendly points.

@madig
Copy link
Collaborator

madig commented Sep 10, 2020

I don't understand what this does from the PR text or the code :O please elaborate.

@ctrlcctrlv
Copy link
Contributor Author

@madig I don't understand why you don't understand 😓

If you call Ufo::load("someufo.ufo"), norad will parse all the glyphs and allocate memory to hold their data.

If you call my above example, it will only parse the font's fontinfo.plist.

@madig
Copy link
Collaborator

madig commented Sep 10, 2020

Aha! Now I understand the purpose, though I still don't know how the code above arrives at the fontinfo.plist data. It will be some time until I can study this. Maybe @cmyr has a quick take...

@ctrlcctrlv
Copy link
Contributor Author

Right here:

let font_info: FontInfo = FontInfo::from_file(fontinfo_path, meta.format_version)?;

This part has not changed. All I did was not fetch fields of the Ufo which the program has said it never plans to read by setting them false in the UfoDataRequest.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a reasonable addition? We may want to revisit at some point in the future, but this seems pretty straight-forward.

I have some naming and API suggestions, but overall I have no problem with this being added. Thanks!

src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
@madig
Copy link
Collaborator

madig commented Sep 10, 2020

This suddenly reminds me of ufoLib's API. See all the read* methods for https://github.com/fonttools/fonttools/blob/master/Lib/fontTools/ufoLib/__init__.py#L197. Might be useful for making a rustified Python ufoLib API.

@ctrlcctrlv ctrlcctrlv force-pushed the UfoDataRequest branch 2 times, most recently from 04423ba to e5d66e1 Compare September 12, 2020 10:14
Switch to #[non_exhaustive]

Make UfoDataRequest Copy

Builder pattern for UfoDataRequest

Better documentation for UfoDataRequest

Co-authored-by: Colin Rofls (@cmyr)

UfoDataRequest→DataRequest

Add tests
Switch to #[non_exhaustive]

Make UfoDataRequest Copy

Builder pattern for UfoDataRequest

Better documentation for UfoDataRequest

Co-authored-by: Colin Rofls (@cmyr)

UfoDataRequest→DataRequest

Add tests
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay a few more little notes but this is basically good to go I think.

src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@cmyr
Copy link
Member

cmyr commented Nov 4, 2020

@ctrlcctrlv what's the status of this? It felt like we were very close to merging, would still be happy to get it in...

@ctrlcctrlv
Copy link
Contributor Author

@cmyr Hello four months later. Sorry, I moved in November 2020, and have been working on a lot of different stuff. But finally found the time to advance this, as MFEK project (it's K now, not Q, the core team and I decided to change it) is taking up more of my time again. Please see 73840a9.

@cmyr
Copy link
Member

cmyr commented Mar 20, 2021

No worries, happy to take a look whenever it feels ready to you :)

@ctrlcctrlv
Copy link
Contributor Author

I'd say it's ready. The failing test isn't my doing, the service seems down.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cmyr cmyr merged commit 2233ab4 into linebender:master Mar 23, 2021
@cmyr cmyr mentioned this pull request Jun 29, 2021
@cmyr cmyr mentioned this pull request Dec 24, 2021
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 this pull request may close these issues.

3 participants