# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0
PortGroup           select 1.0

name                py-fonttools
version             4.63.0
revision            0

description         XML<->TrueType/OpenType Converter
long_description    TTX is a tool to convert OpenType and TrueType fonts to \
                    and from XML. FontTools is a library for manipulating \
                    fonts, written in Python. It supports TrueType, OpenType, \
                    AFM and to an extent Type 1 and some Mac-specific formats.

homepage            https://github.com/fonttools/fonttools

categories-append   print
license             MIT
maintainers         {amake @amake} openmaintainer

checksums           rmd160  a7e22a05f340f7515766572bd2bcff76e5696f75 \
                    sha256  caeb583deeb5168e694b65cda8b4ee62abedfa66cf88488734466f2366b9c4e0 \
                    size    3597189

python.versions     310 311 312 313 314

if {${name} ne ${subport}} {
    depends_build-append \
                    port:py${python.version}-cython

    depends_run-append \
                    port:${python.rootname}_select

    default_variants +lxml +woff +unicode

    variant lxml description {Install preferred backend for XML reading/writing} {
        depends_run-append  port:py${python.version}-lxml
    }

    variant ufo description {Install dependencies for UFO font support} {
        depends_run-append  port:py${python.version}-fs
    }

    variant woff description {Install dependencies for WOFF 1.0 & 2.0 font support} {
        depends_run-append  port:py${python.version}-brotli \
                            port:py${python.version}-zopfli
    }

    variant unicode description {Install dependencies for up-to-date Unicode support} {
        depends_run-append  port:py${python.version}-unicodedata2
    }

    variant graphite description {Install dependencies for graphite type tables} {
        depends_run-append  port:py${python.version}-lz4
    }

    variant interpolatable description {Install dependencies for Assignment problem} {
        depends_run-append  port:py${python.version}-scipy
    }

    variant plot description {Install dependencies for plot visualizations} {
        depends_run-append  port:py${python.version}-matplotlib
    }

    variant symfont description {Install dependencies for symbolic font statistics analysis} {
        depends_run-append  port:py${python.version}-sympy
    }

    variant type1 description {Install dependencies for Type 1 font support} {
        depends_run-append  port:py${python.version}-xattr
    }

    # TODO: `pathops` extra: requires skia-pathops (not yet in MacPorts)

    # TODO: `repacker` extra: requires uharfbuzz (not yet in MacPorts)

    # Non-"extras" variants:

    variant cocoa description {Install dependencies for Cocoa glyph drawing} {
        depends_run-append  port:py${python.version}-pyobjc
    }

    variant qt description {Install dependencies for Qt glyph drawing} {
        depends_run-append  port:py${python.version}-pyqt5
    }

    variant png description {Install dependencies for PNG glyph drawing} {
        depends_run-append  port:py${python.version}-reportlab
    }

    variant all requires lxml ufo woff unicode plot symfont cocoa qt png description {Install all available optional dependencies} {}

    select.group    ${python.rootname}
    select.file     ${filespath}/${python.rootname}-${python.version}

    notes "
To make the Python ${python.branch} version of fonttools the one that is run\
when you execute the commands without a version suffix, e.g. 'fonttools', run:

    sudo port select --set ${select.group} [file tail ${select.file}]
"

    livecheck.type  none
}
