classify Breaks(clusters:Array<Break Cluster>, policy:Break Policy) - > Result<Array<Break Opportunity>, Typeset Error>- Module
- std.
typeset - Receiver
- Not applicable
- Minimum arity
- 2
- Maximum arity
- 2
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/std/typeset/breaks.tpz at
b48527d0a174· 1 - 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.
For the same ordered input values, policies, calculation grid, and product release, classifyBreaks and breakParagraph produce the same result. This includes boundary order, selected breaks, line widths, costs, and the returned error variant.
Planning reads measured text and policy values without changing caller arrays. It does not shape text, load fonts, or write output. Ordinary argument evaluation finishes before the operation begins.
The selected cost model, admission rules, and search bounds define plan quality. The two reported plans expose their own costs for inspection.
Related rule: Repeat a paragraph plan deterministicallyclassifyBreaks reads measured clusters in array order and returns Result<Array<Break. It does not shape text, normalize strings, split a cluster, or change any supplied record or array.
Each BreakCluster.text is the scalar string for one indivisible measured unit. Empty text still occupies one cluster index. advance includes trackingAfter. A span width sums its advances and removes the trackingAfter of its final cluster.
advance and advance minus trackingAfter must be nonnegative point lengths. Zero advance and signed trackingAfter are accepted. Invalid extents return TypesetError.InvalidInput. Length arithmetic follows the common Length contract.
classifyBreaks sums stored point ticks and compares them with the stored point targets. It has no DistanceGrid argument and does not quantize to a paragraph grid. Exact equality with a target counts as fitting.
boundaryAllowed has exactly one entry for each cluster. Entry i governs the boundary after cluster i. The last entry must be true for nonempty input. A wrong mask length or a false last entry returns TypesetError.InvalidInput.
Validation checks mask length and terminal permission, word targets, forbidBefore, forbidAfter, generated hyphen indices, and measured extents in that order. Array checks visit entries in input order. Unicode mandatory crossings are checked before boundary conflicts are visited in increasing cluster order. An empty result follows successful structural and policy validation.
An empty cluster array with a valid empty boundary mask returns Ok with an empty opportunity array. It does not create a synthetic unit or terminal opportunity.
Successful nonempty results contain increasing, unique unitEnd values from one through the cluster count. unitEnd is an exclusive cluster index rather than a byte or scalar offset. The final opportunity has unitEnd equal to the cluster count and kind ForcedEnd.
Repeated calls with equal cluster values and equal policies produce the same ordered opportunities and categories. Validation and classification do not read host locale, perform I/O, invoke caller callbacks, or mutate input values. Argument expressions use the ordinary language evaluation order.
A BreakOpportunity carries a boundary and its category. It does not carry a penalty width or BreakRule. A caller preserving mandatory boundaries maps every ForcedEnd opportunity to a Forced penalty before calling breakParagraph.
Related rule: Classify measured clusters into an ordered boundary sequenceResult
Effects
Failures
Result and effects
LinkThe function validates its measured clusters and explicit break policy, then returns ordered opportunities. Empty input has an empty result. Nonempty successful results end with ForcedEnd. Invalid input and policy values are reported through TypesetError without mutating the supplied values.
Why
LinkMeasured clusters retain shaping boundaries while explicit Unicode and locale policies choose line-break opportunities. Their separation lets the same paragraph model serve Chinese, Japanese, Korean, and mixed text without an implicit language-dependent category name.
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
LinkRepeat a paragraph plan deterministically
LinkRepeat a paragraph plan deterministically
For the same ordered input values, policies, calculation grid, and product release, classifyBreaks and breakParagraph produce the same result. This includes boundary order, selected breaks, line widths, costs, and the returned error variant.
Planning reads measured text and policy values without changing caller arrays. It does not shape text, load fonts, or write output. Ordinary argument evaluation finishes before the operation begins.
The selected cost model, admission rules, and search bounds define plan quality. The two reported plans expose their own costs for inspection.
Why
Repeatable paragraph layout lets applications cache plans and reproduce published pages. An explicit search contract separates reproducibility from the quality of a chosen plan.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
f3807a34248e· 1-107 - compiler/crates/topaz_resolve/src/std/typeset/greedy.tpz at
f3807a34248e· 1-39 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-96 -
topaz.stdlib.contract.typeset-determinismatworking-tree
Retain a deterministic choice among equal cost candidates
Linkimport std.typeset as tsimport std.ioimport std.testlet items: Array<ts.Item> = [ts.Item.BoxItem(ts.Box { unitIndex: 0, text: "word", width: 10pt, trackingAfter: 0pt }),ts.Item.PenaltyItem(ts.Penalty { unitEnd: 1, width: 0pt, rule: ts.BreakRule.Allowed(0), kind: ts.BreakKind.LatinSpace(), flagged: false }),ts.Item.PenaltyItem(ts.Penalty { unitEnd: 1, width: 0pt, rule: ts.BreakRule.Allowed(0), kind: ts.BreakKind.ClosingPunctuation(), flagged: false })]let input = ts.Paragraph {grid: ts.DistanceGrid.MilliPoint(),items: items,geometry: ts.LineGeometry { bodyTarget: 10pt, firstTarget: 10pt, dropCapSpan: 0, dropCapInset: 0pt },justification: ts.JustificationPolicy {mode: ts.JustificationMode.Unjustified(), minGapCount: 0,minLineWidthRatioM: 0, minFinalLineWidthRatioM: None(),maxAdjustment: 0pt, maxGapAdjustment: 0pt, maxGapRatioR: 0,latinSpacing: None(), cjkStretchRatio: 0.0},costModel: ts.CostModel.FixedPoint(),knuthPlass: ts.KnuthPlassPolicy { toleranceR: 100000000, linePenalty: 10, fitnessDemerit: 0, flaggedDemerit: 0, finalFlaggedDemerit: 0 }}function category(kind: ts.BreakKind) -> string {match (kind) {case LatinSpace() => "space"case ClosingPunctuation() => "punctuation"case _ => "unexpected kind"}}for pass in ([0, 1]) {let result = test.assertOk(ts.breakParagraph(input))let optimized = result.optimized.lines[0]let greedy = result.greedy.lines[0]io.writeLine("{pass} {optimized.start} {optimized.endExclusive} {category(optimized.kind)} {category(greedy.kind)}")}
0 0 1 space punctuation 1 0 1 space punctuation
Expected result
Expected result
Execution completes. Exit code 0.
0 0 1 space punctuation1 0 1 space punctuation
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
f3807a34248e· 1-107 - compiler/crates/topaz_resolve/src/std/typeset/greedy.tpz at
f3807a34248e· 1-39 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-96 -
topaz.stdlib.contract.typeset-determinismatworking-tree
Report the same first failing stage for repeated invalid input
Linkimport std.typeset as tsimport std.iolet items: Array<ts.Item> = [ts.Item.BoxItem(ts.Box { unitIndex: 2, text: "a", width: 1pt, trackingAfter: 0pt })]let input = ts.Paragraph {grid: ts.DistanceGrid.MilliPoint(),items: items,geometry: ts.LineGeometry { bodyTarget: 0pt, firstTarget: 0pt, dropCapSpan: 0, dropCapInset: 0pt },justification: ts.JustificationPolicy {mode: ts.JustificationMode.Unjustified(), minGapCount: 0,minLineWidthRatioM: 0, minFinalLineWidthRatioM: None(),maxAdjustment: 0pt, maxGapAdjustment: 0pt, maxGapRatioR: 0,latinSpacing: None(), cjkStretchRatio: 0.0},costModel: ts.CostModel.FixedPoint(),knuthPlass: ts.KnuthPlassPolicy { toleranceR: 100000000, linePenalty: 10, fitnessDemerit: 0, flaggedDemerit: 0, finalFlaggedDemerit: 0 }}for pass in ([0, 1]) {match (ts.breakParagraph(input)) {case Err(InvalidPolicy(_)) => io.writeLine("{pass} InvalidPolicy")case _ => io.writeLine("unexpected result")}}
0 InvalidPolicy 1 InvalidPolicy
Expected result
Expected result
Execution completes. Exit code 0.
0 InvalidPolicy1 InvalidPolicy
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
f3807a34248e· 1-107 - compiler/crates/topaz_resolve/src/std/typeset/greedy.tpz at
f3807a34248e· 1-39 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-96 -
topaz.stdlib.contract.typeset-determinismatworking-tree
Classify measured clusters into an ordered boundary sequence
LinkClassify measured clusters into an ordered boundary sequence
classifyBreaks reads measured clusters in array order and returns Result<Array<Break. It does not shape text, normalize strings, split a cluster, or change any supplied record or array.
Each BreakCluster.text is the scalar string for one indivisible measured unit. Empty text still occupies one cluster index. advance includes trackingAfter. A span width sums its advances and removes the trackingAfter of its final cluster.
advance and advance minus trackingAfter must be nonnegative point lengths. Zero advance and signed trackingAfter are accepted. Invalid extents return TypesetError.InvalidInput. Length arithmetic follows the common Length contract.
classifyBreaks sums stored point ticks and compares them with the stored point targets. It has no DistanceGrid argument and does not quantize to a paragraph grid. Exact equality with a target counts as fitting.
boundaryAllowed has exactly one entry for each cluster. Entry i governs the boundary after cluster i. The last entry must be true for nonempty input. A wrong mask length or a false last entry returns TypesetError.InvalidInput.
Validation checks mask length and terminal permission, word targets, forbidBefore, forbidAfter, generated hyphen indices, and measured extents in that order. Array checks visit entries in input order. Unicode mandatory crossings are checked before boundary conflicts are visited in increasing cluster order. An empty result follows successful structural and policy validation.
An empty cluster array with a valid empty boundary mask returns Ok with an empty opportunity array. It does not create a synthetic unit or terminal opportunity.
Successful nonempty results contain increasing, unique unitEnd values from one through the cluster count. unitEnd is an exclusive cluster index rather than a byte or scalar offset. The final opportunity has unitEnd equal to the cluster count and kind ForcedEnd.
Repeated calls with equal cluster values and equal policies produce the same ordered opportunities and categories. Validation and classification do not read host locale, perform I/O, invoke caller callbacks, or mutate input values. Argument expressions use the ordinary language evaluation order.
A BreakOpportunity carries a boundary and its category. It does not carry a penalty width or BreakRule. A caller preserving mandatory boundaries maps every ForcedEnd opportunity to a Forced penalty before calling breakParagraph.
Why
A measured cluster is the unit that shaping can safely keep together. Exclusive indices connect classification to paragraph items without converting through text offsets. A complete terminal boundary and deterministic order make the output suitable for reproducible layout.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree
Classify atomic clusters in repeatable boundary order
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 selected = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true, true],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}for pass in ([0, 1]) {let breaks = test.assertOk(ts.classifyBreaks(clusters, selected))for boundary in (breaks) {let category = match (boundary.kind) {case CjkCluster() => "CJK"case ForcedEnd() => "end"case _ => "unexpected kind"}io.writeLine("{pass} {boundary.unitEnd} {category}")}}io.writeLine(clusters[0].text)
0 1 CJK 0 2 end 1 1 CJK 1 2 end 한
Expected result
Expected result
Execution completes. Exit code 0.
0 1 CJK0 2 end1 1 CJK1 2 end한
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree
Classify an empty cluster sequence
Linkimport std.typeset as tsimport std.ioimport std.testlet clusters: Array<ts.BreakCluster> = []let selected = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}let breaks = test.assertOk(ts.classifyBreaks(clusters, selected))io.writeLine("{breaks.length}")
0
Expected result
Expected result
Execution completes. Exit code 0.
0
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree
Reject a mask with the wrong number of entries
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", advance: 1pt, trackingAfter: 0pt }]let selected = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [],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/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree
Reject negative measured and untracked cluster extents
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 selected = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}io.writeLine(outcome(ts.classifyBreaks([ts.BreakCluster { text: "a", advance: -1pt, trackingAfter: 0pt }], selected)))io.writeLine(outcome(ts.classifyBreaks([ts.BreakCluster { text: "b", advance: 1pt, trackingAfter: 2pt }], selected)))
InvalidInput InvalidInput
Expected result
Expected result
Execution completes. Exit code 0.
InvalidInputInvalidInput
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree
Reject a masked paragraph end in every ruleset
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", advance: 1pt, trackingAfter: 0pt }]let atlas = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [false],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}let unicode = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [false],generatedHyphenEnds: [],protectFittingLatin: false,preserveShortWords: false,narrowestWordTarget: 0pt,bodyWordTarget: 0pt}io.writeLine(outcome(ts.classifyBreaks(clusters, atlas)))io.writeLine(outcome(ts.classifyBreaks(clusters, unicode)))
InvalidInput InvalidInput
Expected result
Expected result
Execution completes. Exit code 0.
InvalidInputInvalidInput
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree
Keep exact point measurements at the classifier boundary
Linkimport std.typeset as tsimport std.testimport std.iolet clusters = [ts.BreakCluster { text: "a", advance: 0.5002pt, trackingAfter: 0pt },ts.BreakCluster { text: "b", advance: 0.5002pt, trackingAfter: 0pt }]let policy = ts.BreakPolicy {mode: ts.BreakMode.Word(), rules: ts.KinsokuRules.AtlasDefault(),forbidBefore: [], forbidAfter: [], boundaryAllowed: [true, true],generatedHyphenEnds: [], protectFittingLatin: false, preserveShortWords: false,narrowestWordTarget: 0pt, bodyWordTarget: 1pt}let result = test.assertOk(ts.classifyBreaks(clusters, policy))for boundary in (result) {io.writeLine("{boundary.unitEnd}")}
1 2
Expected result
Expected result
Execution completes. Exit code 0.
12
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
f3807a34248e· 24-32 - compiler/crates/topaz_resolve/src/std/typeset/breaks.tpz at
f3807a34248e· 1-94 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 24-25 - compiler/crates/topaz_resolve/src/std/typeset/measure.tpz at
f3807a34248e· 52-66 - 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-inputsatworking-tree