line Badness(width: Length<Pt>, target: Length<Pt>, char Count: int, spaces: int, kind: Break Kind, is Last: bool, justification B: int, hyphen Advance: Length<Pt>) - > Result<int, Typeset Error>- 수신자
- 해당 없음
- 최소 인자 수
- 8
- 최대 인자 수
- 8
Declaration and parameters
링크사용 조건
기본 포함 · 미정
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.
수신자
매개변수 제약
Public measurement fields use Length<Pt>. Widths, advances, tracking, stretch, shrink, physical targets, insets, font sizes, and optional width limits keep that type across input and output records. Explicit Length conversion functions remain the integer interchange boundary.
Box., Box., Glue., Glue., Glue., Glue., and Penalty. have type Length<Pt>.
Break, Break, Break, and Break have type Length<Pt>.
Latin, Justification, and Justification have type Length<Pt>.
Line, Line, and Line have type Length<Pt>.
Plan, Plan, Plan, Plan, and Plan have type Length<Pt>. Plan has type Option<Length<Pt>>.
An int, a float, or a Length with another unit marker is not an implicit point-length argument. Convert physical units explicitly with toPt() before constructing a typesetting record.
Indices, counts, penalties, costs, and dimensionless ratios retain their declared types. LatinSpacing.maxLetterSpacingEm is a relative Length<Em>. Resolve it to Length<Pt> with fontSizePt before selecting the computation grid.
Paragraph. selects quantization at the computation boundary. ScaledPoint uses the exact scaled-point integer. MilliPoint uses the existing nearest-even conversion to millipoints. The selected grid never changes the physical interpretation of a public Length<Pt> value.
Returned distances are converted from the computation grid into Length<Pt> at the output boundary. Paragraph reports the computation policy and is not needed to interpret its distances.
The public type change preserves the selected cost model. FixedPoint retains its MilliPoint computation requirement. Word-space and CJK ratio calculations keep their independent floor rules. The relative letter-spacing distance is resolved and quantized through the shared Length conversions before it contributes to capacity.
The public line-badness entry point also receives width, target, and hyphen advance as Length<Pt>. It converts those distances to millipoints at entry and preserves its existing integer cost calculation.
line is the public entry point. lineBadnessMpt is absent and importing it is rejected with TPZ3009.
The three distances require Length<Pt>. A raw scalar or another unit marker is rejected with TPZ5001. Width and hyphen advance may be negative. justificationB accepts every int and can make the resulting cost negative.
Evaluate all eight argument expressions once in source order before entering the function. Convert width, target, and hyphenAdvance to millipoints in that order with the shared nearest-even rule.
The converted target must be positive. charCount and spaces must each be nonnegative and need not satisfy a relation to each other. Invalid inputs return Err containing TypesetError.InvalidInput before cost arithmetic. The explanatory message text is not fixed.
Let w, t, and h be the converted distances, c the character count, s the space count, and j the supplied justification cost. Let B be 1,000,000 and R be 100,000,000.
For a nonnegative n and positive d, H gives n divided by d rounded to the nearest integer with ties upward. H describes cost rounding. Physical Length conversion keeps its separate nearest-even rule.
The following sequence uses checked int operations in the stated order. A failing intermediate operation stops with runtime diagnostic TPZ4004. It does not return TypesetError or replace overflow with a bounded cost.
Set effective to w + h for LatinSoftHyphen and to w for every other kind. Set slack to t - effective and absolute to the absolute value of slack.
Set raw to 4 R when absolute is at least 4 t. Otherwise set raw to absolute * R / with integer division. This explicit ratio cap does not change a supplied length.
Set capacity to 100 + s * 45 when slack is nonnegative and to 100 + s * 25 otherwise. Set ratio = H(raw * 100, capacity), then q = H(ratio * ratio, R), then cost = H(q * (1000 * B), R).
If isLast is true, replace cost with H(cost * 2, 5). Add 500 B when isLast is true and `w 100 < t * 52`. The strict comparison uses the original converted width and also applies when charCount is zero.
If slack is negative, add 20000 * B + H(20000 * B * ratio, R). Add 65 B for LatinHyphen or LatinSoftHyphen. Add 50000 B for HardFallback. The other break kinds add no break penalty.
If c is at most two, add 275 B. Then add 10 B and j in that order and return the result in Ok. The hyphenAdvance input affects width for LatinSoftHyphen and is ignored for the other kinds.
An exact fit with more than two characters, no special break penalty, and zero justification cost returns 10000000. The documented 90 point line against a 100 point target with nine characters and two spaces returns 12770080.
The function performs no I/O, changes no input, and reads no font, paragraph, or global grid state. Effects from argument evaluation remain visible on InvalidInput or a later arithmetic fault.
An arithmetic fault identifies the public lineBadness call as its primary source location. Argument effects already performed remain visible and later expressions do not run.
관련 규칙 · Compute fixed-point line badness from point lengths →결과
The declared result type is Result<int, Typeset.
효과
실패
Result and effects
링크Convert the three point distances to nearest-even millipoints and compute the specified checked fixed-point cost. A nonpositive converted target or negative count returns TypesetError.InvalidInput. Arithmetic overflow raises TPZ4004.
Why
링크A function name describes the computation while Length<Pt> carries its physical unit. One typed entry point avoids a second millipoint API for the same line-badness calculation.
Related entries
링크Give public typesetting distances a point-length type
링크Give public typesetting distances a point-length type
Public measurement fields use Length<Pt>. Widths, advances, tracking, stretch, shrink, physical targets, insets, font sizes, and optional width limits keep that type across input and output records. Explicit Length conversion functions remain the integer interchange boundary.
Box., Box., Glue., Glue., Glue., Glue., and Penalty. have type Length<Pt>.
Break, Break, Break, and Break have type Length<Pt>.
Latin, Justification, and Justification have type Length<Pt>.
Line, Line, and Line have type Length<Pt>.
Plan, Plan, Plan, Plan, and Plan have type Length<Pt>. Plan has type Option<Length<Pt>>.
An int, a float, or a Length with another unit marker is not an implicit point-length argument. Convert physical units explicitly with toPt() before constructing a typesetting record.
Indices, counts, penalties, costs, and dimensionless ratios retain their declared types. LatinSpacing.maxLetterSpacingEm is a relative Length<Em>. Resolve it to Length<Pt> with fontSizePt before selecting the computation grid.
Paragraph. selects quantization at the computation boundary. ScaledPoint uses the exact scaled-point integer. MilliPoint uses the existing nearest-even conversion to millipoints. The selected grid never changes the physical interpretation of a public Length<Pt> value.
Returned distances are converted from the computation grid into Length<Pt> at the output boundary. Paragraph reports the computation policy and is not needed to interpret its distances.
The public type change preserves the selected cost model. FixedPoint retains its MilliPoint computation requirement. Word-space and CJK ratio calculations keep their independent floor rules. The relative letter-spacing distance is resolved and quantized through the shared Length conversions before it contributes to capacity.
The public line-badness entry point also receives width, target, and hyphen advance as Length<Pt>. It converts those distances to millipoints at entry and preserves its existing integer cost calculation.
이유
A physical distance carries the same Length<Pt> type in application geometry and paragraph planning. The type prevents a grid selector or an unlabelled scalar from silently changing the distance.
Use point lengths in Box
링크import std.typeset as tslet value: ts.Box = ts.Box {unitIndex: 0,text: "A",width: 12pt,trackingAfter: 0pt}let distance: Length<Pt> = value.width
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in Box
링크import std.typeset as tslet value: ts.Box = ts.Box {unitIndex: 0,text: "A",width: 12,trackingAfter: 0}
표준 출력 없음.기대 결과
Use point lengths in Glue
링크import std.typeset as tslet value: ts.Glue = ts.Glue {unitIndex: 1,text: " ",width: 3pt,trackingAfter: 0pt,stretch: 1pt,shrink: 1pt}let distance: Length<Pt> = value.width
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in Glue
링크import std.typeset as tslet value: ts.Glue = ts.Glue {unitIndex: 1,text: " ",width: 3,trackingAfter: 0,stretch: 1,shrink: 1}
표준 출력 없음.기대 결과
Use point lengths in Penalty
링크import std.typeset as tslet value: ts.Penalty = ts.Penalty {unitEnd: 1,width: 0pt,rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(),flagged: false}let distance: Length<Pt> = value.width
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in Penalty
링크import std.typeset as tslet value: ts.Penalty = ts.Penalty {unitEnd: 1,width: 0,rule: ts.BreakRule.Forced(),kind: ts.BreakKind.ForcedEnd(),flagged: false}
표준 출력 없음.기대 결과
Use point lengths in BreakPolicy
링크import std.typeset as tslet value: ts.BreakPolicy = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true],generatedHyphenEnds: [],protectFittingLatin: true,preserveShortWords: true,narrowestWordTarget: 12pt,bodyWordTarget: 24pt}let distance: Length<Pt> = value.narrowestWordTarget
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in BreakPolicy
링크import std.typeset as tslet value: ts.BreakPolicy = ts.BreakPolicy {mode: ts.BreakMode.Character(),rules: ts.KinsokuRules.Unicode16Ja(),forbidBefore: [],forbidAfter: [],boundaryAllowed: [true],generatedHyphenEnds: [],protectFittingLatin: true,preserveShortWords: true,narrowestWordTarget: 12,bodyWordTarget: 24}
표준 출력 없음.기대 결과
기대 결과
거절 단계 check. 종료 코드가 0이 아닙니다.
stdlib-physical-distance-requires-points at
main.tpz:11:24
Use point lengths in BreakCluster
링크import std.typeset as tslet value: ts.BreakCluster = ts.BreakCluster {text: "A",advance: 12pt,trackingAfter: 0pt}let distance: Length<Pt> = value.advance
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in BreakCluster
링크import std.typeset as tslet value: ts.BreakCluster = ts.BreakCluster {text: "A",advance: 12,trackingAfter: 0}
표준 출력 없음.기대 결과
Use point lengths in LatinSpacing
링크import std.typeset as tslet value: ts.LatinSpacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01em,fontSizePt: 12pt}let distance: Length<Pt> = value.fontSizePt
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in LatinSpacing
링크import std.typeset as tslet value: ts.LatinSpacing = ts.LatinSpacing {minWordSpaceRatio: 0.8,maxWordSpaceRatio: 1.33,maxLetterSpacingEm: 0.01em,fontSizePt: 12.0}
표준 출력 없음.기대 결과
Use point lengths in JustificationPolicy
링크import std.typeset as tslet value: ts.JustificationPolicy = ts.JustificationPolicy {mode: ts.JustificationMode.Unjustified(),minGapCount: 0,minLineWidthRatioM: 0,minFinalLineWidthRatioM: None(),maxAdjustment: 12pt,maxGapAdjustment: 3pt,maxGapRatioR: 0,latinSpacing: None(),cjkStretchRatio: 0.0}let distance: Length<Pt> = value.maxAdjustment
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in JustificationPolicy
링크import std.typeset as tslet value: ts.JustificationPolicy = ts.JustificationPolicy {mode: ts.JustificationMode.Unjustified(),minGapCount: 0,minLineWidthRatioM: 0,minFinalLineWidthRatioM: None(),maxAdjustment: 12,maxGapAdjustment: 3,maxGapRatioR: 0,latinSpacing: None(),cjkStretchRatio: 0.0}
표준 출력 없음.기대 결과
Use point lengths in LineGeometry
링크import std.typeset as tslet value: ts.LineGeometry = ts.LineGeometry {bodyTarget: 24pt,firstTarget: 20pt,dropCapSpan: 0,dropCapInset: 0pt}let distance: Length<Pt> = value.bodyTarget
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in LineGeometry
링크import std.typeset as tslet value: ts.LineGeometry = ts.LineGeometry {bodyTarget: 24,firstTarget: 20,dropCapSpan: 0,dropCapInset: 0}
표준 출력 없음.기대 결과
Use point lengths in PlanLine
링크import std.typeset as tslet value: ts.PlanLine = ts.PlanLine {start: 0,endExclusive: 1,trimmedEndExclusive: 1,displayTextScalarLength: 1,kind: ts.BreakKind.ForcedEnd(),target: 12pt,rawTextWidth: 10pt,trimmedTextWidth: 10pt,costTextWidth: 10pt,selectedPenaltyWidth: 0pt,postValidationWidthLimit: Some(13pt),cost: 0,adjustmentRatioR: 0}let distance: Length<Pt> = value.targetlet limit: Option<Length<Pt>> = value.postValidationWidthLimit
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject untyped physical distances in PlanLine
링크import std.typeset as tslet value: ts.PlanLine = ts.PlanLine {start: 0,endExclusive: 1,trimmedEndExclusive: 1,displayTextScalarLength: 1,kind: ts.BreakKind.ForcedEnd(),target: 12,rawTextWidth: 10,trimmedTextWidth: 10,costTextWidth: 10,selectedPenaltyWidth: 0,postValidationWidthLimit: Some(13),cost: 0,adjustmentRatioR: 0}
표준 출력 없음.기대 결과
Pass typed distances to the line-cost function
링크import std.typeset as tslet value = ts.lineBadness(20pt, 20pt, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0pt)
표준 출력 없음.기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
Reject raw distances at the line-cost boundary
링크import std.typeset as tslet value = ts.lineBadness(20, 20, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0)
표준 출력 없음.기대 결과
Diagnostics
링크Compute fixed-point line badness from point lengths
링크Compute fixed-point line badness from point lengths
line is the public entry point. lineBadnessMpt is absent and importing it is rejected with TPZ3009.
The three distances require Length<Pt>. A raw scalar or another unit marker is rejected with TPZ5001. Width and hyphen advance may be negative. justificationB accepts every int and can make the resulting cost negative.
Evaluate all eight argument expressions once in source order before entering the function. Convert width, target, and hyphenAdvance to millipoints in that order with the shared nearest-even rule.
The converted target must be positive. charCount and spaces must each be nonnegative and need not satisfy a relation to each other. Invalid inputs return Err containing TypesetError.InvalidInput before cost arithmetic. The explanatory message text is not fixed.
Let w, t, and h be the converted distances, c the character count, s the space count, and j the supplied justification cost. Let B be 1,000,000 and R be 100,000,000.
For a nonnegative n and positive d, H gives n divided by d rounded to the nearest integer with ties upward. H describes cost rounding. Physical Length conversion keeps its separate nearest-even rule.
The following sequence uses checked int operations in the stated order. A failing intermediate operation stops with runtime diagnostic TPZ4004. It does not return TypesetError or replace overflow with a bounded cost.
Set effective to w + h for LatinSoftHyphen and to w for every other kind. Set slack to t - effective and absolute to the absolute value of slack.
Set raw to 4 R when absolute is at least 4 t. Otherwise set raw to absolute * R / with integer division. This explicit ratio cap does not change a supplied length.
Set capacity to 100 + s * 45 when slack is nonnegative and to 100 + s * 25 otherwise. Set ratio = H(raw * 100, capacity), then q = H(ratio * ratio, R), then cost = H(q * (1000 * B), R).
If isLast is true, replace cost with H(cost * 2, 5). Add 500 B when isLast is true and `w 100 < t * 52`. The strict comparison uses the original converted width and also applies when charCount is zero.
If slack is negative, add 20000 * B + H(20000 * B * ratio, R). Add 65 B for LatinHyphen or LatinSoftHyphen. Add 50000 B for HardFallback. The other break kinds add no break penalty.
If c is at most two, add 275 B. Then add 10 B and j in that order and return the result in Ok. The hyphenAdvance input affects width for LatinSoftHyphen and is ignored for the other kinds.
An exact fit with more than two characters, no special break penalty, and zero justification cost returns 10000000. The documented 90 point line against a 100 point target with nine characters and two spaces returns 12770080.
The function performs no I/O, changes no input, and reads no font, paragraph, or global grid state. Effects from argument evaluation remain visible on InvalidInput or a later arithmetic fault.
An arithmetic fault identifies the public lineBadness call as its primary source location. Argument effects already performed remain visible and later expressions do not run.
이유
One typed entry point fixes the physical meaning before scoring a line. Explicit intermediate rounding makes costs reproducible. The same last-line width condition applies to every valid character count, including an empty line.
Compute a line cost from point lengths
링크import std.ioimport std.typeset as tslet cost = ts.lineBadness(20pt, 20pt, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0pt)match (cost) {case Ok(value) => io.writeLine("{value}")case Err(_) => io.writeLine("unexpected input error")}
10000000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
10000000
Reject the former millipoint function name
링크import std.typeset { lineBadnessMpt }
표준 출력 없음.기대 결과
Preserve the published fixed-point costs
링크import std.typeset as tsimport std.testimport std.iofunction show(value: Result<int, ts.TypesetError>) -> () {let cost = test.assertOk(value)io.writeLine("{cost}")}show(ts.lineBadness(100pt, 100pt, 10, 2, ts.BreakKind.LatinSpace(), false, 0, 0pt))show(ts.lineBadness(90pt, 100pt, 9, 2, ts.BreakKind.LatinSpace(), false, 0, 0pt))show(ts.lineBadness(100pt, 100pt, 10, 2, ts.BreakKind.LatinHyphen(), false, 0, 0pt))show(ts.lineBadness(40pt, 100pt, 4, 0, ts.BreakKind.ForcedEnd(), true, 0, 0pt))
10000000
12770080
75000000
654000000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
100000001277008075000000654000000
Apply break penalties and the small character count boundary
링크import std.typeset as tsimport std.testimport std.iofunction show(value: Result<int, ts.TypesetError>) -> () {let cost = test.assertOk(value)io.writeLine("{cost}")}show(ts.lineBadness(100pt, 100pt, 3, 0, ts.BreakKind.CjkCluster(), false, 0, 0pt))show(ts.lineBadness(100pt, 100pt, 3, 0, ts.BreakKind.ClosingPunctuation(), false, 0, 0pt))show(ts.lineBadness(100pt, 100pt, 3, 0, ts.BreakKind.HardFallback(), false, 0, 0pt))show(ts.lineBadness(100pt, 100pt, 2, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt))show(ts.lineBadness(99pt, 100pt, 9, 0, ts.BreakKind.LatinSoftHyphen(), false, 0, 1pt))show(ts.lineBadness(99pt, 100pt, 9, 0, ts.BreakKind.LatinHyphen(), false, 0, 1pt))
10000000
10000000
50010000000
285000000
75000000
75100000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
1000000010000000500100000002850000007500000075100000
Use a strict last-line width threshold
링크import std.typeset as tsimport std.testimport std.iofunction show(value: Result<int, ts.TypesetError>) -> () {let cost = test.assertOk(value)io.writeLine("{cost}")}show(ts.lineBadness(52pt, 100pt, 4, 0, ts.BreakKind.ForcedEnd(), true, 0, 0pt))show(ts.lineBadness(51pt, 100pt, 4, 0, ts.BreakKind.ForcedEnd(), true, 0, 0pt))
102160000
606040000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
102160000606040000
Apply the last-line width condition to zero characters
링크import std.typeset as tsimport std.testimport std.iofunction show(value: Result<int, ts.TypesetError>) -> () {let cost = test.assertOk(value)io.writeLine("{cost}")}show(ts.lineBadness(0pt, 100pt, 0, 0, ts.BreakKind.ForcedEnd(), true, 0, 0pt))
1185000000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
1185000000
Keep signed inputs and cap the scoring ratio explicitly
링크import std.typeset as tsimport std.testimport std.iofunction show(value: Result<int, ts.TypesetError>) -> () {let cost = test.assertOk(value)io.writeLine("{cost}")}show(ts.lineBadness(100pt, 100pt, 3, 0, ts.BreakKind.ForcedEnd(), false, -10000001, 0pt))show(ts.lineBadness(-1000pt, 100pt, 3, 0, ts.BreakKind.ForcedEnd(), false, 0, -1pt))show(ts.lineBadness(500pt, 100pt, 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt))show(ts.lineBadness(600pt, 100pt, 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt))
-1
16010000000
116010000000
116010000000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
-116010000000116010000000116010000000
Return InvalidInput for the target and count boundaries
링크import std.typeset as tsimport std.iofor result in ([ts.lineBadness(1pt, 0pt, 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt),ts.lineBadness(1pt, -1pt, 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt),ts.lineBadness(1pt, 1pt, -1, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt),ts.lineBadness(1pt, 1pt, 3, -1, ts.BreakKind.ForcedEnd(), false, 0, 0pt)]) {match (result) {case Err(InvalidInput(_)) => io.writeLine("invalid input")case _ => io.writeLine("unexpected result")}}
invalid input
invalid input
invalid input
invalid input
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
invalid inputinvalid inputinvalid inputinvalid input
Validate target positivity after millipoint conversion
링크import std.typeset as tsimport std.testimport std.iofunction show(value: Result<int, ts.TypesetError>) -> () {let cost = test.assertOk(value)io.writeLine("{cost}")}let rejected = ts.lineBadness(0pt, ts.fromScaledPoints(32), 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt)match (rejected) {case Err(InvalidInput(_)) => io.writeLine("rounded target is zero")case _ => io.writeLine("unexpected result")}show(ts.lineBadness(ts.fromScaledPoints(33), ts.fromScaledPoints(33), 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt))show(ts.lineBadness(ts.fromScaledPoints(4096), ts.fromMilliPoints(62), 3, 0, ts.BreakKind.ForcedEnd(), false, 0, 0pt))
rounded target is zero
10000000
10000000
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
rounded target is zero1000000010000000
Evaluate every argument before input validation
링크import std.typeset as tsimport std.iofunction length(label: string, value: Length<Pt>) -> Length<Pt> {io.writeLine(label)value}function count(label: string, value: int) -> int {io.writeLine(label)value}function kind(value: ts.BreakKind) -> ts.BreakKind {io.writeLine("kind")value}function last(value: bool) -> bool {io.writeLine("last")value}let result = ts.lineBadness(length("width", 1pt), length("target", 0pt),count("chars", 3), count("spaces", 0),kind(ts.BreakKind.ForcedEnd()), last(false),count("justification", 0), length("hyphen", 0pt))match (result) {case Err(InvalidInput(_)) => io.writeLine("invalid input")case _ => io.writeLine("unexpected result")}
width
target
chars
spaces
kind
last
justification
hyphen
invalid input
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
widthtargetcharsspaceskindlastjustificationhypheninvalid input
Stop on checked cost overflow
링크import std.typeset as tsts.lineBadness(1pt, 1pt, 3, 0, ts.BreakKind.ForcedEnd(), false, 9223372036854775807, 0pt)
표준 출력 없음.