-
Notifications
You must be signed in to change notification settings - Fork 18
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
Code Review: Fill in all schema description
fields and tidy up TODOs
(#6)
#7
Conversation
Some answers/pointers as best I can:
My memory says we used to use the text system's default line spacing approach, but now have something that mimics what web browsers do. The enum is for compatibility to know which one should be in use. @randomsequence is best to know I think?
Also @randomsequence is best to answer I believe.
This one corresponds to
We've got this idea that a group can have a layout object associated with it to control what happens when resized etc. Normal groups have this freeform layout which doesn't really do anything special. But then Smart Layout can kick in to have an effect and other things like that. |
(a) This was new in Sketch 3.6. If you have fixed line height on a layer we use a custom layout manager to make sure the baselines are a fixed distance apart, even with mixed fonts, like in a browser. This is not how the system layout manager behaves. (b) Layers created before 3.6 have the old behaviour. Changing the fixed line height on any layer in 3.6 or later switches it to the new behaviour. There is no UI for setting it back to the old. (c) We haven't yet expose this to users, but if you really want one I'd go with "legacy" and "consistent baseline" |
See
For user-facing strings, I'd go with:
See also: https://blog.sketchapp.com/introducing-libraries-and-smooth-corners-in-sketch-47-2abc5dfc1fb3 |
@mikeabdullah @randomsequence Thanks for your help so far dudes! I'm off on holiday next week, but please keep any info/input coming in the meantime if you're able, and I'll incorporate when I'm back. |
A few more gaps Jed:
They denote the type of line ending:
The posible values are:
They determine how the exported layer should be scaled. E.g. in the export options you can enter a size like
The export file name will be the layer name with an optional suffix or prefix (e.g.
I believe this is legacy and only kept for migrating old documents.
It's not used. We have shared layer and text style containers. The original idea was that symbols would similarly be in a symbol container, but that didn't happen.
I think this is the strike through that can be set on text via: As far as I can tell, the valid values are defined by Apple:
(Yep this says underline, but I think it's used for strikethrough as well 😕)
Just how text can be vertically alined to it's container:
|
I'm seeing this in the BCConstraint file:
How do these play out into real values in the document JSON? I'm confused because I thought for example |
@jedrichards where did you come across the |
|
Ok gotcha, thanks - so in terms of what title: Resize Constraint
description: Enumeration of the possible types of resizing constraints
type: integer
enum:
- 0
- 1
- 2
- 4
- 8
- 16
- 32
- 64
enumDescriptions:
- All flexible
- Right margin flexible
- Width flexible
- Left margin flexible
- Top margin flexible
- Height flexible
- Bottom margin flexible
- All fixed |
It's not an enumeration, it's a bit field (or set of flags) - the values can be combined together. I've no idea how you do that in js 😳 |
Ah yeah I was beginning to have a hunch something like that might be the case ... it's not so much doing it in JS, it's just trying to formalise it into a schema that describes the possible range of values to be found in the JSON. Maybe the |
By combining the values you can make any integer from 0 to 127, so I guess a positive integer should work. I think you're going to encounter quite a few of these bitfields though, so it might be something you need to come up with a proper solution for. |
Defining it as an integer between 0 and 127 sounds good for now. I guess that is fundamentally what the value is, and if people need to reproduce a meaningful value they'll need to do some bit-shifting themselves, which is out of scope of this schema. I didn't come across anything else so far that looked like a bitfield, but I may have been mistaking some for enums, not sure. |
Co-Authored-By: Christian Klotz <hello@christianklotz.co.uk>
Co-Authored-By: Christian Klotz <hello@christianklotz.co.uk>
Co-Authored-By: Christian Klotz <hello@christianklotz.co.uk>
Closes #6
This PR will enhance the schemas by filling in human readable descriptions for the top level objects, and tidies up some loose ends indicated by
TODO
comments.I don't consider this PR ready for final review yet, so it's still in draft status. It needs dedicated input from someone in the Mac team close to the file format. The
description
values I've added need going over carefully and determining whether they make sense in the historical/technical context of the file format - corrections, additions and improvements welcome. Any suggestions for extra detail in descriptions welcome too, I realise some of mine may be a bit terse.At this stage we're just adding
descriptions
to the top level objects, but a future effort could be to add descriptions to more properties, especially where some discussion would aid those implementing this spec in other products.Questions
Below are the outstanding questions I have. Once I've had answers to these in this thread I'll incorporate into this PR and we can move towards a final review and merge.
lineSpacingBehaviour
field of a text layer? How is it edited via the UI? What are the descriptions for each of its numerical values?startMarkerType
andendMarkerType
fields on a style object? How are they edited via the UI?pointRadiusBehaviour
enum on shape layers, what could be considered human readable descriptions for these?resizingType
field of a layer?resizingConstraint
field of a layer?visibleScaleType
field on anexportFormat
object? How is it changed from the UI?namingScheme
field on anexportFormat
object? Is it an enum? If so what are its possible values and associated human readable descriptions?MSImmutableFreeformGroupLayout
object? It always seems to be emptyimageCollection
object in use? It always seems to be emptysymbolContainer
object that appears on the document used? It always seems to be emptystrikethroughStyle
field on a text style? Is it an enum? How is it edited via the UI?textStyleVerticalAlignmentKey
on a text style?