Skip to content

Commit a22d206

Browse files
authored
Merge pull request #111 from ryanbugden/master
Typos & UI fixes
2 parents c810fd4 + 29bd407 commit a22d206

3 files changed

Lines changed: 38 additions & 10 deletions

File tree

DesignspaceEditor2.roboFontExt/lib/designspaceEditor/parsers/variableFontsParser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def storeVariableFonts(text, operator):
113113
Store variable fonts as objects from a string for a given operator and
114114
store the variable fonts string representation in the operator lib.
115115
"""
116-
parsed = parseVariableFonts(text, operator.writerClass.variableFontDescriptorClas)
116+
parsed = parseVariableFonts(text, operator.writerClass.variableFontDescriptorClass)
117117
operator.lib[variableFontsLibKey] = text
118118
operator.variableFonts.clear()
119119
operator.variableFonts.extend(parsed)

DesignspaceEditor2.roboFontExt/lib/designspaceEditor/tools.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from mojo.extensions import getExtensionDefault, ExtensionBundle
99

1010

11+
1112
def holdRecursionDecorator(func):
1213
"""
1314
A decorator preventing calling the same method inside itself.
@@ -137,17 +138,44 @@ def __exit__(self, type, value, traceback):
137138
)
138139

139140

140-
def symbolImage(symbolName, color, flipped=False):
141+
def symbolImage(symbolName, color, flipped=False, pointSize=18.0, weight="light", scale="medium"):
141142
if osVersionCurrent >= osVersion12_0:
142143
image = AppKit.NSImage.imageWithSystemSymbolName_accessibilityDescription_(symbolName, "")
143144
if isinstance(color, tuple):
144145
color = AppKit.NSColor.colorWithCalibratedRed_green_blue_alpha_(*color)
145146
else:
146147
color = symbolColorMap[color]()
147148

148-
configuration = AppKit.NSImageSymbolConfiguration.configurationWithHierarchicalColor_(
149-
color
149+
pointSize = float(pointSize)
150+
151+
scales = {
152+
"small": AppKit.NSImageSymbolScaleSmall,
153+
"medium": AppKit.NSImageSymbolScaleMedium,
154+
"large": AppKit.NSImageSymbolScaleLarge,
155+
}
156+
scale = scales.get(scale, AppKit.NSImageSymbolScaleMedium)
157+
158+
weights = {
159+
"ultraLight": AppKit.NSFontWeightUltraLight,
160+
"thin": AppKit.NSFontWeightThin,
161+
"light": AppKit.NSFontWeightLight,
162+
"regular": AppKit.NSFontWeightRegular,
163+
"medium": AppKit.NSFontWeightMedium,
164+
"semibold": AppKit.NSFontWeightSemibold,
165+
"bold": AppKit.NSFontWeightBold,
166+
"heavy": AppKit.NSFontWeightHeavy,
167+
"black": AppKit.NSFontWeightBlack,
168+
}
169+
weight = weights.get(weight, AppKit.NSFontWeightRegular)
170+
171+
baseConfig = AppKit.NSImageSymbolConfiguration.configurationWithHierarchicalColor_(color)
172+
newConfig = AppKit.NSImageSymbolConfiguration.configurationWithPointSize_weight_scale_(
173+
pointSize,
174+
weight,
175+
scale
150176
)
177+
# newConfig = AppKit.NSImageSymbolConfiguration.configurationWithScale_(scale)
178+
configuration = baseConfig.configurationByApplyingConfiguration_(newConfig)
151179
image = image.imageWithSymbolConfiguration_(configuration)
152180
else:
153181
# older systems

DesignspaceEditor2.roboFontExt/lib/designspaceEditor/ui.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _instantiateFont(self, path):
8989
def updateFonts(self, fonts=None):
9090
if fonts is None:
9191
fonts = AllFonts()
92-
super().udpateFonts([font.asDefcon() for font in fonts])
92+
super().updateFonts([font.asDefcon() for font in fonts])
9393

9494
# axes
9595

@@ -947,9 +947,9 @@ def build(self):
947947
visibleByDefault=tabItem not in ["Notes"],
948948
) for tabItem in self.tabItems]
949949

950-
other_extensions = []
950+
otherExtensions = []
951951
if self.hasPreplatorSupport:
952-
other_extensions.append(
952+
otherExtensions.append(
953953
dict(
954954
itemIdentifier="prepolator",
955955
label="Prepolator",
@@ -958,18 +958,18 @@ def build(self):
958958
)
959959
)
960960
if self.hasBatchSupport:
961-
other_extensions.append(
961+
otherExtensions.append(
962962
dict(
963963
itemIdentifier="batch",
964964
label="Batch",
965965
callback=self.toolbarBatch,
966966
imageObject=symbolImage("arrow.right.filled.filter.arrow.right", (1, 0, 1, 1))
967967
)
968968
)
969-
if other_extensions:
969+
if otherExtensions:
970970
toolbarItems.append(dict(itemIdentifier=AppKit.NSToolbarSpaceItemIdentifier))
971971

972-
toolbarItems.extend(other_extensions)
972+
toolbarItems.extend(otherExtensions)
973973

974974
toolbarItems.extend([
975975
dict(itemIdentifier=AppKit.NSToolbarSpaceItemIdentifier,

0 commit comments

Comments
 (0)