Font
Element type: Dictionary
When a key is of type FontConfiguration
, for example the TextFontConfiguration
of the Text Component,
it allows you to configure the font used to display the title of this component. Here are the keys used in this configuration.
Keys
Name | Type | Possible Values | Required |
---|---|---|---|
Style | String | - | |
Name | String | - | |
TextAlignment | String | Left , Center , Right , Justify | |
Size | Number | - | |
SystemFontWeight | String | Bold , Black , Heavy , Light , Medium , Regular , Semibold , Thin , UltraLight | |
Color | Color | - | |
LinksAreEnabled | Boolean | - |
Details
Style
Type: String
Explanation: Let you use a font configuration style defined in the Font styles section.
Name
Type: String
Explanation: The full name of the font. You have to use the PostScript Name for a match with the macOS fonts book.
For example “Avenir-Light”, or “HelveticaNeue-ThinItalic”.
If no match if found, Octory will use the standard system font.
It is simple to find the PostScript name, simply open Font Book.app, select the font and do a View/ Show Font Info or ⌘I.
TextAlignment
Type: String
Possible values: Left
, Center
, Right
, Justify
Explanation: Choose the text alignment. Default is Left
.
Size
Type: Number
Explanation: The point size of the font you want to use (or the system standard font if no font name is specified)
SystemFontWeight
Type String
Possible values: Bold
, Black
, Heavy
, Light
, Medium
, Regular
, Semibold
, Thin
, UltraLight
Explanation: When you don't specify a Name
key for the font, Octory will use the standard system font. You can then specify which weight to use.
You can refer to Apple's documentation for more info about those weights.
Color
Type: Color
Explanation: Specify here the text color
Single string style
When using a parent style font you don’t want to modify, you can replace all the dictionary with a single string. Just like that:
<key>Font</key>
<string>Title</string>
Size and Name
If you specify the Name
key with no Size
key, Octory will use the regular size. If you specify the Size
key with no Name
key, the system standard font will be used.
You can also specify only the SystemFontWeight
. Doing so, regular size and standard font will then be used.
Note that specifying the SystemFontWeight
key when the Name
key is also specified is irrelevant, and the SystemFontWeight
key will be ignored.
LinksAreEnabled
Type Boolean
Default: false
Explanation: Activate automatic URL link detection (_:// or _.domain). URL will automatically appear in system Blue foreground color. Clicking on it will open the web page with the default web browser on the Mac. If the OnScreen
property is set as FullScreen
or BlurredBackground
, the link will open in the background.
Examples
We define here a font using the system standard, and modify its weight, its size and the text alignment.
<?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>
<dict>
<key>FontWeight</key>
<string>Semibold</string>
<key>Size</key>
<integer>30</integer>
<key>TextAlignment</key>
<string>Center</string>
</dict>
</dict>
</dict>
</dict>
We define here a font using the Avenir family with the Light weight. We also specify a color for it, and modify its text alignment.
<dict>
<key>TextAlignment</key>
<string>Center</string>
<key>Name</key>
<string>Avenir-Light</string>
<key>Color</key>
<dict>
<key>DarkMode</key>
<string>#000000</string>
<key>LightMode</key>
<string>#FFFFFF</string>
</dict>
</dict>