resolve(font Size: Length<Pt>) - > Length<Pt>- Module
- std.
typeset - Receiver
- Length<Em>
- Minimum arity
- 1
- Maximum arity
- 1
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_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1304 - compiler/crates/topaz_resolve/src/stdlib.rs at
b48527d0a174· 40 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1304 - compiler/crates/topaz_self_frontend/topaz/checker/builtin_signatures.tpz at
b48527d0a174· 522 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1296 - compiler/crates/topaz_self_frontend/topaz/checker/model.tpz at
b48527d0a174· 694 - compiler/crates/topaz_self_frontend/topaz/checker/model.tpz at
b48527d0a174· 697
Receiver
Length<Em>
Parameter constraints
Physical Length values with the Pt, Mm, Cm, or In marker provide toScaledPoints returning int. One point is 65,536 scaled points. The result is the exact stored signed 64-bit count.
The scaledPoints member is absent from every Length type. Calling that removed member is rejected with TPZ5006. Length<Em> has no toScaledPoints member and must resolve to a physical length first.
fromScaledPoints accepts every int from -9223372036854775808 through 9223372036854775807 inclusive. It returns Length<Pt> with that exact scaled-point count. Zero and negative inputs are valid. Construction performs no rounding and has no value-dependent failure.
fromMilliPoints interprets its int argument as thousandths of a point. Its scaled-point result is roundEven of the exact rational input times 8192 divided by 125.
fromMilliPoints accepts -140737488355328000 through 140737488355327999 inclusive. An input outside that range stops with runtime diagnostic TPZ4004. It does not return Result, wrap, saturate, or clamp.
Length<Pt>.toMilliPoints returns roundEven of the exact stored count times 125 divided by 8192. Every representable point length has a representable int result.
roundEven selects the nearest integer and chooses the even integer at an exact tie. Positive and negative ties follow the same rule. Range checking applies to the final rounded value. Intermediate arithmetic must preserve the exact rational value.
A count of 4096 scaled points converts to 62 millipoints. A count of 12288 converts to 188. Their negatives convert to -62 and -188. One millipoint constructs 66 scaled points and negative one constructs -66.
Millipoint conversion can lose scaled-point precision. A conversion to millipoints and back need not recover the original length. The maximum point length converts to 140737488355328000 millipoints, which exceeds the fromMilliPoints input range.
The constructors require int arguments. A float or Length argument is rejected with TPZ5001. Physical conversions and scalar arithmetic do not provide an implicit integer constructor.
A constructor evaluates its argument once before checking the result range. A receiver conversion evaluates its receiver once. These operations perform no I/O or mutation and read no font or paragraph state.
A fromMilliPoints overflow is reported at the public constructor call. Earlier argument effects remain visible and later expressions do not execute.
Related rule: Convert physical lengths with toScaledPointsLatinSpacing 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 LengthLength<Em> stores a signed 64-bit relative count with 65,536 ticks per em. Its inclusive count range is -9223372036854775808 through 9223372036854775807. Zero and negative relative lengths are valid.
An em literal rounds its exact decimal magnitude to relative ticks with nearest-even rounding. Resolution uses those stored ticks and does not recover discarded literal precision.
resolve takes one Length<Pt> font size and returns Length<Pt>. The font size must have a strictly positive scaled-point count. A one-scaled-point font is valid.
If e is the stored em count and f is the stored font-size count, the physical result is roundEven of the exact rational e times f divided by 65,536. Multiply before rounding and round once to the physical grid.
The result must fit the common signed 64-bit physical range after rounding. Overflow stops with runtime diagnostic TPZ4004. Exact intermediates must not create a smaller accepted domain.
A zero or negative font size stops with runtime diagnostic TPZ4004, including when the relative length is zero. These failures are runtime faults and are not Result values.
A font size with a different unit marker, an int, or a float is rejected with TPZ5001. A physical Length has no resolve member. Relative lengths have no direct physical conversion or integer grid member.
The receiver evaluates once and then the font-size argument evaluates once. Resolution reads no ambient font state and performs no I/O or mutation. It preserves effects already caused by evaluating those inputs.
After resolution, use the physical conversion methods and integer interchange operations. LatinSpacing uses this same resolution before the selected paragraph grid quantizes the per-gap distance.
For 0.01em and 12pt, the relative count is 655 and the resolved count is 7,860 scaled points. Its nearest-even millipoint conversion is 120.
Related rule: Resolve an em length with an explicit positive font sizeResult
The declared result type is Length<Pt>.
Effects
Failures
Result and effects
LinkMultiply the stored relative ticks by the explicit positive Length<Pt> font size and round once to the physical scaled-point grid. A nonpositive font or unrepresentable result stops with TPZ4004. No ambient font participates.
Why
LinkA font-relative length needs an explicit font size to become a physical distance. The argument keeps stored lengths independent of an ambient or subsequently changed font.
Related entries
LinkConvert physical lengths with toScaledPoints
LinkConvert physical lengths with toScaledPoints
Physical Length values with the Pt, Mm, Cm, or In marker provide toScaledPoints returning int. One point is 65,536 scaled points. The result is the exact stored signed 64-bit count.
The scaledPoints member is absent from every Length type. Calling that removed member is rejected with TPZ5006. Length<Em> has no toScaledPoints member and must resolve to a physical length first.
fromScaledPoints accepts every int from -9223372036854775808 through 9223372036854775807 inclusive. It returns Length<Pt> with that exact scaled-point count. Zero and negative inputs are valid. Construction performs no rounding and has no value-dependent failure.
fromMilliPoints interprets its int argument as thousandths of a point. Its scaled-point result is roundEven of the exact rational input times 8192 divided by 125.
fromMilliPoints accepts -140737488355328000 through 140737488355327999 inclusive. An input outside that range stops with runtime diagnostic TPZ4004. It does not return Result, wrap, saturate, or clamp.
Length<Pt>.toMilliPoints returns roundEven of the exact stored count times 125 divided by 8192. Every representable point length has a representable int result.
roundEven selects the nearest integer and chooses the even integer at an exact tie. Positive and negative ties follow the same rule. Range checking applies to the final rounded value. Intermediate arithmetic must preserve the exact rational value.
A count of 4096 scaled points converts to 62 millipoints. A count of 12288 converts to 188. Their negatives convert to -62 and -188. One millipoint constructs 66 scaled points and negative one constructs -66.
Millipoint conversion can lose scaled-point precision. A conversion to millipoints and back need not recover the original length. The maximum point length converts to 140737488355328000 millipoints, which exceeds the fromMilliPoints input range.
The constructors require int arguments. A float or Length argument is rejected with TPZ5001. Physical conversions and scalar arithmetic do not provide an implicit integer constructor.
A constructor evaluates its argument once before checking the result range. A receiver conversion evaluates its receiver once. These operations perform no I/O or mutation and read no font or paragraph state.
A fromMilliPoints overflow is reported at the public constructor call. Earlier argument effects remain visible and later expressions do not execute.
Why
Integer conversions use the same to prefix as unit conversions and collection conversions. Scaled points and millipoints remain distinct because they represent different units and rounding boundaries.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Convert every physical length unit to scaled points
Linkimport std.ioimport std.typeset as tslet pt = (1pt).toScaledPoints()let mm = (25.4mm).toScaledPoints()let cm = (2.54cm).toScaledPoints()let inch = (1in).toScaledPoints()io.writeLine("{pt}|{mm}|{cm}|{inch}|{ts.fromScaledPoints(pt) == 1pt}")
65536|4718592|4718592|4718592|true
Expected result
Expected result
Execution completes. Exit code 0.
65536|4718592|4718592|4718592|true
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Keep the millipoint conversion boundary
Linkimport std.ioimport std.typeset as tslet tie = ts.fromScaledPoints(4096).toMilliPoints()let rounded = ts.fromMilliPoints(1) == ts.fromScaledPoints(66)io.writeLine("{tie}|{rounded}")
62|true
Expected result
Expected result
Execution completes. Exit code 0.
62|true
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<Pt>`
Linklet distance = 1ptdistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<Mm>`
Linklet distance = 1mmdistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<Cm>`
Linklet distance = 1cmdistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<In>`
Linklet distance = 1indistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Resolve font-relative lengths before integer conversion
Linklet distance = 1emdistance.toScaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-unresolved-em-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Read both endpoints of the exact integer representation
Linkimport std.typeset as tsimport std.iolet low = ts.fromScaledPoints(-9223372036854775808).toScaledPoints()let high = ts.fromScaledPoints(9223372036854775807).toScaledPoints()io.writeLine("{low}|{high}")
-9223372036854775808|9223372036854775807
Expected result
Expected result
Execution completes. Exit code 0.
-9223372036854775808|9223372036854775807
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Construct the millipoint endpoints and keep signed rounding
Linkimport std.typeset as tsimport std.iolet low = ts.fromMilliPoints(-140737488355328000)let high = ts.fromMilliPoints(140737488355327999)let negative = ts.fromMilliPoints(-1)let lowGrid = ts.fromScaledPoints(-9223372036854775808).toMilliPoints()let highGrid = ts.fromScaledPoints(9223372036854775807).toMilliPoints()io.writeLine("{low == -140737488355328pt}|{high == ts.fromScaledPoints(9223372036854775742)}|{negative == ts.fromScaledPoints(-66)}")io.writeLine("{lowGrid}|{highGrid}")
true|true|true -140737488355328000|140737488355328000
Expected result
Expected result
Execution completes. Exit code 0.
true|true|true-140737488355328000|140737488355328000
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Round both signs and both sides of a millipoint tie
Linkimport std.typeset as tsimport std.iolet below = ts.fromScaledPoints(4095).toMilliPoints()let tie = ts.fromScaledPoints(4096).toMilliPoints()let above = ts.fromScaledPoints(4097).toMilliPoints()let negativeBelow = ts.fromScaledPoints(-4095).toMilliPoints()let negativeTie = ts.fromScaledPoints(-4096).toMilliPoints()let negativeAbove = ts.fromScaledPoints(-4097).toMilliPoints()let upperTie = ts.fromScaledPoints(12288).toMilliPoints()let negativeUpperTie = ts.fromScaledPoints(-12288).toMilliPoints()io.writeLine("{below}|{tie}|{above}|{negativeBelow}|{negativeTie}|{negativeAbove}|{upperTie}|{negativeUpperTie}")
62|62|63|-62|-62|-63|188|-188
Expected result
Expected result
Execution completes. Exit code 0.
62|62|63|-62|-62|-63|188|-188
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject a millipoint input above the representable range
Linkimport std.typeset as tsts.fromMilliPoints(140737488355328000)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-unrepresentable atmain.tpz:2:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject a millipoint input below the representable range
Linkimport std.typeset as tsts.fromMilliPoints(-140737488355328001)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-unrepresentable atmain.tpz:2:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Require an int for fromScaledPoints
Linkimport std.typeset as tsts.fromScaledPoints(1.0)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-length-int-required atmain.tpz:2:21
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Require an int for fromMilliPoints
Linkimport std.typeset as tsts.fromMilliPoints(1.0)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-length-int-required atmain.tpz:2:20
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Diagnostics
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
Resolve an em length with an explicit positive font size
LinkResolve an em length with an explicit positive font size
Length<Em> stores a signed 64-bit relative count with 65,536 ticks per em. Its inclusive count range is -9223372036854775808 through 9223372036854775807. Zero and negative relative lengths are valid.
An em literal rounds its exact decimal magnitude to relative ticks with nearest-even rounding. Resolution uses those stored ticks and does not recover discarded literal precision.
resolve takes one Length<Pt> font size and returns Length<Pt>. The font size must have a strictly positive scaled-point count. A one-scaled-point font is valid.
If e is the stored em count and f is the stored font-size count, the physical result is roundEven of the exact rational e times f divided by 65,536. Multiply before rounding and round once to the physical grid.
The result must fit the common signed 64-bit physical range after rounding. Overflow stops with runtime diagnostic TPZ4004. Exact intermediates must not create a smaller accepted domain.
A zero or negative font size stops with runtime diagnostic TPZ4004, including when the relative length is zero. These failures are runtime faults and are not Result values.
A font size with a different unit marker, an int, or a float is rejected with TPZ5001. A physical Length has no resolve member. Relative lengths have no direct physical conversion or integer grid member.
The receiver evaluates once and then the font-size argument evaluates once. Resolution reads no ambient font state and performs no I/O or mutation. It preserves effects already caused by evaluating those inputs.
After resolution, use the physical conversion methods and integer interchange operations. LatinSpacing uses this same resolution before the selected paragraph grid quantizes the per-gap distance.
For 0.01em and 12pt, the relative count is 655 and the resolved count is 7,860 scaled points. Its nearest-even millipoint conversion is 120.
Why
An explicit positive font size gives a relative length one physical meaning. Shared integer rounding makes standalone lengths and letter-spacing budgets agree, including ties, negative offsets, and range boundaries.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Resolve zero and negative relative lengths with a positive font
Linkimport std.typeset as tsimport std.iolet negative = (-0.5em).resolve(12pt)let zero = (0em).resolve(ts.fromScaledPoints(1))let large = (140737488355327.9999847412109375em).resolve(ts.fromScaledPoints(1))io.writeLine("{negative == -6pt}|{zero == 0pt}|{large == ts.fromScaledPoints(140737488355328)}")
true|true|true
Expected result
Expected result
Execution completes. Exit code 0.
true|true|true
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Evaluate the relative value and font size once in order
Linkimport std.iofunction relative() -> Length<Em> {io.writeLine("relative")0.5em}function font() -> Length<Pt> {io.writeLine("font")12pt}let result = relative().resolve(font())io.writeLine("{result == 6pt}")
relative font true
Expected result
Expected result
Execution completes. Exit code 0.
relativefonttrue
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject a zero font size
Linklet relative = 0emlet font = 0ptrelative.resolve(font)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-font-positive atmain.tpz:3:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject a negative font size
Linklet relative = 1emlet font = -12ptrelative.resolve(font)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-font-positive atmain.tpz:3:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Reject an unrepresentable physical result
Linkimport std.typeset as tslet relative = 2emlet font = ts.fromScaledPoints(9223372036854775807)relative.resolve(font)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-unrepresentable atmain.tpz:4:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi
Require a point font size
Linklet relative = 1emrelative.resolve(1mm)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-physical-distance-requires-points atmain.tpz:2:18
Source evidence
- compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 303-312 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 99-118 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1303-1313 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1013-1137 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1616-1657 -
topaz.stdlib.contract.length-resolveatworking-tree - topaz.decision.letter-spacing-em.1 at
topaz.decisi