| 1 |
@startuml v5_class_diagram |
| 2 |
|
| 3 |
title |
| 4 |
Designspace v5 Class Diagram |
| 5 |
|
| 6 |
<size:12>Note: the ""Descriptor"" suffix is omitted from most classes |
| 7 |
end title |
| 8 |
|
| 9 |
' left to right direction |
| 10 |
|
| 11 |
skinparam class { |
| 12 |
BackgroundColor<<New>> PaleGreen |
| 13 |
} |
| 14 |
|
| 15 |
class DesignSpaceDocument { |
| 16 |
+ formatVersion: str = None |
| 17 |
+ <color:green><b><<New>> elidedFallbackName: str = None |
| 18 |
+ rulesProcessingLast: bool = False |
| 19 |
+ lib: Dict = {} |
| 20 |
} |
| 21 |
|
| 22 |
note left of DesignSpaceDocument::elidedFallbackName |
| 23 |
STAT Style Attributes Header field ""elidedFallbackNameID"" |
| 24 |
end note |
| 25 |
|
| 26 |
abstract class AbstractAxis { |
| 27 |
+ tag: str |
| 28 |
+ name: str |
| 29 |
+ labelNames: Dict[str, str] |
| 30 |
+ hidden: bool |
| 31 |
+ map: List[Tuple[float, float]] |
| 32 |
+ <color:green><b><<New>> axisOrdering: int |
| 33 |
} |
| 34 |
DesignSpaceDocument *-- "*" AbstractAxis: axes > |
| 35 |
note right of AbstractAxis::axisOrdering |
| 36 |
STAT Axis Record field |
| 37 |
end note |
| 38 |
|
| 39 |
class Axis { |
| 40 |
+ minimum: float |
| 41 |
+ maximum: float |
| 42 |
+ default: float |
| 43 |
} |
| 44 |
AbstractAxis <|--- Axis |
| 45 |
note bottom of Axis |
| 46 |
This is the usual |
| 47 |
Axis, with a range |
| 48 |
of values. |
| 49 |
end note |
| 50 |
|
| 51 |
class DiscreteAxis <<New>> { |
| 52 |
+ values: List[float] |
| 53 |
+ default: float |
| 54 |
} |
| 55 |
AbstractAxis <|--- DiscreteAxis |
| 56 |
note bottom of DiscreteAxis |
| 57 |
A discrete axis is not |
| 58 |
interpolable, e.g. |
| 59 |
Uprights vs Italics, and |
| 60 |
so has "discrete" stops |
| 61 |
instead of a continuous |
| 62 |
range of values. |
| 63 |
end note |
| 64 |
|
| 65 |
Axis .[hidden] DiscreteAxis |
| 66 |
|
| 67 |
class AxisLabel <<New>> { |
| 68 |
+ userMinimum: Optional[float] |
| 69 |
+ userValue: float |
| 70 |
+ userMaximum: Optional[float] |
| 71 |
+ name: str |
| 72 |
+ elidable: bool |
| 73 |
+ olderSibling: bool |
| 74 |
+ linkedUserValue: Optional[float] |
| 75 |
+ labelNames: Dict[str, str] |
| 76 |
|
| 77 |
+ getFormat(): 1 | 2 | 3 |
| 78 |
} |
| 79 |
note right of AxisLabel |
| 80 |
Label for a |
| 81 |
stop on an Axis |
| 82 |
(STAT format |
| 83 |
1,2,3) |
| 84 |
end note |
| 85 |
AbstractAxis *-- "*" AxisLabel: <<New>> \n axisLabels > |
| 86 |
|
| 87 |
class LocationLabel <<New>> { |
| 88 |
+ name: str |
| 89 |
+ location: Dict[str, float] |
| 90 |
+ elidable: bool |
| 91 |
+ olderSibling: bool |
| 92 |
+ labelNames: Dict[str, str] |
| 93 |
} |
| 94 |
note right of LocationLabel |
| 95 |
Label for a |
| 96 |
freestanding |
| 97 |
location |
| 98 |
(STAT format 4) |
| 99 |
end note |
| 100 |
DesignSpaceDocument *--- "*" LocationLabel: <<New>> \n locationLabels > |
| 101 |
|
| 102 |
class Rule { |
| 103 |
+ name: str |
| 104 |
+ conditionSets: List[ConditionSet] |
| 105 |
+ subs: Dict[str, str] |
| 106 |
} |
| 107 |
DesignSpaceDocument *- "*" Rule: rules > |
| 108 |
|
| 109 |
class Source { |
| 110 |
+ name: Optional[str] |
| 111 |
+ filename: str |
| 112 |
+ path: str |
| 113 |
+ layerName: Optional[str] |
| 114 |
+ <color:brown><s><<Deprecated>> location: Location |
| 115 |
+ <color:green><b><<New>> designLocation: SimpleLocation |
| 116 |
.... |
| 117 |
+ font: Optional[Font] |
| 118 |
.... |
| 119 |
+ familyName: Optional[str] |
| 120 |
+ styleName: Optional[str] |
| 121 |
+ <color:green><b><<New>> localisedFamilyName: Dict |
| 122 |
.... |
| 123 |
+ <color:brown><s><<Deprecated>> copyLib: bool |
| 124 |
+ <color:brown><s><<Deprecated>> copyInfo: bool |
| 125 |
+ <color:brown><s><<Deprecated>> copyGroups: bool |
| 126 |
+ <color:brown><s><<Deprecated>> copyFeatures: bool |
| 127 |
.... |
| 128 |
+ muteKerning: bool |
| 129 |
+ muteInfo: bool |
| 130 |
+ mutedGlyphNames: List[str] |
| 131 |
---- |
| 132 |
+ <color:green><b><<New>> getFullDesignLocation(doc) |
| 133 |
} |
| 134 |
DesignSpaceDocument *-- "*" Source: sources > |
| 135 |
note right of Source::localisedFamilyName |
| 136 |
New field to allow generation |
| 137 |
of localised instance names using |
| 138 |
STAT information. |
| 139 |
end note |
| 140 |
note right of Source::copyGroups |
| 141 |
These fields are already not meaningful |
| 142 |
anymore in version 4 (the default source |
| 143 |
will be used as "neutral" for groups, info |
| 144 |
and features. ''copyLib'' can be emulated |
| 145 |
by putting content in the designspace's lib. |
| 146 |
end note |
| 147 |
|
| 148 |
note as NLocSource |
| 149 |
The location of |
| 150 |
sources can still only |
| 151 |
be defined in design |
| 152 |
coordinates, and now |
| 153 |
also by relying on |
| 154 |
axis defaults. |
| 155 |
|
| 156 |
To build the final, |
| 157 |
"full" location, a |
| 158 |
helper method is |
| 159 |
provided, that uses |
| 160 |
axis defaults and |
| 161 |
axis mappings to |
| 162 |
fill in the blanks. |
| 163 |
end note |
| 164 |
NLocSource . Source::designLocation |
| 165 |
NLocSource . Source::getFullDesignLocation |
| 166 |
|
| 167 |
class VariableFont <<New>> { |
| 168 |
+ filename: str |
| 169 |
+ lib: Dict |
| 170 |
} |
| 171 |
DesignSpaceDocument *--- "*" VariableFont: <<New>> \n variableFonts > |
| 172 |
note right of VariableFont |
| 173 |
A variable font is a |
| 174 |
subset of the designspace |
| 175 |
where everything interpolates |
| 176 |
(and so can be compiled into |
| 177 |
an OpenType variable font). |
| 178 |
end note |
| 179 |
|
| 180 |
abstract class AbstractAxisSubset <<New>> { |
| 181 |
+ name: str |
| 182 |
} |
| 183 |
VariableFont *-- "*" AbstractAxisSubset: <<New>> \n axisSubsets > |
| 184 |
|
| 185 |
note right of AbstractAxisSubset |
| 186 |
An axis subset selects a range |
| 187 |
or a spot on each the available |
| 188 |
axes from the whole designspace. |
| 189 |
|
| 190 |
By default, only the default value |
| 191 |
of each axis is used to define the |
| 192 |
variable font. |
| 193 |
|
| 194 |
Continuous axes can be specified |
| 195 |
to include their full range instead; |
| 196 |
or a subset of the range. |
| 197 |
|
| 198 |
Discrete axes can be specified |
| 199 |
to include a different spot than the |
| 200 |
default. |
| 201 |
end note |
| 202 |
|
| 203 |
class RangeAxisSubset <<New>> { |
| 204 |
+ userMinimum: float |
| 205 |
+ userDefault: float |
| 206 |
+ userMaximum: float |
| 207 |
} |
| 208 |
AbstractAxisSubset <|-- RangeAxisSubset |
| 209 |
|
| 210 |
class ValueAxisSubset <<New>> { |
| 211 |
+ userValue: float |
| 212 |
} |
| 213 |
AbstractAxisSubset <|-- ValueAxisSubset |
| 214 |
|
| 215 |
class Instance { |
| 216 |
+ filename: str |
| 217 |
+ path: str |
| 218 |
+ <color:brown><s><<Deprecated>> location: Location |
| 219 |
+ <color:green><b><<New>> locationLabel: str |
| 220 |
+ <color:green><b><<New>> designLocation: AnisotropicLocation |
| 221 |
+ <color:green><b><<New>> userLocation: SimpleLocation |
| 222 |
.... |
| 223 |
+ font: Optional[Font] |
| 224 |
.... |
| 225 |
+ <color:orange><b><<Changed>> name: Optional[str] |
| 226 |
+ <color:orange><b><<Changed>> familyName: Optional[str] |
| 227 |
+ <color:orange><b><<Changed>> styleName: Optional[str] |
| 228 |
+ <color:orange><b><<Changed>> postScriptFontName: Optional[str] |
| 229 |
+ <color:orange><b><<Changed>> styleMapFamilyName: Optional[str] |
| 230 |
+ <color:orange><b><<Changed>> styleMapStyleName: Optional[str] |
| 231 |
+ localisedFamilyName: Dict |
| 232 |
+ localisedStyleName: Dict |
| 233 |
+ localisedStyleMapFamilyName: Dict |
| 234 |
+ localisedStyleMapStyleName: Dict |
| 235 |
.... |
| 236 |
+ <color:brown><s><<Deprecated>> glyphs: Dict |
| 237 |
+ <color:brown><s><<Deprecated>> kerning: bool |
| 238 |
+ <color:brown><s><<Deprecated>> info: bool |
| 239 |
.... |
| 240 |
+ lib: Dict |
| 241 |
---- |
| 242 |
+ <color:green><b><<New>> clearLocation() |
| 243 |
+ <color:green><b><<New>> getLocationLabelDescriptor(doc) |
| 244 |
+ <color:green><b><<New>> getFullDesignLocation(doc) |
| 245 |
+ <color:green><b><<New>> getFullUserLocation(doc) |
| 246 |
} |
| 247 |
DesignSpaceDocument *-- "*" Instance: instances > |
| 248 |
note right of Instance::locationLabel |
| 249 |
The location can now alternatively |
| 250 |
be a string = name of a LocationLabel |
| 251 |
(STAT format 4). The instance then |
| 252 |
adopts the location of that label. |
| 253 |
See the Decovar example file. |
| 254 |
end note |
| 255 |
note right of Instance::styleMapStyleName |
| 256 |
All the name field are now optional. |
| 257 |
Their default values will be computed |
| 258 |
using the provided STAT table data |
| 259 |
and the STAT rules from the spec. |
| 260 |
For styleMap{Family,Style}Name, they |
| 261 |
would be computed using the STAT |
| 262 |
""linkedUserValue"" fields. |
| 263 |
end note |
| 264 |
note right of Instance::glyphs |
| 265 |
This attribute has been replaced by rules |
| 266 |
end note |
| 267 |
note right of Instance::kerning |
| 268 |
All instances get kerning and info |
| 269 |
nowadays. |
| 270 |
end note |
| 271 |
|
| 272 |
note as NLocInstance |
| 273 |
The location of instances |
| 274 |
can now be defined using |
| 275 |
either: |
| 276 |
- a STAT LocationLabel |
| 277 |
- design coordinates |
| 278 |
- user coordinates. |
| 279 |
- relying on axis defaults |
| 280 |
|
| 281 |
To build the final, "full" |
| 282 |
location, a few helper |
| 283 |
methods are provided, |
| 284 |
that aggregate data from |
| 285 |
these sources and apply |
| 286 |
the axis mappings. |
| 287 |
end note |
| 288 |
NLocInstance . Instance::designLocation |
| 289 |
NLocInstance . Instance::getFullDesignLocation |
| 290 |
|
| 291 |
@enduml |
| 292 |
|