Skip to content

Commit

Permalink
Add supported formats to drop placeholder text
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Nov 26, 2022
1 parent 28ce64c commit dee20c0
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions Lib/fontgoggles/mac/fontList.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
fontItemMaximumSize = 1500


supportedFormatsString = """
Supported formats:
• .designspace, .ufo, .ufoz
• .ttf, .otf, .woff, .woff2, .ttx
• .ttc, .otc
"""


def makeUndoProxy(model, changeMonitor=None):
um = UndoManager(changeMonitor)
return um.setModel(model)
Expand Down Expand Up @@ -322,10 +330,28 @@ def setupFontItems(self):

def setupDropFontsPlaceholder(self):
color = AppKit.NSColor.systemGrayColor()
color = color.blendedColorWithFraction_ofColor_(0.5, AppKit.NSColor.textBackgroundColor())
self.dropFontsPlaceHolder = UnclickableTextBox((10, 10, -10, -10),
"Drop some fonts here!", fontSize=24,
textColor=color)

attrs = {
AppKit.NSForegroundColorAttributeName: color,
AppKit.NSFontAttributeName: AppKit.NSFont.systemFontOfSize_(24),
}
header = AppKit.NSAttributedString.alloc().initWithString_attributes_(
"Drop some fonts here!\n",
attrs,
)
attrs[AppKit.NSFontAttributeName] = AppKit.NSFont.systemFontOfSize_(16)
info = AppKit.NSAttributedString.alloc().initWithString_attributes_(
supportedFormatsString,
attrs,
)
text = AppKit.NSMutableAttributedString.alloc().init()
text.appendAttributedString_(header)
text.appendAttributedString_(info)

self.dropFontsPlaceHolder = UnclickableTextBox(
(10, 10, -10, -10), "", fontSize=22, textColor=color
)
self.dropFontsPlaceHolder._nsObject.setAttributedStringValue_(text)

@property
def width(self):
Expand Down

0 comments on commit dee20c0

Please sign in to comment.