fontlabapp.core.sharing
sharing
Whether an edit to a shape's contours would change another glyph's outline.
What: element_shared(shape, layer) is True only when the shape's
shapeData.referenceCount exceeds 1 plus the component shapes that use
this glyph's same-name layer; sharing_operation() memoises the user counts
for one scan, plan or apply pass.
Why: FontLab counts every component shape that points at a glyph's layer in
the element's reference count (a plain a used by 33 composites reads 34;
on Lato Hairline a composite holding two acute components adds two).
Those composites re-render from the base glyph, so they are not shared outline
data. The raw referenceCount > 1 test refused every component base.
Studios (fontlabapp.studios) and fontlabapp.contours.writer both use
these names; the writer re-exports them.
Safety: reads only. When the glyph, layer or package cannot be resolved, the
answer stays the conservative referenceCount > 1 and the reason is logged
at debug level.
Counting users reads one layer of every glyph (about 0.05 s per master in a
3000-glyph font). Inside sharing_operation() the counts are memoised per
(package id, layer name) and dropped on exit, so no cache outlives an edit.
The memo assumes the pass does not add or remove components while it is
active, and it is module-global, so use it from the FontLab main thread only.
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
LOG |
attribute | ||
element_shared |
function | (shape: Any, layer: Any=None, package: Any=None) -> bool |
Return True when editing <code>shape</code>'s contours would change another glyph. |
sharing_operation |
function | () -> Iterator[None] |
Memoise component-user counts for one scan, planning or apply pass. |