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