Commit Graph
740 Commits
Author SHA1 Message Date
dotCooCoo 31876d6775 Merge main into feat/font-sheet 2026-12-04 20:36:17 -08:00
FredApps 44ffd596e8 Merge branch 'main' into feat/gujarati-web-ui 2026-12-04 10:28:06 +01:00
dotCooCoo 20a5b6eb50 Merge main into fix/doc-tests-unsafe-code 2026-12-03 19:53:53 -08:00
dotCooCoo 983a7a2522 Merge main into feat/font-sheet 2026-12-03 11:02:31 -08:00
dotCooCoo a244590e8b Fonts: add the bundled fonts to the font catalog on its first read
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
2026-12-03 10:44:28 -08:00
dotCooCoo 9c11c47f75 Doc tests: unsafe code is denied in doc tests too
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.
2026-12-03 09:51:28 -08:00
dotCooCoo 206fc9684f Tests: remove the fallback size test's folder when the test panics
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.
2026-12-02 21:34:29 -08:00
dotCooCoo 00cb293b97 Tests: bent type on a path and the fallback file size limit
- 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.
2026-12-02 20:54:45 -08:00
dotCooCoo 9217a44f6e Type: font sheet checks the capitals All Caps draws
With All Caps on in [Normal Character Style], layout draws the sample in
capitals, but the coverage check looked only at the text as typed, so a
font with a lowercase letter and no capital was left out of the fallback
warning. The check now also tests the capitals, in plain fonts and in
composite fonts, where each cluster's part is still chosen by the
character as typed.
2026-12-02 14:05:15 -08:00
dotCooCoo 8cdfcdbb5c Merge main into feat/font-sheet 2026-12-02 12:20:29 -08:00
dotCooCoo 0db6dddc60 Type: Font Sheet lists composite fonts lacking sample glyphs as fallbacks
A composite font's entry was never named in `fallback`, even when the
part that sets the sample lacked a glyph it needs. The entry now checks
each grapheme's part face for the characters layout draws, in the
sample's numeral system, through the new
`FontDb::composite_drawn_coverage`.
2026-12-02 06:34:37 -08:00
dotCooCoo fffcca5cd2 CI: build paths without parent-step literals the read check counts as reads
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.
2026-12-02 06:20:29 -08:00
ruchirguitar 750bf94b59 Web: Gujarati can be chosen as the interface language
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.
2026-12-02 19:33:51 +05:30
dotCooCoo 9b40798f6a Merge main into fix/retype-period-font-order 2026-12-02 00:40:20 -08:00
dotCooCoo 5dcc1519e4 Merge main into feat/font-sheet 2026-12-02 00:38:36 -08:00
.CooCoo 95dd368c2c Merge pull request #10188 from dotCooCoo/fix/craft-fonts-pin-main
CI: move the craft-fonts pin to craft-fonts main in every workflow, so builds embed the tab-title face
2026-12-01 22:27:41 -08:00
.CooCoo 40b3f26d62 Merge pull request #10535 from dotCooCoo/fix/sysfonts-menu-family-held-scan
Tests: the menu family list test holds the font scan with a lister
2026-12-01 22:12:54 -08:00
.CooCoo 22bc29d69d Merge pull request #10460 from dotCooCoo/fix/test-lint-mirror-false-alarms
xtask: test-lint mirror leaves out entry reads, never-run follows #[path] modules
2026-12-01 20:19:50 -08:00
dotCooCoo 1957da7178 Tests: the menu family list test holds the font scan with a lister
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.
2026-12-01 19:54:21 -08:00
dotCooCoo 6e6a9a6d2f Merge main into fix/craft-fonts-pin-main 2026-12-01 19:29:33 -08:00
dotCooCoo 5071f17319 Tests: skip the Hebrew mark cluster test when no font covers Hebrew
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.
2026-12-01 17:53:19 -08:00
dotCooCoo 771e73d405 Tests: Hebrew mark clusters must cover the whole word
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.
2026-12-01 17:47:59 -08:00
dotCooCoo beeeacafe5 Tests: text and doc tests check what the code returns, not only that it is there
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.
2026-12-01 17:25:24 -08:00
dotCooCoo a61a9ba254 Merge main into fix/test-lint-mirror-false-alarms 2026-12-01 16:17:26 -08:00
.CooCoo 4596f1a8be Merge pull request #10374 from dotCooCoo/fix/swallowed-regression-guards
Tests: guards check the environment, not the output under test
2026-12-01 14:10:23 -08:00
dotCooCoo ebc14a9b36 Type: Create Font Sheet names entries whose font lacks a glyph of the sample
An entry whose font has no glyph for a character the sample draws (by the
shaper's rules and the style's numerals) stays on the sheet, and is listed
in `fallback` and named in the warning. Composite font names given in
another letter case, accented letters included, are found as the font
database compares names.
2026-12-01 13:37:32 -08:00
dotCooCoo 2933880c63 Merge main into feat/font-sheet 2026-12-01 11:03:27 -08:00
dotCooCoo eca4eae37d Merge main into fix/test-lint-mirror-false-alarms 2026-12-01 07:13:57 -08:00
.CooCoo dd144f7cab Merge pull request #10440 from dotCooCoo/fix/test-tolerances-text-color
Tests: tighten loose bounds in color and text tests
2026-12-01 06:50:03 -08:00
dotCooCoo b2e8b5637e Merge main into chore/never-run-test-allows 2026-12-01 02:55:37 -08:00
dotCooCoo 6ea1132e5c Tests: tighten loose bounds in color and text tests
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.
2026-12-01 02:27:00 -08:00
dotCooCoo 010367e39e Tests: allow the 26 Windows and macOS tests that CI never runs
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.
2026-12-01 01:46:09 -08:00
dotCooCoo c9d9b75f76 Tests: the held font scan test no longer hangs when its pipe is released early
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.
2026-12-01 01:30:45 -08:00
dotCooCoo 1dbbf87436 Tests: guards check the environment, not the output under test
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.
2026-11-30 21:56:24 -08:00
dotCooCoo ff79ce65b7 Merge main into feat/font-sheet 2026-11-30 06:08:58 -08:00
dotCooCoo bf562e3717 Retype: near matching reuses poses by outline group without comparing again
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.
2026-11-30 05:27:38 -08:00
dotCooCoo 3e0a3f6cc7 Retype: outline comparisons in near matching count toward its work limit
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.
2026-11-30 04:52:29 -08:00
dotCooCoo 5b0fbec416 Retype: glyphs drawn alike in several fonts count as one outline in near matching
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.
2026-11-30 02:55:01 -08:00
dotCooCoo 2198519cc7 Type Tools: Create Font Sheet keeps its opening artboard and sizes rows by ink
Preview and OK now place the sheet on the artboard that was active when
the dialog opened, and the view's active artboard is restored afterwards.
Deleting that artboard while the dialog is open is refused; if it is gone,
Preview and OK stop and ask to reopen the dialog. Other add-on dialogs keep
using the current artboard.

Rows are sized from each run's laid-out ink, so composite fonts whose
sample uses fallback faces get rows tall enough for what they draw. The
layout keeps per-run ink bounds so labeled sheets measure each glyph
outline once.
2026-11-29 22:18:10 -08:00
dotCooCoo c61c271b74 CI: move the craft-fonts pin to craft-fonts main in every workflow
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.
2026-11-29 20:05:10 -08:00
dotCooCoo d2b18d1270 Text: web-fonts.txt lists only faces that craft-fonts ships
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.
2026-11-29 16:50:38 -08:00
.CooCoo 378ab8525e Merge pull request #9950 from dotCooCoo/train/carry9243
Missing Fonts: a folder search finds the file of a PostScript name split into family and style (carries #9243)
2026-11-28 13:15:06 -08:00
dotCooCoo 69e8a0a392 Fonts: offer a split PostScript name's file only when installing it resolves the name
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.
2026-11-28 09:33:49 -08:00
dotCooCoo 990c8b2d26 Fonts: test the full-name and empty-style cases of the split PostScript name search
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.
2026-11-28 08:37:27 -08:00
dotCooCoo b812b4a627 Merge main into train/carry9243 2026-11-28 08:11:20 -08:00
dotCooCoo 338a5c7a32 Merge main into fix/previewbounds-memo-flake 2026-11-28 05:18:26 -08:00
dotCooCoo 0753eeeb9b Merge main into fix/issue-8583 2026-11-27 22:29:29 -08:00
dotCooCoo 90749b1646 Tests: text tests count work and wait on handshakes instead of the clock
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.
2026-11-27 17:10:42 -08:00
dotCooCoo 64ada8e7fc Tests: hover memo counts hold plug-ins and hyphenation steady
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.
2026-11-27 15:23:49 -08:00
BFlat a431537d95 Merge pull request #8823 from dotCooCoo/feat/retype-installed-fonts
Retype: installed fonts that are not loaded yet are matched too
2026-11-27 05:09:16 +07:00