Break Kind.Cjk Cluster()- Module
- std.
typeset - Receiver
- Not applicable
- Minimum arity
- 0
- Maximum arity
- 0
Declaration and parameters
LinkAvailability
Included by default: Pending
Import std.typeset in language mode 5.21.
The current compiler selects std/typeset.tpz for this language mode. Availability in other released editions and inclusion in each installed distribution are Pending.
Source evidence
- compiler/crates/topaz_resolve/src/stdlib.rs at
b48527d0a174· 40
Receiver
Parameter constraints
Break constructs the variant for the existing CJK and East Asian cluster classification. Break is absent and rejected.
Renaming this variant preserves the classification predicates and the effect of the selected Unicode, locale, custom punctuation, and shaping-boundary policies.
A CjkCluster category does not itself permit a break. classify returns the opportunities admitted by its supplied policy.
KinsokuRules is an explicit choice of boundary policy. AtlasDefault retains its fixed Atlas punctuation sets and context checks. It does not acquire new Unicode rules when the host changes.
Unicode16Ko, Unicode16Zh, and Unicode16Ja use the ordered Unicode 16.0.0 UAX 14 revision 53 decisions. They retain non-tailorable prohibitions, mandatory breaks, and required opportunities before locale and custom typography rules.
The Korean policy applies KLReq punctuation and fitting Hangul word handling. The Japanese policy applies strict JLReq kinsoku including small kana and numeric prefix and suffix contexts. The Chinese policy applies CLReq basic punctuation handling. The exact versioned character predicates are the referenced policy definitions.
Unicode policies reject a cluster that crosses a mandatory line break with TypesetError.InvalidInput. A mandatory break after an intact cluster is a ForcedEnd opportunity even when more clusters follow. A cluster boundary inside a forbidden Unicode sequence is not an opportunity.
LatinSpace marks an admitted boundary after a cluster whose text is U+0020. LatinHyphen marks an admitted boundary after an existing hyphen cluster. LatinSoftHyphen marks an admitted generated hyphen candidate. Neither category inserts a character into the input.
ClosingPunctuation marks an admitted boundary after the selected closing-punctuation category. CjkCluster marks the admitted CJK or East Asian cluster category. HardFallback marks another admitted boundary or a permitted emergency word boundary. These categories do not authorize a break excluded by the selected policy.
ForcedEnd marks the paragraph end or a mandatory Unicode boundary. BreakRule.Forced is the distinct planning constraint that prevents a plan from crossing that position. A ForcedEnd category on a caller-created penalty does not replace its BreakRule.
For Unicode candidates, mandatory boundaries are classified first, followed by space, existing hyphen, closing punctuation, CJK or East Asian text, and HardFallback. Generated hyphens replace a missing or HardFallback category when admissible. Output ordering follows the cluster indices rather than category order.
Related rule: Keep boundary policy separate from break categoryResult
The declared result type is Break.
Effects
Failures
Result and effects
LinkThe category retains the selected Unicode, locale, custom punctuation, and shaping rules. Its name does not independently permit a boundary.
Why
LinkA break category names the text it classifies. CjkCluster covers the existing Chinese, Japanese, and Korean classification path and matches the module's CjkInterCharacter vocabulary. Locale policy continues to determine where a break is allowed.
Related entries
LinkName the CJK cluster break category
LinkName the CJK cluster break category
Break constructs the variant for the existing CJK and East Asian cluster classification. Break is absent and rejected.
Renaming this variant preserves the classification predicates and the effect of the selected Unicode, locale, custom punctuation, and shaping-boundary policies.
A CjkCluster category does not itself permit a break. classify returns the opportunities admitted by its supplied policy.
Why
A break category names the text it classifies. CjkCluster covers the existing Chinese, Japanese, and Korean classification path and matches the module's CjkInterCharacter vocabulary. Locale policy continues to determine where a break is allowed.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 2 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
271329b482bc· 43 - compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
271329b482bc· 28 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1334 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_interp/tests/fixtures/typeset_leaf.tpz at
271329b482bc· 1 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.cjk-clusteratworking-tree - topaz.decision.cjk-cluster.1 at
topaz.decisi
Use the CJK cluster variant
Linkimport std.typeset as tslet kind: ts.BreakKind = ts.BreakKind.CjkCluster()
No stdout.
Expected result
Expected result
Checking accepts the program. Exit code 0.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 2 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
271329b482bc· 43 - compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
271329b482bc· 28 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1334 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_interp/tests/fixtures/typeset_leaf.tpz at
271329b482bc· 1 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.cjk-clusteratworking-tree - topaz.decision.cjk-cluster.1 at
topaz.decisi
Reject the former KoreanCluster name
Linkimport std.typeset as tslet kind = ts.BreakKind.KoreanCluster()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-korean-cluster atmain.tpz:2:12
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 2 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
271329b482bc· 43 - compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
271329b482bc· 28 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1334 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_interp/tests/fixtures/typeset_leaf.tpz at
271329b482bc· 1 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.cjk-clusteratworking-tree - topaz.decision.cjk-cluster.1 at
topaz.decisi
Diagnostics
LinkKeep boundary policy separate from break category
LinkKeep boundary policy separate from break category
KinsokuRules is an explicit choice of boundary policy. AtlasDefault retains its fixed Atlas punctuation sets and context checks. It does not acquire new Unicode rules when the host changes.
Unicode16Ko, Unicode16Zh, and Unicode16Ja use the ordered Unicode 16.0.0 UAX 14 revision 53 decisions. They retain non-tailorable prohibitions, mandatory breaks, and required opportunities before locale and custom typography rules.
The Korean policy applies KLReq punctuation and fitting Hangul word handling. The Japanese policy applies strict JLReq kinsoku including small kana and numeric prefix and suffix contexts. The Chinese policy applies CLReq basic punctuation handling. The exact versioned character predicates are the referenced policy definitions.
Unicode policies reject a cluster that crosses a mandatory line break with TypesetError.InvalidInput. A mandatory break after an intact cluster is a ForcedEnd opportunity even when more clusters follow. A cluster boundary inside a forbidden Unicode sequence is not an opportunity.
LatinSpace marks an admitted boundary after a cluster whose text is U+0020. LatinHyphen marks an admitted boundary after an existing hyphen cluster. LatinSoftHyphen marks an admitted generated hyphen candidate. Neither category inserts a character into the input.
ClosingPunctuation marks an admitted boundary after the selected closing-punctuation category. CjkCluster marks the admitted CJK or East Asian cluster category. HardFallback marks another admitted boundary or a permitted emergency word boundary. These categories do not authorize a break excluded by the selected policy.
ForcedEnd marks the paragraph end or a mandatory Unicode boundary. BreakRule.Forced is the distinct planning constraint that prevents a plan from crossing that position. A ForcedEnd category on a caller-created penalty does not replace its BreakRule.
For Unicode candidates, mandatory boundaries are classified first, followed by space, existing hyphen, closing punctuation, CJK or East Asian text, and HardFallback. Generated hyphens replace a missing or HardFallback category when admissible. Output ordering follows the cluster indices rather than category order.
Why
A locale policy decides whether a boundary can be used. A category tells the planner why that admitted boundary exists. Keeping those roles distinct lets the same paragraph model carry Unicode, locale, and caller-supplied constraints without treating a punctuation label as permission.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
f3807a34248e· 1-64 - compiler/crates/topaz_resolve/src/std/typeset/uax14.tpz at
f3807a34248e· 1-157 - compiler/crates/topaz_resolve/src/std/typeset/locale.tpz at
f3807a34248e· 1-59 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 27-86 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.typeset-break-categoriesatworking-tree
Select Japanese small-kana protection explicitly
Linkimport std.typeset as tsimport std.ioimport std.testlet clusters = [ts.BreakCluster { text: "あ", advance: 1pt, trackingAfter: 0pt }, ts.BreakCluster { text: "ぁ", advance: 1pt, trackingAfter: 0pt }]let atlas = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true, true],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}let japanese = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true, true],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}let a = test.assertOk(ts.classifyBreaks(clusters, atlas))let b = test.assertOk(ts.classifyBreaks(clusters, japanese))io.writeLine("{a.length} {b.length}")
2 1
Expected result
Expected result
Execution completes. Exit code 0.
2 1
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
f3807a34248e· 1-64 - compiler/crates/topaz_resolve/src/std/typeset/uax14.tpz at
f3807a34248e· 1-157 - compiler/crates/topaz_resolve/src/std/typeset/locale.tpz at
f3807a34248e· 1-59 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 27-86 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.typeset-break-categoriesatworking-tree
Keep a nonbreaking space protected in character mode
Linkimport std.typeset as tsimport std.ioimport std.testlet clusters = [ts.BreakCluster { text: "A", advance: 1pt, trackingAfter: 0pt }, ts.BreakCluster { text: " ", advance: 1pt, trackingAfter: 0pt }, ts.BreakCluster { text: "B", advance: 1pt, trackingAfter: 0pt }]let selected = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true, true, true],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}let breaks = test.assertOk(ts.classifyBreaks(clusters, selected))io.writeLine("{breaks.length} {breaks[0].unitEnd}")
1 3
Expected result
Expected result
Execution completes. Exit code 0.
1 3
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
f3807a34248e· 1-64 - compiler/crates/topaz_resolve/src/std/typeset/uax14.tpz at
f3807a34248e· 1-157 - compiler/crates/topaz_resolve/src/std/typeset/locale.tpz at
f3807a34248e· 1-59 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 27-86 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.typeset-break-categoriesatworking-tree
Reject a cluster that hides a mandatory Unicode break
Linkimport std.typeset as tsimport std.ioimport std.testfunction outcome(value: Result<Array<ts.BreakOpportunity>, ts.TypesetError>) -> string {match (value) {case Ok(_) => "Ok"case Err(InvalidInput(_)) => "InvalidInput"case Err(InvalidPolicy(_)) => "InvalidPolicy"case Err(_) => "unexpected error"}}let clusters = [ts.BreakCluster { text: "A\nB", advance: 1pt, trackingAfter: 0pt }]let selected = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}io.writeLine(outcome(ts.classifyBreaks(clusters, selected)))
InvalidInput
Expected result
Expected result
Execution completes. Exit code 0.
InvalidInput
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/atlas_breaks.tpz at
f3807a34248e· 1-64 - compiler/crates/topaz_resolve/src/std/typeset/uax14.tpz at
f3807a34248e· 1-157 - compiler/crates/topaz_resolve/src/std/typeset/locale.tpz at
f3807a34248e· 1-59 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 27-86 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
f3807a34248e· 691-713 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
f3807a34248e· 1319-1340 -
topaz.stdlib.contract.typeset-break-categoriesatworking-tree