On May 21, 2015, at 3:51 AM, David Raymond <david_...@sil.org> wrote:XML indents - Spaces seem to be used more commonly than tabs and seem to be preferable. When I last looked I _think_ Robofab, Robfont, FontForge and Glyphs all used 2 spaces for indents in glif files. Also the majority of those don't do an indent for the <dict>, so don't know if that is a useful convention.
For elements with no contents you say "A space not preceed the />" but then have a space in the examples! No space seems the normal use.
Attribute ordering - Specifying a order for at least some seems preferable to alphabetic in terms of human-readability.
Perhaps it would be helpful to know what a library should do if it encounters a UFO that doesn't conform to the normalization rules, even if that behavior is just to reformat it correctly?
Yes, sorry, I was referring to writing specifically. Reading should never be an action that alters data.
Rather, the concern (from my perspective) is for all UFO writers to generate a consistent form so that change detection (e.g., used by version control systems) works well.
<plist version="1.0"><dict><key>ascender</key><integer>1650</integer>...
Plist Element OrderingCurrently nothing specified in the spec, but alphabetic seems the most common order used by tools.
Here are a few additional comments on the proposed spec - either clarification of earlier comments or new suggestions.
White-space and indentation
Note that examples in the UFO spec follow my 2 suggestions!
Elements, comments
Having thought about it, I now agree with the proposal
Elements, attributes
Where attributes contain numbers, positive numbers should not have a leading + sign.
Where attributes contain real numbers, there should be a maximum of 6 digits following the decimal point.
Elements, decimal precision
Since numbers in ttf are not more than 16 bit, there is no need to store more than 6 digits. Storing in higher precision within XML will increase the likelihood of rounding errors coming in simply from round-tripping through font tools. Clearly font tools will want to use higher precision internally - again to reduce rounding errors.
In terms of formatting when the value is an integer, since the UFO spec specifies all values that might have decimals as “Integer or float”, the proposed format of <integer>n</integer> within XML does seem the best standard.
GLIF Element Ordering
There is one exception to principle of not reordering contours and components - anchors within UFO 2 (which, by convention, are single point contours with type “move”). Some tools put these before other contours/components and others put them after. Suggest normalizers should put them first - but otherwise maintain their order.
Plist Element Ordering
Currently nothing specified in the spec, but ascending key order is suggested in the UFO spec conventions.
See also note on <dict> order in general below.
Default values
Having thought about it, I now agree with the proposal. Note that I would not expect to implement this within my normalizer unless the need arose, since I think existing tools work this way anyhow.
Item not covered - <dict> sorting
Although the order of the main dict for .plist files has been raised, problems also occur in dictionaries within individual elements. Since, with ElementTree for example, maintaining any original order is hard, sorting all dicts ascending key order should be part of the spec. If accepted, no need to mention the order for Plists specifically.
On May 28, 2015, at 11:00 AM, David Raymond <david_...@sil.org> wrote:
White-space and indentation1) Would prefer two spaces to tab. When tabs are used, if displayed by an editor or browser that uses 8-spaces for tabs, the XML becomes hard to read
2) Currently most tools don't indent <dict> in plists, eg:<plist version="1.0"><dict><key>ascender</key><integer>1650</integer>...
Elements, attributesThese should be ordered a logical, predetermined order rather than alphabetic. Simplest order seems to be the order they are defined within the UFO spec
Elements, commentsDo any current tools use comments? (I don't know!)
Elements, decimal precisionTen digits past the decimal seems a bit high, and more likely to lead to rounding errors when round-tripped through different tools. However, I've no relevant experience to say what level of precision is needed.
Also note there's been recent discussion elsewhere about whether <real> values that are exact integers should be shown as just 1 or 1.0 - no view on this myself (as long as it's clear one way or the other, which it currently is).
GLIF Element OrderingAgreed that there needs to be fixed order. Currently I think tools tend to follow the order they are defined in the UFO spec, ie [advance, unicode, note, image, guideline, anchor, outline, lib] so might that be a better order?
Plist Element OrderingCurrently nothing specified in the spec, but alphabetic seems the most common order used by tools.
Item not covered - .glif file namingWhilst this is perhaps off-spec for an "XML Normalization" spec, it does need to be covered by any normalization tool, since some font tools do change .glif file names. Naming these using the suggested algorithm from the UFO 3.0 spec seems the best approach.
On Jun 1, 2015, at 5:35 AM, David Raymond <david_...@sil.org> wrote:
On Thursday, 28 May 2015 16:00:32 UTC+1, David Raymond wrote:
Plist Element OrderingCurrently nothing specified in the spec, but alphabetic seems the most common order used by tools.
Alphabetic sorting only applies to dictionary plists. For array plists like layercontents.plist either an order needs to be defined, or existing order preserved.
The spec also needs to cover the formatting of the DOCTYPE linefor plists, eg<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
On Jun 5, 2015, at 12:21 PM, David Raymond <david_...@sil.org> wrote:White-space and indentationNote that examples in the UFO spec follow my 2 suggestions!
Elements, attributesWhere attributes contain numbers, positive numbers should not have a leading + sign.
Where attributes contain real numbers, there should be a maximum of 6 digits following the decimal point.
Elements, decimal precisionSince numbers in ttf are not more than 16 bit, there is no need to store more than 6 digits.
Storing in higher precision within XML will increase the likelihood of rounding errors coming in simply from round-tripping through font tools.
In terms of formatting when the value is an integer, since the UFO spec specifies all values that might have decimals as “Integer or float”, the proposed format of <integer>n</integer> within XML does seem the best standard.
GLIF Element OrderingThere is one exception to principle of not reordering contours and components - anchors within UFO 2 (which, by convention, are single point contours with type “move”). Some tools put these before other contours/components and others put them after. Suggest normalizers should put them first - but otherwise maintain their order.
Plist Element Ordering
Currently nothing specified in the spec, but ascending key order is suggested in the UFO spec conventions.See also note on <dict> order in general below.
Default valuesHaving thought about it, I now agree with the proposal. Note that I would not expect to implement this within my normalizer unless the need arose, since I think existing tools work this way anyhow.
Item not covered - <dict> sortingAlthough the order of the main dict for .plist files has been raised, problems also occur in dictionaries within individual elements. Since, with ElementTree for example, maintaining any original order is hard, sorting all dicts ascending key order should be part of the spec. If accepted, no need to mention the order for Plists specifically.
On 05/06/2015, at 11:06, Tal Leming <t...@typesupply.com> wrote:
Item not covered - .glif file naming
Whilst this is perhaps off-spec for an "XML Normalization" spec, it does need to be covered by any normalization tool, since some font tools do change .glif file names. Naming these using the suggested algorithm from the UFO 3.0 spec seems the best approach.
This is out of scope in normalization. I don't want normalizers renaming files. The UFO 3 spec has a robust naming algorithm.
...
--
You received this message because you are subscribed to the Google Groups "Unified Font Object Specification" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ufo-spec+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> 2) Images should only be written out if referenced by a glif
>
> Like .glif file naming, (2) is more than "XML normalisation", but I think should be in the scope of UFO normalizing
This seems fine, but it brings up a question: what should happen to image elements in GLIF that reference a non-existent image? If we remove those, should we also remove components that reference non-existent glyphs?
Thanks,
Tal
Nice! I've been working on an example implementation to test the feasibility of my draft:
Nice! I've been working on an example implementation to test the feasibility of my draft