You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make formatVersion in metainfo.plist a major/minor #78
We have switched to an incremental approach to updating the spec rather than holding lots of changes until a major version bump. To make it easier for readers to more easily identify these new format UFOs we need to make the formatVersion in metainfo.plist a float instead of an int.
Suggest to only ever to increment by 0.1, and not go over 3.9. After that 4.0 is inevitable and then we should change the format specifier in metainfo.plist.
What about, instead of changing the type of the existing formatVersion element from int to float (which would break existing implementation), we add an additional int element <formatVersionMinor> which defines the minor version, and the existing <formatVersion> continues to define (implicitly) the major version?
This way existing clients will (with all probability) ignore the extra element (unless they are overly strict in their validation), while updated clients will be able to read the new formatVersionMinor element and act accordingly.
We could settle on a versioning policy whereby we only ever change the major version when: 1) we remove support for existing pieces of data; or 2) change their semantics in a breaking way. Whereas we would bump the minor version every time we add extra elements or attributes to existing elements or define new public. lib keys or add whole new files to the UFO package.
Alternatively, we would be forced to bump the formatVersion directly to 4.0, that is bump the major version because we changed the type of formatVersion element itself from int to float.
OK, I'll work on fontTools.ufoLib support for parsing a new optional formatVersionMinor element in metainfo.plist.
But what about the GLIF format attribute? Do we want to add a new optional formatMinor attribute? Or do we re-purpose the existing format attribute to be a dot-separated "minor.major" string?
XML attributes (unlike plist) do not have an intrinsic type, they're just strings.
I am leaning towards simply doing format="2.1", instead of adding new formatMinor for GLIF.
Hm. However the whole point of defining an additional minor version was to avoid breaking existing tools, since the new features are meant to be additive. If we change the meaning of GLIF format attribute from an integer to a dotted version string, then existing tool will break (e.g. you won't be able to read a UFO 3.1 with GLIF 2.1 in an editor that only supports up to UFO3/GLIF2).
Older versions of fontTools.ufoLib, to take one, will refuse to load such GLIF 2.1 with "Unsupported format version" because it casts to int() and check if it's in (1, 2).
@anthrotype You've just argued against your earlier lean; but this raises a really good point. Based on that, I would think the thing to do is to also add formatMinor to GLIF, keeping format for the major format. Nothing will break then.
Should we consider bumping the major version to 4 after all, but keep the amount of spec changes low, to increase the chance that it will be adopted soon?
I think adding a extra formatMinorVersion (and formatVersion attribute in GLIF) would give lend us more flexibility in the future for adding non-breaking-changes stuff like the verticalOrigin.
The way I'm implementing them in ufoLib is so that a UFO 3.1 will still be read in by older versions with its additional data (silently) ignored. I think this is better than the font being completely rejected as invalid, especially for things like the verticalOrigin or height which are relatively less common in predominantly horizontal-scripts-centric font develpment workflows.
(glyph.height returning None instead of 0 would be a breaking change, though, no?)
hm, you got me there.. 🤔
The current behavior of glifLib is to not write a height attribute when the glyph.height value is 0.
Whereas the new glifLib would not write the height attribute when getattr(glyph, "height", None) is None.
So if one reads a new GLIF 2.1 using the old glifLib, then an omitted height attribute would be mistaken for a height of 0. That's not good, but..
Conversely if one reads an old GLIF 2.0 using the new glifLib updated to support formatMinor and new optional-height-default, then we could decide to do two things when faced with an omitted height attribute:
either we interpret this as an implicit height = 0 (but then as we save the UFO with the latest format all the glyphs will end up with an additional explicit height set to 0; maybe not too bad); or
intepreted as (incorrectly) meaning that the default height (asc - desc) is not overridden by this particular glyph and be unset to None.
Ah, another thing. Since these proposed changes to verticalOrigin and glyph height only concern the GLIF file and not the rest of the UFO files or structure, and given GLIF format has a version of its own, I think it would make more sense to only increment the GLIF format version (from 2 to 2.1) and not also the UFO format version which could stay 3 (err 3.0, formatVersion=3 and implicit formatVersionMinor=0 in the metainfo.plist).
Is it too late to revisit this? I don't think float makes any sense for version numbers and is just going to confuse the issue and make other things hard down the road. Floats just aren't good for versioning. Using a major/minor or even major/minor/patch versioning scheme would be awesome (ala Semver) but a float just confuses the issue. It won't be backwards compatible, it will look like a mathematical value but you won't be able to do normal math (x < y) on it, etc. Of course the other option is to just stick with integers. If introducing a breaking change from 3 to 3.1 is somehow okay (i.e. an existing field that needs parsing as a different type) then just calling it 4 and not being afraid to run up the integer count is probably a better plan.
I've been working on documenting the specification process and "what version of the spec should this proposal apply to?" is near the top of the page. We have two models for that now:
A change that would trigger code changes in existing tools goes to the next major version.
A change that can be implemented via a lib key goes to the current version.
Where would the minor version fit into this? Is it a hint to tools that "this UFO was last touched by a tool that knows about X, Y, Z new things"? I'm just trying to figure out how to fit this into the process.
I think that @anthrotype will have a better nuanced view than I, but i would say that minor versions are for things that won't break existing tools but add information, such as the addition of version minor (yes, this is recursive). Additions to fontinfo would fall under this too, at least in my mind.
i would say that minor versions are for things that won't break existing tools but add information, such as the addition of version minor (yes, this is recursive).
Makes sense. I'll work this into the process.
Additions to fontinfo would fall under this too, at least in my mind.
changed the title [-]Make formatVersion in metainfo.plist a float.[/-][+]Make formatVersion in metainfo.plist a versionMajor.versionMinor[/+]on Aug 16, 2020
changed the title [-]Make formatVersion in metainfo.plist a versionMajor.versionMinor[/-][+]Make formatVersion in metainfo.plist a major/minor[/+]on Aug 16, 2020
Activity
justvanrossum commentedon Jan 8, 2019
Suggest to only ever to increment by 0.1, and not go over 3.9. After that 4.0 is inevitable and then we should change the format specifier in
metainfo.plist.anthrotype commentedon Nov 1, 2019
What about, instead of changing the type of the existing formatVersion element from int to float (which would break existing implementation), we add an additional int element
<formatVersionMinor>which defines the minor version, and the existing<formatVersion>continues to define (implicitly) the major version?This way existing clients will (with all probability) ignore the extra element (unless they are overly strict in their validation), while updated clients will be able to read the new formatVersionMinor element and act accordingly.
We could settle on a versioning policy whereby we only ever change the major version when: 1) we remove support for existing pieces of data; or 2) change their semantics in a breaking way. Whereas we would bump the minor version every time we add extra elements or attributes to existing elements or define new
public.lib keys or add whole new files to the UFO package.anthrotype commentedon Nov 1, 2019
(maybe
formatMinorVersionreads better in English thanformatVersionMinor)anthrotype commentedon Nov 1, 2019
Alternatively, we would be forced to bump the formatVersion directly to
4.0, that is bump the major version because we changed the type of formatVersion element itself from int to float.typesupply commentedon Nov 1, 2019
I like the
formatVersionMinoridea. We have aversionMinorfield infontinfo.plistso I'm fine with the awkward order.benkiel commentedon Nov 1, 2019
+1
anthrotype commentedon Nov 20, 2019
OK, I'll work on fontTools.ufoLib support for parsing a new optional
formatVersionMinorelement in metainfo.plist.But what about the GLIF
formatattribute? Do we want to add a new optionalformatMinorattribute? Or do we re-purpose the existingformatattribute to be a dot-separated "minor.major" string?XML attributes (unlike plist) do not have an intrinsic type, they're just strings.
I am leaning towards simply doing
format="2.1", instead of adding newformatMinorfor GLIF.WDYT?
benkiel commentedon Nov 21, 2019
That sounds like the simplest thing
anthrotype commentedon Nov 21, 2019
Hm. However the whole point of defining an additional minor version was to avoid breaking existing tools, since the new features are meant to be additive. If we change the meaning of GLIF format attribute from an integer to a dotted version string, then existing tool will break (e.g. you won't be able to read a UFO 3.1 with GLIF 2.1 in an editor that only supports up to UFO3/GLIF2).
Older versions of fontTools.ufoLib, to take one, will refuse to load such GLIF 2.1 with "Unsupported format version" because it casts to int() and check if it's in (1, 2).
anthrotype commentedon Nov 21, 2019
cc @justvanrossum
benkiel commentedon Nov 21, 2019
@anthrotype You've just argued against your earlier lean; but this raises a really good point. Based on that, I would think the thing to do is to also add
formatMinorto GLIF, keepingformatfor the major format. Nothing will break then.justvanrossum commentedon Dec 13, 2019
Should we consider bumping the major version to 4 after all, but keep the amount of spec changes low, to increase the chance that it will be adopted soon?
anthrotype commentedon Dec 13, 2019
I think adding a extra formatMinorVersion (and formatVersion attribute in GLIF) would give lend us more flexibility in the future for adding non-breaking-changes stuff like the verticalOrigin.
The way I'm implementing them in ufoLib is so that a UFO 3.1 will still be read in by older versions with its additional data (silently) ignored. I think this is better than the font being completely rejected as invalid, especially for things like the verticalOrigin or height which are relatively less common in predominantly horizontal-scripts-centric font develpment workflows.
justvanrossum commentedon Dec 13, 2019
Oh, that is beyond doubt.
If you think we can pull off a 3.1 without breakage that would be awesome.
(
glyph.heightreturningNoneinstead of 0 would be a breaking change, though, no? #95)anthrotype commentedon Dec 13, 2019
hm, you got me there.. 🤔
The current behavior of glifLib is to not write a height attribute when the glyph.height value is 0.
Whereas the new glifLib would not write the height attribute when getattr(glyph, "height", None) is None.
So if one reads a new GLIF 2.1 using the old glifLib, then an omitted height attribute would be mistaken for a height of 0. That's not good, but..
Conversely if one reads an old GLIF 2.0 using the new glifLib updated to support formatMinor and new optional-height-default, then we could decide to do two things when faced with an omitted height attribute:
Ah, another thing. Since these proposed changes to verticalOrigin and glyph height only concern the GLIF file and not the rest of the UFO files or structure, and given GLIF format has a version of its own, I think it would make more sense to only increment the GLIF format version (from 2 to 2.1) and not also the UFO format version which could stay 3 (err 3.0, formatVersion=3 and implicit formatVersionMinor=0 in the metainfo.plist).
9 remaining items
alerque commentedon Aug 12, 2020
Is it too late to revisit this? I don't think float makes any sense for version numbers and is just going to confuse the issue and make other things hard down the road. Floats just aren't good for versioning. Using a major/minor or even major/minor/patch versioning scheme would be awesome (ala Semver) but a float just confuses the issue. It won't be backwards compatible, it will look like a mathematical value but you won't be able to do normal math (x < y) on it, etc. Of course the other option is to just stick with integers. If introducing a breaking change from 3 to 3.1 is somehow okay (i.e. an existing field that needs parsing as a different type) then just calling it 4 and not being afraid to run up the integer count is probably a better plan.
justvanrossum commentedon Aug 12, 2020
Check ufoLib: it has not been implemented as a float, but as major/minor.
benkiel commentedon Aug 12, 2020
I'll write doc for this. Will do this weekend.
benkiel commentedon Aug 12, 2020
And, this should be in 3.1.
typesupply commentedon Aug 12, 2020
I've been working on documenting the specification process and "what version of the spec should this proposal apply to?" is near the top of the page. We have two models for that now:
Where would the minor version fit into this? Is it a hint to tools that "this UFO was last touched by a tool that knows about X, Y, Z new things"? I'm just trying to figure out how to fit this into the process.
benkiel commentedon Aug 12, 2020
I think that @anthrotype will have a better nuanced view than I, but i would say that minor versions are for things that won't break existing tools but add information, such as the addition of version minor (yes, this is recursive). Additions to fontinfo would fall under this too, at least in my mind.
typesupply commentedon Aug 12, 2020
Makes sense. I'll work this into the process.
Cool. That relates to #128.
[-]Make formatVersion in metainfo.plist a float.[/-][+]Make formatVersion in metainfo.plist a versionMajor.versionMinor[/+][-]Make formatVersion in metainfo.plist a versionMajor.versionMinor[/-][+]Make formatVersion in metainfo.plist a major/minor[/+]py-fonttools: updated to 4.12.1
py-fonttools: updated to 4.12.1
py-fonttools: updated to 4.12.1