GithubHelp home page GithubHelp logo

glyphssdk's Introduction

GlyphsSDK

Plugin SDK

This is the Plugin SDK for the Glyphs font editor. There are various kinds of plugins (see below), and there are two ways of writing them, in ObjectiveC or in Python. You will find extensive documentation in the readme files and the code comments. But do start with the tutorial. Then, continue with the README.md file inside the respective template subfolder.

.glyphsFileFormat

These plugins add additional file formats for the export dialog.

.glyphsFilter

These are plugins that add functionality in the Filter submenu of Glyphs. A filter can either have a GUI (dialog window) or none. A filter can also be called as an instance custom parameter.

.glyphsPalette

These plugins add new sections to the Palette (Window > Palette, Cmd-Opt-P).

.glyphsPlugin

These are all plugins that do not fit any other category.

.glyphsReporter

These plugins add extra View functionality. They usually draw additional items in the current Edit View. Their titles, preceded by ‘Show’ will appear at the bottom of the View menu of the application.

.glyphsTool

These plugins add a new tool in the toolbar. You can place a small PDF as toolbar icon in the Contents/Resources/ folder. For measurements, take a look at the placeholder image that is already there.

File Format Description

The file GlyphsFileFormat.md contains a description of the Glyphs 1.x file format.

License

Copyright 2013-2016 Georg Seifert (@schriftgestalt), Jan Gerner (@yanone) and Rainer Erich Scheichelbauer (@mekkablue).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

glyphssdk's People

Contributors

anthrotype avatar composerjk avatar delucis avatar gobbel2000 avatar ivanukhov avatar jenskutilek avatar justanotherfoundry avatar mark2mark avatar mekkablue avatar pkolchanov avatar rafalbuchner avatar schriftgestalt avatar simoncozens avatar stone-zeng avatar yanone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glyphssdk's Issues

Reporter not executed when Caret is at the end of a text

I noticed, that when you are in an Edit Tab and the Text Cursor aka Caret is at the very end, the reporter is not executing code. Is that on purpose? Could it be made to run? I know there could be an issue with the selectedLayer, but one could handle this in other ways (e.g. having a return None for that situation)

No interface to `GSMetrics` in object wrapper

There's no documented interface from the Python GSFont object to get the metrics for a Glyphs3 font. I am having to do this:

metrics = Glyphs.font.metrics() # Method call, not property
metrics_names = [ m.name or m.typeName() for m in metrics]

which is fine, but super undocumented.

Cant Test Implement Skeleton Plugins

Hello,

I cant test-implement the skeleton-plugins in GlyphsSDK/ Python Templates/.
This means, when just grabbing a skeleton-plugin (f.e. reporter) and drop this into my plugins-folder, nothing ist shown ... also for just testing/ hacking ...

some versions before (there were more code in the skeleton-plugins), this effect was available.

Are there any reasons for that?

Default Paths for Xcode Templates

I think those could be defaulted to Glyphs 3:

  1. Build Settings > Installation Build Products Location:
    $(USER_LIBRARY_DIR)/Application Support/Glyphs/Plugins 
    -> $(USER_LIBRARY_DIR)/Application Support/Glyphs 3/Plugins

(It took me a while to find out why a new plugin didn’t show in the Debug GlyphsApp.)

  1. Search Paths > Framework Search Paths:
    $(SYSTEM_APPS_DIR)/Glyphs.app/Contents/Frameworks
    -> $(SYSTEM_APPS_DIR)/Glyphs 3.app/Contents/Frameworks

I am not sure if Glyphs 3 is called "Glyphs 3" by default, but currently in times of transition it would make things easier.

Reporters don't show up in Glyphs.activeReporters

After activating a reporter using Glyphs.activateReporter(reporter), Glyphs.activeReporters() still returns an empty list. The unit test for this case is located in test_GSApplication() around line 168 as of the current unit_test branch.

GSShape.shapeType returns boolean

GSShape.shapeType returns boolean

Accordingly to docs, it should return integer value :

'''
.. attribute:: shapeType
the type of the shapes. can be GSShapeTypePath or GSShapeTypeComponent

	:type: int

'''

@schriftgestalt Do you want me to update the wrapper, so it actually returns integer?, or should I change documentation to something else (maybe you changed returned type on some purpose ? )

Little Xcode Template Clean-Up

Latest Xcode Templates pulled this morning.


  • Compiler warning In a Reporter:
- (int)modifierMask {
    return 0;
}

⚠️ Conflicting return type in implementation of 'modifierMask': 'NSEventModifierFlags' (aka 'enum NSEventModifierFlags') vs 'int'


  • Are these commented imports ever needed? Why not remove those?
// #import "GSEditViewController.h"
// #import "GSWindowController.h"

  • Is there some documentation about when init and loadPlugin are (not) called? I remember having had to find out the hard way that either of those weren’t called when I expected them to be. Can dig that scenario out if needed.
    While working on the Paddle sample plugin, I noticed that loadPlugin (in a Reporter) is actually never called. Neither at launch of Glyphs, nor when the plugin gets activated the first time. (For the other times there are will(/De)Activate, I know)

  • GIyphsCore Framework package vs folder

Also similar to this Forum Issue the Framework comes like this per default. It works, the only thing is that one cannot search in the headers from within Xcode. Is that something that should be changed on the Template-user side? Maybe we can provide a little Instruction: explaining to drag the framework folder from a recent GlyphsApp package, unchecking the "Copy Items if needed" and also remembering to never "Move To Trash" when removing it. (I am really used to always move to trash)

Screenshot 2021-02-20 at 10 24 02


  • Lots of console logs with Glyphs Debug

I always get a lot of stuff logged, and some of it looks quite crashy. It’s also happening with a clean plugins folder and a very fresh template, executed out of Xcode:

2021-02-20 10:40:35.360617+0100 Glyphs 3[82059:4027530] [AppCenterCrashes] WARNING: -[MSACCrashes configureCrashReporterWithUncaughtExceptionHandlerEnabled:]/715 Detecting crashes is NOT enabled due to running the app with a debugger attached.
2021-02-20 10:40:36.771133+0100 Glyphs 3[82059:4027530] principalClass time: 1.277120  Skedge.glyphsPlugin
2021-02-20 10:40:36.912125+0100 Glyphs 3[82059:4027530] CFSocketSetAddress bind failure: 48
2021-02-20 10:40:36.912238+0100 Glyphs 3[82059:4027530] HTTPServer error: Error Domain=HTTPServerError Code=0 "Unable to bind socket to address." UserInfo={NSLocalizedDescription=Unable to bind socket to address.}
2021-02-20 10:40:37.244026+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.247767+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.248632+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.249159+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.249625+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.250168+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.250619+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.251088+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.251517+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.251965+0100 Glyphs 3[82059:4027530] ScanAllPluginsInLibrary: load Library [/System/Library/Filesystems/NetFSPlugins]
2021-02-20 10:40:37.296516+0100 Glyphs 3[82059:4027530] Could not listen on port com.GeorgSeifert.Glyphs3
2021-02-20 10:40:37.354369+0100 Glyphs 3[82059:4027530] CFSocketSetAddress bind failure: 48
CoreGraphics PDF has logged an error. Set environment variable "CG_PDF_VERBOSE" to learn more.
2021-02-20 10:40:37.532149+0100 Glyphs 3[82059:4027530] Metal API Validation Enabled
2021-02-20 10:40:37.544790+0100 Glyphs 3[82059:4027530] flock failed to lock list file (/var/folders/qf/w3mt8k352zg44bdv61qsw2280000gn/C//com.GeorgSeifert.Glyphs3/com.apple.metal/16777235_322/functions.list): errno = 35
2021-02-20 10:40:37.572574+0100 Glyphs 3[82059:4027585] flock failed to lock list file (/var/folders/qf/w3mt8k352zg44bdv61qsw2280000gn/C//com.GeorgSeifert.Glyphs3/com.apple.metal/31001/libraries.list): errno = 35
=================================================================
Main Thread Checker: UI API called on a background thread: -[NSApplication delegate]
PID: 82059, TID: 4027588, Thread name: (none), Queue name: NSDocumentController Opening (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4   Glyphs 3                            0x00000001043ce19c _ZN7plcrash2MS5async35plcrash_async_dwarf_expression_evalIyxEE15plcrash_error_tP21plcrash_async_mobjectjPK26plcrash_async_thread_statePK25MSplcrash_async_byteorderyxyPT_mSD_ + 692020
5   AppKit                              0x000000019fe67f84 -[NSDocumentController documentClassForType:] + 68
6   Glyphs 3                            0x00000001043ce360 _ZN7plcrash2MS5async35plcrash_async_dwarf_expression_evalIyxEE15plcrash_error_tP21plcrash_async_mobjectjPK26plcrash_async_thread_statePK25MSplcrash_async_byteorderyxyPT_mSD_ + 692472
7   AppKit                              0x00000001a01737c4 -[NSDocumentController makeDocumentForURL:withContentsOfURL:ofType:error:] + 144
8   AppKit                              0x00000001a0172c48 __104-[NSDocumentController makeDocumentForURL:withContentsOfURL:alternateContents:ofType:completionHandler:]_block_invoke + 84
9   Foundation                          0x000000019e184398 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24
10  Foundation                          0x000000019e184240 -[NSBlockOperation main] + 104
11  Foundation                          0x000000019e1841d0 __NSOPERATION_IS_INVOKING_MAIN__ + 24
12  Foundation                          0x000000019e183414 -[NSOperation start] + 808
13  Foundation                          0x000000019e1830e4 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24
14  Foundation                          0x000000019e182f98 __NSOQSchedule_f + 184
15  libdispatch.dylib                   0x0000000105384a28 _dispatch_block_async_invoke2 + 148
16  libdispatch.dylib                   0x0000000105371d20 _dispatch_client_callout + 20
17  libdispatch.dylib                   0x00000001053753cc _dispatch_continuation_pop + 612
18  libdispatch.dylib                   0x000000010537444c _dispatch_async_redirect_invoke + 692
19  libdispatch.dylib                   0x00000001053887f0 _dispatch_root_queue_drain + 364
20  libdispatch.dylib                   0x000000010538939c _dispatch_worker_thread2 + 140
21  libsystem_pthread.dylib             0x00000001048474b8 _pthread_wqthread + 216
22  libsystem_pthread.dylib             0x0000000104846228 start_wqthread + 8
2021-02-20 10:40:37.595683+0100 Glyphs 3[82059:4027588] [reports] Main Thread Checker: UI API called on a background thread: -[NSApplication delegate]
PID: 82059, TID: 4027588, Thread name: (none), Queue name: NSDocumentController Opening (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4   Glyphs 3                            0x00000001043ce19c _ZN7plcrash2MS5async35plcrash_async_dwarf_expression_evalIyxEE15plcrash_error_tP21plcrash_async_mobjectjPK26plcrash_async_thread_statePK25MSplcrash_async_byteorderyxyPT_mSD_ + 692020
5   AppKit                              0x000000019fe67f84 -[NSDocumentController documentClassForType:] + 68
6   Glyphs 3                            0x00000001043ce360 _ZN7plcrash2MS5async35plcrash_async_dwarf_expression_evalIyxEE15plcrash_error_tP21plcrash_async_mobjectjPK26plcrash_async_thread_statePK25MSplcrash_async_byteorderyxyPT_mSD_ + 692472
7   AppKit                              0x00000001a01737c4 -[NSDocumentController makeDocumentForURL:withContentsOfURL:ofType:error:] + 144
8   AppKit                              0x00000001a0172c48 __104-[NSDocumentController makeDocumentForURL:withContentsOfURL:alternateContents:ofType:completionHandler:]_block_invoke + 84
9   Foundation                          0x000000019e184398 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24
10  Foundation                          0x000000019e184240 -[NSBlockOperation main] + 104
11  Foundation                          0x000000019e1841d0 __NSOPERATION_IS_INVOKING_MAIN__ + 24
12  Foundation                          0x000000019e183414 -[NSOperation start] + 808
13  Foundation                          0x000000019e1830e4 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24
14  Foundation                          0x000000019e182f98 __NSOQSchedule_f + 184
15  libdispatch.dylib                   0x0000000105384a28 _dispatch_block_async_invoke2 + 148
16  libdispatch.dylib                   0x0000000105371d20 _dispatch_client_callout + 20
17  libdispatch.dylib                   0x00000001053753cc _dispatch_continuation_pop + 612
18  libdispatch.dylib                   0x000000010537444c _dispatch_async_redirect_invoke + 692
19  libdispatch.dylib                   0x00000001053887f0 _dispatch_root_queue_drain + 364
20  libdispatch.dylib                   0x000000010538939c _dispatch_worker_thread2 + 140
21  libsystem_pthread.dylib             0x00000001048474b8 _pthread_wqthread + 216
22  libsystem_pthread.dylib             0x0000000104846228 start_wqthread + 8
2021-02-20 10:40:42.690743+0100 Glyphs 3[82059:4027530] CFSocketSetAddress bind failure: 48
2021-02-20 10:40:42.690810+0100 Glyphs 3[82059:4027530] HTTPServer error: Error Domain=HTTPServerError Code=0 "Unable to bind socket to address." UserInfo={NSLocalizedDescription=Unable to bind socket to address.}
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:40:42.959950+0100 Glyphs 3[82059:4027530] ___ 0
2021-02-20 10:41:27.877342+0100 Glyphs 3[82059:4027530] +[NSSavePanel _warmUp] attempted warmup
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:27.995411+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:28.012807+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:28.029706+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:28.046193+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:28.062998+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:28.079687+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
2021-02-20 10:41:28.096259+0100 Glyphs 3[82059:4027530] ___ 0
Glyphs.app: DebugReporter: Show_Deltas_From_Origin (1) >> OK
Glyphs.app: DebugReporter: Sample_Paddleable_Glyphs_Plugin (1) >> OK
... This keeps coming forever on each interface update ^^^^^^^^^^^^^^

Scripts and Plugins

"Implementing unavailable method"

With the Glyphs 3 Templates > Reporter

The default GlyphsCore framework works, as long as the Framework search path is adjusted to "Glyphs 3" (as in #44).
However, the Framework in the file browser is marked red, and the compiler complains
Implementing unavailable method for the following methods:
- (void) drawForegroundForLayer:(GSLayer*)Layer
- (void) drawBackgroundForLayer:(GSLayer*)Layer
- (void) drawBackgroundForInactiveLayer:(GSLayer*)Layer

Dragging (copy items if needed) the framework from a current Glyphs 3 package solves the red framework, but does not solve those error messages.

I guess they should to default to:
- (void)drawForegroundForLayer:(GSLayer *)layer options:(NSDictionary *)options
- (void)drawBackgroundForLayer:(GSLayer *)layer options:(NSDictionary *)options
- (void) drawBackgroundForInactiveLayer:(GSLayer *)layer options:(NSDictionary *)options

Python Templates: "Further Reading" links are MIA

Both of the links in the "Further Reading" subsection on the Python Templates page are now dead.

The Apple one redirects to a general, top-level AppKit page ... annoying that they don't care about breaking links, but at least the right content is probably still there.

The adamw523 one is just 404ed, and the domain seems to belong to sketchy-looking company now (and not the good kind of sketching).

Tools Xcode template does not compile

    editViewController = [windowController activeEditViewController];
Use of undeclared identifier 'editViewController'; did you mean '_editViewController'?
Unknown receiver 'windowController'; did you mean 'NSWindowController'?

Python + XIB: Can’t make connections with Xcode 13

I am quite fit with the Interface Builder and Objective-C, but I never used the IB with Python until today.

I tried to follow the steps here, but struggled a lot, because I could not access the outlets from the python file.

I had added the python file, set the File’s owner to it’s main class.
There was no way to ctrl-drag anything from or to the window.

So I ended up editing the XIB as source code and copy-paste …

<connections>
    <outlet property="fontNameLabel" destination="5LS-iz-okA" id="FTt-lA-0ki"/>
    <outlet property="window" destination="QvC-M9-y7g" id="zeT-oI-P6k"/>
</connections>

… from an Objecitve-C project and matched the destination IDs.
Then it worked. The Outlets in IB have a yellow exclam, but the outlets are accessible in the python code.

Am I too stupid, or did things change over time? Has no one ever had any issues?
Xcode 13.2.1

Objective C Templates not working in 9.3.1 ?

Xcode Version 9.3.1 (9E501)

I followed the instructions to copy the templates folder into the (user*) Library > Developer > Xcode > Templates > (Glyphs Dev)

But the templates don’t appear in the New Project menu of Xcode. When I worked with them half a year a go with an older Xcode on El Capitan, those Templates where available. I assume sth changed to make them not accessible as they are now?

——

  • also tried the main Library

File Format v3

Let's maybe discuss details here?

It doesn’t use the more common XML-based flavor (that is supported for reading) to save space

Interesting. Is this v3 only or does Glyphs 2.x support that, too?

I like the standalone axes key. How to specify mappings?

Timestamps are, UTC, yes?

Filter always report the inEditView as True

Glyphs Version: 3.0.3 (3059)

As the templates said:

  1. Call through Filter menu in Font View
    The user has selected several glyphs in the Font View and has clicked on the filter in the Filter menu. inEditView will be set to False and customParameters will be empty and the filter() method will be called several times, each time containing a different layer.

But in the testing, it always return a "True" value. No matter where you trigger the filter.

3841611821851_ pic_hd

Can’t access `self.windowController()` from GeneralPlugin (Python)

In a GeneralPlugin (created from the Plugin Maker) I can’t access the windowController as the sample "Smiley Palette" shows.

self.windowController(): object has no attribute 'windowController'

Other Plugins (by mekkablue also use it, but they are of a different type. Is that an issue with the GeneralPlugin type? And how to solve it?

Python SelectTool malfunction?

I installed the sample file of Python SelectTool but it doesn't start up on app's launch, and instead returns the following error. Is this expected?

Traceback (most recent call last):
File "/Users/toshi/Library/Application Support/Glyphs/Plugins/PluginName.glyphsTool/Contents/Resources/boot.py", line 47, in
_run('PluginFileName.py')
File "/Users/toshi/Library/Application Support/Glyphs/Plugins/PluginName.glyphsTool/Contents/Resources/boot.py", line 45, in _run
execfile(path, globals(), globals())
File "/Users/toshi/Library/Application Support/Glyphs/Plugins/PluginName.glyphsTool/Contents/Resources/PluginFileName.py", line 10, in
if not path in sys.path:
NameError: name 'sys' is not defined

`GSGuide.filter` should not be a `bool` value

GSGuide.filter should not be a bool value:

GSGuide.filter = property(lambda self: bool(self.pyobjc_instanceMethods.filter()),
lambda self, value: self.setFilter_(value))
'''
.. attribute:: filter
A filter to only show the guide in certain glyphs. Only relevant in global guides
:type: NSPredicate
'''

In Glyphs, there is the same issue:

guide = Font.masters[0].guides[0]

print(guide)
print(guide.filter)
print(guide.pyobjc_instanceMethods.filter())

Output:

<GSGuide x=257.0 y=355.0 angle=0.0>
True
tags CONTAINS "guide_Test"

BUG: node.selected = True

node.selected = True was once working. It isn’t anymore.
Can you please fix it? Or how can i set a node selected now?

File "GlyphsApp/__init__.py", line 3211, in <lambda>
File "GlyphsApp/__init__.py", line 2234, in SetObjectInLayer_selected
AttributeError: '__LayerSelectionProxy' object has no attribute 'append'

Many thanks in advance!

Documentation for `needsExtraMainOutlineDrawingForInactiveLayer`

I wonder if there is a confusion: It says in the Glyphs 3 Core API:
"Implement this and return YES if you did all drawing yourself and don’t need the regular outline drawn on top of it."

→ In fact, it works the opposite way. If I return NO (or False in python), then it doesn’t draw the default outlines as expected.

  • This is also the same with the documentation of the GlyphsReporterProtocol.h:
    It says: "@return return YES if the normal outline drawing should be supressed."

  • Same for needsExtraMainOutlineDrawingForActiveLayer

Small getting started issue

Two simple non-issues that kept be scratching my head when trying to figure out how to get started writing a plugin:

  • Once you have located the plugins folder and copied a plugin template there, it took me some googling that in order to get the "bundle" I simply need to rename the folder to a .glyphsReporter or .glyphsPlugin
  • I was checking in the Plugin Manager on how to activate my new local development plugin, without realising that it simply is activated

Outlining these two simple pitfalls in the "getting started" part would be helpful.

Hook property setters into Objective-C validators

Setting an illegal value through the property setters of the Python wrapper should raise a descriptive ValueError (or TypeError). This should be accomplished by calling the appropriate key-value-validation methods in objective C for most setters from within the Python wrapper.

An initial implementation exists in the unit_tests branch at ObjectWrapper/GlyphsApp/init.py with _setValueValidation(), doing only type testing for now. This function should eventually be used in all setters where validation is necessary.

.glyphsPalette template: missing ‘self.dialogName’

A .glyphsPalette built from the template, will write an error into the Macro window stating that self.dialogName was not set or missing. I can fix it by adding self.dialogName = self.name to the settings() method.

Is there a structural difference between name and dialogName or are they they same? And if so, should the line above be added to plugins.py?

Hotkey customisation support in SelectTool

Both G3 and G2 support hotkey customisation for the builtin .glyphsTool plugins via the user defaults:

$ defaults write com.GeorgSeifert.Glyphs3 AnnotationTool.Hotkey 'q'

I think it's nice to have it supported also in the Python wrapper by default.

def trigger(self):
    return Glyphs.defaults['.'.join((type(self).__name__.replace('NSKVONotifying_', ''), 'Hotkey'))] or self.keyboardShortcut

Replacing the trigger() method in plugins.py like above will do.

Executable in Python template causes notarization failure

Notarization fails when uploaded the custom plugin bundle based on the Python template in this repository, with the following message:

The binary uses an SDK older than the 10.9 SDK.

@mekkablue seems to be using the newer version of the Mach-O executable named plugin, which looks like a tiny helper that loads a PyObjC class from the path specified in Info.plist, and the notarization is successfully completed when uploading the bundle to Notary Service after replacing that binary with his version.

So, it looks to me that the Python templates in this repository are outdated somehow and need to be updated to be notarization ready. I'm afraid that's a bit confusing to users, and I would be more than happy if the copies of the executable in this repository would be in sync with the latest version you have. Also main.py could possibly be removed from the template if it's not needed anymore.

Errors after installing Smiley Palette

Using Glyphs version 1256:

After installing the Smiley Palette demo, I get the following error:

Traceback (most recent call last):
  File "GlyphsApp/GlyphsApp/plugins.py", line 909, in init
  File "plugin.py", line 30, in settings
    self.logError(traceback.format_exc())
NameError: global name 'traceback' is not defined

Maybe related: In my own glyphsPalette, I am getting this error:

Traceback (most recent call last):
  File "GlyphsApp/GlyphsApp/plugins.py", line 929, in init
  File "plugin.py", line 337, in start
    Glyphs.addCallback(self.update, UPDATEINTERFACE)
NameError: global name 'UPDATEINTERFACE' is not defined

UPDATEINTERFACE is also used by the Smiley Palette but does not cause an error there.

Any hints how I could get addCallback in my palette to work?

Wrong documentation for GSComponent.smartComponentValues

Dictionary of interpolations values of the Smart Component. Key are the names, values are between the top and the bottom value of the corresponding :class:`GSSmartComponentAxis` objects. Corresponds to the values of the 'Smart Component Settings' dialog. Returns None if the component is not a Smart Component.
Also see https://glyphsapp.com/tutorials/smart-components for reference.
:type: dict, int
.. code-block:: python
# Narrow shoulders of m
glyph = font.glyphs['m']
glyph.layers[0].components[1].smartComponentValues['shoulderWidth'] = 30 # First shoulder. Index is 1, given that the stem is also a component with index 0
glyph.layers[0].components[2].smartComponentValues['shoulderWidth'] = 30 # Second shoulder. Index is 2, given that the stem is also a component with index 0
# Low crotch of h
glyph = font.glyphs['h']
crotchDepthAxis = glyph.smartComponentAxes['crotchDepth']
glyph.layers[0].components[1].smartComponentValues[crotchDepthAxis.id] = -77 # Shoulder. Index is 1, given that the stem is also a component with index 0

It appears to require axis IDs instead of names as keys. Lines 7015, 7025, and 7026 need to be corrected.

Cap component “fit”

This comment here is confusing me:

For corner components, it stores the alingment settings: left = 0, center = 2, right = 1, auto (for caps) = alignment | 8

Are you sure it’s | 8? For me, this doesn’t work but & 8 works.

Also, this refers to the “fit” checkbox, right? Maybe then the comment should say “fit” instead of “auto”.

Also, alignment is only relevant for cap components but not for corner components, right? Maybe then the comment should say “For cap components ...” instead of “For corner components ...”.

Can't set the keyboard shortcut for the SelectTool Plugin

Glyphs Version: 3.0.3 (3075)

Codes in def settings(self):

self.keyboardShortcut = 'g'

or

Defaults = NSUserDefaults.standardUserDefaults()
Defaults.registerDefaults_({"Pixel45.hotKey" : "g"})
self.keyboardShortcut = Glyphs.defaults["Pixel45.hotKey"]

Not working right now.

WX20210402-000224@2x
And the tool will get a hotkey 'V' from some where. Also not working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.