Skip to content

Certain deltas crash IUP optimisation #1116

Closed
googlefonts/fontations
#1381
@Hoolean

Description

@Hoolean

Hello again - we observed one other issue when trying to experimentally compile one of our larger library fonts with fontc at Dalton Maag.

A particular arrangement of deltas succeeds with fontmake but crashes fontc compilation with an IUP error:

[... ThreadId(1) fontc ERROR] IUP error for glyph: AchievedInvalidState("No best solution identified")
error: process didn't exit successfully: `...\fontc.exe .../Deltas.designspace` (exit code: 1)

Reproducing

As with the earlier issue (#1115), the original font is proprietary and so we've made an independent minimal reproducer to share and use here.

from fontTools.designspaceLib import (
    AxisDescriptor,
    DesignSpaceDocument,
    InstanceDescriptor,
    SourceDescriptor,
)
from ufoLib2 import Font
from ufoLib2.objects import Contour, Point

# Deltas that trigger the IUP crash
# (more minimal deltas are probably possible, but at this point I struggled to
#  use fewer while still triggering the crash)
DELTAS = [
    Point(x=0, y=0, type="line"),
    Point(x=1, y=0, type="line"),
    Point(x=1, y=0, type="line"),
    Point(x=0, y=1, type="line"),
    Point(x=0, y=0, type="line"),
    Point(x=1, y=0, type="line"),
    Point(x=1, y=3, type="line"),
    Point(x=2, y=0, type="line"),
    Point(x=2, y=3, type="line"),
    Point(x=0, y=0, type="line"),
    Point(x=0, y=0, type="line"),
    Point(x=0, y=3, type="line"),
]

# Create designspace with weight axis
doc = DesignSpaceDocument()
doc.addAxis(
    AxisDescriptor(tag="wght", name="Weight", minimum=400, maximum=700, default=400)
)

# Create a glyph with all points at origin in one source, and all points at
# particular offsets in another.
for style, weight, points in [
    ("Regular", 400, DELTAS),
    ("Bold", 700, [Point(x=0, y=0, type="line") for _ in range(len(DELTAS))]),
]:
    ufo = Font()

    inner = ufo.newGlyph("glyph")
    inner.contours.append(Contour(points))

    ufo.save(f"{style}.ufo", overwrite=True)

    doc.addSource(SourceDescriptor(path=f"{style}.ufo", location={"Weight": weight}))
    doc.addInstance(InstanceDescriptor(styleName=style, location={"Weight": weight}))

doc.write("Deltas.designspace")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions