├── SpeedPunk.roboFontExt ├── Icon ├── lib │ ├── deYanoneRoboFontSpeedpunk │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ └── speedpunklib.py │ └── SpeedPunkTool.py ├── resources │ └── toolbar.pdf └── info.plist ├── SpeedPunk_py.glyphsReporter └── Contents │ ├── Resources │ ├── speedpunk │ │ ├── __init__.py │ │ └── speedpunklib.py │ ├── Base.lproj │ │ ├── settingsView.nib │ │ └── settingsView.xib │ ├── ja.lproj │ │ └── settingsView.strings │ ├── ko.lproj │ │ └── settingsView.strings │ ├── en.lproj │ │ └── settingsView.strings │ ├── de.lproj │ │ └── settingsView.strings │ ├── pt.lproj │ │ └── settingsView.strings │ ├── fr.lproj │ │ └── settingsView.strings │ ├── es.lproj │ │ └── settingsView.strings │ └── plugin.py │ ├── MacOS │ └── plugin │ └── Info.plist ├── .gitignore ├── Resources ├── icon1024.icns ├── icon1024.png ├── toolbar.pdf ├── toolbar.png └── speedpunkglyphs.jpg ├── GlyphsSource ├── SpeedPunk │ ├── ja.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── en.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── ko.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── de.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── es.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── fr.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── pt.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── SpeedPunk-Info.plist │ ├── SpeedPunk-Prefix.pch │ ├── SpeedPunk.h │ ├── debug.xcconfig │ ├── common.xcconfig │ ├── Base.lproj │ │ └── settingsView.xib │ └── SpeedPunk.m └── SpeedPunk.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ ├── xcuserdata │ └── georg.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── xcshareddata │ └── xcschemes │ │ └── SpeedPunk.xcscheme │ └── project.pbxproj ├── SpeedPunk.glyphsReporter └── Contents │ ├── MacOS │ └── SpeedPunk │ ├── Resources │ ├── ja.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── ko.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── en.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── es.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── fr.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── pt.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ ├── de.lproj │ │ ├── Localizable.strings │ │ └── settingsView.strings │ └── Base.lproj │ │ └── settingsView.nib │ │ ├── keyedobjects.nib │ │ └── keyedobjects-101300.nib │ ├── Info.plist │ └── _CodeSignature │ └── CodeResources ├── stream.json ├── README.md └── LICENSE /SpeedPunk.roboFontExt/Icon : -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SpeedPunk.roboFontExt/lib/deYanoneRoboFontSpeedpunk/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/speedpunk/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | *.pyc 4 | 5 | __pycache__ 6 | *.xcuserstate 7 | -------------------------------------------------------------------------------- /Resources/icon1024.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/Resources/icon1024.icns -------------------------------------------------------------------------------- /Resources/icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/Resources/icon1024.png -------------------------------------------------------------------------------- /Resources/toolbar.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/Resources/toolbar.pdf -------------------------------------------------------------------------------- /Resources/toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/Resources/toolbar.png -------------------------------------------------------------------------------- /Resources/speedpunkglyphs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/Resources/speedpunkglyphs.jpg -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/ja.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ 設定"; 3 | 4 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Settings"; 3 | 4 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/ko.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ 환경설정"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.roboFontExt/resources/toolbar.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk.roboFontExt/resources/toolbar.pdf -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Einstellungen"; 3 | 4 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ preferencias"; 3 | 4 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Préférences"; 3 | 4 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/pt.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Preferências"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/MacOS/SpeedPunk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk.glyphsReporter/Contents/MacOS/SpeedPunk -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/ja.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ 設定"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/MacOS/plugin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk_py.glyphsReporter/Contents/MacOS/plugin -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/ko.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ 환경설정"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Settings"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ preferencias"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Préférences"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/pt.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Preferências"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Plugin Title */ 2 | "Speed Punk v%@ Settings" = "Speed Punk v%@ Einstellungen"; 3 | 4 | -------------------------------------------------------------------------------- /SpeedPunk.roboFontExt/lib/deYanoneRoboFontSpeedpunk/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk.roboFontExt/lib/deYanoneRoboFontSpeedpunk/__init__.pyc -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/Base.lproj/settingsView.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk_py.glyphsReporter/Contents/Resources/Base.lproj/settingsView.nib -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/Base.lproj/settingsView.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk.glyphsReporter/Contents/Resources/Base.lproj/settingsView.nib/keyedobjects.nib -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/Base.lproj/settingsView.nib/keyedobjects-101300.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanone/speedpunk/HEAD/SpeedPunk.glyphsReporter/Contents/Resources/Base.lproj/settingsView.nib/keyedobjects-101300.nib -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/SpeedPunk-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/SpeedPunk-Prefix.pch: -------------------------------------------------------------------------------- 1 | #if DEBUG 2 | #define GSLog(args...) (void)printf("%i %s: %s\n", __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:args] UTF8String]) 3 | #else 4 | #define GSLog(args...) // stubbed out 5 | #endif 6 | 7 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/ja.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "グリフの外側"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "アウトラインの外側"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "ゲイン"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "フェード"; 12 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/ko.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "글리프의 바깥쪽"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "곡선의 바깥쪽"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "늘이기"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "흐리게"; 12 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/de.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Außen am Glyph"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Außen am Pfad"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Stärke"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Ausblenden"; 12 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/pt.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Fora do glifo"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Fora da curva"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Volume"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Opacidade"; 12 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/ja.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "グリフの外側"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "アウトラインの外側"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "ゲイン"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "フェード"; 12 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/ko.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "글리프의 바깥쪽"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "곡선의 바깥쪽"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "늘이기"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "흐리게"; 12 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/es.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Exterior del glifo"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Exterior del trazo"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Tamaño"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Opacidad"; 12 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/fr.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Éxterieur de la forme"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Éxterieur de la courbe"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Volume"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Opacité"; 12 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/pt.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Fora do glifo"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Fora da curva"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Volume"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Opacidade"; 12 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/de.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Außen am Glyph"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Außen am Pfad"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Stärke"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Ausblenden"; 12 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/es.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Exterior del glifo"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Exterior del trazo"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Tamaño"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Opacidad"; 12 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/fr.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Outside of glyph" */ 2 | "3ZB-4e-WGF.title" = "Éxterieur de la forme"; 3 | 4 | /* "Outer side of curve" */ 5 | "38c-0D-izC.title" = "Éxterieur de la courbe"; 6 | 7 | /* "Gain" */ 8 | "PWU-f4-6sZ.title" = "Volume"; 9 | 10 | /* "Fade" */ 11 | "MA5-dI-rlC.title" = "Opacité"; 12 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/ja.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 設定"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "グリフの外側"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "アウトラインの外側"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "ゲイン"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "フェード"; 15 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/ko.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 환경설정"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "글리프의 바깥쪽"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "곡선의 바깥쪽"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "늘이기"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "흐리게"; 15 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/SpeedPunk.h: -------------------------------------------------------------------------------- 1 | // 2 | // SpeedPunk.h 3 | // SpeedPunk 4 | // 5 | // Created by Georg Seifert on 27.09.23. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SPSpeedPunk : NSViewController 13 | 14 | @property (weak) IBOutlet NSSlider *gainSlider; 15 | @property (weak) IBOutlet NSTextField *titleField; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/en.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 Settings"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "Outside of glyph"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "Outer side of curve"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "Gain"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "Fade"; 15 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/en.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Twitter → */ 3 | "1Jp-Ac-jPD.title" = "Twitter →"; 4 | 5 | /* Outer side of curve */ 6 | "38c-0D-izC.title" = "Outer side of curve"; 7 | 8 | /* Outside of glyph */ 9 | "3ZB-4e-WGF.title" = "Outside of glyph"; 10 | 11 | /* Fade */ 12 | "MA5-dI-rlC.title" = "Fade"; 13 | 14 | /* Gain */ 15 | "PWU-f4-6sZ.title" = "Gain"; 16 | 17 | /* GitHub → */ 18 | "tya-T9-UP3.title" = "GitHub →"; 19 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/de.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 Einstellungen"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "Außen an Form"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "Außen am Pfad"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "Stärke"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "Ausblenden"; 15 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/pt.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 Preferências"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "Fora do glifo"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "Fora da curva"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "Volume"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "Opacidade"; 15 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/fr.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 Préférences"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "Éxterieur de la forme"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "Éxterieur de la courbe"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "Volume"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "Opacité"; 15 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Resources/en.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Twitter → */ 3 | "1Jp-Ac-jPD.title" = "Twitter →"; 4 | 5 | /* Outer side of curve */ 6 | "38c-0D-izC.title" = "Outer side of curve"; 7 | 8 | /* Outside of glyph */ 9 | "3ZB-4e-WGF.title" = "Outside of glyph"; 10 | 11 | /* Fade */ 12 | "MA5-dI-rlC.title" = "Fade"; 13 | 14 | /* Gain */ 15 | "PWU-f4-6sZ.title" = "Gain"; 16 | 17 | /* GitHub → */ 18 | "tya-T9-UP3.title" = "GitHub →"; 19 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/es.lproj/settingsView.strings: -------------------------------------------------------------------------------- 1 | /* "Speed Punk v1.13 Settings" */ 2 | "MpF-Ww-0Vd.title" = "Speed Punk v1.20 preferencias"; 3 | 4 | /* "Outside of glyph" */ 5 | "3ZB-4e-WGF.title" = "Exterior del glifo"; 6 | 7 | /* "Outer side of curve" */ 8 | "38c-0D-izC.title" = "Exterior del trazo"; 9 | 10 | /* "Gain" */ 11 | "PWU-f4-6sZ.title" = "Tamaño"; 12 | 13 | /* "Fade" */ 14 | "MA5-dI-rlC.title" = "Opacidad"; 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk.xcodeproj/xcuserdata/georg.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SpeedPunk.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 18 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5664B2AF2AC4597800A28703 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /stream.json: -------------------------------------------------------------------------------- 1 | { 2 | "lastUpdate" : "2019-11-29 19:05", 3 | "extensions" : [ 4 | { 5 | "extensionName": "Speed Punk", 6 | "repository" : "https://github.com/yanone/speedpunk", 7 | "extensionPath" : "SpeedPunk.roboFontExt", 8 | "icon" : "https://raw.githubusercontent.com/yanone/speedpunk/master/Resources/icon1024.png", 9 | "description" : "Understand and improve your outlines with this curvature comb visualization.", 10 | "developer" : "Yanone", 11 | "developerURL" : "https://yanone.de", 12 | "tags" : ["contours", "curvature", "bezier", "visual", "drawing", "toolbar tools"] 13 | }] 14 | } -------------------------------------------------------------------------------- /SpeedPunk.roboFontExt/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | addToMenu 6 | 7 | developer 8 | Yanone 9 | developerURL 10 | https://yanone.de 11 | html 12 | 13 | launchAtStartUp 14 | 1 15 | mainScript 16 | SpeedPunkTool.py 17 | name 18 | SpeedPunk 19 | requiresVersionMajor 20 | 3 21 | requiresVersionMinor 22 | 1 23 | timeStamp 24 | 1577127173.541112 25 | version 26 | 1.131 27 | 28 | 29 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | plugin 9 | CFBundleIdentifier 10 | de.Yanone.GlyphsAppSpeedPunkReporter 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | SpeedPunk 15 | CFBundleVersion 16 | 16 17 | CFBundleShortVersionString 18 | 1.2.2 19 | NSHumanReadableCopyright 20 | Copyright 2018 by Yanone 21 | NSPrincipalClass 22 | GlyphsAppSpeedPunkReporter 23 | PyMainFileNames 24 | 25 | plugin.py 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 21G726 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | SpeedPunk 11 | CFBundleIdentifier 12 | de.Yanone.SpeedPunk 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | SpeedPunk 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.3 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 20 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 14A400 31 | DTPlatformName 32 | macosx 33 | DTPlatformVersion 34 | 12.3 35 | DTSDKBuild 36 | 21E226 37 | DTSDKName 38 | macosx12.3 39 | DTXcode 40 | 1401 41 | DTXcodeBuild 42 | 14A400 43 | LSMinimumSystemVersion 44 | 10.11 45 | NSPrincipalClass 46 | SPSpeedPunk 47 | 48 | 49 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/debug.xcconfig: -------------------------------------------------------------------------------- 1 | 2 | #include "common.xcconfig" 3 | 4 | COPY_PHASE_STRIP = NO 5 | GCC_OPTIMIZATION_LEVEL = 0 6 | SWIFT_OPTIMIZATION_LEVEL = -Onone 7 | 8 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 // GLYPHS_LITE // BETA 9 | 10 | GENERATE_PROFILING_CODE = YES 11 | 12 | DEBUG_INFORMATION_FORMAT = dwarf 13 | 14 | OTHER_CODE_SIGN_FLAGS = --timestamp=none 15 | 16 | //CLANG_STATIC_ANALYZER_MODE = deep 17 | LLVM_LTO = NO 18 | ONLY_ACTIVE_ARCH = YES 19 | 20 | DEPLOYMENT_POSTPROCESSING = NO 21 | STRIP_INSTALLED_PRODUCT = NO 22 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES 23 | //CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 24 | GCC_WARN_ABOUT_MISSING_NEWLINE = YES 25 | GCC_WARN_SHADOW = YES 26 | //GCC_WARN_STRICT_SELECTOR_MATCH = YES 27 | CLANG_ANALYZER_NONNULL = NO 28 | 29 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 30 | CLANG_WARN_COMMA = YES; 31 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 32 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 33 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 34 | CLANG_WARN_STRICT_PROTOTYPES = YES; 35 | ENABLE_STRICT_OBJC_MSGSEND = YES; 36 | ENABLE_TESTABILITY = YES; 37 | 38 | CLANG_WARN_CONSTANT_CONVERSION = YES; 39 | CLANG_WARN_ENUM_CONVERSION = YES; 40 | CLANG_WARN_INT_CONVERSION = YES; 41 | 42 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 43 | 44 | ENABLE_NS_ASSERTIONS = YES 45 | 46 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR 47 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE 48 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR 49 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR 50 | 51 | CLANG_ANALYZER_NONNULL = YES 52 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = NO 53 | 54 | MTL_ENABLE_DEBUG_INFO = YES 55 | 56 | //CLANG_WARN_DOCUMENTATION_COMMENTS = YES 57 | -------------------------------------------------------------------------------- /SpeedPunk.roboFontExt/lib/SpeedPunkTool.py: -------------------------------------------------------------------------------- 1 | ########################################################################################## 2 | # 3 | # Speed Punk 4 | # Visualisation tool of outline curvature for font editors. 5 | # 6 | # Distributed under Apache 2.0 license 7 | # 8 | ########################################################################################## 9 | 10 | import traceback 11 | from AppKit import NSLog 12 | 13 | try: 14 | 15 | from mojo.events import installTool, EditingTool 16 | from deYanoneRoboFontSpeedpunk import speedpunklib 17 | from mojo.extensions import ExtensionBundle 18 | bundle = ExtensionBundle("SpeedPunk") 19 | 20 | 21 | ################################################################################################################ 22 | 23 | class SpeedPunkTool(EditingTool): 24 | 25 | def becomeActive(self): 26 | self.speedpunklib = speedpunklib.SpeedPunkLib() 27 | self.speedpunklib.tool = self 28 | self.speedpunklib.Open() 29 | 30 | def becomeInactive(self): 31 | self.speedpunklib.Close() 32 | 33 | def drawBackground(self, scale): 34 | try: 35 | 36 | if self.getGlyph() != None: 37 | self.speedpunklib.UpdateGlyph(self.getGlyph()) 38 | 39 | except: 40 | NSLog('Speed Punk:\n%s' % traceback.format_exc()) 41 | 42 | def glyphWindowWillClose(self, a): 43 | self.speedpunklib.Close() 44 | 45 | def glyphWindowDidOpen(self, a): 46 | self.speedpunklib.Open() 47 | 48 | def getToolbarTip(self): 49 | return "Speed Punk" 50 | 51 | def getToolbarIcon(self): 52 | NSImage = bundle.getResourceImage("toolbar") 53 | if NSImage: 54 | return NSImage 55 | 56 | installTool(SpeedPunkTool()) 57 | 58 | except: 59 | NSLog('Speed Punk:\n%s' % traceback.format_exc()) -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/common.xcconfig: -------------------------------------------------------------------------------- 1 | // common 2 | 3 | MARKETING_VERSION = 1.3 4 | CURRENT_PROJECT_VERSION = 20 5 | 6 | HUMAN_READABLE_COPYRIGHT = © 2023 Yanone 7 | 8 | PRODUCT_BUNDLE_IDENTIFIER = de.Yanone.${PRODUCT_NAME:rfc1034identifier} 9 | 10 | INFOPLIST_FILE = $(TARGET_NAME)/$(TARGET_NAME)-Info.plist 11 | 12 | GCC_PREFIX_HEADER = $(SRCROOT)/SpeedPunk/SpeedPunk-Prefix.pch 13 | 14 | PRODUCT_NAME = $(TARGET_NAME); 15 | 16 | ARCHS = $(ARCHS_STANDARD) 17 | 18 | CLANG_ENABLE_OBJC_ARC = YES 19 | 20 | CLANG_ENABLE_MODULES = YES 21 | 22 | COMBINE_HIDPI_IMAGES = YES 23 | 24 | OTHER_CODE_SIGN_FLAGS = -o kill 25 | 26 | GCC_PRECOMPILE_PREFIX_HEADER = YES 27 | 28 | MACOSX_DEPLOYMENT_TARGET = 10.11 29 | SDKROOT = macosx 30 | DEBUG_INFORMATION_FORMAT = dwarf-with-dsym 31 | CLANG_CXX_LANGUAGE_STANDARD = c++14 32 | GCC_WARN_UNUSED_VARIABLE = YES 33 | 34 | DEPLOYMENT_POSTPROCESSING = YES 35 | 36 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES 37 | CLANG_ANALYZER_NONNULL = YES 38 | CLANG_STATIC_ANALYZER_MODE = deep 39 | 40 | CLANG_WARN_INFINITE_RECURSION = YES 41 | CLANG_WARN_SUSPICIOUS_MOVE = YES 42 | CLANG_WARN_BOOL_CONVERSION = YES 43 | CLANG_WARN_UNREACHABLE_CODE = YES 44 | CLANG_WARN_EMPTY_BODY = YES; 45 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 46 | 47 | GCC_WARN_UNDECLARED_SELECTOR = YES 48 | GCC_WARN_UNUSED_FUNCTION = YES 49 | INSTALL_PATH = @rpath 50 | SKIP_INSTALL = YES 51 | COPY_PHASE_STRIP = NO 52 | LLVM_LTO = YES 53 | GCC_NO_COMMON_BLOCKS = YES 54 | GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; 55 | CLANG_ENABLE_OBJC_WEAK = NO; 56 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 57 | 58 | IBC_WARNINGS = NO 59 | IBC_NOTICES = NO 60 | 61 | CLANG_MODULES_AUTOLINK = NO 62 | 63 | ALWAYS_SEARCH_USER_PATHS = NO 64 | 65 | STRINGS_FILE_OUTPUT_ENCODING = UTF-8 66 | 67 | ENABLE_NS_ASSERTIONS = NO 68 | 69 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 70 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 71 | 72 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; 73 | 74 | DEAD_CODE_STRIPPING = YES 75 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk.xcodeproj/xcshareddata/xcschemes/SpeedPunk.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repository hosts Yanone’s popular curvature illustration plug-in for [Glyphs.app](https://glyphsapp.com) and [RoboFont](https://robofont.com). 2 | 3 | # Speed Punk 4 | 5 | ![Curvature visualization with Speed Punk](./Resources/speedpunkglyphs.jpg) 6 | 7 | Speed Punk is a learning tool. It teaches you to better understand the nature of Bézier curves and their curvature, the technical basis of digital type design. 8 | 9 | Speed Punk illustrates the curvature on top of the outlines with shapes that stand perpendicular on the outline. This is a technique commonly known from CAD software. The “bigger” the illustration is (the further away from the outline), the higher the curvature is at this point. This way it is easy to judge curvature continuity at on-curve points: if the illustrations are of same distance from the on-curve point (they “meet”), the two curves are of continuous curvature. If you see a jump in the curvature illustration, curvature is discontinuous. Simple. Mathematically speaking the curvature is the first derivative of the curve’s direction and it is being calculated using the general cubic Bézier equation. 10 | 11 | The Bézier curve was developed almost simultaneously by two Frenchmen working in computer aided design (CAD) in the French automobile industry in the early 1960s, Paul de Casteljau working for Citroën and Pierre Bézier working for Renault. De Casteljau is today attributed with the invention, but Citroën decided to keep his research secret until the late ’60s, hence they carry Bézier’s name. 12 | The curves play an important role in many areas of industrial design, namely aqua- and aerodynamics, as well as computer animation (smoothly controlling the velocity of an object over time). And of course computer graphics in general and type design in particular, as they provide a memory efficient means of storing illustrations and can easily be scaled and rasterized on the fly for sharp printing on output devices with varying resolutions. 13 | 14 | 15 | *»If you ever have to make a case for redesign, I’ve found Speed Punk a helpful tool in explaining drawing quality to non-designery people. It makes quick and easy infographics so you show clients why their old art sucks and your new art rules.«* — Jackson Cavanaugh, Okay Type 16 | 17 | *»Useful and pretty – a rare combination.«* — Hrant Papazian 18 | 19 | *»Well, you don’t strictly need it. It’s just an analysis tool that amplifies and illuminates what is happening in your curves, particularly continuity at the junction of curve segments, making it easier to see where adjustments may be needed. It’s a way of seeing if your curves are really as smooth as you think they are.«* — Mark Simonson 20 | 21 | # Installation 22 | 23 | The plugins are installed through Glyphs.app’s built-in *Plugin Manager* or RoboFont’s *[Mechanic 2](https://robofontmechanic.com) Extension Manager*. 24 | 25 | # How To Use 26 | 27 | ### Glyphs.app 28 | 29 | The plug-in is activated in the View menu under *Show Speed Punk* or with the keyboard shortcut *Cmd+Shift+X*. The plug-in settings have moved into the context menu (right click). 30 | 31 | ### RoboFont 32 | 33 | The plug-in is activated through the anarchy-icon in the toolbar. 34 | 35 | # License 36 | 37 | Formerly a commercial plug-in sold by Yanone, it is free & open source software as of December 2019 courtesy of Google Fonts, published under the **Apache 2.0** license. 38 | 39 | # Contribution 40 | 41 | I accept Pull Requests under the condition that utmost care is taken as to keeping the *speedpunklib* library for both Glyphs and RoboFont versions inside this repository identical. Maybe contact me first, because I may want to sort out things first. 42 | 43 | # History 44 | 45 | The plug in was first conceived during Yanone’s year at [Type & Media](http://typemedia.org) in 2010/11 at the KABK in Den Haag, where he learned about the math behind the Bézier curves. 46 | 47 | It was publicly introduced during the Robothon 2012 conference in Den Haag, and sold there on CD and later by email before Yanone set up his online shop. 48 | 49 | Meanwhile, the technology made it into the Fontlab 6 editor, and with [Supertool](http://www.corvelsoftware.co.uk/software/supertool/) a similar plug-in was first sold and later open sourced by Simon Cozens. 50 | 51 | Given the free availability of similar plug-ins, especially with Supertool as a competition, Yanone ended up accepting Google Fonts’ offer to liberate the plug-in. -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/plugin.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from __future__ import division, print_function, unicode_literals 3 | 4 | ########################################################################################## 5 | # 6 | # Speed Punk 7 | # Visualisation tool of outline curvature for font editors. 8 | # 9 | # Distributed under Apache 2.0 license 10 | # 11 | ########################################################################################## 12 | 13 | import objc, webbrowser 14 | from GlyphsApp import * 15 | from GlyphsApp import NSStr 16 | from GlyphsApp.plugins import * 17 | from Foundation import NSString 18 | from AppKit import NSGraphicsContext, NSUserDefaultsController 19 | 20 | import speedpunk.speedpunklib 21 | 22 | # import cProfile, pstats 23 | # def gprofile(self, layer, command): 24 | 25 | # filename = 'profile_stats.stats' 26 | # #profile.run(command, filename) 27 | # cProfile.runctx(command, globals(), locals(), filename) 28 | 29 | # # Read all 5 stats files into a single object 30 | # stats = pstats.Stats(filename) 31 | # # Clean up filenames for the report 32 | # stats.strip_dirs() 33 | # # Sort the statistics by the cumulative time spent in the function 34 | # stats.sort_stats('cumulative') 35 | # stats.print_stats() 36 | 37 | class GlyphsAppSpeedPunkReporter(ReporterPlugin): 38 | 39 | settingsView = objc.IBOutlet() 40 | gainSlider = objc.IBOutlet() 41 | 42 | @objc.python_method 43 | def settings(self): 44 | self.keyboardShortcut = 'x' 45 | 46 | curveGain = speedpunk.speedpunklib.curveGain 47 | self.loadNib('settingsView', __file__) 48 | self.menuName = 'Speed Punk' 49 | self.speedpunklib = speedpunk.speedpunklib.SpeedPunkLib() 50 | self.speedpunklib.tool = self 51 | self.generalContextMenus = [{'name': 'Speed Punk', 'view': self.settingsView}] 52 | self.gainSlider.setMinValue_(curveGain[0]) 53 | self.gainSlider.setMaxValue_(curveGain[1]) 54 | 55 | self.histWidth = 200 56 | self.histHeight = 20 57 | 58 | default = NSUserDefaultsController.sharedUserDefaultsController() 59 | default.addObserver_forKeyPath_options_context_(self, NSStr('values.de.yanone.speedPunk.illustrationPositionIndex'), 0, None) 60 | default.addObserver_forKeyPath_options_context_(self, NSStr('values.de.yanone.speedPunk.curveGain'), 0, None) 61 | default.addObserver_forKeyPath_options_context_(self, NSStr('values.de.yanone.speedPunk.useFader'), 0, None) 62 | default.addObserver_forKeyPath_options_context_(self, NSStr('values.de.yanone.speedPunk.fader'), 0, None) 63 | 64 | @objc.python_method 65 | def conditionsAreMetForDrawing(self): 66 | """ 67 | Don't activate if text or pan (hand) tool are active. 68 | """ 69 | currentController = self.controller.view().window().windowController() 70 | if currentController: 71 | tool = currentController.toolDrawDelegate() 72 | textToolIsActive = tool.isKindOfClass_( NSClassFromString("GlyphsToolText") ) 73 | handToolIsActive = tool.isKindOfClass_( NSClassFromString("GlyphsToolHand") ) 74 | if not textToolIsActive and not handToolIsActive: 75 | return True 76 | return False 77 | 78 | def observeValueForKeyPath_ofObject_change_context_(self, keypath, observed, changed, context): 79 | self.speedpunklib.loadPreferences() 80 | Glyphs.redraw() 81 | 82 | @objc.python_method 83 | def background(self, layer): 84 | if self.conditionsAreMetForDrawing(): 85 | self.speedpunklib.UpdateGlyph(layer) 86 | 87 | def drawForegroundWithOptions_(self, options): 88 | if self.speedpunklib.useFader: 89 | visibleRect = self.controller.viewPort 90 | histOriginX = NSMinX(visibleRect) + 10 91 | histOriginY = NSMaxY(visibleRect) - 10 - self.histHeight 92 | NSGraphicsContext.currentContext().saveGraphicsState() 93 | clippingPath = NSBezierPath.bezierPathWithRoundedRect_cornerRadius_(NSRect((histOriginX, histOriginY), (self.histWidth, self.histHeight)), 5) 94 | clippingPath.addClip() 95 | self.speedpunklib.drawGradient(histOriginX, histOriginY, self.histWidth, self.histHeight) 96 | self.speedpunklib.drawHistogram(histOriginX, histOriginY, self.histWidth, self.histHeight) 97 | NSGraphicsContext.currentContext().restoreGraphicsState() 98 | 99 | @objc.python_method 100 | def __file__(self): 101 | """Please leave this method unchanged""" 102 | return __file__ 103 | 104 | @objc.IBAction 105 | def visitWebsite_(self, sender): 106 | webbrowser.open_new_tab('https://github.com/yanone/speedpunk') 107 | 108 | @objc.IBAction 109 | def visitTwitter_(self, sender): 110 | webbrowser.open_new_tab('https://twitter.com/yanone') 111 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/Base.lproj/settingsView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 101 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /SpeedPunk.glyphsReporter/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/Base.lproj/settingsView.nib/keyedobjects-101300.nib 8 | 9 | T4Rfg7/yvflFP+6+oj3GXd6pWG4= 10 | 11 | Resources/Base.lproj/settingsView.nib/keyedobjects.nib 12 | 13 | nMHyZ5/X2D44xBp0VAe6f9Q5qv4= 14 | 15 | Resources/de.lproj/Localizable.strings 16 | 17 | hash 18 | 19 | 4pKk/N5DyVlGRHIK2P3u67WZNBs= 20 | 21 | optional 22 | 23 | 24 | Resources/de.lproj/settingsView.strings 25 | 26 | hash 27 | 28 | s/sYpgfteOQciyb1sBsKrZQdFU8= 29 | 30 | optional 31 | 32 | 33 | Resources/en.lproj/Localizable.strings 34 | 35 | hash 36 | 37 | XrYjK1wUp7PlsGaIu7olO5MarkQ= 38 | 39 | optional 40 | 41 | 42 | Resources/en.lproj/settingsView.strings 43 | 44 | hash 45 | 46 | idVNHYdlychxZpbsIR9kN4Hhgmo= 47 | 48 | optional 49 | 50 | 51 | Resources/es.lproj/Localizable.strings 52 | 53 | hash 54 | 55 | t8TxyZkddr403CoMiYWmHyEhZdI= 56 | 57 | optional 58 | 59 | 60 | Resources/es.lproj/settingsView.strings 61 | 62 | hash 63 | 64 | gPl5+lRNwvtA7hVLrYFLKBr7Wvk= 65 | 66 | optional 67 | 68 | 69 | Resources/fr.lproj/Localizable.strings 70 | 71 | hash 72 | 73 | Q8PzZoxUPnsei0dU6dvt7NRqjOc= 74 | 75 | optional 76 | 77 | 78 | Resources/fr.lproj/settingsView.strings 79 | 80 | hash 81 | 82 | LXUgnmtRi3K43q42YDsQRmbg3nE= 83 | 84 | optional 85 | 86 | 87 | Resources/ja.lproj/Localizable.strings 88 | 89 | hash 90 | 91 | TpdplJK/Wga6WbONYLhEd46jhvg= 92 | 93 | optional 94 | 95 | 96 | Resources/ja.lproj/settingsView.strings 97 | 98 | hash 99 | 100 | SRtIJwKqJTB3VRAC4UJtWk+Y6Jw= 101 | 102 | optional 103 | 104 | 105 | Resources/ko.lproj/Localizable.strings 106 | 107 | hash 108 | 109 | S0Cp50OWeKLkVdh9lhGErY8vjyw= 110 | 111 | optional 112 | 113 | 114 | Resources/ko.lproj/settingsView.strings 115 | 116 | hash 117 | 118 | xflDz+S3yZ+k4k0NqTgpPhHMwc8= 119 | 120 | optional 121 | 122 | 123 | Resources/pt.lproj/Localizable.strings 124 | 125 | hash 126 | 127 | xPVzdtLIc48Nk3kHNHg33RvZ8pU= 128 | 129 | optional 130 | 131 | 132 | Resources/pt.lproj/settingsView.strings 133 | 134 | hash 135 | 136 | HBwloMCkqx6R4TqZVzVohQfY9w4= 137 | 138 | optional 139 | 140 | 141 | 142 | files2 143 | 144 | Resources/Base.lproj/settingsView.nib/keyedobjects-101300.nib 145 | 146 | hash 147 | 148 | T4Rfg7/yvflFP+6+oj3GXd6pWG4= 149 | 150 | hash2 151 | 152 | m9qyb/rg4hhnef4nrLO2oQcl2lj0Mr+tZEZsPOrRVbo= 153 | 154 | 155 | Resources/Base.lproj/settingsView.nib/keyedobjects.nib 156 | 157 | hash 158 | 159 | nMHyZ5/X2D44xBp0VAe6f9Q5qv4= 160 | 161 | hash2 162 | 163 | 43Rt8wM/njeSYszkXdXL7f6HjTR0wSzo8+IN8a1+el8= 164 | 165 | 166 | Resources/de.lproj/Localizable.strings 167 | 168 | hash 169 | 170 | 4pKk/N5DyVlGRHIK2P3u67WZNBs= 171 | 172 | hash2 173 | 174 | Vzi+nEeY7Qhq5JbgCuICrJ8oVlYXbDdmQrTMnpz+PTE= 175 | 176 | optional 177 | 178 | 179 | Resources/de.lproj/settingsView.strings 180 | 181 | hash 182 | 183 | s/sYpgfteOQciyb1sBsKrZQdFU8= 184 | 185 | hash2 186 | 187 | Cx493oGhnyNdaXVtXRoZLkXmQP8Nv+R1yoyqaf4eD9s= 188 | 189 | optional 190 | 191 | 192 | Resources/en.lproj/Localizable.strings 193 | 194 | hash 195 | 196 | XrYjK1wUp7PlsGaIu7olO5MarkQ= 197 | 198 | hash2 199 | 200 | SXnHpgu4GoXe/oKz7slF7ZLqOjyoVhJ6yF6f9LZkhHc= 201 | 202 | optional 203 | 204 | 205 | Resources/en.lproj/settingsView.strings 206 | 207 | hash 208 | 209 | idVNHYdlychxZpbsIR9kN4Hhgmo= 210 | 211 | hash2 212 | 213 | D9Tfo1n0TBMm0AoTk12q9mMCzWXIAqTvuRUNGE9UyJ0= 214 | 215 | optional 216 | 217 | 218 | Resources/es.lproj/Localizable.strings 219 | 220 | hash 221 | 222 | t8TxyZkddr403CoMiYWmHyEhZdI= 223 | 224 | hash2 225 | 226 | EwpNzY9/son25PAMkAzHUy+ZPNeuWyd0Gq6yho9ANYQ= 227 | 228 | optional 229 | 230 | 231 | Resources/es.lproj/settingsView.strings 232 | 233 | hash 234 | 235 | gPl5+lRNwvtA7hVLrYFLKBr7Wvk= 236 | 237 | hash2 238 | 239 | ADafIuejhPAmdp0DSbtT1iVPWq/2HnWNGaNbOueqGOY= 240 | 241 | optional 242 | 243 | 244 | Resources/fr.lproj/Localizable.strings 245 | 246 | hash 247 | 248 | Q8PzZoxUPnsei0dU6dvt7NRqjOc= 249 | 250 | hash2 251 | 252 | SWdawJ8asjMOVuP+7yed2L7QVZZa0oIuWGWbBDZ/ikg= 253 | 254 | optional 255 | 256 | 257 | Resources/fr.lproj/settingsView.strings 258 | 259 | hash 260 | 261 | LXUgnmtRi3K43q42YDsQRmbg3nE= 262 | 263 | hash2 264 | 265 | p/Ewvs5w3oRopKk8GXgauh8O7+0nIUU504TMYY/mjXY= 266 | 267 | optional 268 | 269 | 270 | Resources/ja.lproj/Localizable.strings 271 | 272 | hash 273 | 274 | TpdplJK/Wga6WbONYLhEd46jhvg= 275 | 276 | hash2 277 | 278 | vpaEEhniZGCTQbHkjvzAxeZPrrEdNiGKjUnroAwX3Qs= 279 | 280 | optional 281 | 282 | 283 | Resources/ja.lproj/settingsView.strings 284 | 285 | hash 286 | 287 | SRtIJwKqJTB3VRAC4UJtWk+Y6Jw= 288 | 289 | hash2 290 | 291 | DEXm5hjIQffyNC4tGND5opoZMZIsIfU2EXHqnyH4XA0= 292 | 293 | optional 294 | 295 | 296 | Resources/ko.lproj/Localizable.strings 297 | 298 | hash 299 | 300 | S0Cp50OWeKLkVdh9lhGErY8vjyw= 301 | 302 | hash2 303 | 304 | MJWsTUuPBbEC2n3CJaSy14rvguui7U5bf8k7V9hJZjw= 305 | 306 | optional 307 | 308 | 309 | Resources/ko.lproj/settingsView.strings 310 | 311 | hash 312 | 313 | xflDz+S3yZ+k4k0NqTgpPhHMwc8= 314 | 315 | hash2 316 | 317 | kKLLvFatpfKIl2myK1BR67eFcgh7qdjVgBEvoNToX1k= 318 | 319 | optional 320 | 321 | 322 | Resources/pt.lproj/Localizable.strings 323 | 324 | hash 325 | 326 | xPVzdtLIc48Nk3kHNHg33RvZ8pU= 327 | 328 | hash2 329 | 330 | CRkW9ohiEHveOgmEZ8gzIFanG8UHQDCwyYE/XDDyGck= 331 | 332 | optional 333 | 334 | 335 | Resources/pt.lproj/settingsView.strings 336 | 337 | hash 338 | 339 | HBwloMCkqx6R4TqZVzVohQfY9w4= 340 | 341 | hash2 342 | 343 | M8apDonVHNshnwBECTGS4aR4eDSM1zkEhn6uuYnlPFY= 344 | 345 | optional 346 | 347 | 348 | 349 | rules 350 | 351 | ^Resources/ 352 | 353 | ^Resources/.*\.lproj/ 354 | 355 | optional 356 | 357 | weight 358 | 1000 359 | 360 | ^Resources/.*\.lproj/locversion.plist$ 361 | 362 | omit 363 | 364 | weight 365 | 1100 366 | 367 | ^Resources/Base\.lproj/ 368 | 369 | weight 370 | 1010 371 | 372 | ^version.plist$ 373 | 374 | 375 | rules2 376 | 377 | .*\.dSYM($|/) 378 | 379 | weight 380 | 11 381 | 382 | ^(.*/)?\.DS_Store$ 383 | 384 | omit 385 | 386 | weight 387 | 2000 388 | 389 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 390 | 391 | nested 392 | 393 | weight 394 | 10 395 | 396 | ^.* 397 | 398 | ^Info\.plist$ 399 | 400 | omit 401 | 402 | weight 403 | 20 404 | 405 | ^PkgInfo$ 406 | 407 | omit 408 | 409 | weight 410 | 20 411 | 412 | ^Resources/ 413 | 414 | weight 415 | 20 416 | 417 | ^Resources/.*\.lproj/ 418 | 419 | optional 420 | 421 | weight 422 | 1000 423 | 424 | ^Resources/.*\.lproj/locversion.plist$ 425 | 426 | omit 427 | 428 | weight 429 | 1100 430 | 431 | ^Resources/Base\.lproj/ 432 | 433 | weight 434 | 1010 435 | 436 | ^[^/]+$ 437 | 438 | nested 439 | 440 | weight 441 | 10 442 | 443 | ^embedded\.provisionprofile$ 444 | 445 | weight 446 | 20 447 | 448 | ^version\.plist$ 449 | 450 | weight 451 | 20 452 | 453 | 454 | 455 | 456 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/Base.lproj/settingsView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 94 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5649E5C62AC604C600A0FF33 /* settingsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5649E5C82AC604C600A0FF33 /* settingsView.xib */; }; 11 | 5649E5E32AC60A5D00A0FF33 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5649E5E12AC60A5D00A0FF33 /* Localizable.strings */; }; 12 | 5649E5EB2AC61EBC00A0FF33 /* GlyphsCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5649E5EA2AC61EBC00A0FF33 /* GlyphsCore.framework */; }; 13 | 5664B2B42AC4597800A28703 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5664B2B32AC4597800A28703 /* Cocoa.framework */; }; 14 | 5664B2B82AC4597800A28703 /* SpeedPunk.m in Sources */ = {isa = PBXBuildFile; fileRef = 5664B2B72AC4597800A28703 /* SpeedPunk.m */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 5649E55C2AC5E92A00A0FF33 /* common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = common.xcconfig; sourceTree = ""; }; 19 | 5649E55D2AC5E92A00A0FF33 /* debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = debug.xcconfig; sourceTree = ""; }; 20 | 5649E5C72AC604C600A0FF33 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/settingsView.xib; sourceTree = ""; }; 21 | 5649E5CC2AC604E700A0FF33 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/settingsView.strings; sourceTree = ""; }; 22 | 5649E5D02AC6051B00A0FF33 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/settingsView.strings; sourceTree = ""; }; 23 | 5649E5D32AC6054500A0FF33 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/settingsView.strings; sourceTree = ""; }; 24 | 5649E5D42AC6055B00A0FF33 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/settingsView.strings; sourceTree = ""; }; 25 | 5649E5D82AC605AC00A0FF33 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/settingsView.strings; sourceTree = ""; }; 26 | 5649E5DC2AC605BF00A0FF33 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/settingsView.strings; sourceTree = ""; }; 27 | 5649E5E02AC605D300A0FF33 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/settingsView.strings; sourceTree = ""; }; 28 | 5649E5E22AC60A5D00A0FF33 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 29 | 5649E5E42AC60A6300A0FF33 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; 30 | 5649E5E52AC60A6500A0FF33 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; 31 | 5649E5E62AC60A6600A0FF33 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; 32 | 5649E5E72AC60A6700A0FF33 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = ""; }; 33 | 5649E5E82AC60A6800A0FF33 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; 34 | 5649E5E92AC60A6A00A0FF33 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; 35 | 5649E5EA2AC61EBC00A0FF33 /* GlyphsCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GlyphsCore.framework; path = "../../../../../../Applications/Glyphs 3.app/Contents/Frameworks/GlyphsCore.framework"; sourceTree = ""; }; 36 | 5664B2B02AC4597800A28703 /* SpeedPunk.glyphsReporter */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SpeedPunk.glyphsReporter; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 5664B2B32AC4597800A28703 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 38 | 5664B2B62AC4597800A28703 /* SpeedPunk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpeedPunk.h; sourceTree = ""; }; 39 | 5664B2B72AC4597800A28703 /* SpeedPunk.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SpeedPunk.m; sourceTree = ""; }; 40 | 5664B2BB2AC4597800A28703 /* SpeedPunk-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SpeedPunk-Prefix.pch"; sourceTree = ""; }; 41 | 5664B2BD2AC4597800A28703 /* SpeedPunk-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SpeedPunk-Info.plist"; sourceTree = ""; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | 5664B2AD2AC4597800A28703 /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | 5649E5EB2AC61EBC00A0FF33 /* GlyphsCore.framework in Frameworks */, 50 | 5664B2B42AC4597800A28703 /* Cocoa.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | 5664B2A72AC4597800A28703 = { 58 | isa = PBXGroup; 59 | children = ( 60 | 5664B2B52AC4597800A28703 /* SpeedPunk */, 61 | 5664B2B22AC4597800A28703 /* Frameworks */, 62 | 5664B2B12AC4597800A28703 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 5664B2B12AC4597800A28703 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 5664B2B02AC4597800A28703 /* SpeedPunk.glyphsReporter */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 5664B2B22AC4597800A28703 /* Frameworks */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 5649E5EA2AC61EBC00A0FF33 /* GlyphsCore.framework */, 78 | 5664B2B32AC4597800A28703 /* Cocoa.framework */, 79 | ); 80 | name = Frameworks; 81 | sourceTree = ""; 82 | }; 83 | 5664B2B52AC4597800A28703 /* SpeedPunk */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 5664B2B62AC4597800A28703 /* SpeedPunk.h */, 87 | 5664B2B72AC4597800A28703 /* SpeedPunk.m */, 88 | 5664B2BB2AC4597800A28703 /* SpeedPunk-Prefix.pch */, 89 | 5664B2BD2AC4597800A28703 /* SpeedPunk-Info.plist */, 90 | 5649E55C2AC5E92A00A0FF33 /* common.xcconfig */, 91 | 5649E55D2AC5E92A00A0FF33 /* debug.xcconfig */, 92 | 5649E5E12AC60A5D00A0FF33 /* Localizable.strings */, 93 | 5649E5C82AC604C600A0FF33 /* settingsView.xib */, 94 | ); 95 | path = SpeedPunk; 96 | sourceTree = ""; 97 | }; 98 | /* End PBXGroup section */ 99 | 100 | /* Begin PBXNativeTarget section */ 101 | 5664B2AF2AC4597800A28703 /* SpeedPunk */ = { 102 | isa = PBXNativeTarget; 103 | buildConfigurationList = 5664B2C02AC4597800A28703 /* Build configuration list for PBXNativeTarget "SpeedPunk" */; 104 | buildPhases = ( 105 | 5664B2AC2AC4597800A28703 /* Sources */, 106 | 5664B2AD2AC4597800A28703 /* Frameworks */, 107 | 5664B2AE2AC4597800A28703 /* Resources */, 108 | ); 109 | buildRules = ( 110 | ); 111 | dependencies = ( 112 | ); 113 | name = SpeedPunk; 114 | productName = SpeedPunk; 115 | productReference = 5664B2B02AC4597800A28703 /* SpeedPunk.glyphsReporter */; 116 | productType = "com.apple.product-type.bundle"; 117 | }; 118 | /* End PBXNativeTarget section */ 119 | 120 | /* Begin PBXProject section */ 121 | 5664B2A82AC4597800A28703 /* Project object */ = { 122 | isa = PBXProject; 123 | attributes = { 124 | BuildIndependentTargetsInParallel = 1; 125 | LastUpgradeCheck = 1400; 126 | TargetAttributes = { 127 | 5664B2AF2AC4597800A28703 = { 128 | CreatedOnToolsVersion = 14.0.1; 129 | }; 130 | }; 131 | }; 132 | buildConfigurationList = 5664B2AB2AC4597800A28703 /* Build configuration list for PBXProject "SpeedPunk" */; 133 | compatibilityVersion = "Xcode 14.0"; 134 | developmentRegion = en; 135 | hasScannedForEncodings = 0; 136 | knownRegions = ( 137 | en, 138 | Base, 139 | de, 140 | es, 141 | fr, 142 | pt, 143 | ko, 144 | ja, 145 | ); 146 | mainGroup = 5664B2A72AC4597800A28703; 147 | productRefGroup = 5664B2B12AC4597800A28703 /* Products */; 148 | projectDirPath = ""; 149 | projectRoot = ""; 150 | targets = ( 151 | 5664B2AF2AC4597800A28703 /* SpeedPunk */, 152 | ); 153 | }; 154 | /* End PBXProject section */ 155 | 156 | /* Begin PBXResourcesBuildPhase section */ 157 | 5664B2AE2AC4597800A28703 /* Resources */ = { 158 | isa = PBXResourcesBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | 5649E5E32AC60A5D00A0FF33 /* Localizable.strings in Resources */, 162 | 5649E5C62AC604C600A0FF33 /* settingsView.xib in Resources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXResourcesBuildPhase section */ 167 | 168 | /* Begin PBXSourcesBuildPhase section */ 169 | 5664B2AC2AC4597800A28703 /* Sources */ = { 170 | isa = PBXSourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | 5664B2B82AC4597800A28703 /* SpeedPunk.m in Sources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXSourcesBuildPhase section */ 178 | 179 | /* Begin PBXVariantGroup section */ 180 | 5649E5C82AC604C600A0FF33 /* settingsView.xib */ = { 181 | isa = PBXVariantGroup; 182 | children = ( 183 | 5649E5C72AC604C600A0FF33 /* Base */, 184 | 5649E5CC2AC604E700A0FF33 /* en */, 185 | 5649E5D02AC6051B00A0FF33 /* de */, 186 | 5649E5D32AC6054500A0FF33 /* es */, 187 | 5649E5D42AC6055B00A0FF33 /* fr */, 188 | 5649E5D82AC605AC00A0FF33 /* pt */, 189 | 5649E5DC2AC605BF00A0FF33 /* ko */, 190 | 5649E5E02AC605D300A0FF33 /* ja */, 191 | ); 192 | name = settingsView.xib; 193 | sourceTree = ""; 194 | }; 195 | 5649E5E12AC60A5D00A0FF33 /* Localizable.strings */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | 5649E5E22AC60A5D00A0FF33 /* en */, 199 | 5649E5E42AC60A6300A0FF33 /* fr */, 200 | 5649E5E52AC60A6500A0FF33 /* de */, 201 | 5649E5E62AC60A6600A0FF33 /* ja */, 202 | 5649E5E72AC60A6700A0FF33 /* ko */, 203 | 5649E5E82AC60A6800A0FF33 /* pt */, 204 | 5649E5E92AC60A6A00A0FF33 /* es */, 205 | ); 206 | name = Localizable.strings; 207 | sourceTree = ""; 208 | }; 209 | /* End PBXVariantGroup section */ 210 | 211 | /* Begin XCBuildConfiguration section */ 212 | 5664B2BE2AC4597800A28703 /* Debug */ = { 213 | isa = XCBuildConfiguration; 214 | baseConfigurationReference = 5649E55D2AC5E92A00A0FF33 /* debug.xcconfig */; 215 | buildSettings = { 216 | }; 217 | name = Debug; 218 | }; 219 | 5664B2BF2AC4597800A28703 /* Release */ = { 220 | isa = XCBuildConfiguration; 221 | baseConfigurationReference = 5649E55C2AC5E92A00A0FF33 /* common.xcconfig */; 222 | buildSettings = { 223 | }; 224 | name = Release; 225 | }; 226 | 5664B2C12AC4597800A28703 /* Debug */ = { 227 | isa = XCBuildConfiguration; 228 | baseConfigurationReference = 5649E55D2AC5E92A00A0FF33 /* debug.xcconfig */; 229 | buildSettings = { 230 | CODE_SIGN_IDENTITY = "Developer ID Application: Georg Seifert (X2L8375ZQ7)"; 231 | DEPLOYMENT_LOCATION = YES; 232 | DEVELOPMENT_TEAM = X2L8375ZQ7; 233 | DSTROOT = "$(USER_LIBRARY_DIR)/Application Support/Glyphs 3/Plugins"; 234 | FRAMEWORK_SEARCH_PATHS = "\"/Applications/Glyphs 3.app/Contents/Frameworks\""; 235 | GENERATE_INFOPLIST_FILE = YES; 236 | INFOPLIST_KEY_NSPrincipalClass = SPSpeedPunk; 237 | INSTALL_PATH = /; 238 | SKIP_INSTALL = NO; 239 | WRAPPER_EXTENSION = glyphsReporter; 240 | }; 241 | name = Debug; 242 | }; 243 | 5664B2C22AC4597800A28703 /* Release */ = { 244 | isa = XCBuildConfiguration; 245 | baseConfigurationReference = 5649E55C2AC5E92A00A0FF33 /* common.xcconfig */; 246 | buildSettings = { 247 | CODE_SIGN_IDENTITY = "Developer ID Application: Georg Seifert (X2L8375ZQ7)"; 248 | DEPLOYMENT_POSTPROCESSING = NO; 249 | DEVELOPMENT_TEAM = X2L8375ZQ7; 250 | FRAMEWORK_SEARCH_PATHS = "\"/Applications/Glyphs 3.app/Contents/Frameworks\""; 251 | GENERATE_INFOPLIST_FILE = YES; 252 | INFOPLIST_KEY_NSPrincipalClass = SPSpeedPunk; 253 | INSTALL_PATH = /; 254 | SKIP_INSTALL = NO; 255 | STRIP_INSTALLED_PRODUCT = NO; 256 | WRAPPER_EXTENSION = glyphsReporter; 257 | }; 258 | name = Release; 259 | }; 260 | /* End XCBuildConfiguration section */ 261 | 262 | /* Begin XCConfigurationList section */ 263 | 5664B2AB2AC4597800A28703 /* Build configuration list for PBXProject "SpeedPunk" */ = { 264 | isa = XCConfigurationList; 265 | buildConfigurations = ( 266 | 5664B2BE2AC4597800A28703 /* Debug */, 267 | 5664B2BF2AC4597800A28703 /* Release */, 268 | ); 269 | defaultConfigurationIsVisible = 0; 270 | defaultConfigurationName = Release; 271 | }; 272 | 5664B2C02AC4597800A28703 /* Build configuration list for PBXNativeTarget "SpeedPunk" */ = { 273 | isa = XCConfigurationList; 274 | buildConfigurations = ( 275 | 5664B2C12AC4597800A28703 /* Debug */, 276 | 5664B2C22AC4597800A28703 /* Release */, 277 | ); 278 | defaultConfigurationIsVisible = 0; 279 | defaultConfigurationName = Release; 280 | }; 281 | /* End XCConfigurationList section */ 282 | }; 283 | rootObject = 5664B2A82AC4597800A28703 /* Project object */; 284 | } 285 | -------------------------------------------------------------------------------- /GlyphsSource/SpeedPunk/SpeedPunk.m: -------------------------------------------------------------------------------- 1 | // 2 | // SpeedPunk.m 3 | // SpeedPunk 4 | // 5 | // Created by Georg Seifert on 27.09.23. 6 | // 7 | // 8 | 9 | #import "SpeedPunk.h" 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | 22 | extern void calcQuadraticParameters(NSPoint p1, NSPoint p2, NSPoint p3, NSPoint *a, NSPoint *b, NSPoint *c); 23 | extern void calcCubicParameters(NSPoint p1, NSPoint p2, NSPoint p3, NSPoint p4, NSPoint *a, NSPoint *b, NSPoint *c, NSPoint *d); 24 | 25 | // #define DRAW_GRADIENTS 1 26 | 27 | // int TOTALSEGMENTS = min(int(Stamina() * .00000008), 1000) 28 | #if DRAW_GRADIENTS 29 | int TOTALSEGMENTS = 100; 30 | #else 31 | int TOTALSEGMENTS = 400; 32 | #endif 33 | 34 | int MINSEGMENTS = 5; 35 | 36 | CGFloat curveGainMin = .1; 37 | CGFloat curveGainMax = 3; 38 | 39 | int outsideOfGlyph = 0; // index of selected radio button 40 | int outsideOfCurve = 1; 41 | 42 | static NSString *IllustrationPositionIndexKey = @"de.yanone.speedPunk.illustrationPositionIndex"; 43 | static NSString *CurveGainKey = @"de.yanone.speedPunk.curveGain"; 44 | static NSString *AlphaKey = @"de.yanone.speedPunk.alpha"; 45 | 46 | CGFloat CurveGain; 47 | int IllustrationPosition; 48 | CGFloat Alpha; 49 | 50 | #define drawfactor .01 51 | 52 | #if 0 // HSB 53 | static CGFloat Colors[3][3] = { 54 | {0.588235, 0.108974, 0.611765}, 55 | {0.101928, 1.000000, 0.949020}, 56 | {0.941997, 1.000000, 0.890196}, 57 | }; 58 | #else 59 | static CGFloat Colors[3][3] = { 60 | {(0x8b / 255.0), (0x93 / 255.0), (0x9c / 255.0)}, 61 | {(0xf2 / 255.0), (0x94 / 255.0), (0x00 / 255.0)}, 62 | {(0xe3 / 255.0), (0x00 / 255.0), (0x4f / 255.0)}, 63 | }; 64 | #endif 65 | 66 | 67 | CGFloat solveCubicBezierCurvature(NSPoint a, NSPoint b, NSPoint c, NSPoint d, NSPoint *r1, NSPoint *r2, NSPoint *r3, CGFloat t) { 68 | /* 69 | Calc curvature using cubic Bezier equation and 1st and 2nd derivative. 70 | Returns position of on-curve point p1234, and vector of 1st and 2nd derivative. 71 | */ 72 | 73 | CGFloat t3 = t * t * t; 74 | CGFloat t2 = t * t; 75 | r1->x = a.x * t3 + b.x * t2 + c.x * t + d.x; 76 | r1->y = a.y * t3 + b.y * t2 + c.y * t + d.y; 77 | 78 | r2->x = 3 * a.x * t2 + 2 * b.x * t + c.x; 79 | r2->y = 3 * a.y * t2 + 2 * b.y * t + c.y; 80 | 81 | r3->x = 6 * a.x * t + 2 * b.x; 82 | r3->y = 6 * a.y * t + 2 * b.y; 83 | 84 | return (r2->x * r3->y - r2->y * r3->x) / pow(r2->x * r2->x + r2->y * r2->y, 1.5); 85 | } 86 | 87 | CGFloat solveQuadraticBezierCurvature(NSPoint a, NSPoint b, NSPoint c, NSPoint *r1, NSPoint *r2, NSPoint *r3, CGFloat t) { 88 | /* 89 | Calc curvature using quadratic Bezier equation and 1st and 2nd derivative. 90 | Returns position of on-curve point p123, and vector of 1st and 2nd derivative. 91 | */ 92 | CGFloat t2 = t * t; 93 | r1->x = a.x * t2 + b.x * t + c.x; 94 | r1->y = a.y * t2 + b.y * t + c.y; 95 | 96 | 97 | r2->x = 2 * a.x * t + b.x; 98 | r2->y = 2 * a.y * t + b.y; 99 | 100 | 101 | r3->x = 2 * a.x; 102 | r3->y = 2 * a.y; 103 | 104 | //return (r, r1, r2, (r1.x * r2.y - r1.y * r2.x) / (r1.x ** 2 + r1.y ** 2) ** 1.5) 105 | return (r2->x * r3->y - r2->y * r3->x) / pow(r2->x * r2->x + r2->y * r2->y, 1.5); 106 | } 107 | 108 | CGFloat Interpolate(CGFloat a, CGFloat b, CGFloat p) { 109 | /* 110 | Interpolate between values a and b at float position p (0-1) 111 | Limit: No extrapolation 112 | */ 113 | CGFloat i = a + (b - a) * p; 114 | return i; 115 | } 116 | 117 | void InterpolateHexColorList(CGFloat colors[3][3], CGFloat p, CGFloat *R, CGFloat *G, CGFloat *B) { 118 | /* 119 | Interpolate between list of hex RRGGBB values at float position p (0-1) 120 | Returns float list (R, G, B) 121 | */ 122 | 123 | if (p <= 0) { 124 | CGFloat *color = colors[0]; 125 | *R = color[0]; 126 | *G = color[1]; 127 | *B = color[2]; 128 | return; 129 | } 130 | else if (p >= 1) { 131 | CGFloat *color = colors[2]; 132 | *R = color[0]; 133 | *G = color[1]; 134 | *B = color[2]; 135 | return; 136 | } 137 | else { 138 | int count = 3; //(int)colors; 139 | 140 | for (int i = 0; i < count; i++) { 141 | 142 | CGFloat before = i / (CGFloat)(count - 1); 143 | CGFloat after = (i + 1) / (CGFloat)(count - 1); 144 | 145 | if (before < p && p < after) { 146 | CGFloat v = (p - before) / (after - before); 147 | 148 | // print("interpolate between", before, after, p, v) 149 | CGFloat *color1 = colors[i]; 150 | CGFloat *color2 = colors[i + 1]; 151 | *R = Interpolate(color1[0], color2[0], v); 152 | *G = Interpolate(color1[1], color2[1], v); 153 | *B = Interpolate(color1[2], color2[2], v); 154 | } 155 | else if (p == before) { 156 | CGFloat *color = colors[i]; 157 | *R = color[0]; 158 | *G = color[1]; 159 | *B = color[2]; 160 | return; 161 | } 162 | else if (p == after) { 163 | CGFloat *color = colors[i + 1]; 164 | *R = color[0]; 165 | *G = color[1]; 166 | *B = color[2]; 167 | return; 168 | } 169 | } 170 | } 171 | } 172 | 173 | @interface SPCurvature : NSObject 174 | 175 | - (instancetype)initWithCurvature1:(CGFloat)curvature1 r1:(NSPoint)r1 r2:(NSPoint)r2 q1:(NSPoint)q1 q2:(NSPoint)q2 curvature2:(CGFloat)curvature2; 176 | 177 | - (void)draw; 178 | 179 | @property (nonatomic, weak) SPSpeedPunk *speedPunk; 180 | @property (nonatomic) float curvature1; 181 | @property (nonatomic) float curvature2; 182 | @property (nonatomic) NSPoint r1; 183 | @property (nonatomic) NSPoint r2; 184 | @property (nonatomic) NSPoint q1; 185 | @property (nonatomic) NSPoint q2; 186 | 187 | @property (nonatomic) float vmin; 188 | @property (nonatomic) float vmax; 189 | 190 | @property (nonatomic, strong) NSBezierPath *path; 191 | #if DRAW_GRADIENTS 192 | @property (nonatomic, strong) NSGradient *gradient; 193 | #else 194 | @property (nonatomic, strong) NSColor *color; 195 | #endif 196 | 197 | @end 198 | 199 | @interface SPSpeedPunk () 200 | 201 | @property (nonatomic, strong) NSMutableArray *segments; 202 | @property (nonatomic, weak) GSLayer *lastLayer; 203 | @property (nonatomic) NSTimeInterval lastUpdate; 204 | @property (nonatomic) CGFloat unitsperem; 205 | 206 | @end 207 | 208 | @implementation SPCurvature 209 | 210 | - (instancetype)initWithCurvature1:(CGFloat)curvature1 r1:(NSPoint)r1 r2:(NSPoint)r2 q1:(NSPoint)q1 q2:(NSPoint)q2 curvature2:(CGFloat)curvature2 { 211 | self = [self init]; 212 | _curvature1 = curvature1; 213 | _curvature2 = curvature2; 214 | _r1 = r1; 215 | _r2 = r2; 216 | _q1 = q1; 217 | _q2 = q2; 218 | return self; 219 | } 220 | 221 | - (void)draw { 222 | // update color 223 | #if DRAW_GRADIENTS 224 | if (!self.gradient) { 225 | if (![self updateColor]) { 226 | return; // can happen with straight segments 227 | } 228 | } 229 | #else 230 | if (!self.color) { 231 | if (![self updateColor]) { 232 | return; // can happen with straight segments 233 | } 234 | } 235 | #endif 236 | if (!self.path) { 237 | [self updateCurvaturePath]; 238 | } 239 | [self drawCurvaturePaths]; 240 | } 241 | 242 | - (CGFloat)Value { 243 | return (fabs(self.curvature1 * drawfactor) + fabs(self.curvature2 * drawfactor)) / 2.0; 244 | } 245 | 246 | - (BOOL)updateColor { 247 | // Color 248 | CGFloat deltaV = _vmax - _vmin; 249 | 250 | if (fabs(deltaV) < 0.0000001) { 251 | return NO; 252 | } 253 | #if DRAW_GRADIENTS 254 | CGFloat p = ((self.curvature1 * drawfactor) - _vmin) / deltaV; 255 | CGFloat R = 1, G = 0, B = 0; 256 | InterpolateHexColorList(Colors, p, &R, &G, &B); 257 | 258 | NSColor *color1 = [NSColor colorWithCalibratedRed:R green:G blue:B alpha:Alpha]; 259 | p = ((self.curvature2 * drawfactor) - _vmin) / deltaV; 260 | InterpolateHexColorList(Colors, p, &R, &G, &B); 261 | 262 | NSColor *color2 = [NSColor colorWithCalibratedRed:R green:G blue:B alpha:Alpha]; 263 | 264 | self.gradient = [[NSGradient alloc] initWithStartingColor:color1 endingColor:color2]; 265 | #else 266 | CGFloat p = ([self Value] - _vmin) / deltaV; 267 | CGFloat R = 1, G = 0, B = 0; 268 | //InterpolateHexColorList(colors[_speedPunk.curves], p); 269 | InterpolateHexColorList(Colors, p, &R, &G, &B); 270 | 271 | self.color = [NSColor colorWithCalibratedRed:R green:G blue:B alpha:Alpha]; 272 | #endif 273 | //self.color = [NSColor colorWithCalibratedHue:R saturation:G brightness:B alpha:A]; 274 | return YES; 275 | } 276 | 277 | - (void)updateCurvaturePath { 278 | // Recalc illustration 279 | CGFloat factor = drawfactor * CurveGain * pow(_speedPunk.unitsperem, 2); 280 | CGFloat k1 = self.curvature1 * factor; 281 | CGFloat k2 = self.curvature2 * factor; 282 | 283 | if (IllustrationPosition == outsideOfGlyph) { 284 | k1 = fabs(k1); 285 | k2 = fabs(k2); 286 | #if 0 287 | // TrueType 288 | if (speedpunklib.curves == 'quadratic') { 289 | k1 = -k1; 290 | k2 = -k2; 291 | } 292 | #endif 293 | } 294 | // Define points 295 | NSPoint S10 = self.r1; 296 | NSPoint S11 = self.r2; 297 | NSPoint S20 = self.q1; 298 | NSPoint S21 = self.q2; 299 | //self.oncurve1 = S10 300 | //self.oncurve2 = S20 301 | CGFloat S21abs = sqrt(S21.x * S21.x + S21.y * S21.y); 302 | CGFloat S11abs = sqrt(S11.x * S11.x + S11.y * S11.y); 303 | NSPoint outerspace2 = NSMakePoint(S20.x + (S21.y / S21abs * k2), S20.y - (S21.x / S21abs * k2)); 304 | NSPoint outerspace1 = NSMakePoint(S10.x + (S11.y / S11abs * k1), S10.y - (S11.x / S11abs * k1)); 305 | 306 | NSBezierPath *path = [GSSaveBezierPath new]; 307 | // OnCurve 308 | [path moveToPoint:S10]; 309 | [path lineToPoint:S20]; 310 | // Outer points 311 | [path lineToPoint:outerspace2]; 312 | [path lineToPoint:outerspace1]; 313 | [path closePath]; 314 | self.path = path; 315 | } 316 | 317 | - (void)drawCurvaturePaths { 318 | #if DRAW_GRADIENTS 319 | if (!self.gradient) { 320 | return; 321 | } 322 | [NSGraphicsContext saveGraphicsState]; 323 | [self.path addClip]; 324 | [self.gradient drawFromPoint:self.r1 toPoint:self.q1 options:NSGradientDrawsBeforeStartingLocation | NSGradientDrawsAfterEndingLocation]; 325 | [NSGraphicsContext restoreGraphicsState]; 326 | #else 327 | if (!self.color) { 328 | return; 329 | } 330 | [self.color setFill]; 331 | [self.path fill]; 332 | #endif 333 | } 334 | 335 | @end 336 | 337 | @implementation SPSpeedPunk 338 | 339 | @synthesize controller = _editViewController; 340 | 341 | + (void)initialize { 342 | NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults; 343 | CGFloat defaultCurveGain = Interpolate(curveGainMin, curveGainMax, .2); 344 | [defaults registerDefaults:@{ 345 | CurveGainKey: @(defaultCurveGain), 346 | AlphaKey: @0.7 347 | }]; 348 | CurveGain = [defaults floatForKey:CurveGainKey]; 349 | IllustrationPosition = (int)[defaults integerForKey:IllustrationPositionIndexKey]; 350 | Alpha = [defaults floatForKey:AlphaKey]; 351 | } 352 | 353 | - (instancetype)init { 354 | self = [super initWithNibName:@"settingsView" bundle:[NSBundle bundleForClass:[self class]]]; 355 | [self view]; 356 | return self; 357 | } 358 | 359 | - (void)awakeFromNib { 360 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 361 | NSString *versionString = bundle.infoDictionary[@"CFBundleShortVersionString"]; 362 | NSString *string = NSLocalizedStringFromTableInBundle(@"Speed Punk v%@ Settings", nil, bundle, @"Plugin Title"); 363 | string = [NSString stringWithFormat:string, versionString]; 364 | self.titleField.stringValue = string; 365 | 366 | self.gainSlider.minValue = curveGainMin; 367 | self.gainSlider.maxValue = curveGainMax; 368 | 369 | NSUserDefaultsController *defaultsController = NSUserDefaultsController.sharedUserDefaultsController; 370 | [defaultsController addObserver:self forKeyPath:[@"values." stringByAppendingString:IllustrationPositionIndexKey] options:0 context:(__bridge void *)(IllustrationPositionIndexKey)]; 371 | [defaultsController addObserver:self forKeyPath:[@"values." stringByAppendingString:CurveGainKey] options:0 context:(__bridge void *)(CurveGainKey)]; 372 | [defaultsController addObserver:self forKeyPath:[@"values." stringByAppendingString:AlphaKey] options:0 context:(__bridge void *)(AlphaKey)]; 373 | } 374 | 375 | - (NSUInteger)interfaceVersion { 376 | // Distinguishes the API verison the plugin was built for. Return 1. 377 | return 1; 378 | } 379 | 380 | - (NSString *)title { 381 | // This is the name as it appears in the menu in combination with 'Show'. 382 | // E.g. 'return @"Nodes";' will make the menu item read "Show Nodes". 383 | return @"Speed Punk"; 384 | } 385 | 386 | - (NSString *)keyEquivalent { 387 | // The key for the keyboard shortcut. Set modifier keys in modifierMask further below. 388 | // Pretty tricky to find a shortcut that is not taken yet, so be careful. 389 | // If you are not sure, use 'return nil;'. Users can set their own shortcuts in System Prefs. 390 | return @"x"; 391 | } 392 | 393 | - (NSEventModifierFlags)modifierMask { 394 | // Use any combination of these to determine the modifier keys for your default shortcut: 395 | // return NSShiftKeyMask | NSControlKeyMask | NSCommandKeyMask | NSAlternateKeyMask; 396 | // Or: 397 | // return 0; 398 | // ... if you do not want to set a shortcut. 399 | return 0; 400 | } 401 | 402 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 403 | if ((__bridge NSString *)context == IllustrationPositionIndexKey || 404 | (__bridge NSString *)context == CurveGainKey) { 405 | NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults; 406 | CurveGain = [defaults floatForKey:CurveGainKey]; 407 | IllustrationPosition = (int)[defaults integerForKey:IllustrationPositionIndexKey]; 408 | 409 | self.segments = nil; 410 | [self.controller redraw]; 411 | return; 412 | } 413 | if ((__bridge NSString *)context == AlphaKey) { 414 | NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults; 415 | Alpha = [defaults floatForKey:AlphaKey]; 416 | 417 | for (GSPathSegment *segment in self.segments) { 418 | for (SPCurvature *curvatrue in segment.objects) { 419 | #if DRAW_GRADIENTS 420 | curvatrue.gradient = nil; 421 | #else 422 | curvatrue.color = nil; 423 | #endif 424 | } 425 | } 426 | [self.controller redraw]; 427 | return; 428 | } 429 | } 430 | 431 | - (void)addMenuItemsForEvent:(nonnull NSEvent *)theEvent toMenu:(nonnull NSMenu *)theMenu { 432 | NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@"Speed Punk" action:nil keyEquivalent:@""]; 433 | menuItem.view = self.view; 434 | [theMenu addItem:NSMenuItem.separatorItem]; 435 | [theMenu addItem:menuItem]; 436 | [theMenu addItem:NSMenuItem.separatorItem]; 437 | } 438 | 439 | - (NSArray *)_calcCurvaturesCubic:(NSPoint)p1 p2:(NSPoint)p2 p3:(NSPoint)p3 p4:(NSPoint)p4 steps:(int)steps { 440 | 441 | NSMutableArray *curvatureSets = [NSMutableArray new]; 442 | NSPoint a, b, c, d; 443 | calcCubicParameters(p1, p2, p3, p4, &a, &b, &c, &d); 444 | 445 | CGFloat curvature1 = NSNotFound; 446 | CGFloat curvature2 = NSNotFound; 447 | NSPoint q1 = NSZeroPoint; 448 | NSPoint q2 = NSZeroPoint; 449 | for (int idx = 0; idx <= steps; idx++) { 450 | CGFloat t = idx / (CGFloat)steps; 451 | NSPoint r1, r2, r3; 452 | curvature1 = solveCubicBezierCurvature(a, b, c, d, &r1, &r2, &r3, t); 453 | if (curvature2 < NSNotFound) { 454 | SPCurvature *curve = [[SPCurvature alloc] initWithCurvature1:curvature1 r1:r1 r2:r2 q1:q1 q2:q2 curvature2:curvature2]; 455 | curve.speedPunk = self; 456 | [curvatureSets addObject:curve]; 457 | } 458 | q1 = r1; 459 | q2 = r2; 460 | curvature2 = curvature1; 461 | } 462 | return curvatureSets; 463 | } 464 | 465 | - (NSArray *)_calcCurvaturesQuadratic:(NSPoint)p1 p2:(NSPoint)p2 p3:(NSPoint)p3 steps:(int)steps { 466 | 467 | NSMutableArray *curvatureSets = [NSMutableArray new]; 468 | NSPoint a, b, c; 469 | calcQuadraticParameters(p1, p2, p3, &a, &b, &c); 470 | 471 | CGFloat curvature1 = NSNotFound; 472 | CGFloat curvature2 = NSNotFound; 473 | NSPoint q1 = NSZeroPoint; 474 | NSPoint q2 = NSZeroPoint; 475 | for (int idx = 0; idx <= steps; idx++) { 476 | CGFloat t = idx / (CGFloat)steps; 477 | NSPoint r1, r2, r3; 478 | curvature1 = solveQuadraticBezierCurvature(a, b, c, &r1, &r2, &r3, t); 479 | if (curvature2 < NSNotFound) { 480 | SPCurvature *curve = [[SPCurvature alloc] initWithCurvature1:curvature1 r1:r1 r2:r2 q1:q1 q2:q2 curvature2:curvature2]; 481 | curve.speedPunk = self; 482 | [curvatureSets addObject:curve]; 483 | } 484 | q1 = r1; 485 | q2 = r2; 486 | curvature2 = curvature1; 487 | } 488 | return curvatureSets; 489 | } 490 | 491 | - (void)calcCurvatures:(GSPathSegment *)segment steps:(int)steps { 492 | NSArray *curvatureSets; 493 | if( segment.type == CURVE) { 494 | // curvatureSets = self._calcCurvaturesCubic(segment[0], segment[1], segment[2], segment[3], steps) 495 | curvatureSets = [self _calcCurvaturesCubic:segment->elements[0] p2:segment->elements[1] p3:segment->elements[2] p4:segment->elements[3] steps:steps]; 496 | } 497 | else if (segment.type == QCURVE) { 498 | if (segment->count == 3) { 499 | curvatureSets = [self _calcCurvaturesQuadratic:segment->elements[0] p2:segment->elements[1] p3:segment->elements[2] steps:steps]; 500 | } 501 | else { 502 | curvatureSets = [NSMutableArray new]; 503 | NSPoint prevOn = segment->elements[0]; 504 | steps /= segment->count - 2; 505 | steps++; 506 | int idx = 1; 507 | for (; idx < segment->count - 2; idx++) { 508 | NSPoint nextOn = GSScalePoint(GSAddPoints(segment->elements[idx], segment->elements[idx + 1]), 0.5); 509 | NSArray *segmentCurvatureSets = [self _calcCurvaturesQuadratic:prevOn p2:segment->elements[idx] p3:nextOn steps:steps]; 510 | prevOn = nextOn; 511 | [(NSMutableArray *)curvatureSets addObjectsFromArray:segmentCurvatureSets]; 512 | } 513 | NSArray *segmentCurvatureSets = [self _calcCurvaturesQuadratic:prevOn p2:segment->elements[idx] p3:segment->elements[idx + 1] steps:steps]; 514 | [(NSMutableArray *)curvatureSets addObjectsFromArray:segmentCurvatureSets]; 515 | } 516 | } 517 | [segment setObjects:curvatureSets]; 518 | } 519 | 520 | - (void)gatherSegments:(GSLayer *)layer { 521 | 522 | self.unitsperem = layer.font.unitsPerEm; 523 | 524 | NSMutableArray *newSegments = [NSMutableArray new]; 525 | for (GSPath *path in layer.paths) { 526 | for (GSPathSegment *segment in [path segments]) { 527 | if (segment.type == CURVE || segment.type == QCURVE) { 528 | [newSegments addObject:segment]; 529 | } 530 | } 531 | } 532 | self.segments = newSegments; 533 | if (newSegments.count == 0) { 534 | return; 535 | } 536 | int steps = (int)MAX(TOTALSEGMENTS / newSegments.count, MINSEGMENTS - 1); 537 | CGFloat vmin = 1000; 538 | CGFloat vmax = -1000; 539 | for (GSPathSegment *segment in newSegments) { 540 | [self calcCurvatures:segment steps:steps]; 541 | for (SPCurvature *curvature in segment.objects) { 542 | CGFloat value = [curvature Value]; 543 | vmin = MIN(vmin, value); 544 | vmax = MAX(vmax, value); 545 | } 546 | } 547 | 548 | for (GSPathSegment *segment in newSegments) { 549 | [self calcCurvatures:segment steps:steps]; 550 | for (SPCurvature *curvature in segment.objects) { 551 | curvature.vmin = vmin; 552 | curvature.vmax = vmax; 553 | } 554 | } 555 | } 556 | 557 | - (void)updatePunk:(GSLayer *)layer { 558 | if (layer != _lastLayer) { 559 | _segments = nil; 560 | } 561 | if (_lastUpdate < layer.lastUpdate) { 562 | _segments = nil; 563 | } 564 | if (!_segments) { 565 | [self gatherSegments:layer]; 566 | _lastUpdate = layer.lastUpdate; 567 | _lastLayer = layer; 568 | } 569 | } 570 | 571 | - (BOOL)conditionsAreMetForDrawing { 572 | /* 573 | Don't activate if text or pan (hand) tool are active. 574 | */ 575 | NSWindowController *currentController = self.controller.view.window.windowController; 576 | if (!currentController) { 577 | return NO; 578 | } 579 | id tool = [currentController toolDrawDelegate]; 580 | BOOL textToolIsActive = [tool isKindOfClass:NSClassFromString(@"GlyphsToolText")]; 581 | BOOL handToolIsActive = [tool isKindOfClass:NSClassFromString(@"GlyphsToolHand")]; 582 | if (!textToolIsActive && !handToolIsActive) { 583 | return YES; 584 | } 585 | return NO; 586 | } 587 | 588 | - (void)drawBackgroundForLayer:(GSLayer*)layer options:(NSDictionary *)options { 589 | // Whatever you draw here will be displayed BEHIND the paths. 590 | if (!self.conditionsAreMetForDrawing) { 591 | return; 592 | } 593 | [self updatePunk:layer]; 594 | for (GSPathSegment *segment in self.segments) { 595 | for (SPCurvature *curvature in segment.objects) { 596 | [curvature draw]; 597 | } 598 | } 599 | } 600 | 601 | - (IBAction)visitWebsite:(id)sender { 602 | [NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:@"https://github.com/yanone/speedpunk"]]; 603 | }; 604 | 605 | - (IBAction)visitTwitter:(id)sender { 606 | [NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:@"https://twitter.com/yanone"]]; 607 | }; 608 | 609 | @end 610 | -------------------------------------------------------------------------------- /SpeedPunk_py.glyphsReporter/Contents/Resources/speedpunk/speedpunklib.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from __future__ import division, print_function, unicode_literals 3 | 4 | ########################################################################################## 5 | # 6 | # Speed Punk 7 | # Visualisation tool of outline curvature for font editors. 8 | # 9 | # Distributed under Apache 2.0 license 10 | # 11 | ########################################################################################## 12 | 13 | import math, time, traceback 14 | 15 | from AppKit import NSImage, NSColor, NSBezierPath, NSPoint, NSGradient, NSMakeRect 16 | 17 | 18 | 19 | ########################################################################################## 20 | ########################################################################################## 21 | 22 | def InterpolateHexColorList(colors, p): 23 | """ 24 | Interpolate between list of hex RRGGBB values at float position p (0-1) 25 | Returns float list (R, G, B) 26 | """ 27 | 28 | # Safety first 29 | if p < 0: p = 0 30 | if p > 1: p = 1 31 | 32 | if p == 0: 33 | return colors[0] 34 | elif p == 1: 35 | return colors[-1] 36 | else: 37 | for i in range(len(colors)): 38 | 39 | before = (float(i) / (len(colors) - 1)) 40 | after = (float(i + 1) / (len(colors) - 1)) 41 | 42 | if before < p < after: 43 | v = (p - before) / (after - before) 44 | 45 | # print("interpolate between", before, after, p, v) 46 | 47 | R = Interpolate(colors[i][0], colors[i + 1][0], v) 48 | G = Interpolate(colors[i][1], colors[i + 1][1], v) 49 | B = Interpolate(colors[i][2], colors[i + 1][2], v) 50 | return (R, G, B) 51 | elif p == before: 52 | return colors[i] 53 | elif p == after: 54 | return colors[i + 1] 55 | 56 | def Interpolate(a, b, p, limit = False): 57 | """ 58 | Interpolate between values a and b at float position p (0-1) 59 | Limit: No extrapolation 60 | """ 61 | i = a + (b - a) * p 62 | if limit and i < a: 63 | return a 64 | elif limit and i > b: 65 | return b 66 | else: 67 | return i 68 | 69 | def Execute(command): 70 | """ 71 | Execute system command, return output. 72 | """ 73 | 74 | import sys, os, platform 75 | 76 | if sys.version.startswith("2.3") or platform.system() == "Windows": 77 | p = os.popen(command, "r") 78 | response = p.read() 79 | p.close() 80 | return response 81 | else: 82 | import subprocess 83 | 84 | process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True, close_fds=True) 85 | os.waitpid(process.pid, 0) 86 | response = process.stdout.read().strip() 87 | process.stdout.close() 88 | return response 89 | 90 | def Stamina(): 91 | """ 92 | Calculate system power as integer using by multiplying number of active CPUs with clock speed. 93 | """ 94 | return int(Execute('sysctl hw.activecpu').split(' ')[-1]) * int(Execute('sysctl hw.cpufrequency').split(' ')[-1]) 95 | 96 | def Environment(): 97 | """ 98 | Return the environment, from which this script is being called. 99 | Currently supported: FontLab, GlyphsApp, NodeBox, Python 100 | """ 101 | 102 | environment = 'Python' 103 | 104 | try: 105 | import FL 106 | environment = 'FontLab' 107 | except: pass 108 | 109 | try: 110 | import GlyphsApp 111 | environment = 'GlyphsApp' 112 | except: pass 113 | 114 | try: 115 | import mojo 116 | environment = 'RoboFont' 117 | except: pass 118 | 119 | try: 120 | import nodebox 121 | environment = 'NodeBox' 122 | except: pass 123 | 124 | return environment 125 | 126 | 127 | def solveCubicBezier(p1, p2, p3, p4): 128 | """ 129 | Solve cubic Bezier equation and 1st and 2nd derivative. 130 | """ 131 | a = NSPoint() 132 | a.x = -p1.x + 3.0 * p2.x - 3.0 * p3.x + p4.x 133 | a.y = -p1.y + 3.0 * p2.y - 3.0 * p3.y + p4.y 134 | b = NSPoint() 135 | b.x = 3.0 * p1.x - 6.0 * p2.x + 3.0 * p3.x 136 | b.y = 3.0 * p1.y - 6.0 * p2.y + 3.0 * p3.y 137 | c = NSPoint() 138 | c.x = -3.0 * p1.x + 3.0 * p2.x 139 | c.y = -3.0 * p1.y + 3.0 * p2.y 140 | d = p1 141 | return a, b, c, d 142 | 143 | def solveCubicBezierCurvature(a, b, c, d, t): 144 | """ 145 | Calc curvature using cubic Bezier equation and 1st and 2nd derivative. 146 | Returns position of on-curve point p1234, and vector of 1st and 2nd derivative. 147 | """ 148 | r = NSPoint() 149 | t3 = t ** 3 150 | t2 = t ** 2 151 | r.x = a.x * t3 + b.x * t2 + c.x * t + d.x 152 | r.y = a.y * t3 + b.y * t2 + c.y * t + d.y 153 | 154 | r1 = NSPoint() 155 | r1.x = 3 * a.x * t2 + 2 * b.x * t + c.x 156 | r1.y = 3 * a.y * t2 + 2 * b.y * t + c.y 157 | 158 | r2 = NSPoint() 159 | r2.x = 6 * a.x * t + 2 * b.x 160 | r2.y = 6 * a.y * t + 2 * b.y 161 | 162 | return (r, r1, r2, (r1.x * r2.y - r1.y * r2.x) / (r1.x ** 2 + r1.y ** 2) ** 1.5) 163 | 164 | 165 | ########################################################################################## 166 | ########################################################################################## 167 | 168 | 169 | environment = Environment() 170 | # colors = { 171 | # 'cubic': ('8b939c', 'f29400', 'e3004f'), 172 | # 'quadratic': ('8b939c', 'f29400', '006f9b') 173 | # } 174 | 175 | colors = { 176 | 'cubic': ( 177 | (0x8b / 255.0, 0x93 / 255.0, 0x9c / 255.0), 178 | (0xf2 / 255.0, 0x94 / 255.0, 0x00 / 255.0), 179 | (0xe3 / 255.0, 0x00 / 255.0, 0x4f / 255.0) 180 | ), 181 | 'quadratic': ( 182 | (0x8b / 255.0, 0x93 / 255.0, 0x9c / 255.0), 183 | (0xf2 / 255.0, 0x94 / 255.0, 0x00 / 255.0), 184 | (0x00 / 255.0, 0x6f / 255.0, 0x9b / 255.0) 185 | ) 186 | } 187 | 188 | c = colors['cubic'] 189 | cs = (NSColor.colorWithCalibratedRed_green_blue_alpha_(c[0][0], c[0][1], c[0][2], 0.7), NSColor.colorWithCalibratedRed_green_blue_alpha_(c[1][0], c[1][1], c[1][2], 0.7), NSColor.colorWithCalibratedRed_green_blue_alpha_(c[2][0], c[2][1], c[2][2], 0.7)) 190 | cubicGradient = NSGradient.alloc().initWithColors_(cs) 191 | 192 | c = colors['quadratic'] 193 | cs = (NSColor.colorWithCalibratedRed_green_blue_alpha_(c[0][0], c[0][1], c[0][2], 0.7), NSColor.colorWithCalibratedRed_green_blue_alpha_(c[1][0], c[1][1], c[1][2], 0.7), NSColor.colorWithCalibratedRed_green_blue_alpha_(c[2][0], c[2][1], c[2][2], 0.7)) 194 | quadraticGradient = NSGradient.alloc().initWithColors_(cs) 195 | 196 | gradients = { 197 | 'cubic': cubicGradient, 198 | 'quadratic' : quadraticGradient 199 | } 200 | 201 | curveGain = (.1, 3) 202 | drawfactor = .01 203 | 204 | outsideOfGlyph = 0 # index of selected radio button 205 | outsideOfCurve = 1 206 | 207 | try: 208 | TOTALSEGMENTS = min(int(Stamina() * .00000008), 1000) 209 | except: 210 | TOTALSEGMENTS = 400 211 | MINSEGMENTS = 5 212 | VERSION = '1.2' 213 | 214 | if environment == 'RoboFont': 215 | from lib.tools.bezierTools import curveConverter 216 | 217 | elif environment == 'GlyphsApp': 218 | import GlyphsApp 219 | from GlyphsApp import Glyphs, Message, CURVE 220 | 221 | 222 | defaultsPrefix = "de.yanone.speedPunk." 223 | defaultPreferences = { 224 | # defaultsPrefix+"illustrationPositionIndex":1, 225 | defaultsPrefix+"curveGain":Interpolate(curveGain[0], curveGain[1], .2), 226 | defaultsPrefix+"fader":1.0, 227 | defaultsPrefix+"useFader":False 228 | } 229 | 230 | class SpeedPunkLib(object): 231 | def __init__(self): 232 | 233 | self.tool = None 234 | self.curvesegments = [] 235 | self.values = [] 236 | self.vmin = None 237 | self.vmax = None 238 | self.histogram = {} 239 | self.glyphchanged = False 240 | self.numberofcurvesegments = 0 241 | self.glyphstring = None 242 | self.unitsperem = 1000 243 | self.curves = 'cubic' 244 | 245 | # Preferences 246 | self.preferenceKeys = ('illustrationPositionIndex', 'curveGain', 'useFader', 'fader') 247 | Glyphs.registerDefaults(defaultPreferences) 248 | justInstalled = Glyphs.defaults[defaultsPrefix+'illustrationPositionIndex'] is None 249 | if justInstalled: 250 | Glyphs.defaults[defaultsPrefix+'illustrationPositionIndex'] = 1 251 | self.loadPreferences() 252 | 253 | ''' 254 | # UI 255 | 256 | self.prefwindow = SpeedPunkPrefWindow(self) 257 | self.drawGradientImage() 258 | ''' 259 | 260 | ## Welcome 261 | if justInstalled and environment == 'GlyphsApp' and False: # remove ‘and False’ if you want to reactivate the dialog 262 | Message( 263 | message = Glyphs.localize({ 264 | 'en': 'Thank you for choosing Speed Punk. You’ll find me in the View menu under ‘Show Speed Punk’ or with the keyboard shortcut Cmd+Shift+X. The plug-in settings have moved into the context menu (right click).\n\nEnjoy and make sure to follow @yanone on Twitter.', 265 | 'de': 'Danke zur Wahl von Speed Punk. Du findest mich im Ansicht-Menü unter ‘Speed Punk anzeigen’ oder mit dem Tastenkürzel Cmd+Shift+X. Die Plug-in-Einstellungen sind ins Kontextmenü (Rechtsklick) gewandert.\n\nViel Spaß und wir sehen uns bei @yanone auf Twitter.', 266 | 'fr': 'Merci d’avoir choisi Speed Punk. Retrouvez-le dans le menu Affichage sous ‘Afficher Speed Punk’ ou avec le raccourci Cmd+Shift+X. Les préférences se trouvent dans le menu contextuel (clic-droit).\n\nProfitez-en et suivez-moi sur Twitter: @yanone.', 267 | 'es': '¡Gracias por instalar Speed Punk! Lo encontrarás en el menú «Vista > Mostrar Speed Punk» o con el atajo de teclado Cmd+Shift+X. Botón derecho para ver las preferencias. ¡Disfrútalo! Puedes seguirme en Twitter: @yanone.', 268 | 'pt': 'Obrigado por instalar o Speed Punk! Você o encontrará no menu «Visualizar > Exibir Speed Punk» ou com o atalho de teclado Cmd+Shift+X. Clique com o botão direito do mouse para ver as preferências. Aproveite! Você pode me seguir no Twitter: @yanone.', 269 | 'ja': 'Speed Punk を使っていただき有難うございます。Speed Punkは表示メニューバーの「Speed Punk を表示」または Cmd+Shift+X ショートカットで使えます。プラグイン設定は右クリックのコンテクストメニューにあります。\n\nお楽しみください。Twitter の @yanone もよろしくお願いします。', 270 | 'ko': '“Speed Punk”를 사용해주셔서 감사합니다. 상단메뉴의 ’보기 > 보기 Speed Punk’ 클릭 또는 단축키 Cmd + Shift + X로 실행할 수 있습니다. 플러그인 설정은 마우스 오른쪽 > 컨텍스트 메뉴에 있습니다.\n\n트위터에서 @yanone 를 팔로우 해주시기 바랍니다.', 271 | }), 272 | title = Glyphs.localize({ 273 | 'en': 'Welcome to Speed Punk %s' % VERSION, 274 | 'de': 'Willkommen zu Speed Punk %s' % VERSION, 275 | 'fr': 'Bienvenu·e·s chez Speed Punk %s' % VERSION, 276 | 'es': 'Bienvenido a Speed Punk %s' % VERSION, 277 | 'pt': 'Bem-vindo ao Speed Punk %s' % VERSION, 278 | 'ja': 'Speed Punk %s へようこそ' % VERSION, 279 | 'ko': '“Speed Punk %s”를 사용해주셔서 감사합니다.' % VERSION, 280 | }), 281 | ) 282 | 283 | return 284 | 285 | def setPreference(self, key, value): 286 | Glyphs.defaults[defaultsPrefix + key] = value 287 | 288 | def loadPreferences(self): 289 | for key in self.preferenceKeys: 290 | value = Glyphs.defaults[defaultsPrefix + key] 291 | setattr(self, key, value) 292 | 293 | def Open(self): 294 | self.prefwindow.w.show() 295 | self.RefreshView() 296 | 297 | def Close(self): 298 | self.tool.Close() 299 | self.prefwindow.w.hide() 300 | 301 | def RefreshView(self): 302 | if environment == 'GlyphsApp': 303 | GlyphsApp.Glyphs.redraw() 304 | elif environment == 'RoboFont': 305 | self.tool.refreshView() 306 | 307 | def gatherSegments(self, g): 308 | changed = False 309 | oldSegments = self.curvesegments 310 | 311 | # Compile new curve segments list 312 | newSegmentPositions = [] 313 | newCurvesType = self.curves 314 | 315 | # Glyphs 316 | if environment == 'GlyphsApp': 317 | for p in g.paths: 318 | idx = 0 319 | for n in p.nodes: 320 | if n.type == CURVE: 321 | p1 = p.nodes[idx - 3].position 322 | p2 = p.nodes[idx - 2].position 323 | p3 = p.nodes[idx - 1].position 324 | p4 = n.position 325 | newSegmentPositions.append((p1, p2, p3, p4)) 326 | idx += 1 327 | # RoboFont 328 | elif environment == 'RoboFont': 329 | for c in g: 330 | previouspoint = previouspoint = c[-1].points[-1] 331 | for s in c: 332 | if s.type == 'curve': 333 | newCurvesType = 'cubic' 334 | p1 = Point(previouspoint.x, previouspoint.y) 335 | p2 = Point(s.points[0].x, s.points[0].y) 336 | p3 = Point(s.points[1].x, s.points[1].y) 337 | p4 = Point(s.points[2].x, s.points[2].y) 338 | newSegmentPositions.append((p1, p2, p3, p4)) 339 | elif s.type == 'qcurve': 340 | newCurvesType = 'quadratic' 341 | p1 = Point(previouspoint.x, previouspoint.y) 342 | p2 = Point(s.points[0].x, s.points[0].y) 343 | p3 = Point(s.points[1].x, s.points[1].y) 344 | p4 = Point(s.points[2].x, s.points[2].y) 345 | 346 | (h1x, h1y), (h2x, h2y), (x2, y2) = curveConverter.convertSegment((p1.x, p1.y), ((p2.x, p2.y), (p3.x, p3.y), (p4.x, p4.y)), "curve") 347 | p2 = Point(h1x, h1y) 348 | p3 = Point(h2x, h2y) 349 | p4 = Point(x2, y2) 350 | 351 | newSegmentPositions.append((p1, p2, p3, p4)) 352 | 353 | previouspoint = s.points[-1] 354 | 355 | # Curve type has changed 356 | if newCurvesType != self.curves: 357 | self.curves = newCurvesType 358 | self.drawGradientImage() 359 | 360 | # Compare curvesegments (p1, p2, p3, p4) to list of segments objects. 361 | if len(newSegmentPositions) != len(oldSegments): 362 | oldSegments = [] 363 | changed = True 364 | for curvesegment in newSegmentPositions: 365 | p1, p2, p3, p4 = curvesegment 366 | oldSegments.append(Segment(self, p1, p2, p3, p4)) 367 | 368 | else: 369 | # Compare stored segments with new coordinates, recalc if necessary 370 | for i, curvesegment in enumerate(newSegmentPositions): 371 | p1, p2, p3, p4 = curvesegment 372 | if (p1, p2, p3, p4) != (oldSegments[i].p1, oldSegments[i].p2, oldSegments[i].p3, oldSegments[i].p4): 373 | oldSegments[i] = Segment(self, p1, p2, p3, p4) 374 | changed = True 375 | 376 | self.curvesegments = oldSegments 377 | self.glyphchanged = changed 378 | 379 | def calcNumberofcurvesegments(self, g): 380 | numberofcurvesegments = 0 381 | if environment == 'GlyphsApp': 382 | for p in g.paths: 383 | for n in p.nodes: 384 | if n.type == CURVE: 385 | numberofcurvesegments += 1 386 | elif environment == 'RoboFont': 387 | for c in g: 388 | for s in c: 389 | if 'curve' in s.type: 390 | numberofcurvesegments += 1 391 | return numberofcurvesegments 392 | 393 | def UpdateGlyph(self, g, glyphstring = None): 394 | 395 | # Units per em 396 | if environment == 'GlyphsApp': 397 | self.unitsperem = g.parent.parent.upm 398 | elif environment == 'RoboFont': 399 | self.unitsperem = g.getParent().info.unitsPerEm 400 | 401 | # Compare string to see if glyph changed 402 | if (glyphstring and glyphstring != self.glyphstring) or not glyphstring: 403 | if glyphstring: 404 | self.glyphstring = glyphstring 405 | 406 | # Number of curve segments, quick gathering 407 | self.numberofcurvesegments = self.calcNumberofcurvesegments(g) 408 | # Assign new segments 409 | self.gatherSegments(g) 410 | # Things have actually changed 411 | if self.glyphchanged: 412 | self.values = [] 413 | 414 | for segment in self.curvesegments: 415 | self.values.extend(segment.Values()) 416 | 417 | # Glyph has outlines 418 | if self.values: 419 | self.vmin = min(self.values) 420 | self.vmax = max(self.values) 421 | # Draw 422 | # context = NSGraphicsContext.currentContext() 423 | # context.setCompositingOperation_(12) 424 | # context.setShouldAntialias_(False) 425 | 426 | if self.useFader: 427 | self.buildHistogram(self.tool.histWidth) 428 | #self.drawHistogramImage() 429 | 430 | for segment in self.curvesegments: 431 | segment.DrawSegment() 432 | 433 | # Reset 434 | self.glyphchanged = False 435 | 436 | def iterateSegments(self): 437 | for segment in self.curvesegments: 438 | segment.DrawSegment() 439 | 440 | def drawGradientImage(self): 441 | frame = self.prefwindow.w.gradientImage.getNSImageView().frame() 442 | width = int(frame.size[0]) 443 | height = int(frame.size[1]) 444 | image = NSImage.alloc().initWithSize_((width, height)) 445 | image.lockFocus() 446 | 447 | self.drawGradient(0, 0, width, height) 448 | 449 | image.unlockFocus() 450 | self.prefwindow.w.gradientImage.setImage(imageObject=image) 451 | 452 | def drawGradient(self, originX, originY, width, height): 453 | gradient = gradients[self.curves] 454 | gradient.drawInRect_angle_(NSMakeRect(originX, originY, width, height), 0) 455 | 456 | def buildHistogram(self, width): 457 | self.histogram = {} 458 | self.maxhistogram = 0 459 | for v in self.values: 460 | key = int(Interpolate(1, width, (v - self.vmin) / (self.vmax - self.vmin))) - 1 461 | if key not in self.histogram: 462 | self.histogram[key] = 0 463 | self.histogram[key] += 1 464 | if self.histogram[key] > self.maxhistogram: 465 | self.maxhistogram = self.histogram[key] 466 | 467 | def drawHistogramImage(self): 468 | width = int(self.tool.histWidth) 469 | height = int(self.tool.histHeight) 470 | 471 | image = NSImage.alloc().initWithSize_((width, height)) 472 | image.lockFocus() 473 | image.setBackgroundColor_(NSColor.clearColor()) 474 | self.drawHistogram(0, 0, width, height) 475 | image.unlockFocus() 476 | self.prefwindow.w.histogramImage.setImage(imageObject=image) 477 | 478 | def drawHistogram(self, originX, originY, width, height): 479 | NSColor.colorWithWhite_alpha_(0, .5).set() 480 | path = NSBezierPath.bezierPath() 481 | path.moveToPoint_((originX, originY - 2)) 482 | prevY = 0 483 | for x in range(width): 484 | if x in self.histogram: 485 | y = (self.histogram[x] / float(self.maxhistogram)) * height 486 | path.lineToPoint_((x + .5 + originX, y + originY)) 487 | else: 488 | path.lineToPoint_((x + .5 + originX, originY - 2)) 489 | path.lineToPoint_((originX + width, originY - 2)) 490 | path.closePath() 491 | path.fill() 492 | 493 | class Curvature: 494 | def __init__(self, segment, set1, set2): 495 | self.segment = segment 496 | self.set1 = set1 497 | self.set2 = set2 498 | self.curveGain = None 499 | self.illustrationPosition = None 500 | self.fader = None 501 | self.useFader = None 502 | self.color = None 503 | 504 | def DrawCurvature(self): 505 | 506 | # Color 507 | if not self._DrawCurvatureColor(): 508 | return # can happen with straight segments 509 | self._DrawCurvatureIllustration() 510 | self._DrawCurvaturePaths() 511 | 512 | def _DrawCurvatureColor(self): 513 | speedpunklib = self.segment.speedpunklib 514 | prefFader = speedpunklib.fader 515 | prefUseFader = speedpunklib.useFader 516 | if speedpunklib.glyphchanged or self.fader != prefFader or self.useFader != prefUseFader: 517 | #print("__color") 518 | self.fader = prefFader 519 | self.useFader = prefUseFader 520 | 521 | # Color 522 | deltaV = speedpunklib.vmax - speedpunklib.vmin 523 | 524 | if abs(deltaV) < 0.0000001: 525 | return False 526 | p = (self.Value() - speedpunklib.vmin) / deltaV 527 | R, G, B = InterpolateHexColorList(colors[speedpunklib.curves], p) 528 | 529 | # Fader 530 | faderMin = .2 531 | faderMax = .7 532 | if prefUseFader: 533 | # Alpha 534 | fader = prefFader 535 | histerese = .2 536 | 537 | if p > fader: 538 | d = p - fader 539 | if d > histerese: 540 | v = 0.0 541 | else: 542 | v = 1.0 - d / histerese 543 | else: 544 | v = 1.0 545 | 546 | A = Interpolate(faderMin, faderMax, v) 547 | else: 548 | A = faderMax 549 | 550 | self.color = NSColor.colorWithCalibratedRed_green_blue_alpha_(R, G, B, A) 551 | return True 552 | 553 | def _DrawCurvatureIllustration(self): 554 | # Recalc illustration 555 | speedpunklib = self.segment.speedpunklib 556 | prefIllustrationPositionIndex = int(speedpunklib.illustrationPositionIndex) 557 | prefCurveGain = speedpunklib.curveGain 558 | 559 | if speedpunklib.glyphchanged or self.curveGain != prefCurveGain or self.illustrationPosition != prefIllustrationPositionIndex: 560 | #print("__illustration") 561 | self.curveGain = prefCurveGain 562 | self.illustrationPosition = prefIllustrationPositionIndex 563 | 564 | factor = drawfactor * self.curveGain * speedpunklib.unitsperem ** 2 565 | k1 = self.set1[3] * factor 566 | k2 = self.set2[3] * factor 567 | 568 | if self.illustrationPosition == outsideOfGlyph: 569 | k1 = abs(k1) 570 | k2 = abs(k2) 571 | 572 | # TrueType 573 | if speedpunklib.curves == 'quadratic': 574 | k1 *= -1 575 | k2 *= -1 576 | 577 | # Define points 578 | S10 = self.set1[0] 579 | S11 = self.set1[1] 580 | S20 = self.set2[0] 581 | S21 = self.set2[1] 582 | oncurve1 = S10 583 | oncurve2 = S20 584 | S21abs = math.sqrt(S21.x ** 2 + S21.y ** 2) 585 | S11abs = math.sqrt(S11.x ** 2 + S11.y ** 2) 586 | outerspace2 = (S20.x + (S21.y / S21abs * k2), S20.y - (S21.x / S21abs * k2)) 587 | outerspace1 = (S10.x + (S11.y / S11abs * k1), S10.y - (S11.x / S11abs * k1)) 588 | 589 | self.path = NSBezierPath.bezierPath() 590 | # OnCurve 591 | self.path.moveToPoint_(oncurve1) 592 | self.path.lineToPoint_(oncurve2) 593 | # Outer points 594 | self.path.lineToPoint_(outerspace2) 595 | self.path.lineToPoint_(outerspace1) 596 | self.path.closePath() 597 | 598 | def _DrawCurvaturePaths(self): 599 | if self.color is None: 600 | return 601 | self.color.set() 602 | 603 | self.path.fill() 604 | 605 | def Value(self): 606 | return (abs(self.set1[3] * drawfactor) + abs(self.set2[3] * drawfactor)) / 2.0 607 | 608 | class Segment: 609 | def __init__(self, speedpunklib, p1, p2, p3, p4): 610 | 611 | self.speedpunklib = speedpunklib 612 | 613 | self.p1 = p1 614 | self.p2 = p2 615 | self.p3 = p3 616 | self.p4 = p4 617 | 618 | self.highestvalue = None 619 | self.lowestvalue = None 620 | 621 | ### Calc 622 | steps = int(max(TOTALSEGMENTS / speedpunklib.numberofcurvesegments, MINSEGMENTS - 1)) 623 | 624 | curvatureSets = [] 625 | a, b, c, d = solveCubicBezier(p1, p2, p3, p4) 626 | set2 = None 627 | for i in range(steps + 1): 628 | t = i / float(steps) 629 | try: 630 | set1 = solveCubicBezierCurvature(a, b, c, d, t) 631 | if set2 is not None: 632 | curvatureSets.append(Curvature(self, set1, set2)) 633 | set2 = set1 634 | except: 635 | pass 636 | 637 | self.curvatureSets = curvatureSets 638 | 639 | def DrawSegment(self): 640 | for set in self.curvatureSets: 641 | set.DrawCurvature() 642 | 643 | def Values(self): 644 | values = [] 645 | for set in self.curvatureSets: 646 | values.append(set.Value()) 647 | return values 648 | -------------------------------------------------------------------------------- /SpeedPunk.roboFontExt/lib/deYanoneRoboFontSpeedpunk/speedpunklib.py: -------------------------------------------------------------------------------- 1 | ########################################################################################## 2 | # 3 | # Speed Punk 4 | # Visualisation tool of outline curvature for font editors. 5 | # 6 | # Distributed under Apache 2.0 license 7 | # 8 | ########################################################################################## 9 | 10 | import time, os, math, sys, plistlib, traceback 11 | 12 | import vanilla 13 | from AppKit import NSBezierPath, NSColor, NSBundle, NSUserDefaults, NSImage, NSLog 14 | 15 | 16 | ########################################################################################## 17 | 18 | 19 | def Environment(): 20 | """\ 21 | Return the environment, from which this script is being called. 22 | Currently supported: FontLab, GlyphsApp, NodeBox, Python 23 | """ 24 | 25 | environment = 'Python' 26 | 27 | try: 28 | import FL 29 | environment = 'FontLab' 30 | except: pass 31 | 32 | try: 33 | from AppKit import NSBundle 34 | MainBundle = NSBundle.mainBundle() 35 | if 'Glyphs' in MainBundle.bundlePath(): 36 | environment = 'GlyphsApp' 37 | except: pass 38 | 39 | try: 40 | import mojo 41 | environment = 'RoboFont' 42 | except: pass 43 | 44 | try: 45 | import nodebox 46 | environment = 'NodeBox' 47 | except: pass 48 | 49 | return environment 50 | 51 | def Stamina(): 52 | """\ 53 | Calculate system power as integer using by mulitplying number of active CPUs with clock speed. 54 | """ 55 | from ynlib.system import Execute 56 | return int(Execute('sysctl hw.activecpu').split(' ')[-1]) * int(Execute('sysctl hw.cpufrequency').split(' ')[-1]) 57 | 58 | def Interpolate(a, b, p): 59 | """\ 60 | Interpolate between values a and b at float position p (0-1) 61 | """ 62 | return a + (b - a) * p 63 | 64 | 65 | def InterpolateHexColorList(colors, p): 66 | """\ 67 | Interpolate between list of hex RRGGBB values at float position p (0-1) 68 | Returns float list (R, G, B) 69 | """ 70 | 71 | #from ynlib.maths import Interpolate 72 | 73 | # Safety first 74 | if p < 0: p = 0 75 | if p > 1: p = 1 76 | 77 | if p == 0: 78 | return (int(colors[0][0:2], 16) / 255.0, int(colors[0][2:4], 16) / 255.0, int(colors[0][4:6], 16) / 255.0) 79 | elif p == 1: 80 | return (int(colors[-1][0:2], 16) / 255.0, int(colors[-1][2:4], 16) / 255.0, int(colors[-1][4:6], 16) / 255.0) 81 | else: 82 | for i in range(len(colors)): 83 | 84 | before = (float(i) / (len(colors) - 1)) 85 | after = (float(i + 1) / (len(colors) - 1)) 86 | 87 | if before < p < after: 88 | v = (p - before) / (after - before) 89 | 90 | # print "interpolate between", before, after, p, v 91 | 92 | R = Interpolate(int(colors[i][0:2], 16) / 255.0, int(colors[i + 1][0:2], 16) / 255.0, v) 93 | G = Interpolate(int(colors[i][2:4], 16) / 255.0, int(colors[i + 1][2:4], 16) / 255.0, v) 94 | B = Interpolate(int(colors[i][4:6], 16) / 255.0, int(colors[i + 1][4:6], 16) / 255.0, v) 95 | return (R, G, B) 96 | elif p == before: 97 | return (int(colors[i][0:2], 16) / 255.0, int(colors[i][2:4], 16) / 255.0, int(colors[i][4:6], 16) / 255.0) 98 | elif p == after: 99 | return (int(colors[i + 1][0:2], 16) / 255.0, int(colors[i + 1][2:4], 16) / 255.0, int(colors[i + 1][4:6], 16) / 255.0) 100 | 101 | 102 | class Point: 103 | def __init__(self, x, y): 104 | self.x = x 105 | self.y = y 106 | 107 | def __add__(self, other): 108 | if isinstance(other, int) or isinstance(other, float): 109 | other = Point(other, other) 110 | return Point(self.x + other.x, self.y + other.y) 111 | 112 | __radd__ = __add__ 113 | 114 | def __sub__(self, other): 115 | if isinstance(other, int) or isinstance(other, float): 116 | other = Point(other, other) 117 | return Point(self.x - other.x, self.y - other.y) 118 | 119 | def __rsub__(self, other): 120 | if isinstance(other, int) or isinstance(other, float): 121 | other = Point(other, other) 122 | return Point(other.x - self.x, other.y - self.y) 123 | 124 | def __mul__(self, other): 125 | if isinstance(other, int) or isinstance(other, float): 126 | other = Point(other, other) 127 | return Point(self.x * other.x, self.y * other.y) 128 | 129 | __rmul__ = __mul__ 130 | 131 | def __div__(self, other): 132 | if isinstance(other, int) or isinstance(other, float): 133 | other = Point(other, other) 134 | return Point(self.x / other.x, self.y / other.y) 135 | 136 | def __rdiv__(self, other): 137 | if isinstance(other, int) or isinstance(other, float): 138 | other = Point(other, other) 139 | return Point(other.x / self.x, other.y / self.y) 140 | 141 | def __abs__(self): 142 | return math.sqrt(self.x**2 + self.y**2) 143 | 144 | 145 | def __neg__(self): 146 | return Point(-self.x, -self.y) 147 | 148 | # def __cmp__(self, other): 149 | # c = hash(other) - hash(self) 150 | # if not isinstance(c, int): 151 | # c = int(-1) 152 | # return c 153 | 154 | def __eq__(self, other): 155 | return (self.x, self.y) == (other.x, other.y) 156 | 157 | def __ne__(self, other): 158 | return (self.x, self.y) != (other.x, other.y) 159 | 160 | def __hash__(self): 161 | return hash((self.x, self.y)) 162 | 163 | def __repr__(self): 164 | return '' % (self.x, self.y) 165 | 166 | 167 | def solveCubicBezier(p1, p2, p3, p4, t): 168 | """\ 169 | Solve cubic Bezier equation and 1st and 2nd derivative. 170 | Returns position of on-curve point p1234, and vector of 1st and 2nd derivative. 171 | """ 172 | a = -p1 + 3.0 * p2 - 3.0 * p3 + p4 173 | b = 3.0 * p1 - 6.0 * p2 + 3.0 * p3 174 | c = -3.0 * p1 + 3.0 * p2 175 | d = p1 176 | 177 | r = a*t**3 + b*t**2 + c*t + d 178 | r1 = 3*a*t**2 + 2*b*t + c 179 | r2 = 6*a*t + 2*b 180 | 181 | return r, r1, r2 182 | 183 | def solveCubicBezierCurvature(r, r1, r2): 184 | """\ 185 | Calc curvature using cubic Bezier equation and 1st and 2nd derivative. 186 | """ 187 | return (r1.x * r2.y - r1.y * r2.x) / (r1.x**2 + r1.y**2)**1.5 188 | 189 | 190 | def ListPairs(list, num_pairs): 191 | """\ 192 | Return 'num_pairs' amount of elements of list stacked together as lists. 193 | Example: 194 | list = ['a', 'b', 'c', 'd', 'e'] 195 | for one, two, three in ListPairs(list, 3): 196 | print one, two, three 197 | a b c 198 | b c d 199 | c d e 200 | """ 201 | returnlist = [] 202 | 203 | for i in range(len(list) - num_pairs + 1): 204 | 205 | singlereturnlist = [] 206 | for j in range(num_pairs): 207 | singlereturnlist.append(list[i + j]) 208 | 209 | returnlist.extend([singlereturnlist]) 210 | 211 | return returnlist 212 | 213 | 214 | 215 | ########################################################################################## 216 | 217 | 218 | 219 | environment = Environment() 220 | colors = { 221 | 'cubic': ('8b939c', 'f29400', 'e3004f'), 222 | 'quadratic': ('8b939c', 'f29400', '006f9b') 223 | } 224 | curveGain = (.1, 3) 225 | drawfactor = .01 226 | try: 227 | TOTALSEGMENTS = min(int(Stamina() * .00000008), 1000) 228 | except: 229 | TOTALSEGMENTS = 400 230 | MINSEGMENTS = 5 231 | 232 | if sys.version_info.major < 3: 233 | plist = plistlib.readPlist(os.path.join(os.path.dirname(__file__), '..', '..', 'info.plist')) 234 | else: 235 | with open(os.path.join(os.path.dirname(__file__), '..', '..', 'info.plist'), 'rb') as pl_file: 236 | plist = plistlib.load(pl_file) 237 | VERSION = plist['version'] 238 | 239 | if environment == 'RoboFont': 240 | from lib.tools.bezierTools import curveConverter 241 | 242 | elif environment == 'GlyphsApp': 243 | MainBundle = NSBundle.mainBundle() 244 | path = MainBundle.bundlePath()+"/Contents/Scripts" 245 | if not path in sys.path: 246 | sys.path.append(path) 247 | import GlyphsApp 248 | 249 | 250 | 251 | ########################################################################################## 252 | 253 | 254 | class SpeedPunkLib: 255 | def __init__(self): 256 | 257 | self.tool = None 258 | self.curvesegments = [] 259 | self.values = [] 260 | self.vmin = None 261 | self.vmax = None 262 | self.histogram = {} 263 | self.glyphchanged = False 264 | self.numberofcurvesegments = 0 265 | self.glyphstring = None 266 | self.preferences = {} 267 | self.preferenceKeys = ('illustrationPosition', 'curveGain') 268 | self.unitsperem = 1000 269 | self.curves = 'cubic' 270 | 271 | self.loadPreferences() 272 | 273 | # Preferences 274 | if not self.getPreference('illustrationPosition'): 275 | self.setPreference('illustrationPosition', 'outsideOfGlyph') 276 | if not self.getPreference('curveGain'): 277 | self.setPreference('curveGain', Interpolate(curveGain[0], curveGain[1], .2)) 278 | self.setPreference('fader', 1.0) 279 | self.setPreference('useFader', False) 280 | 281 | # UI 282 | self.prefwindow = SpeedPunkPrefWindow(self) 283 | self.drawGradientImage() 284 | 285 | def getPreference(self, key): 286 | return self.preferences[key] 287 | 288 | def setPreference(self, key, value): 289 | self.preferences[key] = value 290 | 291 | def loadPreferences(self): 292 | for key in self.preferenceKeys: 293 | self.preferences[key] = NSUserDefaults.standardUserDefaults().objectForKey_("de.yanone.speedPunk.%s" % (key)) 294 | 295 | def savePreferences(self): 296 | for key in self.preferenceKeys: 297 | if key in self.preferences: 298 | NSUserDefaults.standardUserDefaults().setObject_forKey_(self.preferences[key], "de.yanone.speedPunk.%s" % (key)) 299 | 300 | def Open(self): 301 | self.prefwindow.w.show() 302 | self.RefreshView() 303 | 304 | def Close(self): 305 | self.savePreferences() 306 | self.prefwindow.w.hide() 307 | 308 | def RefreshView(self): 309 | if environment == 'GlyphsApp': 310 | if self.tool.editViewController(): 311 | self.tool.editViewController().graphicView().setNeedsDisplay_(True) 312 | # except: pass 313 | elif environment == 'RoboFont': 314 | self.tool.refreshView() 315 | 316 | def gatherSegments(self, g): 317 | 318 | changed = False 319 | oldSegments = self.curvesegments 320 | 321 | # Compile new curve segments list 322 | newSegmentPositions = [] 323 | newCurvesType = self.curves 324 | 325 | # Glyphs 326 | if environment == 'GlyphsApp': 327 | for p in g.paths: 328 | for s in p.segments: 329 | if len(s) == 4: 330 | pv = s[0].pointValue() 331 | p1 = Point(pv[0], pv[1]) 332 | pv = s[1].pointValue() 333 | p2 = Point(pv[0], pv[1]) 334 | pv = s[2].pointValue() 335 | p3 = Point(pv[0], pv[1]) 336 | pv = s[3].pointValue() 337 | p4 = Point(pv[0], pv[1]) 338 | newSegmentPositions.append((p1, p2, p3, p4)) 339 | 340 | # RoboFont 341 | elif environment == 'RoboFont': 342 | for c in g: 343 | previouspoint = previouspoint = c[-1].points[-1] 344 | for s in c: 345 | if s.type == 'curve': 346 | newCurvesType = 'cubic' 347 | p1 = Point(previouspoint.x, previouspoint.y) 348 | p2 = Point(s.points[0].x, s.points[0].y) 349 | p3 = Point(s.points[1].x, s.points[1].y) 350 | p4 = Point(s.points[2].x, s.points[2].y) 351 | newSegmentPositions.append((p1, p2, p3, p4)) 352 | elif s.type == 'qcurve': 353 | newCurvesType = 'quadratic' 354 | p1 = Point(previouspoint.x, previouspoint.y) 355 | p2 = Point(s.points[0].x, s.points[0].y) 356 | p3 = Point(s.points[1].x, s.points[1].y) 357 | p4 = Point(s.points[2].x, s.points[2].y) 358 | 359 | (h1x, h1y), (h2x, h2y), (x2, y2) = curveConverter.convertSegment((p1.x, p1.y), ((p2.x, p2.y), (p3.x, p3.y), (p4.x, p4.y)), "curve") 360 | p2 = Point(h1x, h1y) 361 | p3 = Point(h2x, h2y) 362 | p4 = Point(x2, y2) 363 | 364 | newSegmentPositions.append((p1, p2, p3, p4)) 365 | 366 | previouspoint = s.points[-1] 367 | 368 | # Curve type has changed 369 | if newCurvesType != self.curves: 370 | self.curves = newCurvesType 371 | self.drawGradientImage() 372 | 373 | # Compare curvesegments (p1, p2, p3, p4) to list of segments objects. 374 | if len(newSegmentPositions) != len(oldSegments): 375 | oldSegments = [] 376 | changed = True 377 | for curvesegment in newSegmentPositions: 378 | p1, p2, p3, p4 = curvesegment 379 | oldSegments.append(Segment(self, p1, p2, p3, p4)) 380 | 381 | else: 382 | # Compare stored segments with new coordinates, recalc if necessary 383 | for i, curvesegment in enumerate(newSegmentPositions): 384 | p1, p2, p3, p4 = curvesegment 385 | if (p1, p2, p3, p4) != (oldSegments[i].p1, oldSegments[i].p2, oldSegments[i].p3, oldSegments[i].p4): 386 | oldSegments[i] = Segment(self, p1, p2, p3, p4) 387 | changed = True 388 | 389 | self.curvesegments = oldSegments 390 | self.glyphchanged = changed 391 | 392 | def UpdateGlyph(self, g, glyphstring = None): 393 | 394 | # Units per em 395 | if environment == 'GlyphsApp': 396 | self.unitsperem = g.parent.parent.upm 397 | elif environment == 'RoboFont': 398 | self.unitsperem = g.font.info.unitsPerEm 399 | 400 | # Compare string to see if glyph changed 401 | if (glyphstring and glyphstring != self.glyphstring) or not glyphstring: 402 | if glyphstring: 403 | self.glyphstring = glyphstring 404 | 405 | # Number of curve segments, quick gathering 406 | numberofcurvesegments = 0 407 | if environment == 'GlyphsApp': 408 | for p in g.paths: 409 | for s in p.segments: 410 | if len(s) == 4: 411 | numberofcurvesegments += 1 412 | elif environment == 'RoboFont': 413 | for c in g: 414 | for s in c: 415 | if 'curve' in s.type: 416 | numberofcurvesegments += 1 417 | self.numberofcurvesegments = numberofcurvesegments 418 | 419 | 420 | # Assign new segments 421 | self.gatherSegments(g) 422 | 423 | # Things have actually changed 424 | if self.glyphchanged: 425 | self.values = [] 426 | 427 | for segment in self.curvesegments: 428 | self.values.extend(segment.Values()) 429 | 430 | # Glyph has outlines 431 | if self.values: 432 | self.vmin = min(self.values) 433 | self.vmax = max(self.values) 434 | 435 | # Draw 436 | # context = NSGraphicsContext.currentContext() 437 | # context.setCompositingOperation_(12) 438 | # context.setShouldAntialias_(False) 439 | 440 | if self.getPreference('useFader'): 441 | self.buildHistogram(self.prefwindow.w.gradientImage.getNSImageView().frame().size[0]) 442 | self.drawHistogram() 443 | 444 | drawcount = 0 445 | for segment in self.curvesegments: 446 | drawcount += segment.Draw() 447 | 448 | # Reset 449 | self.glyphchanged = False 450 | 451 | def drawGradientImage(self): 452 | 453 | width = int(self.prefwindow.w.gradientImage.getNSImageView().frame().size[0]) 454 | height = int(self.prefwindow.w.gradientImage.getNSImageView().frame().size[1]) 455 | image = NSImage.alloc().initWithSize_((width, height)) 456 | image.lockFocus() 457 | 458 | for x in range(width): 459 | p = x/float(width) 460 | R, G, B = InterpolateHexColorList(colors[self.curves], p) 461 | NSColor.colorWithCalibratedRed_green_blue_alpha_(R, G, B, 1.0).set() 462 | path = NSBezierPath.bezierPath() 463 | path.moveToPoint_((x, 0)) 464 | path.lineToPoint_((x, height)) 465 | path.stroke() 466 | 467 | image.unlockFocus() 468 | self.prefwindow.w.gradientImage.setImage(imageObject=image) 469 | 470 | def buildHistogram(self, width): 471 | self.histogram = {} 472 | self.maxhistogram = 0 473 | for v in self.values: 474 | key = int(Interpolate(1, width, (v - self.vmin) / (self.vmax - self.vmin))) - 1 475 | if key not in self.histogram: 476 | self.histogram[key] = 0 477 | self.histogram[key] += 1 478 | if self.histogram[key] > self.maxhistogram: 479 | self.maxhistogram = self.histogram[key] 480 | 481 | def drawHistogram(self): 482 | width = int(self.prefwindow.w.histogramImage.getNSImageView().frame().size[0]) 483 | height = int(self.prefwindow.w.histogramImage.getNSImageView().frame().size[1]) 484 | 485 | image = NSImage.alloc().initWithSize_((width, height)) 486 | image.lockFocus() 487 | image.setBackgroundColor_(NSColor.colorWithCalibratedRed_green_blue_alpha_(1, 1, 1, 0)) 488 | NSColor.colorWithCalibratedRed_green_blue_alpha_(0, 0, 0, .8).set() 489 | 490 | for x in range(width): 491 | if x in self.histogram: 492 | path = NSBezierPath.bezierPath() 493 | path.moveToPoint_((x + .5, 0)) 494 | y = (self.histogram[x] / float(self.maxhistogram)) * height 495 | 496 | path.lineToPoint_((x + .5, y)) 497 | path.stroke() 498 | 499 | image.unlockFocus() 500 | self.prefwindow.w.histogramImage.setImage(imageObject=image) 501 | 502 | 503 | class Curvature: 504 | def __init__(self, segment, set1, set2): 505 | self.segment = segment 506 | self.set1 = set1 507 | self.set2 = set2 508 | self.curveGain = None 509 | self.illustrationPosition = None 510 | self.fader = None 511 | self.useFader = None 512 | 513 | def Draw(self): 514 | 515 | # Color 516 | if self.segment.speedpunklib.glyphchanged or self.fader != self.segment.speedpunklib.getPreference('fader') or self.useFader != self.segment.speedpunklib.getPreference('useFader'): 517 | self.fader = self.segment.speedpunklib.getPreference('fader') 518 | self.useFader = self.segment.speedpunklib.getPreference('useFader') 519 | 520 | # Color 521 | p = (self.Value() - self.segment.speedpunklib.vmin) / (self.segment.speedpunklib.vmax - self.segment.speedpunklib.vmin) 522 | R, G, B = InterpolateHexColorList(colors[self.segment.speedpunklib.curves], p) 523 | 524 | 525 | # Fader 526 | faderMin = .2 527 | faderMax = .7 528 | if self.segment.speedpunklib.getPreference('useFader'): 529 | # Alpha 530 | fader = self.segment.speedpunklib.prefwindow.w.faderSlider.get() 531 | histerese = .2 532 | 533 | if p > fader: 534 | d = p - fader 535 | if d > histerese: 536 | v = 0.0 537 | else: 538 | v = 1.0 - d / histerese 539 | else: 540 | v = 1.0 541 | 542 | A = Interpolate(faderMin, faderMax, v) 543 | else: 544 | A = faderMax 545 | 546 | 547 | self.color = NSColor.colorWithCalibratedRed_green_blue_alpha_(R, G, B, A) 548 | 549 | # Recalc illustration 550 | if self.segment.speedpunklib.glyphchanged or self.curveGain != self.segment.speedpunklib.getPreference('curveGain') or self.illustrationPosition != self.segment.speedpunklib.getPreference('illustrationPosition'): 551 | self.curveGain = self.segment.speedpunklib.getPreference('curveGain') 552 | self.illustrationPosition = self.segment.speedpunklib.getPreference('illustrationPosition') 553 | 554 | k1 = self.set1[3] * drawfactor * self.curveGain * self.segment.speedpunklib.unitsperem**2 555 | k2 = self.set2[3] * drawfactor * self.curveGain * self.segment.speedpunklib.unitsperem**2 556 | 557 | if self.illustrationPosition == 'outsideOfGlyph': 558 | k1 = abs(k1) 559 | k2 = abs(k2) 560 | 561 | # TrueType 562 | if self.segment.speedpunklib.curves == 'quadratic': 563 | k1 *= -1 564 | k2 *= -1 565 | 566 | # Define points 567 | self.oncurve1 = (self.set1[0].x, self.set1[0].y) 568 | self.oncurve2 = (self.set2[0].x, self.set2[0].y) 569 | self.outerspace2 = (self.set2[0].x + (self.set2[1].y / abs(self.set2[1]) * k2), self.set2[0].y - (self.set2[1].x / abs(self.set2[1]) * k2)) 570 | self.outerspace1 = (self.set1[0].x + (self.set1[1].y / abs(self.set1[1]) * k1), self.set1[0].y - (self.set1[1].x / abs(self.set1[1]) * k1) ) 571 | 572 | self.path = NSBezierPath.bezierPath() 573 | # OnCurve 574 | self.path.moveToPoint_(self.oncurve1) 575 | self.path.lineToPoint_(self.oncurve2) 576 | # Outer points 577 | self.path.lineToPoint_(self.outerspace2) 578 | self.path.lineToPoint_(self.outerspace1) 579 | self.path.closePath() 580 | 581 | self.color.set() 582 | # self.path 583 | 584 | self.path.fill() 585 | # self.path.setLineWidth_(0.2) 586 | # self.path.stroke() 587 | 588 | return 1 589 | 590 | # else: 591 | # return 0 592 | 593 | def Value(self): 594 | return abs(self.set1[3] * drawfactor) + abs(self.set2[3] * drawfactor) / 2.0 595 | 596 | 597 | class Segment: 598 | def __init__(self, speedpunklib, p1, p2, p3, p4): 599 | 600 | self.speedpunklib = speedpunklib 601 | 602 | self.p1 = p1 603 | self.p2 = p2 604 | self.p3 = p3 605 | self.p4 = p4 606 | 607 | self.highestvalue = None 608 | self.lowestvalue = None 609 | 610 | ### Calc 611 | steps = int(round(max(TOTALSEGMENTS / self.speedpunklib.numberofcurvesegments, MINSEGMENTS - 1))) 612 | 613 | self.curvatureSets = [] 614 | 615 | sets = [] 616 | for i in range(steps + 1): 617 | t = i / float(steps) 618 | r, r1, r2 = solveCubicBezier(p1, p2, p3, p4, t) 619 | try: 620 | k = solveCubicBezierCurvature(r, r1, r2) 621 | sets.append((r, r1, r2, k)) 622 | except: 623 | pass 624 | 625 | for set1, set2 in ListPairs(sets, 2): 626 | self.curvatureSets.append(Curvature(self, set1, set2)) 627 | 628 | 629 | def Draw(self): 630 | 631 | drawcount = 0 632 | for set in self.curvatureSets: 633 | drawcount += set.Draw() 634 | return drawcount 635 | 636 | def Values(self): 637 | values = [] 638 | for set in self.curvatureSets: 639 | values.append(set.Value()) 640 | return values 641 | 642 | 643 | 644 | class SpeedPunkPrefWindow(object): 645 | 646 | def __init__(self, parent): 647 | self.parent = parent 648 | self.w = vanilla.FloatingWindow((150, 130), "Speed Punk %s" % VERSION, 649 | closable = False, 650 | autosaveName = 'de.yanone.speedPunk.%s.prefWindow' % (environment), 651 | ) 652 | 653 | from AppKit import NSHUDWindowMask, NSUtilityWindowMask, NSTitledWindowMask, NSBorderlessWindowMask 654 | self.w.getNSWindow().setStyleMask_(0 << 1 | 0 << 2 | NSUtilityWindowMask | NSTitledWindowMask | NSBorderlessWindowMask) 655 | 656 | self.w.illustrationPositionRadioGroup = vanilla.RadioGroup((10, 10, -10, 40), 657 | ["Outside of glyph", "Outer side of curve"], 658 | callback=self.radioGroupCallback, 659 | sizeStyle = "small") 660 | 661 | self.w.curveGainTextBox = vanilla.TextBox((10, 60, -10, 17), "Gain", 662 | sizeStyle = "mini") 663 | 664 | self.w.curveGainSlider = vanilla.Slider((10, 70, -10, 25), 665 | tickMarkCount=5, 666 | callback=self.curveGainSliderCallback, 667 | sizeStyle = "small", 668 | minValue = curveGain[0], 669 | maxValue = curveGain[1], 670 | value = self.parent.getPreference('curveGain')) 671 | 672 | if self.parent.getPreference('illustrationPosition') == "outsideOfGlyph": self.w.illustrationPositionRadioGroup.set(0) 673 | if self.parent.getPreference('illustrationPosition') == "outsideOfCurve": self.w.illustrationPositionRadioGroup.set(1) 674 | 675 | 676 | self.w.faderCheckBox = vanilla.CheckBox((10, 100, -10, 17), "Fader", 677 | sizeStyle = "small", 678 | callback=self.faderCheckBoxCallback) 679 | 680 | self.w.faderSlider = vanilla.Slider((10, 125, -10, 25), 681 | sizeStyle = "small", 682 | minValue = 0, 683 | maxValue = 1.0, 684 | value = 1.0, 685 | callback=self.faderSliderCallback, 686 | ) 687 | 688 | self.w.gradientImage = vanilla.ImageView((10, 150, -10, 15)) 689 | self.w.histogramImage = vanilla.ImageView((10, 150, -10, 15)) 690 | 691 | def radioGroupCallback(self, sender): 692 | illustrationPosition = ("outsideOfGlyph", "outsideOfCurve") 693 | self.parent.setPreference('illustrationPosition', illustrationPosition[sender.get()]) 694 | self.parent.RefreshView() 695 | 696 | def curveGainSliderCallback(self, sender): 697 | self.parent.setPreference('curveGain', sender.get()) 698 | self.parent.RefreshView() 699 | 700 | def faderSliderCallback(self, sender): 701 | self.parent.setPreference('fader', sender.get()) 702 | self.parent.RefreshView() 703 | 704 | def faderCheckBoxCallback(self, sender): 705 | self.parent.setPreference('useFader', sender.get()) 706 | self.parent.RefreshView() 707 | if sender.get(): 708 | self.w.faderCheckBox.setPosSize(((10, 105, -10, 17))) 709 | self.w.resize(150, 175, animate=True) 710 | else: 711 | self.w.faderCheckBox.setPosSize(((10, 100, -10, 17))) 712 | self.w.resize(150, 130, animate=True) 713 | 714 | --------------------------------------------------------------------------------