Latin Spacing. max Letter Spacing Em: Length<Em>- Module
- std.
typeset - Receiver
- Latin
Spacing - 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· 35 - compiler/crates/topaz_resolve/src/stdlib.rs at
b48527d0a174· 40
Receiver
LatinSpacing
Parameter constraints
LatinSpacing stores minWordSpaceRatio and maxWordSpaceRatio as dimensionless float values, maxLetterSpacingEm as Length<Em>, and fontSizePt as Length<Pt>. There is no implicit scalar or cross-unit conversion.
Record construction and field reads store and return the supplied values. They do not validate a paragraph policy or resolve the relative length. Field expressions follow ordinary source-order evaluation once.
A paragraph validates every supplied LatinSpacing record before planning. This validation also applies in Unjustified mode and with the KnuthPlass cost model.
minWordSpaceRatio must be finite and between 0.8 and 1.0 inclusive. maxWordSpaceRatio must be finite and between 1.0 and 1.33 inclusive. Invalid ratios return Err containing TypesetError.InvalidPolicy.
maxLetterSpacingEm must be between 0em and 0.015em inclusive on the stored relative grid. The upper bound is 983 em ticks. A negative tick or 984 ticks returns Err containing TypesetError.InvalidPolicy.
fontSizePt must have a strictly positive scaled-point count. A one-scaled-point font is valid even when the paragraph uses millipoints. Zero and negative fonts return Err containing TypesetError.InvalidPolicy, including when letter spacing is zero.
InvalidPolicy carries explanatory text. Its exact message text and the order among independent invalid policy fields are not fixed by this contract.
Resolve the stored maximum with maxLetterSpacingEm.resolve(fontSizePt). The stored relative count is multiplied by the physical font count and divided by 65,536 with one nearest-even rounding to scaled points. No ambient font is read.
Convert the resolved result to the selected computation grid. ScaledPoint preserves its integer count. MilliPoint applies the shared nearest-even conversion. Every eligible gap receives this rounded bound before multiplication by the gap count.
An eligible Latin letter gap lies between adjacent retained text units. Each unit must contain an alphabetic scalar and every scalar must be in U+0041 through U+024F, U+0300 through U+036F, or U+1E00 through U+1EFF. Paragraph trimming determines the retained units.
The retained line uses this capacity path when it contains a CJK unit, or contains a Latin letter unit and no other alphabetic unit. A non-Latin unit containing an alphabetic scalar counts as another alphabetic unit. Paragraph classification determines CJK units.
Let S be the sum of the grid widths of retained units whose text is U+0020. Word shrink capacity is floor(float(S) * (1.. Word stretch capacity is floor(float(S) * (max. Each expression keeps that binary64 evaluation order and its independent floor.
The letter stretch contribution is the eligible gap count times the quantized relative limit. CJK capacity retains its separate floor rule. Combining these contributions does not repeat font resolution or round their total as one relative length.
Unjustified mode does not apply spacing capacity. KnuthPlass obtains stretch and shrink from glue after the shared policy validation. FixedPoint uses the validated Latin spacing in its justification capacity and requires MilliPoint.
Resolution, integer accumulation, and capacity arithmetic use their checked numeric contracts. Overflow stops with TPZ4004 and does not return InvalidPolicy. Validation and conversion perform no I/O and do not mutate the record.
For 0.01em at 12pt, 655 relative ticks resolve to 7,860 scaled points and then 120 millipoints. For 0.0078125em at 24pt, each gap receives 188 millipoints. Two such gaps provide 376 millipoints.
Related rule: Resolve relative letter spacing through LengthResult
The declared result type is Length<Em>.
Effects
Failures
Result and effects
LinkSelect this field from a value of its named type without call parentheses.
Store a relative length from 0em through 0.015em inclusive. Resolve it with fontSizePt before each gap receives the nearest-even grid bound. Invalid bounds return TypesetError.InvalidPolicy at paragraph admission.
Why
LinkA font-relative distance uses the same Length type and explicit resolution as other relative lengths. A separate float multiplier would add a second unit-conversion rule for the same quantity.
Related entries
LinkResolve relative letter spacing through Length
LinkResolve relative letter spacing through Length
LatinSpacing stores minWordSpaceRatio and maxWordSpaceRatio as dimensionless float values, maxLetterSpacingEm as Length<Em>, and fontSizePt as Length<Pt>. There is no implicit scalar or cross-unit conversion.
Record construction and field reads store and return the supplied values. They do not validate a paragraph policy or resolve the relative length. Field expressions follow ordinary source-order evaluation once.
A paragraph validates every supplied LatinSpacing record before planning. This validation also applies in Unjustified mode and with the KnuthPlass cost model.
minWordSpaceRatio must be finite and between 0.8 and 1.0 inclusive. maxWordSpaceRatio must be finite and between 1.0 and 1.33 inclusive. Invalid ratios return Err containing TypesetError.InvalidPolicy.
maxLetterSpacingEm must be between 0em and 0.015em inclusive on the stored relative grid. The upper bound is 983 em ticks. A negative tick or 984 ticks returns Err containing TypesetError.InvalidPolicy.
fontSizePt must have a strictly positive scaled-point count. A one-scaled-point font is valid even when the paragraph uses millipoints. Zero and negative fonts return Err containing TypesetError.InvalidPolicy, including when letter spacing is zero.
InvalidPolicy carries explanatory text. Its exact message text and the order among independent invalid policy fields are not fixed by this contract.
Resolve the stored maximum with maxLetterSpacingEm.resolve(fontSizePt). The stored relative count is multiplied by the physical font count and divided by 65,536 with one nearest-even rounding to scaled points. No ambient font is read.
Convert the resolved result to the selected computation grid. ScaledPoint preserves its integer count. MilliPoint applies the shared nearest-even conversion. Every eligible gap receives this rounded bound before multiplication by the gap count.
An eligible Latin letter gap lies between adjacent retained text units. Each unit must contain an alphabetic scalar and every scalar must be in U+0041 through U+024F, U+0300 through U+036F, or U+1E00 through U+1EFF. Paragraph trimming determines the retained units.
The retained line uses this capacity path when it contains a CJK unit, or contains a Latin letter unit and no other alphabetic unit. A non-Latin unit containing an alphabetic scalar counts as another alphabetic unit. Paragraph classification determines CJK units.
Let S be the sum of the grid widths of retained units whose text is U+0020. Word shrink capacity is floor(float(S) * (1.. Word stretch capacity is floor(float(S) * (max. Each expression keeps that binary64 evaluation order and its independent floor.
The letter stretch contribution is the eligible gap count times the quantized relative limit. CJK capacity retains its separate floor rule. Combining these contributions does not repeat font resolution or round their total as one relative length.
Unjustified mode does not apply spacing capacity. KnuthPlass obtains stretch and shrink from glue after the shared policy validation. FixedPoint uses the validated Latin spacing in its justification capacity and requires MilliPoint.
Resolution, integer accumulation, and capacity arithmetic use their checked numeric contracts. Overflow stops with TPZ4004 and does not return InvalidPolicy. Validation and conversion perform no I/O and do not mutate the record.
For 0.01em at 12pt, 655 relative ticks resolve to 7,860 scaled points and then 120 millipoints. For 0.0078125em at 24pt, each gap receives 188 millipoints. Two such gaps provide 376 millipoints.
Why
One relative length model gives a letter-spacing limit an explicit font and unit. Validating the stored policy before planning separates field construction from recoverable policy errors. Per-gap quantization makes the permitted adjustment reproducible.
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Store a relative spacing length and an explicit point font size
Linkimport std.typeset as tslet value = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01em,fontSizePt: 12pt}let relative: Length<Em> = value.maxLetterSpacingEmlet physical: Length<Pt> = relative.resolve(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· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Resolve the stored spacing before converting to the computation grid
Linkimport std.typeset as tsimport std.iolet spacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01em,fontSizePt: 12pt}let limit = spacing.maxLetterSpacingEm.resolve(spacing.fontSizePt)let exact = limit == ts.fromScaledPoints(7860)let millipoints = limit.toMilliPoints()io.writeLine("{exact}|{millipoints}")
true|120
Expected result
Expected result
Execution completes. Exit code 0.
true|120
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Apply nearest-even rounding at each typed value boundary
Linkimport std.typeset as tsimport std.iolet lowTie = (0.5em).resolve(ts.fromScaledPoints(3)) == ts.fromScaledPoints(2)let highTie = (0.5em).resolve(ts.fromScaledPoints(5)) == ts.fromScaledPoints(2)let literalGrid = (0.01em).resolve(12pt) == ts.fromScaledPoints(7860)let gridLow = (0.5em).resolve(0.125pt).toMilliPoints()let gridHigh = (0.5em).resolve(0.375pt).toMilliPoints()io.writeLine("{lowTie}|{highTie}|{literalGrid}|{gridLow}|{gridHigh}")
true|true|true|62|188
Expected result
Expected result
Execution completes. Exit code 0.
true|true|true|62|188
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject an untyped multiplier in the relative-length field
Linkimport std.typeset as tslet spacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01,fontSizePt: 12pt}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-relative-distance-requires-em atmain.tpz:5:23
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject a physical length where an em length is required
Linkimport std.typeset as tslet spacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.12pt,fontSizePt: 12pt}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-relative-distance-requires-em atmain.tpz:5:23
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject treating the stored relative length as a float
Linkimport std.typeset as tsfunction multiplier(value: ts.LatinSpacing) -> float {value.maxLetterSpacingEm}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-relative-distance-is-not-float atmain.tpz:3:3
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Admit the inclusive ratio and font bounds
Linkimport std.typeset as tsimport std.iofunction paragraph(grid: ts.DistanceGrid, spacing: Option<ts.LatinSpacing>) -> ts.Paragraph {ts.Paragraph {grid: grid,items: [ts.Item.BoxItem(ts.Box { unitIndex: 0, text: "abc", width: 10pt, trackingAfter: 0pt }),ts.Item.PenaltyItem(ts.Penalty {unitEnd: 1, width: 0pt, rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(), flagged: false})],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: spacing, cjkStretchRatio: 0.0},costModel: ts.CostModel.FixedPoint(),knuthPlass: ts.KnuthPlassPolicy {toleranceR: 100000000, linePenalty: 10, fitnessDemerit: 0,flaggedDemerit: 0, finalFlaggedDemerit: 0}}}for value in ([ts.LatinSpacing { minWordSpaceRatio: 0.8, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0em, fontSizePt: ts.fromScaledPoints(1) },ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.33, maxLetterSpacingEm: 0.015em, fontSizePt: 12pt }]) {match (ts.breakParagraph(paragraph(ts.DistanceGrid.MilliPoint(), Some(value)))) {case Ok(_) => io.writeLine("valid policy")case Err(_) => io.writeLine("unexpected error")}}
valid policy valid policy
Expected result
Expected result
Execution completes. Exit code 0.
valid policyvalid policy
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject ratios just outside every allowed endpoint
Linkimport std.typeset as tsimport std.iofunction paragraph(grid: ts.DistanceGrid, spacing: Option<ts.LatinSpacing>) -> ts.Paragraph {ts.Paragraph {grid: grid,items: [ts.Item.BoxItem(ts.Box { unitIndex: 0, text: "abc", width: 10pt, trackingAfter: 0pt }),ts.Item.PenaltyItem(ts.Penalty {unitEnd: 1, width: 0pt, rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(), flagged: false})],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: spacing, cjkStretchRatio: 0.0},costModel: ts.CostModel.FixedPoint(),knuthPlass: ts.KnuthPlassPolicy {toleranceR: 100000000, linePenalty: 10, fitnessDemerit: 0,flaggedDemerit: 0, finalFlaggedDemerit: 0}}}for value in ([ts.LatinSpacing { minWordSpaceRatio: 0.7999, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0em, fontSizePt: 12pt },ts.LatinSpacing { minWordSpaceRatio: 1.0001, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0em, fontSizePt: 12pt },ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 0.9999, maxLetterSpacingEm: 0em, fontSizePt: 12pt },ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.3301, maxLetterSpacingEm: 0em, fontSizePt: 12pt }]) {match (ts.breakParagraph(paragraph(ts.DistanceGrid.MilliPoint(), Some(value)))) {case Err(InvalidPolicy(_)) => io.writeLine("invalid ratio")case _ => io.writeLine("unexpected result")}}
invalid ratio invalid ratio invalid ratio invalid ratio
Expected result
Expected result
Execution completes. Exit code 0.
invalid ratioinvalid ratioinvalid ratioinvalid ratio
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject negative spacing and nonpositive fonts
Linkimport std.typeset as tsimport std.iofunction paragraph(grid: ts.DistanceGrid, spacing: Option<ts.LatinSpacing>) -> ts.Paragraph {ts.Paragraph {grid: grid,items: [ts.Item.BoxItem(ts.Box { unitIndex: 0, text: "abc", width: 10pt, trackingAfter: 0pt }),ts.Item.PenaltyItem(ts.Penalty {unitEnd: 1, width: 0pt, rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(), flagged: false})],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: spacing, cjkStretchRatio: 0.0},costModel: ts.CostModel.FixedPoint(),knuthPlass: ts.KnuthPlassPolicy {toleranceR: 100000000, linePenalty: 10, fitnessDemerit: 0,flaggedDemerit: 0, finalFlaggedDemerit: 0}}}for value in ([ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: -0.0000152587890625em, fontSizePt: 12pt },ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0.0150146484375em, fontSizePt: 12pt },ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0em, fontSizePt: 0pt },ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0em, fontSizePt: -12pt }]) {match (ts.breakParagraph(paragraph(ts.DistanceGrid.MilliPoint(), Some(value)))) {case Err(InvalidPolicy(_)) => io.writeLine("invalid length policy")case _ => io.writeLine("unexpected result")}}
invalid length policy invalid length policy invalid length policy invalid length policy
Expected result
Expected result
Execution completes. Exit code 0.
invalid length policyinvalid length policyinvalid length policyinvalid length policy
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Read a stored policy before paragraph validation
Linkimport std.typeset as tsimport std.iolet value = ts.LatinSpacing { minWordSpaceRatio: 0.0, maxWordSpaceRatio: 2.0, maxLetterSpacingEm: 1em, fontSizePt: 0pt }io.writeLine("{value.minWordSpaceRatio == 0.0}|{value.maxWordSpaceRatio == 2.0}|{value.maxLetterSpacingEm == 1em}|{value.fontSizePt == 0pt}")
true|true|true|true
Expected result
Expected result
Execution completes. Exit code 0.
true|true|true|true
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Fill a line using a rounded bound for every letter gap
Linkimport std.typeset as tsimport std.ioimport std.testfunction paragraph(grid: ts.DistanceGrid, spacing: Option<ts.LatinSpacing>) -> ts.Paragraph {ts.Paragraph {grid: grid,items: [ts.Item.BoxItem(ts.Box { unitIndex: 0, text: "a", width: 1pt, trackingAfter: 0pt }),ts.Item.BoxItem(ts.Box { unitIndex: 1, text: "b", width: 1pt, trackingAfter: 0pt }),ts.Item.BoxItem(ts.Box { unitIndex: 2, text: "c", width: 1pt, trackingAfter: 0pt }),ts.Item.PenaltyItem(ts.Penalty {unitEnd: 3, width: 0pt, rule: ts.BreakRule.Forced(),kind: ts.BreakKind.LatinSpace(), flagged: false}),ts.Item.BoxItem(ts.Box { unitIndex: 3, text: "xyz", width: 3.376pt, trackingAfter: 0pt }),ts.Item.PenaltyItem(ts.Penalty {unitEnd: 4, width: 0pt, rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(), flagged: false})],geometry: ts.LineGeometry {bodyTarget: 3.376pt, firstTarget: 3.376pt, dropCapSpan: 0, dropCapInset: 0pt},justification: ts.JustificationPolicy {mode: ts.JustificationMode.LatinWordSpace(),minGapCount: 0, minLineWidthRatioM: 0, minFinalLineWidthRatioM: None(),maxAdjustment: 0pt, maxGapAdjustment: 0pt, maxGapRatioR: 0,latinSpacing: spacing, cjkStretchRatio: 0.0},costModel: ts.CostModel.FixedPoint(),knuthPlass: ts.KnuthPlassPolicy {toleranceR: 100000000, linePenalty: 10, fitnessDemerit: 0,flaggedDemerit: 0, finalFlaggedDemerit: 0}}}let value = ts.LatinSpacing { minWordSpaceRatio: 1.0, maxWordSpaceRatio: 1.0, maxLetterSpacingEm: 0.0078125em, fontSizePt: 24pt }let result = test.assertOk(ts.breakParagraph(paragraph(ts.DistanceGrid.MilliPoint(), Some(value))))let filled = match (result.optimized.boundedFillFeasible) {case Some(value) => valuecase None() => false}io.writeLine("{filled}|{result.optimized.lines.length}|{result.optimized.lines[0].target == 3.376pt}")
true|2|true
Expected result
Expected result
Execution completes. Exit code 0.
true|2|true
Source evidence
- compiler/crates/topaz_resolve/src/std/typeset/model.tpz at
271329b482bc· 33 - compiler/crates/topaz_resolve/src/std/typeset/spacing.tpz at
271329b482bc· 38 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 90 - compiler/crates/topaz_resolve/src/std/typeset/admission.tpz at
b48527d0a174· 25 - compiler/crates/topaz_resolve/src/std/typeset/paragraph.tpz at
b48527d0a174· 90 -
topaz.stdlib.contract.latin-spacing-ematworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi