daltonmaag / ubuntu

Other
31 stars 5 forks source link

First primitive attempt at a normalization target #18

Closed madig closed 6 years ago

madig commented 6 years ago

It will simply normalize all UFOs.

sladen commented 6 years ago

@madig, probably need re-checking after merging of daltonmaag/ubuntu/pull/20

madig commented 6 years ago

Couldn't figure out yet how to better implement the rules so that ufonormalizer is only called on UFOs that changed and concurrency is possible...

sladen commented 6 years ago

It's slightly hard, because ufonormalize because the files are being modified in-place.

Normally with a Makefile, there is some output file, which is recreated using when the input files further down the chain are found to be newer than the output file (comparison of timestamps). With only one file, you cannot compare it to itself.

Possible solutions, other other .PHONY rule that doesn't produce any outputs, but which does run through the motions of "compiling" the .ufos that are newer than some timestamped output file.

The second, for manually invocation would be to use the output of git status directory/*.ufo.

anthrotype commented 6 years ago

fwiw, ufonormalizer also has an -o option

anthrotype commented 6 years ago

Why do you also need to normalize the ufos when you just want to build ttfs from them? If it’s just normalisation, then the ufo’s content and thus the ttf output won’t change after that. I believe it should be a separate phony target, or a pre-commit hook. I’ll try to find some time to refactor the ufonormalizer to work as a git pre-commit hook (it needs to return the right exit code and allow to normalise single files inside the ufo).

madig commented 6 years ago

Including them in the compilation step prevents forgetting about it. But sure, I'll wait for your refactor :)

anthrotype commented 6 years ago

you know you could simply open all UFOs with defcon (or Trufont which subclasses defcon) and re-save them back, and you would get them "normalized" in the sense of "written out as ufoLib (aka the reference implementation) writes UFOs"... Then you won't need any ufonormalizer step -- of course, as long as you only edit those UFOs using tools that use ufoLib as the writer.

just sayin'

anthrotype commented 6 years ago

this is just to say that ufo normalization is not such a huge priority for me right now. I don't care too much if my xml has spaces vs tabs.

madig commented 6 years ago

Other editors might format the XML differently, so it needs to be an external tool. The defcon idea is clever, but since we're already using ufonormalizer, switching will just lead to huge commit churn.

moyogo commented 6 years ago

We should only normalize with make normalize.