npm install -g @mariozechner/pi-coding-agent# Interactive REPL| f = CurrentFont() | |
| glyphName = "a" | |
| size = 1080 | |
| newPage (size,size) | |
| black = 0,0,0 | |
| red = 1,0,0 | |
| green = 0,1,0 | |
| blue = 0,0,1 | |
| white = 1,1,1 | |
| pointshape = oval #oval or rect |
| from typing import Tuple, Optional | |
| from fontTools.pens.basePen import BasePen | |
| from fontTools.misc.arrayTools import calcBounds | |
| import math | |
| def round_angle_to_step(angle: float, degree: int) -> int: | |
| """ | |
| Rounds an angle to the nearest degree increment. | |
| Args: |
| from fontTools.pens.basePen import BasePen | |
| from fontTools.misc.bezierTools import calcCubicParameters, solveCubic, _alignment_transformation, cubicPointAtT, _line_t_of_pt, linePointAtT | |
| def _curve_line_intersections_t(curve, line): | |
| aligned_curve = _alignment_transformation(line).transformPoints(curve) | |
| a, b, c, d = calcCubicParameters(*aligned_curve) | |
| intersections = solveCubic(a[1], b[1], c[1], d[1]) | |
| return sorted(i for i in intersections if 0.0 <= i <= 1) | |
| def curveLineIntersections(curve, line): |
| import re | |
| sampleText = ''' | |
| A spectre is haunting [Europe](www.robofont.com) — the spectre of **communism**. All the __powers of old Europe have__ entered into a holy alliance to exorcise this spectre: Pope and Tsar, Metternich and Guizot, French Radicals and German police-spies. | |
| Where is the party in opposition that has not been decried as communistic by its opponents in power? Where is the opposition that has not hurled back the branding reproach of **communism**, against the more advanced opposition parties, as well as against its reactionary adversaries? | |
| Two things result from this fact: | |
| I. **Communism** is *already acknowledged* by all _European_ powers to be itself a power. |
| // I'm tired of extensions that automatically: | |
| // - show welcome pages / walkthroughs | |
| // - show release notes | |
| // - send telemetry | |
| // - recommend things | |
| // | |
| // This disables all of that stuff. | |
| // If you have more config, leave a comment so I can add it!! | |
| { |
Provided are the name table record ID and instructions on how to fill it out. Arial is used as an example to show how the names records can be filled. You can see the example records here:
https://learn.microsoft.com/en-us/typography/opentype/spec/namesmp
There are also more exmaples added to the bottom of this file.
| import argparse | |
| import sys | |
| from fontTools.designspaceLib import AxisLabelDescriptor, DesignSpaceDocument | |
| def main(): | |
| parser = argparse.ArgumentParser( | |
| description="Converts statmake axis labels to DesignSpace 5.0 axis labels" | |
| ) | |
| parser.add_argument("input", help="The source .designspace file") |
| """ | |
| Script to create an image of a glyph in the current layer. | |
| Instructions: | |
| - Use within the Drawbot plugin of GlyphsApp. | |
| - Get this plugin via Window > Plugin Manager, then search for "Drawbot" and install it. | |
| - Then, go to File > New Drawbot, and paste in this code and run it. | |
| - You may need to restart glyphs for the Plugin to work. | |
| #!/usr/bin/ruby | |
| t = `aconnect -i -l` | |
| $devices = {} | |
| $device = 0 | |
| t.lines.each do |l| | |
| match = /client (\d*)\:((?:(?!client).)*)?/.match(l) | |
| # we skip empty lines and the "Through" port | |
| unless match.nil? || match[1] == '0' || /Through/=~l | |
| $device = match[1] |