Commit Graph
452 Commits
Author SHA1 Message Date
BFlat 5cb5a1895c Merge pull request #7869 from dotCooCoo/feat/kurikaeshi-moji-shori
Paragraph: Kurikaeshi Moji Shori draws a repeat mark that starts a line as the character it repeats
2026-11-16 08:12:54 +07:00
dotCooCoo 6c5229c851 Merge main into feat/kurikaeshi-moji-shori 2026-11-15 13:43:06 -08:00
dotCooCoo 4a816d626f Merge main into fix/emf-svg-symbol-art-live-effects 2026-11-15 13:42:39 -08:00
BFlat 47d3a5340e Merge pull request #7897 from dotCooCoo/fix/svg-shared-images-skip-hidden-pieces
SVG: hidden pieces of a cut image put no shared image in the defs
2026-11-16 04:28:36 +07:00
BFlat c36cd8dfa5 Merge pull request #7933 from dotCooCoo/fix/svg-import-png-keeps-icc-profile
SVG import: a raster stored again as PNG keeps its ICC profile
2026-11-16 04:27:48 +07:00
dotCooCoo ad275a9291 Merge main into feat/kurikaeshi-moji-shori 2026-11-15 11:59:36 -08:00
dotCooCoo 9392619884 SVG: placed symbol art with live effects writes no duplicate ids
Instances of a symbol whose art has live effects are written as that art placed by each
instance, so a named object in the art appeared once per instance with the same node id and
the same XML id. Symbols' art now takes no name ids, as in an instance that has its own copy
of the art; the instances keep theirs.
2026-11-15 11:31:02 -08:00
dotCooCoo 3a00d5d154 Merge main into fix/emf-svg-symbol-art-live-effects 2026-11-15 10:57:59 -08:00
dotCooCoo d4bbacc3eb Export: live effects in symbol art apply in EMF, WMF and SVG
EMF, WMF and SVG wrote a symbol instance from its symbol's art as stored,
so live effects inside that art were missing: a square moved 100 pt by a
Transform effect stayed in place in the file while the canvas drew it
moved. Art whose own place is off the artboard was left out even when
the effect moved it onto it.

These exports now call bake_document_placing_symbols, as PDF, print, EPS
and DXF do: each instance of a symbol whose art needs baking is written
as that art placed by the instance and then baked, so an instance that
scales or turns its art does not scale what its effects do. EMF and SVG
clip 9-slice cells and WMF does not, as each places other instances. In
SVG those instances are written as groups; instances of symbols without
such effects still share one <symbol>. Preserve Editing still embeds the
document with its live effects.

WrittenLayers gains hidden_objects. SVG sets it with Hidden Layers on,
since it then writes hidden objects too, so a hidden instance is written
hidden with its effects applied. The other exporters leave it off.

An SVG instance nested in another instance's art was shared through
<use> when the def allowed its own transform, while the <use> writes
that transform after the outer instances'. A stroked symbol nested in a
scaled instance then drew its stroke at double weight. The check now
uses the transform the <use> writes.
2026-11-15 10:57:09 -08:00
dotCooCoo 831e539ecc SVG export: a drawn repeat mark in scaled type keeps its character's width
In horizontally scaled type, live SVG text stretched the character a
repeat mark is drawn as (Kurikaeshi Moji Shori) to the mark's advance with
textLength, so a reader narrowed or widened it whenever the two glyphs'
widths differ. Its textLength now takes the width the canvas draws that
character at; the text after it is still placed anew.
2026-11-15 10:54:05 -08:00
dotCooCoo f92a366e3c Merge main into fix/svg-import-absolute-ltr-character 2026-11-15 10:48:48 -08:00
dotCooCoo 250b642812 Merge main into fix/svg-import-png-keeps-icc-profile 2026-11-15 10:48:38 -08:00
dotCooCoo d154d72890 SVG import: absolutely placed characters one text object cannot place import as a group
SVG reorders right-to-left characters only within a text chunk, while one
text object reorders the whole line. In
<text x="100 160 220" direction="rtl">אbג</text> the left-to-right b is
drawn right before ג with no kerning between them, so ג stayed where the
line put it and the import warned.

When kerning cannot put every absolutely placed character on its x, the
text is now cut before each such character and each piece is placed
again, and the text imports as a group of point type objects named after
the element. A text one object can place stays one object. A split text
in a clip path clips by the outlines of all its objects.
2026-11-15 10:48:26 -08:00
dotCooCoo 2d361e2ad7 SVG import: a raster stored again as PNG keeps its ICC profile
An image that SVG import writes again as PNG (a TIFF, or a PNG, JPEG,
GIF or WebP whose orientation turns it) now keeps the ICC profile its
file carries, as an iCCP chunk, when the profile's color space is the
stored samples': gray for gray samples, RGB for RGB ones. Open and
Place already keep it. Profiles of another color space, ones too short
to be a profile, and the profile of a TIFF whose own reader converts
its pixels to RGBA are left out, and the image still imports. Sample
types a PNG doesn't hold are stored as 8-bit RGBA, as Open and Place
store them.
2026-11-15 10:47:47 -08:00
BFlat 39336f44d9 Merge pull request #7863 from dotCooCoo/feat/diacritic-position
Type: Adjust Horizontal and Vertical Diacritic Position move marks off their letters
2026-11-16 01:34:36 +07:00
dotCooCoo 9548a669a0 SVG export: type on a path that starts with a drawn repeat mark is outlined
Type on a path whose frame starts with a repeat mark drawn as the
character it repeats is now written as outlines with a warning, as other
type on a path that a <textPath> cannot reproduce is. With Kurikaeshi
Moji Shori off it stays live text.
2026-11-15 10:18:45 -08:00
dotCooCoo 73502e83ac SVG: hidden pieces of a cut image put no shared image in the defs
The pieces a Warp effect cuts an image into share one <image> in the
defs. The writer counted every piece, hidden ones included, so pieces
the file leaves out (hidden, or in a hidden clip group) still put an
<image> into the defs, with the linked file's path under Images: Link.
A confined caller's read-root check looks only at the art the file
draws and did not refuse it.

Image sharing and the colorized-image counts now walk only the art the
writer draws: hidden layers and objects only with hidden layers kept,
and never a template layer's art.
2026-11-15 09:06:13 -08:00
dotCooCoo f9a2abad18 Paragraph: Kurikaeshi Moji Shori draws a line-start repeat mark as the character it repeats
Paragraph panel menu > Kurikaeshi Moji Shori (text.setFormat
{kurikaeshiMojiShori}) is a paragraph attribute, off by default, saved
only when on and carried by paragraph styles. On, a repeat mark (々, ゝ,
ゞ, ヽ, ヾ) that starts a line of point or area type is drawn as the
character it repeats, with the mark's width, and the text keeps the
mark. Threaded type looks back into the frames before when a paragraph
continues. Live SVG text writes the drawn character and places the
text after it.
2026-11-15 07:02:27 -08:00
dotCooCoo 9afdbe2b03 SVG import: a blur that differs by direction is kept as its SVG filter
A feGaussianBlur or feDropShadow whose blur is not the same in every
direction in the document came in as an even Gaussian Blur or Drop
Shadow of the mean standard deviation. That covers two different
standard deviations (stdDeviation="4 1") and an even one in a skewed or
unevenly scaled user space. An SVG Filters effect in such a user space
is exported live under that transform, so on reopening its blur lost
the difference between directions.

Such a filter is now kept as an SVG Filters effect, which draws it as
it is. A blur in a turned, flipped or evenly scaled user space still
becomes the live effect, and a filter that no SVG Filters effect can
keep still comes in as the nearest even effect, as before.
2026-11-15 06:41:20 -08:00
dotCooCoo f90ac94876 Merge main into feat/diacritic-position 2026-11-15 06:18:24 -08:00
BFlat 8138a6e973 Merge pull request #7814 from dotCooCoo/feat/editing-one-anchor-copies-the-whole-anchor-list
Paths: editing one anchor of a long path keeps one chunk of anchors for undo
2026-11-15 17:31:01 +07:00
BFlat 1387328255 Merge pull request #7731 from dotCooCoo/feat/svg-filter-user-space-matrix
SVG Filters: a filter on a turned or skewed object is kept on import and drawn
2026-11-15 17:30:29 +07:00
dotCooCoo b8b002a662 Merge main into feat/editing-one-anchor-copies-the-whole-anchor-list 2026-11-15 00:21:39 -08:00
dotCooCoo 7c1eb52111 Merge main into feat/diacritic-position 2026-11-14 22:55:52 -08:00
dotCooCoo 0384726c7a Type: Adjust Horizontal and Vertical Diacritic Position move marks off their letters
The Character panel shows Adjust Horizontal and Adjust Vertical Diacritic
Position with the Middle Eastern options. text.setFormat and
text.setRangeStyle take diacriticHorizontal and diacriticVertical, in
thousandths of an em from -1000 to 1000. Positive values move the
characters' mark glyphs (GDEF class 3) right and up, and the letters keep
their places. An Arabic harakat or a Hebrew point styled apart from its
letter takes its own values without splitting the shaping cluster.

Character styles and Character Style Options carry both values. They are
saved only when set, and SVG export writes such type as outlines.

Docs: docs/mcp.md, docs/type-parity.md, docs/target-app-parity.md.
2026-11-14 22:54:10 -08:00
BFlat 4ca206fea9 Merge pull request #7749 from dotCooCoo/fix/svg-textpath-pathlength
SVG import: textPath startOffset follows the path's pathLength
2026-11-15 13:49:33 +07:00
dotCooCoo 7104cd05f3 Merge main into feat/editing-one-anchor-copies-the-whole-anchor-list 2026-11-14 22:05:53 -08:00
BFlat ba350c2e9f Merge pull request #7745 from dotCooCoo/fix/svg-css-not-rule-budget
SVG import: :not() rules test only the rules indexed for the element
2026-11-15 12:37:19 +07:00
dotCooCoo a5493a1cd0 Paths: editing one anchor of a long path keeps one chunk of anchors for undo
A subpath's anchors are now an `Anchors` list held in chunks of up to
256 anchors behind `Arc`s. Copying a path copies the chunk table and
shares the chunks, and editing one anchor copies only the chunk that
holds it, so the undo step of a one-anchor edit no longer keeps a copy
of every anchor of the path. Inserting or removing an anchor copies the
chunk it is in and rebuilds the table. Reads and edits follow the Vec
and slice methods the code used; files write and read each subpath's
anchors as one list, as before, within the same anchor read budget.

The undo memory estimate counts only the chunks the other version of
the path does not hold, and the renderer's kept paths compare only the
chunks an edit copied when they look for moved anchors.

Moving one anchor of an open path of 10,000 or 200,000 anchors
(path.moveAnchor, path.setHandle, path.moveAnchors, a nudge) keeps at
most 48 KiB in its undo and redo steps, where it kept 56 bytes per
anchor.
2026-11-14 21:25:15 -08:00
dotCooCoo 9762e124fc SVG import: textPath startOffset follows the path's pathLength
A startOffset given as a length now counts in the units of the
referenced element's pathLength, so pathLength="100" on a path 400
long puts startOffset="50" at 200. A percentage stays a share of the
computed length. A pathLength of 0 keeps an offset of 0 at the start
and puts any other offset past the end, and an offset too large to
scale starts at the path's end instead of its start.

https://www.w3.org/TR/SVG2/text.html#TextLayoutAlgorithm
https://www.w3.org/TR/SVG2/paths.html#PathLengthAttribute
2026-11-14 21:14:20 -08:00
BFlat 511f36ed4c Merge pull request #7721 from dotCooCoo/fix/glyph-forms-review
Type: glyph forms and width forms follow the OpenType rules
2026-11-15 11:37:33 +07:00
BFlat 23be0cf916 Merge pull request #7634 from dotCooCoo/fix/svg-data-url-decode-bounded
SVG import: image data URLs are decoded once each, within 512 MB per import
2026-11-15 11:36:57 +07:00
dotCooCoo 13fa65cf77 SVG import: :not() rules test only the rules indexed for the element
set_by_not_rules tested every rule with a :not() against every element,
while matched_bytes, which charges the import's selector budget, counts
only the rules Index::candidates gives for the element. A style sheet of
many class-keyed :not() rules made the pre-pass test rules x elements
selectors that the budget never saw. It now loops over the same
candidates, which hold every rule that can match the element, so the
properties it returns are unchanged.
2026-11-14 20:35:10 -08:00
BFlat 26878d3d0e Merge pull request #7715 from dotCooCoo/fix/svg-open-path-type-before-start
Type on a path: type on an open path can start before the path
2026-11-15 10:46:42 +07:00
dotCooCoo 82d2b15946 Merge main into fix/svg-data-url-decode-bounded 2026-11-14 19:28:36 -08:00
dotCooCoo e9cd607aae Merge main into fix/glyph-forms-review 2026-11-14 19:20:09 -08:00
dotCooCoo 6ef785b1d8 SVG Filters: a turned filter measures box units against its box, and export keeps it only where import can
In a turned or skewed user space, the source is drawn onto the filter's
canvas pixels first and cut to the pixels it draws there, so the image
lies along the user space's axes. A region in objectBoundingBox units
(the default filterUnits) and primitive lengths with
primitiveUnits="objectBoundingBox" are then measured against the
object's box in that user space instead of the raster's box turned into
it.

SVG export and the image fallback keep a filter live only when SVG
import can store its user space again: scale and axes together can
scale it past 0.001 to 1000 points to a unit while each is valid alone
(scale 1000 with axes [2, 0, 0, 2]). Such an object is written as an
image. Import and export share the user-space check.
2026-11-14 19:00:19 -08:00
dotCooCoo b981c987c1 SVG Filters: a filter on a turned or skewed object is kept on import and drawn
An SVG whose filtered element sits under a rotate, skew, uneven scale or
matrix transform now opens with the filter as a live Effect > SVG Filters
effect instead of losing it with a warning.

- The svg.filter effect takes an optional axes [a, b, c, d]: the document
  directions of one unit along the filter's x and y axes, before scale.
  effect.apply and effect.setParams refuse axes with an entry outside
  -1000..1000 or a determinant within 0.001 of 0.
- With axes, the filter runs on a canvas lined up with its user space, so
  offsets, blurs and the region run along the element's axes, and the
  result is drawn back through axes. The canvas holds at most 4 times the
  object's raster pixels. A region measured against the object's box uses
  the object's box in that user space.
- SVG import stores the element's user space as scale, origin and axes.
- SVG export writes such a filter live: a group's transform holds the
  user space, and the art is written in document coordinates in a group
  with the inverse transform, so strokes keep their widths.
2026-11-14 18:09:00 -08:00
BFlat 905eb30384 Merge pull request #7716 from dotCooCoo/fix/svg-import-budget-shared
SVG import: bound selector matching and share the limits with linked and embedded SVGs
2026-11-15 08:24:10 +07:00
BFlat 69a9df31fe Merge pull request #7700 from dotCooCoo/fix/svg-clip-use-both-clips
SVG import: a use in a clip path clips by its own clip path and its text's
2026-11-15 08:24:03 +07:00
dotCooCoo 0f8b20c489 Type: glyph forms and width forms follow the OpenType rules
- A form other than the default, set with text.setRangeStyle or
  text.setFormat, takes away the characters' glyph choice, which would
  otherwise keep drawing its own glyph. "default" keeps it.
- With a width form (fwid, hwid, twid, qwid), shaping leaves out palt and
  turns kern and apkn off, and SVG output writes font-kerning: none and no
  palt, as the OpenType feature list asks. proportionalMetrics and kerning
  keep their values.
- The Glyphs panel menu counts a width form as available when a face has
  the feature in GSUB or GPOS.
- At a caret, the menu's check marks and its no-op check read all the
  text of the object, which is what the command formats. Choosing the
  current form again is not skipped when a character has a glyph choice.
2026-11-14 16:39:01 -08:00
dotCooCoo 89f20c45c4 SVG import: bound selector matching and share the limits with linked and embedded SVGs
The measurement that runs before the style cascade and usvg now covers
the inputs that still got past it:

- usvg matches a selector without keeping what it found, so one whose
  leftmost part matches nothing tests every set of ancestors in turn.
  The measurement counts those tests for each copy and stops at
  50,000,000; past that the SVG is refused with "the SVG's style sheets
  take too long to match". An SVG image's matching stops at what the
  SVG showing it left.
- A test counts one more for every 16 attributes a lookup scans and
  every 16 bytes of the value it compares, so many classes against a
  long class list count the work they do, in usvg's matching and in
  the import's own cascade.
- The declarations the import's own cascade keeps, once per element,
  count toward the 64 MB, including those of `:not()` rules, which usvg
  drops. Each `:not()` alternative counts as a test.
- A linked SVG file is measured before its cascade runs. The linked SVG
  files share one measurement: once they pass the limits together, the
  files after that are shown without their links. The tests a file past
  the limits made still count.
- SVG images share the element limit and the selector tests with the
  SVG showing them, as they already shared the 64 MB.

The svg_filters reader measures its SVG before the cascade too.
2026-11-14 16:10:10 -08:00
dotCooCoo 094971e3ac Type on a path: type on an open path can start before the path
Type on an open path can now start before the path's start: its start
is stored below 0, the span runs from there, and the characters whose
middle falls before the path's start are not drawn, as SVG 2 lays out
text on a path (https://www.w3.org/TR/SVG2/text.html#TextLayoutPath).
The text keeps every character, and the start bracket stays at the
path's start. Past the path's end, text that does not fit is overflow,
as for other type on a path. Type that starts on the path draws every
glyph as before.

- SVG import keeps a <textPath> start before an open path's start
  (text-anchor end or middle, or a negative startOffset) instead of
  starting the text at the path's start, which drew every character.
- SVG export writes it as a negative startOffset.
- PDF export writes only the characters drawn on the path.
- The legacy .ai and .ai editing data writers write the type from the
  path's start with the type attributes warning.
- type.pathOptions takes a start below 0 for type on an open path; on a
  closed path it is the path's start, as before. A flip starts the type
  at its start bracket. Dragging the center bracket slides it from where
  it starts, and no further before the path.
- A click at the path's start places the caret by the first drawn
  character, and the caret in the hidden characters stands at the
  path's start. The highlight of substituted fonts and glyphs leaves
  them out.
- Release Type on a Path keeps the first drawn glyph where it was
  drawn, with the hidden characters before it.
- The Touch Type tool shows no box for a hidden character, and
  text.touchType returns an error for one. A character with a drawn
  glyph is changed by that glyph.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-14 15:44:12 -08:00
BFlat 4e42e2bbb0 Merge pull request #7681 from dotCooCoo/feat/east-asian-glyph-forms
Type: Glyphs panel menu draws the selected characters in an East Asian glyph form
2026-11-15 06:17:55 +07:00
dotCooCoo 7d5ad4564b SVG import: a use in a clip path clips by its own clip path and its text's
A <use> in a clip path that shows a text kept only one clip path when
both carried one: the text's own applied, and the <use>'s was dropped
with the warning "clip path of ... in a clip path ignored: the text's
own applies", so art that the <use>'s clip path should hide showed.

The placeholder for such a text now clips by a clip path that holds
both: the text's clip path in the text's user space and the <use>'s in
the <use>'s, each on a rectangle over the text's bounds so a clip path
in bounding box units still measures the text.
2026-11-14 15:05:54 -08:00
BFlat ccb62b0912 Merge pull request #7660 from dotCooCoo/fix/svg-use-chain-bounded
SVG import: refuse an SVG whose use copies and styles expand past the limits
2026-11-15 05:27:22 +07:00
dotCooCoo f4a5d65f6b Type: Glyphs panel menu draws the selected characters in an East Asian glyph form
With Show East Asian Options on, the Glyphs panel menu lists Traditional
Forms, Expert Forms, JIS 04, JIS 90, JIS 78 and JIS 83 Forms, Monospaced
Full-Width, Half-Width, Third-Width and Quarter-Width Forms, and Revert
To Default Forms. Each form draws the selected characters with the
font's OpenType feature for it (trad, expt, jp04, jp90, jp78, jp83,
fwid, hwid, twid or qwid). A form is checked when every selected
character has it and disabled when none of the faces that draw the
selected text, fallback faces included, has the feature.

The form is a new character attribute, glyphForm, one form at a time
(text.setFormat, text.setRangeStyle). It is saved only when set,
character styles carry it, and runs that differ only in their form
shape as one piece of text. SVG writes it in font-feature-settings;
PDF draws the glyphs from the layout.
2026-11-14 13:29:30 -08:00
dotCooCoo 850ef83511 SVG import: a kept filter's feImage holds its data URL, not the key
The prepass writes a key in place of each <feImage> data URL before usvg
reads the SVG, and the filters kept as Effect > SVG Filters were read from
that edited text, so their XML held the key. The effect's check refused it
and the filter was dropped with a warning. The filter's XML now has each
keyed href put back as it was written.
2026-11-14 13:14:04 -08:00
dotCooCoo fcda95ca23 Merge main into fix/svg-data-url-decode-bounded 2026-11-14 12:12:18 -08:00
dotCooCoo df257c2d53 Merge main into fix/svg-raster-keeps-resolution 2026-11-14 12:12:06 -08:00