Skip to main content

Python wrapper around the MFEKmath library

Project description

ufostroker-py

This Python module wraps the Rust MFEK/math library's capability for path stroking. It currently exports one function, constant_width_stroke:

from ufostroker import constant_width_stroke
f = ufoLib2.Font("tests/data/Scurve.ufo")

constant_width_stroke(f["A"], width=50, startcap="square", endcap="square")

This modifies the glyph in place. The library works with defcon and ufoLib2 objects.

This may also be used as a fontmake command line plugin:

fontmake --filter 'ufostroker::StrokeFilter(pre=True,Width=50)' -u OpenPaths.ufo -o ttf

Or by adding a lib key into the UFO file's lib.plist file:

    <key>com.github.googlei18n.ufo2ft.filters</key>
    <array>
      <dict>
        <key>name</key>
        <string>ufostroker.StrokeFilter</string>
        <key>pre</key>
        <true/>
        <key>kwargs</key>
        <dict>
            <key>Width</key>
            <integer>50</integer>
            <key>StartCap</key>
            <string>square</string>
            <key>EndCap</key>
            <string>square</string>
            <key>JoinType</key>
            <string>mitre</string>
            <key>RemoveExternal</key>
            <true/>
        </dict>
      </dict>
    </array>

Building

Use maturin to build ufostroker.

pip3 install maturin
python3 -m venv strokervenv
. ./strokervenv/bin/activate
maturin develop
maturin build # Build wheel

License

Apache 2.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ufostroker-0.3.0.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distributions

ufostroker-0.3.0-cp37-abi3-manylinux_2_34_x86_64.whl (1.9 MB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.34+ x86-64

ufostroker-0.3.0-cp37-abi3-macosx_11_0_arm64.whl (276.4 kB view hashes)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

ufostroker-0.3.0-cp37-abi3-macosx_10_12_x86_64.whl (283.0 kB view hashes)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page