-
Notifications
You must be signed in to change notification settings - Fork 12
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
To what extent, if any, should norad collaborate with MFEK/glifparser.rlib? #107
Comments
I definitely think it's possible, and some of these items seem like pretty obvious fits. Let me think in point form:
So yes, I agree that collaboration on most of these points sounds very reasonable, with only a few items I'm not sure about. |
(I wrote some code to decompose a composite: https://github.com/linebender/norad/blob/add-example-letterspacer/examples/letterspacer.rs#L474-L521) I haven't looked at MFEK but maybe capabilities can be merged over? |
It doesn't look like that code checks if there's circular references, making my version safer. |
About the image data, my glifparser.rlib basically does just that: gives you a |
Cool. Yes, neither norad nor my code currently deal with malformed component trees. |
Cool, doing raw image data works for me, and then if we wanted to use something like the |
I think ufoLib also passes back bytes and no Image object or anything 🤔 |
Well, obviously the degree people implement the spec varies, but the spec says:
So, I have no clue how you can sanely do this without parsing the PNG, reading a bitmap, and clobbering the pixels. I suppose, technically, you could implement it insanely another way:
Then you can just return back the modified PNG data which you've mangled in memory. But that seems crazy to me, to do that and not just return a bitmap. |
I guess this depends on goals? I assume the whole rationale for this is that some authoring tool (robofont?) wanted to be able to use grayscale images as masks, and that ended up being baked into the spec. I would be personally happy to just return the image data and the color information, and then let the user do whatever they want with that. Put another way: per the spec, I would not consider norad to be "the authoring tool". |
@cmyr It is as you say, a matter of goals. For example, for me, glifparser.rlib is tightly coupled to MFEK project, mostly MFEKglif, but everything else too. Converting back and forth between Skia paths is therefore absolutely a necessity—I put it behind a glifparser.rlib also has a type I didn't talk about since ① it's so new and ② not related to norad, but which illustrates the point: |
However, since the spec mandates what should be done, it makes sense to me a ufo library will contain a standard compliant implementation that every app will need and benefit from being the same. Of course apps can do more, if they wish |
@davelab6 This is now implemented in There's a If you call If you call If the If the application changes the color, it can call Changing the color is up to the application, but applying the color is obviously the job of the UFO library, since the spec describes how it should be applied, and applications aren't free to just apply colors however they wish. |
I updated the README file of |
I still haven't found the time to sift through glifparser etc. to see if there's anything to steal... one day! |
In my opinion, most obviously stealable parts are:
|
Hm yes, points 1 sounds interesting, point 2 I need to review (what does norad not support?), but point 3 I'm not sure about. What specifically do you need to have free-standing |
Point three is interesting; there are various projects (such as RoboCJK) that are starting to use the Maybe one possible limitation is that it might not serialize the |
Free standing glyphs are normal in font development which is centered around UFO format. There are so many cases you might want them I couldn't even begin to list them all. Regarding point two, your
|
Also, my if codec != ImageCodec::PNG {
warn!("Image not PNG! `fontmake` and other UFO spec conformant progams will refuse to embed the bitmap. MFEKglif may still be able to display it, however, so only use it for proofing, not output.");
} I support BMP, GIF, and (most importantly) JPEG and WebP besides the UFO spec demand of PNG. The reason I support all these codecs is that people want to trace from books usually and storing many hicolor 600dpi scans losslessly in a font repo is not logical. |
Btw my codec matcher might not be the best but I haven't found any valid files it fails on: let codec = match self.data.unwrap_data().chunks(12).next() {
Some(&[0x42, 0x4D, _, _, _, _, _, _, _, _, _, _]) => ImageCodec::BMP,
Some(&[0xFF, 0xD8, _, _, _, _, _, _, _, _, _, _]) => ImageCodec::JPEG,
Some(&[0x89, 0x50, 0x4E, 0x47, _, _, _, _, _, _, _, _]) => ImageCodec::PNG,
Some(&[0x47, 0x49, 0x46, 0x38, _, _, _, _, _, _, _, _]) => ImageCodec::GIF,
Some(&[0x52, 0x49, 0x46, 0x46, _, _, _, _, 0x57, 0x45, 0x42, 0x50]) => ImageCodec::WebP,
_ => ImageCodec::Unknown
}; If it gets it wrong, then API will just return back an |
Hello,
I just got done writing glifparser v1.0.
glifparser was written primarily for MFEKglif but it's also used in MFEKstroke, and in MFEKufo (unreleased) for previewing glyphs.
It's currently in
mfek
branch, awaiting @MatthewBlanchard and I to patch MFEKglif and MFEKstroke to support the changes. The biggest change is that there are no more panic's, originally, I just panicked via.expect(...)
in a lot of cases because I knew MFEKglif was the only consumer and had a custom panic unwinder that would pretty print the message in red and make it clear what went wrong.glifparser can do quite a few things norad cannot:
kurbo::Affine
!)I was thinking, maybe
norad
can support usingglifparser
at user option, via compile-time feature. Right now what I'm doing is, usingnorad
with theUfoDataRequest
I added and just not reading glyphs with it, using it for metadata only.I think closer collaboration is possible. Is it desirable?
The text was updated successfully, but these errors were encountered: