Merge pull request #7229 from dotCooCoo/feat/kinsoku-sets

Type: Kinsoku Shori sets can be created, edited and chosen per paragraph
This commit is contained in:
BFlat
2026-11-19 14:54:38 +07:00
committed by GitHub
57 changed files with 3072 additions and 119 deletions
+53 -10
View File
@@ -11052,12 +11052,50 @@ which Japanese characters may not start or end a line. **Hard** (the default; ne
setting) keeps closing brackets, commas, full stops, middle dots, iteration marks, the prolonged sound mark ー and small
kana off the line start, and opening brackets off the line end. **Soft** lets 々, ー and small kana start a line, as
JLREQ's level 3 line-breaking rules do (https://www.w3.org/TR/jlreq/#addendum_a3); the rest of the set stays.
**None** applies no kinsoku. `hard` isn't saved. One undo step.
**None** applies no kinsoku. `hard` isn't saved. The name of a custom set of the document (`type.kinsokuSets.list`, any
case) gives each paragraph a copy of that set, saved with the paragraph (`kinsoku_set` in `para`) beside Hard, so an
older build reads the paragraph as Hard; a name the document has no set of fails the call and changes nothing.
Paragraph styles carry the set; `paraStyle.new` and `paraStyle.setAttrs` given `kinsoku_set` with `kinsoku` None or Soft,
or with a blank or built-in set name, fail and change nothing. One undo step.
```json
{"name":"run_command","arguments":{"command":"text.setFormat","params":{"kinsoku":"soft"}}}
```
## Kinsoku Shori Settings
`type.kinsokuSets.set {sets: [{name, from?, cannotStart?, cannotEnd?, hanging?, inseparable?}]}` (Type › Kinsoku Shori
Settings…'s OK, shown with the East Asian options) replaces the active document's custom Kinsoku Shori sets as one undo
step, and records none when nothing changes. `cannotStart` lists the characters that never start a line, `cannotEnd`
those that never end one, and `hanging` the punctuation that Burasagari hangs outside a line's end, each as text, one
character after another. `inseparable` lists sequences of 2 to 16 characters that a line never breaks inside while
Bunri-Kinshi is on. `cannotStart`, `cannotEnd` and `hanging` keep each character once, sorted; `inseparable` keeps each
sequence once, sorted, so a sequence may repeat a character (`……`). Each category holds at most 4096 characters (a
sequence counts each of its characters); a control or space character in a category fails the call. Names are trimmed, 1 to 128 characters, unique in any
case and never None, Hard or Soft; a document holds at most 256 sets. These limits are VectorCraft's own. A set with
the name of a set the document has (any case) and no `from` edits that set; `from` names the set it renames. Every
paragraph and paragraph style using an edited set takes its new characters and name, and those using a set left out
take Hard. An unknown key, a null value, a name used twice, a `from` the document has no set of and a sequence of one
character fail the call and change nothing. The built-in None, Hard and Soft are not stored and can't be changed. → `{sets}`.
`type.kinsokuSets.list` returns the sets with how many paragraphs (`paragraphs`), paragraph styles (`styles`) and graphs
(`graphs`, in the paragraph attributes a graph keeps for its labels) use each. `type.kinsokuSets.base {base: "hard"|"soft"|"none"|name, name?}` returns the categories a new set based on a
built-in or custom set starts with: Hard and Soft list the characters they keep off a line's start and end, the East
Asian comma and full stop as hanging punctuation and the Bunri-Kinshi pairs; None lists nothing.
Type › Kinsoku Shori Settings… opens a dialog on the document's sets: Kinsoku Set picks one, New adds a set based on
the choice in Based on (Hard, Soft, None or a set of the dialog), Delete takes the one picked out, the four fields edit
its categories (inseparable sequences separated by spaces), and Unicode with Add puts the character of a code point
(`U+3001` or `3001`) into Cannot Start Line, Cannot End Line or Hanging Punctuation. Nothing changes until OK, which
runs `type.kinsokuSets.set`; a refused set keeps the dialog open. The Paragraph panel's Kinsoku Set lists the custom
sets after None, Hard and Soft, and its last entry opens the dialog. Importing and exporting sets is not available.
The help page:
https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/use-kinsoku-for-japanese-line-breaking.html
```json
{"name":"run_command","arguments":{"command":"type.kinsokuSets.set","params":{"sets":[{"name":"Tight","cannotStart":"、。」ー","cannotEnd":"「(","hanging":"、。","inseparable":["——","……"]}]}}}
```
## Kinsoku Shori Type
`text.setFormat {kinsokuType: "pushInFirst"|"pushOutFirst"|"pushOutOnly"}` (Paragraph panel menu › Kinsoku Shori Type,
@@ -11070,8 +11108,8 @@ of the character before it and by at most a tenth of that em; a line that cannot
tab, pushes out instead. **Push Out First** pushes in
the same way only when pushing out would leave the line more than an em, of the character before the break, short of
its measure. **Push Out Only** (the default: new type and documents from before the setting) moves the
character before a prohibited line start to the next line with it. With Burasagari on, an overflowing comma or full
stop may hang outside the margin first, leaving the preceding character on the line. With Kinsoku Set None the setting
character before a prohibited line start to the next line with it. With Burasagari on, overflowing hanging punctuation
of the Kinsoku Set may hang outside the margin first, leaving the preceding character on the line. With Kinsoku Set None the setting
does nothing. When Push In First or Push Out First is selected and a paragraph contains a prohibited line-start or
line-end character, the whole paragraph is broken line by line, as the Single-line Composer breaks it, even if no line
ends up pushing a character in. The setting is saved
@@ -11089,10 +11127,13 @@ on or off for the paragraphs of the selected type (or `ids`, or the paragraphs a
line never breaks inside an inseparable pair: two em dashes (U+2014), two horizontal ellipses (U+2026), two two-dot
leaders (U+2025), or the upper half of a vertical kana repeat mark (U+3033 or U+3034) followed by its lower half
(U+3035), the pairs W3C JLREQ lists for its class cl-08 (https://www.w3.org/TR/jlreq/#cl-08), which are VectorCraft's
set. A chain of em dashes stays together as well. A pair is two neighboring characters, whatever their fonts and
styles; a forced line break between them ends the line as before. Both composers, vertical type, Kinsoku Shori Type,
hyphenation and No Break follow it, and a pair wider than the line stays whole on it. Justification adds no space inside
a pair. The setting works only with a Kinsoku Set: with Kinsoku Set None the paragraph keeps the value without effect,
set for Hard and Soft. A chain of em dashes stays together as well. With a custom Kinsoku Set, the set's inseparable
sequences (Kinsoku Shori Settings) replace these pairs: a line never breaks between two characters of an occurrence of
one of them, such as `AB` or `あいう`, and occurrences may overlap. A custom set keeps a built-in pair together only
when it lists that pair, as a set based on Hard or Soft does. A pair or sequence is neighboring characters, whatever
their fonts and styles; a forced line break between them ends the line as before. Both composers, vertical type,
Kinsoku Shori Type, hyphenation and No Break follow it, and a pair or sequence wider than the line stays whole on it.
Justification adds no space inside a pair or sequence. The setting works only with a Kinsoku Set: with Kinsoku Set None the paragraph keeps the value without effect,
and the menu item is unavailable. Off by default, for new type and for paragraphs saved before the option. It is saved
with the paragraph (`bunri_kinshi` in `para`) only when on, paragraph styles carry it (Paragraph Style Options › East
Asian Composition Settings), and Reset Panel turns it off. A value that is not true or false is refused. One undo
@@ -11151,9 +11192,11 @@ help page: https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-an
## Hanging punctuation (burasagari)
`text.setFormat {burasagari: "none"|"standard"|"forced"}` sets the Paragraph panel menu's Burasagari (None / Regular /
Force) of the selected type (or `ids`): an East Asian comma or full stop ending an area type line (、。,., half-width
、。) hangs outside the frame, Regular only when it doesn't fit, Force always (the rest of the line then fills the
measure). Closing brackets and Latin punctuation don't hang; point type, right-to-left and hyphenated lines are left as
Force) of the selected type (or `ids`): hanging punctuation ending an area type line hangs outside the frame, Regular
only when it doesn't fit, Force always (the rest of the line then fills the measure). With the Kinsoku Sets None, Hard
and Soft, the hanging punctuation is the East Asian comma and full stop (、。,., half-width 、。), and closing brackets and
Latin punctuation don't hang. A custom Kinsoku Set hangs the characters in its `hanging` category instead (Kinsoku Shori
Settings), closing brackets and Latin punctuation included. Point type, right-to-left and hyphenated lines are left as
they are. The hanging mark is as wide as its punctuation spacing makes it (`mojikumi`). New type (the Type tools,
`text.create`) takes `standard`; documents from before it and imported text keep `none`, except legacy `.ai` type
with binding punctuation (`Tg`) on, which opens as `forced`. `none` isn't saved. One undo step.
+2 -1
View File
@@ -1716,7 +1716,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Optical Margin Alignment and Roman Hanging Punctuation hang right-to-left paragraphs of point and area type, and type on a path whose first paragraph runs right to left, too. Auto aligns a right-to-left line at its right, or at the end bracket of a path, so it hangs there. A right-to-left line is read from right to left: where it hangs at its left margin, `."` ending it hangs both glyphs.
Type on a path with right-to-left text that does not fit shows the longest start of its text whose glyphs fit, also where tracking gives a letter a negative advance and a shorter start does not fit; the rest overflows or flows to the next threaded object (VectorCraft's own rule). Without hanging punctuation, and on a straight path or with no spacing, every start is measured without arranging it on the path again. With hanging punctuation, or spacing on a curve, when a letter has a negative advance, at most 32 of the starts that could fit are arranged one by one from the longest; when none of them fits, a binary search over the rest shows a start that fits, which is not always the longest (`overflowing_rtl_type_on_a_path_shows_the_longest_start_that_fits`, `the_longest_rtl_start_on_a_path_is_found_without_arranging_each_start`, `the_longest_rtl_start_on_a_path_is_the_one_each_start_gives` and `rtl_type_on_a_curve_whose_letters_take_the_line_back_is_arranged_a_bounded_number_of_times` in `crates/text/src/tests/bidi.rs`). Right-aligned and centered type on a curve with Spacing is placed by what its glyphs take where the line ends up, so text that fits is not cut off at the end bracket (`on_path_aligned_spaced_text_that_fits_shows_whole` in `crates/text/src/tests.rs`).
The Paragraph panel menu's Kinsoku Shori Type (`text.setFormat {kinsokuType}`, with the East Asian options) picks Push In First, Push Out First or Push Out Only for each paragraph: a character the Kinsoku Set keeps off a line's start or end is set on the line, with the line's gaps next to CJK characters closed by at most a tenth of an em each to fit, or moved to the next line with the character before it. Push Out First pushes in only when pushing out would leave the line more than an em short. Push Out Only is the default, the setting is saved only when it is not, and paragraph styles carry it.
The Paragraph panel menu's Bunri-Kinshi (`text.setFormat {bunriKinshi}`, with the East Asian options, and the East Asian Composition Settings section of Paragraph Style Options) keeps inseparable pairs on one line in each paragraph that has it: two em dashes, two ellipses, two two-dot leaders and the two halves of a vertical kana repeat mark (the pairs of W3C JLREQ's class cl-08, VectorCraft's set). Both composers and vertical type follow it, and justification adds no space inside a pair. It works with a Kinsoku Set only, is off by default and is saved only when on; editing the set of pairs is not available.
The Paragraph panel menu's Bunri-Kinshi (`text.setFormat {bunriKinshi}`, with the East Asian options, and the East Asian Composition Settings section of Paragraph Style Options) keeps inseparable pairs on one line in each paragraph that has it: two em dashes, two ellipses, two two-dot leaders and the two halves of a vertical kana repeat mark (the pairs of W3C JLREQ's class cl-08, VectorCraft's set). Both composers and vertical type follow it, and justification adds no space inside a pair. It works with a Kinsoku Set only, is off by default and is saved only when on; the built-in pairs can't be edited, and a custom Kinsoku set keeps its own inseparable sequences instead.
Type › Kinsoku Shori Settings… (`type.kinsokuSets.set`, with the East Asian options) creates, edits, renames and deletes the document's custom Kinsoku Shori sets, each a list of characters that may not start a line, characters that may not end one, hanging punctuation and inseparable sequences, new ones based on Hard, Soft, None or another set, with characters added by Unicode code point. The Paragraph panel's Kinsoku Set and paragraph styles choose a custom set for each paragraph (`text.setFormat {kinsoku: name}`); editing a set changes the paragraphs that use it, and deleting one gives them Hard. Importing and exporting sets is not available ([the help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/use-kinsoku-for-japanese-line-breaking.html)).
`.ai` import reads each paragraph's Kinsoku Set (None, Hard or Soft), Kinsoku Shori Type, Burasagari and Bunri-Kinshi from the file's editable text: the paragraph's own setting, else its paragraph style's or a style that one is based on, else the document's default. A paragraph with a custom Kinsoku set takes its paragraph style's set, and the importer warns about it. A value it cannot read takes its paragraph style's value too. An `.ai` save writes all four settings for every paragraph, the normal paragraph style and the document's defaults, and lists the Hard and Soft sets, in the form that reader reads, so they reopen as set and are not reported as left out; Burasagari and Bunri-Kinshi keep their values under Kinsoku None.
The Paragraph panel menu's Korean Line Break Anywhere (`text.setFormat {koreanLineBreakAnywhere}`, with the East Asian options, and the East Asian Composition Settings section of Paragraph Style Options) sets for each paragraph whether a line may break between any two Hangul syllables. When it is off, a word that contains Hangul breaks only at its spaces and after punctuation, or where the word is wider than the line, and takes no hyphen. New type has it off; paragraphs saved before the option read as on, so their lines do not move.
The Paragraph panel menu's Reset Panel (`text.setStyle`, `text.setFormat` and `text.tabs.clear`) gives the selected type's paragraphs, or the paragraphs the Type tool's selection touches, Auto alignment, no indents or paragraph spacing, Hyphenate off with the default Hyphenation and Justification options, Auto direction, Bottom-to-Bottom Leading, the Line-end Punctuation Half Width Mojikumi Set, Regular burasagari, the Hard kinsoku set, Push Out Only, the Every-line Composer, Bunri-Kinshi, Roman Hanging Punctuation and Korean Line Break Anywhere off, no kashidas and no tab stops, as one undo step.