らんだむな記憶

blogというものを体験してみようか!的なー

Glyphs

GlyphsTracePlugin

GitHub - schriftgestalt/GlyphsTracePlugin が手元の環境 (Big Sur + Glyphs 2.6.6 (1352)) でうまく動作しない。Trace Image Filter Does not work - Scripting - Glyphs Forum の現象の 1 つなのかもしれない。ので調べた。https://github.com/schriftges…

Generative Fonts

NaNGlyphFilters — Generative Fonts & Scripts — Home 凄いな〜、どうしてるんかなぁ〜って思ったら、普通に Glyphs plugin として頑張ってた・・・。ここまで来るとただただ凄いな・・・。Agenda | ATypI Tech Talks 2021 の「GAN and GAN'T」はサマリを見…

Italic Extremes

"Add extremes" Request - Glyphs Forum あー、分かる気がする。選択したとこだけにしたいと。Italic Extremes はワンクッション入っちゃうね。ちょっと改造して一気に極点を置けるようにしちゃうのもアリかも。

ノードの連結

Shortcut to Connect Nodes - Glyphs Forum ふむふむ。 /Applications/Glyphs.app/Contents/Frameworks/GlyphsCore.framework/Versions/A/Headers/GSLayer.h を見ると - (GSNode *)connectPathsWithNode:(GSNode *)moveNode andNode:(GSNode *)overNode; が…

2次曲線のremove overlap

Remove Overlap - Quadratic Curves - Glyphs - Glyphs Forum ってことで、2次の場合のremove overlapは不完全っぽい・・・ 少々アレだが以下のようにすればぼちぼち使えるかもしれない font = Glyphs.font for layer in font.selectedLayers: layer.removeO…

removeOverlapFromLayer

Heatmap/Heatmap at master · simoncozens/Heatmap · GitHub ふむふむ。参考になる・・・

IllustratorからGlyphsへ

Importing from Illustrator | Glyphs Importing from Illustrator into Glyphs Mini | Glyphs とか。むむむ・・・

Glyphs Coreドキュメント

Glyphs Reference おぉっ...こっちはほとんど意識したことがない...。しかも色々情報がある...

type(segment)

●objectGS.pyがインストールされている時 <class 'objectsGS.RSegment'> ●されていない時 <objective-c class __NSArrayI at 0x7fff89938540> みたいな感じで、中身は ( "NSPoint: {46, 242}", "NSPoint: {46, 83}", "NSPoint: {149, -12}", "NSPoint: {279, -12}" ) のようになっている。</objective-c></class>

輪郭を複製して新しいレイヤーに突っ込んでremove overlapとかするサンプル

何がしたいんだってばさ!?ってなサンプル: def copy_path(path): new_path = GSPath() for pt in path.points: pt2 = GSNode(type=pt.type, x=pt.x, y=pt.y) new_path.points.append(pt2) new_path.setClosePath_(True) return new_path def createRemoveO…

新しいレイヤーを作って輪郭を配置する

layer = GSLayer() new_path = GSPath() path = Glyphs.font.selectedLayers[0].paths[0] for pt in path.points: # pt2 = copy.copy(pt) でもいいかも? pt2 = GSNode(type=pt.type, x=pt.x, y=pt.y) new_path.points.append(pt2) layer.paths.append(new_p…

Remove Overlapフィルタをスクリプトから実行する

font = Glyphs.font thisFilter = NSClassFromString("GlyphsFilterRemoveOverlap").alloc().init() thisFilter.setController_(font.currentTab) for layer in font.selectedLayers: thisFilter.runFilterWithLayer_error_(layer, None) あぁぁ... font = G…

Glyphsの自動化(2)

Glyphsの自動化 - らんだむな記憶 自動化とはちょっと違うけど、スクリプト内からフィルタの機能を呼び出したい。 Export Variable Font using Python Scripting API - Scripting - Glyphs Forumを見るとvariable fontは無理みたい。 Generate() API support…

Glyphsにおける2次曲線の扱い

https://forum.glyphsapp.com/t/drawing-with-quadratic-bezier-points/7439によると2.5では2次曲線のままでimportできるっぽい。実際には2.4.4でも表示できているようだ。APIで次数は取得できるだろうか?と思ったが、GSPath.segmentsのリストの中身のsegme…

ReporterPluginにおけるマウスイベント

Mouse click events in reporter - Scripting - Glyphs Forumに書いてあるが、さて...。 def willActivate(self): print "willActivate" def willDeactivate(self): print "willDeactivate" でイベントは拾えた。

Glyphsとnumpy(2)

Glyphsとnumpy - らんだむな記憶とは言うもののめげていても仕方ない。パスの検索順序ということは... sys.path 内の順序か?と思ったので、やったことないけど sys.path.remove を使うことにした。消しっぱは怖いので、末尾に突っ込んではあげる。つまり再…

Glyphsとnumpy

/System/Library/Frameworks/Python.framework/Versions/2.7/Extrasというものがある。 特に.../2.7/Extras/lib/python/numpyがある。そしてモジュールの検索パスとしては、site-packagesより強いようだ。 Which Python · MacPython/wiki Wiki · GitHubとい…

Glyphsで開いているフォントのパス

Glyphs.font.filepath でファイルパスを取得できるので、fontToolsとかで何か処理をしてUI上にマークを付けるとかできるはず...。

Glyphs 2.4.2 Released

Glyphs 2.4.2 Released | Glyphsなんか出てた。 Speaking of script-specific feature code, we started adding support for the CJK-specific palt and vpal features: とあるがどこから何を設定すれば良いのだろう...。Glyphsチュートリアル9:和文フォン…

.glyphsをparseしたい

fontmake -g hoge.glyphsしてみると、GitHub - googlei18n/glyphsLibでUFOに落としているなー、と思った。ってことは.glyphsを解析してるんだなと思った。 glyphsLib/parser.py at master · googlei18n/glyphsLib · GitHub ちょっとドキドキして眺めてみると…

.glyphsのフォーマット

GlyphsSDK/GlyphsFileFormat.md at master · schriftgestalt/GlyphsSDK · GitHubに記載があるがApple property listで記述されたフォーマットとのこと*1。 XMLベースではなくOld-Style ASCII Property Listsのように見える。vertOriginの説明は書かれていな…

縦メトリクス

こんな感じで生の値はとれるみたいだが…。 cur_layer = Glyphs.font.selectedLayers[0] if hasattr(cur_layer, "vertOrigin"): print cur_layer.vertOrigin() if hasattr(cur_layer, "vertWidth"): print cur_layer.vertWidth() Vertical width? - Glyphs - …

楕円の追加

更に: def draw_oval(a, b, x=0, y=0, xscale=1, xskew=0, yskew=0, yscale=1): if a >= b: path = draw_circle(b) path.applyTransform(1.*a/b, 0, 0, 1, 0, 0) else: path = draw_circle(a) path.applyTransform(1, 0, 0, 1.*b/a, 0, 0) path.applyTransfo…

円の追加

こんな感じ: from Foundation import * import math def mk_node(x, y, type="offcurve"): pt = NSPoint(x, y) return GSNode(pt, type=type) def draw_circle(r): K = 4.0 * (math.sqrt(2) - 1) / 3 path = GSPath() path.nodes.append(mk_node(-K*r, r)) p…

輪郭の追加

以下のようにすれば良さそうなんだが、妙に面倒臭い...。 cur_layer = Glyphs.font.selectedLayers[0] path = GSPath() pt = NSPoint(0, 0) node = GSNode(pt, type="line") path.nodes.append(node) pt = NSPoint(100, 0) node = GSNode(pt, type="line") p…

スマートコンポーネントをAPIで操作したい

例えば以下のような感じか。 def makeSmartComponent(): pos = NSMakePoint(-200, 100) comp = GSComponent(Glyphs.font.glyphs["_part.ki"], pos) comp.smartComponentValues["width"] = 1 comp.smartComponentValues["height"] = 50 return comp layer = G…

Glyphs older versions

https://updates.glyphsapp.com/Glyphs2.3.1-922.html https://updates.glyphsapp.com/Glyphs2.4.1-983.html https://updates.glyphsapp.com/Glyphs2.4.2-1038.html https://updates.glyphsapp.com/Glyphs2.4.2-1049.html https://updates.glyphsapp.com/Gly…

Glyphsとpen

How to detect an outside open corner - Scripting - Glyphs Forum How to use a objectsGS.RGlyph for drawBackgroundForLayer_ in a glyphsReporter - Scripting - Glyphs Forum この辺かいなぁ?

Glyphsの自動化

How to automate Glyphs export? - Glyphs ForumにあるようにAppleScriptでがーんばって世界なんだろうな。AppleScriptとか知らんけど。

友愛のない世界

以下のようなコードをマクロウィンドウ内で実行することで、UIを表示せずにグリフ一覧を取得できたり。 font = Glyphs.open("xxx.otf", showInterface=False) print map(lambda g: g.name, font.glyphs)