| 1 |
--- |
| 2 |
title: Layer |
| 3 |
--- |
| 4 |
Layer(width: int = 0, height: int = 0, name: str = None, _master: str = None, id: str = <factory>, guides: [<class 'babelfont.Guide.Guide'>] = <factory>, shapes: [<class 'babelfont.Shape.Shape'>] = <factory>, anchors: [<class 'babelfont.Anchor.Anchor'>] = <factory>, color: babelfont.BaseObject.Color = None, layerIndex: int = 0, _background: str = None, isBackground: bool = False, location: [<class 'float'>] = None, _font: object = None, _formatspecific: dict = <factory>, _: dict = None) |
| 5 |
## Layer.width |
| 6 |
|
| 7 |
* Python type: `int` |
| 8 |
|
| 9 |
|
| 10 |
*If not provided, defaults to* `0`. |
| 11 |
|
| 12 |
|
| 13 |
## Layer.height |
| 14 |
|
| 15 |
* Python type: `int` |
| 16 |
|
| 17 |
|
| 18 |
*If not provided, defaults to* `0`. |
| 19 |
|
| 20 |
|
| 21 |
## Layer.name |
| 22 |
|
| 23 |
* Python type: `str` |
| 24 |
|
| 25 |
|
| 26 |
*If not provided, defaults to* `None`. |
| 27 |
|
| 28 |
|
| 29 |
## Layer._master |
| 30 |
|
| 31 |
* Python type: `str` |
| 32 |
|
| 33 |
|
| 34 |
*If not provided, defaults to* `None`. |
| 35 |
|
| 36 |
|
| 37 |
## Layer.id |
| 38 |
|
| 39 |
* Python type: `str` |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
## Layer.guides |
| 45 |
|
| 46 |
* Python type: [[`Guide`](Guide.html)] |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
## Layer.shapes |
| 52 |
|
| 53 |
* Python type: [[`Shape`](Shape.html)] |
| 54 |
|
| 55 |
* When writing to Babelfont-JSON, each item in the list must be placed on a separate line. |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
## Layer.anchors |
| 61 |
|
| 62 |
* Python type: [[`Anchor`](Anchor.html)] |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
## Layer.color |
| 68 |
|
| 69 |
* Python type: `Color` |
| 70 |
|
| 71 |
|
| 72 |
*If not provided, defaults to* `None`. |
| 73 |
|
| 74 |
|
| 75 |
## Layer.layerIndex |
| 76 |
|
| 77 |
* Python type: `int` |
| 78 |
|
| 79 |
|
| 80 |
*If not provided, defaults to* `0`. |
| 81 |
|
| 82 |
|
| 83 |
## Layer._background |
| 84 |
|
| 85 |
* Python type: `str` |
| 86 |
|
| 87 |
|
| 88 |
*If not provided, defaults to* `None`. |
| 89 |
|
| 90 |
|
| 91 |
## Layer.isBackground |
| 92 |
|
| 93 |
* Python type: `bool` |
| 94 |
|
| 95 |
|
| 96 |
*If not provided, defaults to* `False`. |
| 97 |
|
| 98 |
|
| 99 |
## Layer.location |
| 100 |
|
| 101 |
* Python type: `[float]` |
| 102 |
|
| 103 |
|
| 104 |
*If not provided, defaults to* `None`. |
| 105 |
|
| 106 |
|
| 107 |
## Layer._font |
| 108 |
|
| 109 |
* Python type: `object` |
| 110 |
|
| 111 |
* This field only exists as an attribute of the the Python object and should not be written to Babelfont-JSON. |
| 112 |
|
| 113 |
|
| 114 |
*If not provided, defaults to* `None`. |
| 115 |
|
| 116 |
|
| 117 |
## Layer._formatspecific |
| 118 |
|
| 119 |
* Python type: `dict` |
| 120 |
|
| 121 |
|
| 122 |
Each object in Babelfont has an optional attached dictionary to allow the storage |
| 123 |
of format-specific information. Font creation software may store any additional |
| 124 |
information that they wish to have preserved on import and export under a |
| 125 |
namespaced (reverse-domain) key in this dictionary. For example, information |
| 126 |
specific to the Glyphs software should be stored under the key `com.glyphsapp`. |
| 127 |
The value stored under this key may be any data serializable in JSON; typically |
| 128 |
it will be a `dict`. |
| 129 |
|
| 130 |
Note that there is an important distinction between the Python object format |
| 131 |
of this field and the Babelfont-JSON representation. When stored to JSON, this key |
| 132 |
is exported not as `_formatspecific` but as a simple underscore (`_`). |
| 133 |
|
| 134 |
|
| 135 |
|