Font Styles
Key name: FontStyles
Element type: Dictionnary
Status: Optional
You can define here custom font styles which will be available in any place where you can use font style. To use a font style defined here, you just need to add the key Style
in the font configuration dictionary and give as value the name of the key. A font configuration can have a style and implement other properties, like setting the color.
If a font configuration uses a style but also specifies properties which already exist in the style, the properties in the style will be overridden.
To use them in a font configuration elsewhere in the plist, simply set the key Style
to the name of the style you want to use.
You can define default fonts that will be used in Octory by default if possible when no other font configuration is specified.
Keys
Name | Type | Required |
---|---|---|
DefaultPrimary | Dictionary (Font configuration) | |
DefaultSecondary | Dictionary (Font configuration) |
Detail
DefaultPrimary
Type: Dictionary of Font configuration
Explanation: Use this key to define a font which will be used by default when diplsaying simple text.
DefaultSecondary
Type: Dictionary of Font configuration
Explanation: Use this key to define a font which will be used by default when displaying text which is less important, like details.
Example
We defined here two font styles: "Title" and "Body", to use them elwhere in the configuration file, like in a TextComponent
.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>FontStyles</key>
<dict>
<key>Title</key>
<dict>
<key>SystemFontWeight</key>
<string>Bold</string>
<key>Size</key>
<integer>30</integer>
</dict>
<key>Body</key>
<dict>
<key>SystemFontWeight</key>
<string>Regular</string>
</dict>
</dict>
<!-- ... -->
</dict>
</plist>
You can use a font style to define another font style. Here the style "Title2" uses the style "Title" but changes its color attribute.
If you specify a style A for a font that is already used as a style B in the style A, Octory will ignore one of the style to avoid infinite loops.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>FontStyles</key>
<dict>
<key>Title</key>
<dict>
<key>SystemFontWeight</key>
<string>Bold</string>
<key>Size</key>
<integer>30</integer>
</dict>
<key>Title2</key>
<dict>
<key>Style</key>
<string>Title</string>
<key>Color</key>
<dict>
<key>LightMode</key>
<string>#FFDDEE</string>
<key>DarkMode</key>
<string>#FF0000</string>
</dict>
</dict>
</dict>
<!-- ... -->
</dict>
</plist>