Skip to content

.ai import: keep All Caps and Small Caps on type from the editing data - #4708

Merged
bflatastic merged 1 commit into
storytold:mainfrom
mockydevs:fix/ai-all-caps-text
Oct 30, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
mockydevs:fix/ai-all-caps-text

Conversation

@mockydevs

@mockydevs mockydevs commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Type set in All Caps or Small Caps in a .ai file loses that setting when it is read from the editing data. Words show as typed: a heading the page draws as "BEST HOME SOLUTIONS" shows as "Best Home Solutions".

Cause

Texts::style (crates/eps/src/import/ate.rs) reads a character style's font, size, leading, scaling, tracking, baseline shift, fill and stroke from the text document. It skips attribute 12, the case. Each character's case setting is in CharStyle::all_caps or CharStyle::small_caps, but this reader never set either, so the characters showed exactly as typed.

Fix

style reads key 12, falling back to the document's defaults like the other keys. char_style then maps the value:

  • 2 sets all_caps.
  • 1 sets small_caps, at Document Setup's default Small Caps size.
  • 0 and any other value leave the case as typed.

The characters stay as typed, as with the Character panel's own buttons.

I checked what the values mean the way the module's other keys were checked, against the type each file's page draws:

  • In a user's set of .ai files and Illustrator PDFs, 16,355 of 16,673 runs of type have 0.
  • 312 runs in 71 files have 2. Their pages draw them in capitals.
  • 6 runs in one file have 1, and its page draws them as small capitals.
  • No other value appears.

Reproduced and verified

file (from a user's set) before after
4 logos and letterheads that open from their layers All Caps words exported in mixed case in capitals, as their pages draw them (one compared side by side)
the files that open from their PDF part unchanged unchanged

Screenshots

A logo from a user's file, opened from its layers and exported to PNG by the CLI before and after this change. Its heading is set in All Caps. The width differs from the page because the font isn't installed and a fallback is used.

Before:

before: the heading reads "Best Home Solutions"

After:

after: the heading reads "BEST HOME SOLUTIONS", as the page draws it

Tests

  • crates/eps/src/import/tests_native.rs: type_from_the_text_document_keeps_its_case_setting. A text document of three point-type stories, with key 12 set to 2, 1, and not set. The stories come in with All Caps, with Small Caps at the document's size, and with neither, and their text is as typed. Without the fix, the first assertion fails: the run's all_caps is false.
  • Passing: cargo test -p vectorcraft-eps, cargo test -p vectorcraft-engine --lib ai (334 tests), cargo fmt --check, cargo clippy -p vectorcraft-eps --all-targets --no-deps -- -D warnings, cargo xtask layers, cargo xtask wasm.

Not covered

  • A file's own Small Caps size (Document Setup → Type) isn't read; small capitals use the default size.
  • Case set only in a named character style, with no override on the run, isn't read, the same as the reader's other attributes.

Summary by CodeRabbit

  • New Features
    • Imported text from Illustrator (.ai) now preserves All Caps and Small Caps formatting. The displayed text remains unchanged, while its character styling reflects the case setting.
    • Text with no case setting continues to display without All Caps or Small Caps formatting.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 435fa96 and d211ca7.

Files selected for processing: 3
  • crates/eps/src/import/ate.rs
  • crates/eps/src/import/tests_native.rs
  • docs/file-format-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The Illustrator text importer now preserves All Caps and Small Caps settings from editing data. It records the settings in character runs without changing the underlying text. A regression test covers both settings and text without a case setting.

Changes: Illustrator text case settings

Layer / File(s) Summary
Parse and apply caps settings
crates/eps/src/import/ate.rs, crates/eps/src/import/tests_native.rs, docs/file-format-parity.md
The importer reads character attribute 12. Value 2 sets all caps; value 1 sets small caps using the default document-setup size. Other or missing values default to 0. The regression test checks that text stays unchanged and that the run styles reflect these settings. The parity notes record the change.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: bflatastic

Merge Risk: Minimal · up to d211c

The importer change has no established merge-blocking risk in the reviewed scope.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: preserving All Caps and Small Caps settings during .ai text import.
Description check Passed The description explains the problem, cause, fix, scope, verification steps, tests, and known limitations. It does not include the repository checklist section, but the required change and testing inf…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, cause, fix, scope, verification steps, tests, and known limitations. It does not include the repository checklist section, but the required change and testing information are otherwise complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
⚔️ Resolve merge conflicts: 💡
  • Resolve merge conflict in branch fix/ai-all-caps-text
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

…cument

Character attribute 12 of the editing data's text document is the case
(1 Small Caps, 2 All Caps). The reader skipped it, so type set in All Caps
came in as typed, in lower or mixed case where the page draws capitals.
Map it onto CharStyle::all_caps and CharStyle::small_caps.
@bflatastic
bflatastic force-pushed the fix/ai-all-caps-text branch from d211ca7 to 530605d Compare October 30, 2026 17:50
@bflatastic
bflatastic merged commit aeb827f into storytold:main Oct 30, 2026
3 checks passed
bflatastic pushed a commit to mockydevs/vectorcraft that referenced this pull request Oct 30, 2026
Adds the evidence and revision rows that target-app-parity.md and
roadmap.md expect for the .ai/EPS import changes of 2026-10-30 (storytold#4708,
storytold#4664, storytold#4723, storytold#4742, storytold#4658, storytold#4727, storytold#4738, storytold#4744, storytold#4748, storytold#4743). Scores
and estimates unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants