FontDb::new copied every bundled and craft-fonts font into the font
catalog with add_bytes, which keeps its own copy of the bytes. A CLI run
that exports a small SVG peaked at about 130 MiB, against about 26 MiB
in 0.24.1.
The database now adds the bundled fonts the first time
FontDb::catalog is called, and its own catalog lookups go through that
call. A run that never looks a font up in the catalog does not copy
them: exporting a 10 x 10 SVG with vectorcraft-cli on Linux peaks at
42 MiB instead of 130 MiB, with the same PNG. The workaround can go once
the catalog takes static bytes without copying them (craft-libs#4888).
Part of #10666
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.
- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
The folder sits in a guard that removes it on drop, so a panic in the
write or the search no longer leaves the 41 MiB file in the temporary
directory. The normal path still removes it explicitly and fails on an
error.
- A rectangle bent along a circle keeps its corners at the ends of its
step, its baseline edge on the circle and its other edge on the circle
its height along the normal, with and without a rise off the path. A
straight path and a glyph with no advance leave the outline as it is.
- The file search for a character no loaded font covers loads a font
that covers it, and skips the same font padded to 41 MiB.
The shared gate's undeclared-read check (select legs) reports two reads
on main: crates/text/build.rs reads the workspace root (`.`) and
crates/engine/src/tests/fontfiles.rs reads `crates`. Neither path names
another member's files.
- crates/text/build.rs takes the workspace root as the second ancestor
of the crate directory instead of joining "../..". A relative
CRAFT_FONTS_DIR still resolves from the same directory.
- the_fonts_folder_next_to_a_document_is_an_absolute_path builds its
climb to the filesystem root from ParentDir components instead of
formatting a repeated "../". The test still opens the document by a
relative path to its temporary folder.
The check reports 0 problems on the result, down from 2 on main.
The web build had no Gujarati face, so it never offered Gujarati: the
language gate looked only at embedded craft-fonts faces, and web builds
embed only BIZ UDPGothic.
- crates/text/web-fonts.txt lists Noto Sans Gujarati Regular as a
`demand` face, like Noto Sans Devanagari for Hindi: served beside the
wasm under fonts/ui/ and fetched by the interface font stack when its
text needs Gujarati, never at startup or in the background queue.
- The Gujarati gate counts an embedded Gujarati face, or on the web a
served one (SERVED_FONTS); desktop behaviour is unchanged.
- Tests: web_fonts_follow_the_list expects the new demand face;
web_offers_gujarati_with_the_served_gujarati_face checks that a web
build with only the served face offers `gu`;
web_gujarati_face_covers_the_gujarati_catalog checks that the served
face alone draws every Gujarati character of the catalog.
Docs: gaps.md (G16), localization-parity.md, roadmap.md,
target-app-parity.md.
the_menu_family_list_now_does_not_wait_for_the_scan held the background
font scan with a named pipe named like a font. The font catalog now
skips files that are not regular files, so the scan never waited on the
pipe: it read the small test folder and could finish before the test
called installed_fonts_ready and menu_family_list_now. On a busy CI
runner the test then saw the installed fonts and failed with "before the
scan ends, only the fonts already loaded".
The test now builds its database with a test-only lister that the scan
calls before it reads the folder. The lister waits until the test drops
a channel sender after the two calls return, and gives up after 10 s so
that a list that waits for the scan fails the test instead of hanging
it. The pipe, the release thread and the Unix-only gate are removed.
hebrew_marks_stay_with_base_clusters asserts exact glyph start offsets,
which depend on the face that shapes the word. It now skips, as the
sibling font-dependent tests do, when no installed face covers shin,
lamed, vav and final mem.
hebrew_marks_stay_with_base_clusters now calls assert_source_coverage, so
glyphs that start at the four letters but leave the marks out of their
source ranges fail the test.
Tests in vectorcraft-text and vectorcraft-doc that could pass on an empty
result, or that only checked a result exists, now assert the values:
- Blend: gradient steps assert their stop count before checking each
stop's swatch, tint and plates; the odd dash blended to solid asserts
the whole pattern; a copied step asserts its members.
- Symbols: limiting depth keeps every symbol; a stroke override on type
keeps the run it styles.
- File fonts: an extreme descent clamps to the lowest table value and
the Windows descent still fits.
- Invert wrap on a tangled shape asserts the line still meets it.
- Bidi, ligature carets, Thai and whitespace fallback: the glyph and
line counts are asserted, Hebrew points stay in their letters'
clusters, and every character of an isolate test has a glyph.
- Glyph categories, trace views, compound shape modes and digit
systems check written-out ids instead of a round trip over every
value.
Removed joins_on_a_circle_are_measured, which printed measurements and
asserted nothing, and chord_placement_leaves_the_join_gap_above_the_baseline,
which checked arithmetic done in the test itself;
joined_glyphs_meet_on_a_curved_path covers joined type on a curve.
Five assertions accepted wrong results:
- Freeform: a point split half way along a Catmull-Rom segment must be
at x = 43.75, not anywhere between the two ends.
- Diamond gradient pixels: the center is exactly white and the corners
exactly black, instead of a bound that accepted white scaled to 220.
- Ruby: the default reading is half the base size (ratio 0.5), where
the old bound accepted 70%.
- Caret Up/Down: the caret lands on the stop nearest the column, where
the old 12 pt tolerance accepted a neighboring stop.
- Hyphenation defaults: a frozen hash of line breaks is replaced with
explicit breaks ("The lan-" / "guage", "The gar-" / "den") and hyphen
flags for both composers, ragged and justified.
Each new assertion fails when the behavior it checks is broken.
Each test that a cfg limits to Windows, macOS or a case-insensitive file
system gets a `test-lint: allow never-run` line naming its platform, so
`cargo xtask test-lint` no longer reports them. The tests are unchanged
and still run on their own platform.
the_menu_family_list_now_does_not_wait_for_the_scan holds the font scan
at a named pipe and released it with one blocking open for writing. That
open waits for any reader and lets go only the readers already waiting.
When the scan reached the pipe after the release, or ran on the test's
own thread because its background thread did not start, nothing opened
the pipe again and the test waited until the job timed out (a gate shard
on pull request 10368 ran for over two hours).
The release thread now opens the pipe for reading and writing, which
does not wait for a reader, and repeats that until the scan has ended.
The thread is joined after the list that waits for the scan.
Several tests returned early when the code under test gave back nothing,
so the regression they guard against passed. Each of those guards now
checks only what the host provides (an installed face, the bundled
fonts), and the output itself is asserted:
- PDF live text: the lam-alef face is no longer picked by whether its
type imports (#6072); Insert Kashidas asserts the kashida and the
imported type.
- Effects and Expand Appearance on type assert the outlines and the
drawn type when the default face is installed.
- The OpenType panel's Stylistic Sets test asserts sets with the
bundled fonts.
- Thumbnail worker tests assert that the worker starts; the memory
peak test asserts a reading.
- The json2 test checks the interpreter's Date, replace and RegExp on
every run, before looking for json2.js.
- Devanagari arrow keys and the Arabic narrow-area wrap assert the
layout they set up.
ranked_near now returns each glyph's outline group with it, and
near_matches reuses the last fitted poses when the group matches instead
of comparing the two outlines again. The outline comparisons all happen
in ranked_near, where each one is charged to the shape's allowance, so
the 50 million and 2 billion limits cover them. A new test counts the
outline comparisons near_matches makes beyond ranking.
Near matching groups the glyphs drawn alike by a hash of their outline
and compares each glyph's outline with the outlines in its hash bucket.
Those comparisons were not counted toward the work limit, and the hash
is not collision-resistant: a font with many glyphs whose outlines hash
alike made each new glyph compare with every outline before it, so the
work grew with the square of the glyph count. Each comparison now takes
one unit per element of the glyph's outline from the work limit, and a
glyph is compared with at most 4 outlines of one hash; past them, it is
an outline of its own. docs/mcp.md describes the new count.
The engine test helper lines_in_family took the line's face from
RetypeIndex::matches, which keeps the first 16 matches over every face.
When other tests had loaded more than 16 copies of Source Sans 3 that
draw the i alike, the family the test asked for could fall past them,
and the helper would use another face, without its kerning, so
a_word_space_after_a_glyph_kerned_toward_it_is_kept_past_the_glyphs_measured
could fail in a full engine run with craft-fonts. The helper now reads
all_matches, as Retype does.
Near matching compared a shape with the 256 glyphs closest to it in
proportion, over every indexed face. Faces that draw the same glyphs
(Noto families sharing their Latin dots, copies of a font under other
names) each took places among the 256, and when glyphs tied, which of
them kept a place depended on an unstable selection. A simplified
period, turned with its line, ranks near the 240th place among the
faces craft-fonts supplies, so each face loaded after them pushed some
fonts' periods out: with four copies of Source Sans 3 loaded,
Source Sans 3's period was no longer compared and Retype left the period
of "no." an outline. In a full vectorcraft-engine test run the test
fonts that other tests load into the shared font database did this to
turned_near_matched_round_glyphs_keep_the_line_turn.
Each indexed glyph now carries a hash of its outline. Ranking groups the
glyphs drawn alike into one outline, keeps the 256 closest outlines
with every glyph of each, and breaks ties by index order. A group is
fitted once and its poses go to each of its glyphs, so the comparisons
spent do not grow with the number of faces that draw the outline.
docs/mcp.md describes the limit as 256 outlines.
The CI, FreeBSD, nightly, macOS nightly and release workflows pinned
craft-fonts b076417, which has no fonts/latin-manifest.txt, so every
build warned that it could not embed the tab-title face. They now pin
craft-fonts main at 16bbfc3, which adds Noto Sans Condensed SemiBold
(storytold/craft-fonts#72), so builds from these workflows draw document
tab titles in it. The pin also brings Noto Sans Lao, Noto Sans for eight
Indian scripts (Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu,
Kannada and Malayalam) and the Latin catalog.
With the new faces a build loads 135 faces instead of 54, and Retype
compares the first 96 first. Two faults showed:
- Retype: near matching fits a shape with at most the 256 glyphs closest
to it in proportion over every face. The dots and periods of the new
faces, drawn alike in each family and each named weight, took all 256
places, so a simplified Source Sans 3 period after "no" matched no
glyph of Source Sans 3 and was left as an outline. A shape that near
matches no glyph of the font of the line before it is now also
compared with that font's own 256 closest glyphs, and joins the line
when one fits. RetypeIndex::near_matches_in does that lookup.
- Tests: six Retype tests added their test font to the global font
database and expected Retype to compare it, which it did only while
fewer than 96 faces were loaded before it. They now name the font
(type.retype's fonts, or live type in the family as #6896 does for
of_two_versions_only_the_one_the_name_gives_is_listed), and
lines_in_family fails when the family has no match instead of reading
another face.
all_supplied_craft_font_families_are_registered_without_system_fonts
looked up every embedded craft-fonts face in the document font database.
The tab-title face is embedded for tab titles only and the database
leaves it out (document_fonts), so the test now checks the faces
document_fonts lists.
docs/mcp.md describes the new near-match step, and docs/ui-parity.md and
docs/localization-parity.md describe the new pin.
The pin change and the version test fix follow #6896 by @newsbaba24x7.
crates/text/web-fonts.txt listed 30 background faces (Cairo, Tajawal,
Almarai, IBM Plex Sans Arabic, Noto Kufi Arabic, Amiri, Alexandria,
Fustat, Reem Kufi, Aref Ruqaa and Gulzar) that craft-fonts does not
have yet; they are added by storytold/craft-fonts#11 and #13, which are
still open. Every build with CRAFT_FONTS_DIR printed "web build won't
fetch: Cairo Regular, Tajawal ExtraLight, ..." from crates/text/build.rs
and xtask/src/web_fonts.rs, and the web build fetched none of them.
The rows are removed. The startup and demand faces stay. The rows go
back in when craft-fonts #11 and #13 merge.
The joined-name check now matches the face's PostScript name only, as
`FontDb::canonical` does for cataloged faces, so a file that carries the
joined name only as a full name is no longer offered. A legacy family of
the wanted name now decides the result, looking for the style in the
family of each of its faces, since `canonical` does not join the name
when the legacy family resolves it.
Tests cover the full-name and legacy cases against `FontDb::resolve`,
and a collection whose faces share a legacy family in either order.
The folder search test now also checks a file that carries the joined
name only as its full name, and that a wanted font without a style is
not offered a file through the joined name.
Six tests in vectorcraft-text passed or failed on how fast the machine
ran them. They now check work counts and handshakes:
- Layout speed (1,000 characters, and 10,000 under each composer):
laying out twice the text takes at most 2.5 times the steps, and at
most 32 steps a character. The steps are the bytes shaped, the clusters
the single-line composer reads and the line starts the every-line
composer weighs at each break, counted by a test-only counter.
- Many one-run paragraphs: the runs the paragraphs look through stay
within 4 per paragraph.
- A contour-point caret on a huge composite reads no more glyphs than
the lookup's budget, and a shape whose readings all fail tries no more
readings than the cap.
- The font menu's quick list is read on the test thread while the font
scan is held. A list that waited for the scan would hold the installed
fonts, so the list's content decides the result. The 10 s timeout only
releases a call that hangs.
Two font folder tests slept 50 ms to get past the file system's clock
tick. They now set the folder's modification time with
File::set_modified.
The Preview Bounds memo checks the fonts, the hyphenation exceptions and
the plug-in revisions on every lookup. Other engine tests change the
hyphenation exceptions and install plug-ins on other threads, so a
change between two hovers refreshed one memo slot and
a_hover_checks_the_memo_as_often_however_many_objects_are_selected
counted 5 checks instead of 4.
- set_hyphenation_exceptions takes the font gate (test_fonts::font_change),
as composite font changes do, so steady_fonts holds it back too.
- vectorcraft_plugins::steady (feature test-steady) gates every revision
bump in the plug-in registry and the deferred stages the same way.
- Both counting tests in previewbounds.rs hold both guards, and the
hyphenation round-trip test holds steady_fonts through its sequence.
A sweep gradient sets unsupported without too_large, so a glyph that later passed the budget
still took the raster branch, and Pixels replayed the whole graph with no budget. Check
too_large first, as tree.finish() does. Under-budget glyphs are unchanged. Answers CodeRabbit.
Desktop builds call `Embed::tab_face()`, which embeds the Noto Sans
Condensed SemiBold row of the checkout's `fonts/latin-manifest.txt` with
the `tab` role. craft-ui draws semibold document tab titles in it, scaled
to the semibold face's x-height. The document font list leaves that face
out. Web builds and builds without the face draw tab titles in the
semibold face.
The craft-libs crates point at storytold/craft-libs#3545's head until it
merges.
FontFace::glyph_name looked each name up in the font. In a version 2.0
post table the names are one run of strings, and read-fonts walks that
run from its start for every lookup. The Glyphs panel builds the
tooltip of every visible cell in every frame, and the tooltip of a
glyph that no character maps carries its name, so each frame scanned
the table once per such cell.
glyph_name now reads every name of the face in one pass the first time
it is asked, through skrifa's name iterator, and keeps them on the face.
A new test checks the kept names against each glyph's own lookup for
every bundled face.
A document names Gilroy-Black as the family Gilroy in the style Black. WantedFonts only indexed and checked the family name, so a file whose own family is Gilroy-Black, with no style, was never offered, although FontDb::canonical finds that face by its PostScript name once it is cataloged. The joined family and style is now indexed and accepted against a face's PostScript or full name.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
VectorCraft's UI moves onto the shared craft UI framework in storytold/craft-libs (`next`; the framework side is storytold/craft-libs#2809), as PhotoCraft's did. The app keeps its engine, document model, file formats, commands and automation; its windows, panels, bars, dialogs and canvas are now built and driven by the framework: shell, docking and panels, hosted dialogs, keyboard, focus, IME and pointer routing, and theme tokens.
About 264,000 lines of VectorCraft's own egui UI code are removed and about 154,000 added. craft-libs is pinned at bf62d509f (in `next`), the egui fork at f5025284.
Tests that drove the old UI were rewritten against the port where only their premise changed, with their assertions kept. The UI tests still failing at merge, and their follow-ups, are listed in the pull request.