Break Cluster. advance: Length<Pt>- Module
- std.
typeset - Receiver
- Break
Cluster - 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/std/typeset/model.tpz at
b48527d0a174· 31 - compiler/crates/topaz_resolve/src/stdlib.rs at
b48527d0a174· 40
Receiver
BreakCluster
Parameter constraints
Public measurement fields use Length<Pt>. Widths, advances, tracking, stretch, shrink, physical targets, insets, font sizes, and optional width limits keep that type across input and output records. Explicit Length conversion functions remain the integer interchange boundary.
Box., Box., Glue., Glue., Glue., Glue., and Penalty. have type Length<Pt>.
Break, Break, Break, and Break have type Length<Pt>.
Latin, Justification, and Justification have type Length<Pt>.
Line, Line, and Line have type Length<Pt>.
Plan, Plan, Plan, Plan, and Plan have type Length<Pt>. Plan has type Option<Length<Pt>>.
An int, a float, or a Length with another unit marker is not an implicit point-length argument. Convert physical units explicitly with toPt() before constructing a typesetting record.
Indices, counts, penalties, costs, and dimensionless ratios retain their declared types. LatinSpacing.maxLetterSpacingEm is a relative Length<Em>. Resolve it to Length<Pt> with fontSizePt before selecting the computation grid.
Paragraph. selects quantization at the computation boundary. ScaledPoint uses the exact scaled-point integer. MilliPoint uses the existing nearest-even conversion to millipoints. The selected grid never changes the physical interpretation of a public Length<Pt> value.
Returned distances are converted from the computation grid into Length<Pt> at the output boundary. Paragraph reports the computation policy and is not needed to interpret its distances.
The public type change preserves the selected cost model. FixedPoint retains its MilliPoint computation requirement. Word-space and CJK ratio calculations keep their independent floor rules. The relative letter-spacing distance is resolved and quantized through the shared Length conversions before it contributes to capacity.
The public line-badness entry point also receives width, target, and hyphen advance as Length<Pt>. It converts those distances to millipoints at entry and preserves its existing integer cost calculation.
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.
Related rule: Classify measured clusters into an ordered boundary sequenceResult
The declared result type is Length<Pt>.
Effects
Failures
Result and effects
LinkSelect this field from a value of its named type without call parentheses.
Supply a nonnegative point length that includes trackingAfter. The advance minus trackingAfter must also be nonnegative. Span measurement removes the final cluster tracking from the sum of advances.
Why
LinkA physical distance carries the same Length<Pt> type in application geometry and paragraph planning. The type prevents a grid selector or an unlabelled scalar from silently changing the distance.
Related entries
LinkGive public typesetting distances a point-length type
LinkGive public typesetting distances a point-length type
Public measurement fields use Length<Pt>. Widths, advances, tracking, stretch, shrink, physical targets, insets, font sizes, and optional width limits keep that type across input and output records. Explicit Length conversion functions remain the integer interchange boundary.
Box., Box., Glue., Glue., Glue., Glue., and Penalty. have type Length<Pt>.
Break, Break, Break, and Break have type Length<Pt>.
Latin, Justification, and Justification have type Length<Pt>.
Line, Line, and Line have type Length<Pt>.
Plan, Plan, Plan, Plan, and Plan have type Length<Pt>. Plan has type Option<Length<Pt>>.
An int, a float, or a Length with another unit marker is not an implicit point-length argument. Convert physical units explicitly with toPt() before constructing a typesetting record.
Indices, counts, penalties, costs, and dimensionless ratios retain their declared types. LatinSpacing.maxLetterSpacingEm is a relative Length<Em>. Resolve it to Length<Pt> with fontSizePt before selecting the computation grid.
Paragraph. selects quantization at the computation boundary. ScaledPoint uses the exact scaled-point integer. MilliPoint uses the existing nearest-even conversion to millipoints. The selected grid never changes the physical interpretation of a public Length<Pt> value.
Returned distances are converted from the computation grid into Length<Pt> at the output boundary. Paragraph reports the computation policy and is not needed to interpret its distances.
The public type change preserves the selected cost model. FixedPoint retains its MilliPoint computation requirement. Word-space and CJK ratio calculations keep their independent floor rules. The relative letter-spacing distance is resolved and quantized through the shared Length conversions before it contributes to capacity.
The public line-badness entry point also receives width, target, and hyphen advance as Length<Pt>. It converts those distances to millipoints at entry and preserves its existing integer cost calculation.
Why
A physical distance carries the same Length<Pt> type in application geometry and paragraph planning. The type prevents a grid selector or an unlabelled scalar from silently changing the distance.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in Box
Linkimport std.typeset as tslet value: ts.Box = ts.Box {unitIndex: 0,text: "A",width: 12pt,trackingAfter: 0pt}let distance: Length<Pt> = value.width
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in Box
Linkimport std.typeset as tslet value: ts.Box = ts.Box {unitIndex: 0,text: "A",width: 12,trackingAfter: 0}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:5:10
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in Glue
Linkimport std.typeset as tslet value: ts.Glue = ts.Glue {unitIndex: 1,text: " ",width: 3pt,trackingAfter: 0pt,stretch: 1pt,shrink: 1pt}let distance: Length<Pt> = value.width
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in Glue
Linkimport std.typeset as tslet value: ts.Glue = ts.Glue {unitIndex: 1,text: " ",width: 3,trackingAfter: 0,stretch: 1,shrink: 1}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:5:10
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in Penalty
Linkimport std.typeset as tslet value: ts.Penalty = ts.Penalty {unitEnd: 1,width: 0pt,rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(),flagged: false}let distance: Length<Pt> = value.width
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in Penalty
Linkimport std.typeset as tslet value: ts.Penalty = ts.Penalty {unitEnd: 1,width: 0,rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(),flagged: false}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:4:10
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in BreakPolicy
Linkimport std.typeset as tslet value: ts.BreakPolicy = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true],generatedHyphenEnds: [],protectFittingLatin: true,preserveShortWords: true,narrowestWordTarget: 12pt,bodyWordTarget: 24pt}let distance: Length<Pt> = value.narrowestWordTarget
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in BreakPolicy
Linkimport std.typeset as tslet value: ts.BreakPolicy = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true],generatedHyphenEnds: [],protectFittingLatin: true,preserveShortWords: true,narrowestWordTarget: 12,bodyWordTarget: 24}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:11:24
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in BreakCluster
Linkimport std.typeset as tslet value: ts.BreakCluster = ts.BreakCluster {text: "A",advance: 12pt,trackingAfter: 0pt}let distance: Length<Pt> = value.advance
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in BreakCluster
Linkimport std.typeset as tslet value: ts.BreakCluster = ts.BreakCluster {text: "A",advance: 12,trackingAfter: 0}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:4:12
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in LatinSpacing
Linkimport std.typeset as tslet value: ts.LatinSpacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01em,fontSizePt: 12pt}let distance: Length<Pt> = value.fontSizePt
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in LatinSpacing
Linkimport std.typeset as tslet value: ts.LatinSpacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01em,fontSizePt: 12.0}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:6:15
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in JustificationPolicy
Linkimport std.typeset as tslet value: ts.JustificationPolicy = ts.JustificationPolicy {mode: ts.JustificationMode.Unjustified(),minGapCount: 0,minLineWidthRatioM: 0,minFinalLineWidthRatioM: None(),maxAdjustment: 12pt,maxGapAdjustment: 3pt,maxGapRatioR: 0,latinSpacing: None(),cjkStretchRatio: 0.0}let distance: Length<Pt> = value.maxAdjustment
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in JustificationPolicy
Linkimport std.typeset as tslet value: ts.JustificationPolicy = ts.JustificationPolicy {mode: ts.JustificationMode.Unjustified(),minGapCount: 0,minLineWidthRatioM: 0,minFinalLineWidthRatioM: None(),maxAdjustment: 12,maxGapAdjustment: 3,maxGapRatioR: 0,latinSpacing: None(),cjkStretchRatio: 0.0}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:7:18
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in LineGeometry
Linkimport std.typeset as tslet value: ts.LineGeometry = ts.LineGeometry {bodyTarget: 24pt,firstTarget: 20pt,dropCapSpan: 0,dropCapInset: 0pt}let distance: Length<Pt> = value.bodyTarget
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in LineGeometry
Linkimport std.typeset as tslet value: ts.LineGeometry = ts.LineGeometry {bodyTarget: 24,firstTarget: 20,dropCapSpan: 0,dropCapInset: 0}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:3:15
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Use point lengths in PlanLine
Linkimport std.typeset as tslet value: ts.PlanLine = ts.PlanLine {start: 0,endExclusive: 1,trimmedEndExclusive: 1,displayTextScalarLength: 1,kind: ts.BreakKind.ForcedEnd(),target: 12pt,rawTextWidth: 10pt,trimmedTextWidth: 10pt,costTextWidth: 10pt,selectedPenaltyWidth: 0pt,postValidationWidthLimit: Some(13pt),cost: 0,adjustmentRatioR: 0}let distance: Length<Pt> = value.targetlet limit: Option<Length<Pt>> = value.postValidationWidthLimit
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject untyped physical distances in PlanLine
Linkimport std.typeset as tslet value: ts.PlanLine = ts.PlanLine {start: 0,endExclusive: 1,trimmedEndExclusive: 1,displayTextScalarLength: 1,kind: ts.BreakKind.ForcedEnd(),target: 12,rawTextWidth: 10,trimmedTextWidth: 10,costTextWidth: 10,selectedPenaltyWidth: 0,postValidationWidthLimit: Some(13),cost: 0,adjustmentRatioR: 0}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:8:11
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Pass typed distances to the line-cost function
Linkimport std.typeset as tslet value = ts.lineBadness(20pt, 20pt, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0pt)
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· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Reject raw distances at the line-cost boundary
Linkimport std.typeset as tslet value = ts.lineBadness(20, 20, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:2:28
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 16 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
271329b482bc· 1 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
271329b482bc· 90 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1846 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1976 - compiler/crates/topaz_resolve/src/std/typeset/cost.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.typeset-length-ptatworking-tree - topaz.decision.typeset-length-pt.1 at
topaz.decisi
Diagnostics
LinkClassify 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