본문으로 건너뛰기
토파즈6.0 · 출시 전
다운로드 →

문서 검색

명세 6.0

방향키로 결과를 고르고 Enter를 눌러 여세요.

API 이름, 진단 번호, 규칙 또는 프로젝트 주제를 입력하세요.

    라이브러리 · std.typeset

    BreakCluster.trackingAfter

    The signed tracking included after this cluster.

    BreakCluster.trackingAfter: Length<Pt>
    수신자
    BreakCluster
    최소 인자 수
    0
    최대 인자 수
    0

    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.

    수신자

    BreakCluster

    매개변수 제약

    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.width, Box.trackingAfter, Glue.width, Glue.trackingAfter, Glue.stretch, Glue.shrink, and Penalty.width have type Length<Pt>.

    BreakCluster.advance, BreakCluster.trackingAfter, BreakPolicy.narrowestWordTarget, and BreakPolicy.bodyWordTarget have type Length<Pt>.

    LatinSpacing.fontSizePt, JustificationPolicy.maxAdjustment, and JustificationPolicy.maxGapAdjustment have type Length<Pt>.

    LineGeometry.bodyTarget, LineGeometry.firstTarget, and LineGeometry.dropCapInset have type Length<Pt>.

    PlanLine.target, PlanLine.rawTextWidth, PlanLine.trimmedTextWidth, PlanLine.costTextWidth, and PlanLine.selectedPenaltyWidth have type Length<Pt>. PlanLine.postValidationWidthLimit 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.grid 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. ParagraphPlan.grid reports the computation policy and is not needed to interpret its distances.

    The public type change preserves the selected cost model. FixedPoint retains its MilliPoint computation requirement. Word-space and CJK ratio calculations keep their independent floor rules. The relative letter-spacing distance is resolved and quantized through the shared Length conversions before it contributes to capacity.

    The public line-badness entry point also receives width, target, and hyphen advance as Length<Pt>. It converts those distances to millipoints at entry and preserves its existing integer cost calculation.

    classifyBreaks reads measured clusters in array order and returns Result<Array<BreakOpportunity>, TypesetError>. It does not shape text, normalize strings, split a cluster, or change any supplied record or array.

    Each BreakCluster.text is the scalar string for one indivisible measured unit. Empty text still occupies one cluster index. advance includes trackingAfter. A span width sums its advances and removes the trackingAfter of its final cluster.

    advance and advance minus trackingAfter must be nonnegative point lengths. Zero advance and signed trackingAfter are accepted. Invalid extents return TypesetError.InvalidInput. Length arithmetic follows the common Length contract.

    classifyBreaks sums stored point ticks and compares them with the stored point targets. It has no DistanceGrid argument and does not quantize to a paragraph grid. Exact equality with a target counts as fitting.

    boundaryAllowed has exactly one entry for each cluster. Entry i governs the boundary after cluster i. The last entry must be true for nonempty input. A wrong mask length or a false last entry returns TypesetError.InvalidInput.

    Validation checks mask length and terminal permission, word targets, forbidBefore, forbidAfter, generated hyphen indices, and measured extents in that order. Array checks visit entries in input order. Unicode mandatory crossings are checked before boundary conflicts are visited in increasing cluster order. An empty result follows successful structural and policy validation.

    An empty cluster array with a valid empty boundary mask returns Ok with an empty opportunity array. It does not create a synthetic unit or terminal opportunity.

    Successful nonempty results contain increasing, unique unitEnd values from one through the cluster count. unitEnd is an exclusive cluster index rather than a byte or scalar offset. The final opportunity has unitEnd equal to the cluster count and kind ForcedEnd.

    Repeated calls with equal cluster values and equal policies produce the same ordered opportunities and categories. Validation and classification do not read host locale, perform I/O, invoke caller callbacks, or mutate input values. Argument expressions use the ordinary language evaluation order.

    A BreakOpportunity carries a boundary and its category. It does not carry a penalty width or BreakRule. A caller preserving mandatory boundaries maps every ForcedEnd opportunity to a Forced penalty before calling breakParagraph.

    결과

    The declared result type is Length<Pt>.

    효과

    실패

    Result and effects

    링크

    Select this field from a value of its named type without call parentheses.

    trackingAfter is part of advance and is removed when the cluster ends a measured span. Negative tracking is accepted when the measured and untracked extents remain nonnegative.

    Why

    링크

    A physical distance carries the same Length<Pt> type in application geometry and paragraph planning. The type prevents a grid selector or an unlabelled scalar from silently changing the distance.

    Related entries

    링크

    std.typeset →

    Give public typesetting distances a point-length type

    링크
    규칙topaz.stdlib.contract.typeset-length-pt.rule

    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.width, Box.trackingAfter, Glue.width, Glue.trackingAfter, Glue.stretch, Glue.shrink, and Penalty.width have type Length<Pt>.

    BreakCluster.advance, BreakCluster.trackingAfter, BreakPolicy.narrowestWordTarget, and BreakPolicy.bodyWordTarget have type Length<Pt>.

    LatinSpacing.fontSizePt, JustificationPolicy.maxAdjustment, and JustificationPolicy.maxGapAdjustment have type Length<Pt>.

    LineGeometry.bodyTarget, LineGeometry.firstTarget, and LineGeometry.dropCapInset have type Length<Pt>.

    PlanLine.target, PlanLine.rawTextWidth, PlanLine.trimmedTextWidth, PlanLine.costTextWidth, and PlanLine.selectedPenaltyWidth have type Length<Pt>. PlanLine.postValidationWidthLimit 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.grid 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. ParagraphPlan.grid 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

    링크
    main.tpzUse point lengths in Box플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.Box = ts.Box {
    3. unitIndex: 0,
    4. text: "A",
    5. width: 12pt,
    6. trackingAfter: 0pt
    7. }
    8. let distance: Length<Pt> = value.width
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in Box

    링크
    main.tpzReject untyped physical distances in Box플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.Box = ts.Box {
    3. unitIndex: 0,
    4. text: "A",
    5. width: 12,
    6. trackingAfter: 0
    7. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:5:10

    Use point lengths in Glue

    링크
    main.tpzUse point lengths in Glue플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.Glue = ts.Glue {
    3. unitIndex: 1,
    4. text: " ",
    5. width: 3pt,
    6. trackingAfter: 0pt,
    7. stretch: 1pt,
    8. shrink: 1pt
    9. }
    10. let distance: Length<Pt> = value.width
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in Glue

    링크
    main.tpzReject untyped physical distances in Glue플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.Glue = ts.Glue {
    3. unitIndex: 1,
    4. text: " ",
    5. width: 3,
    6. trackingAfter: 0,
    7. stretch: 1,
    8. shrink: 1
    9. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:5:10

    Use point lengths in Penalty

    링크
    main.tpzUse point lengths in Penalty플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.Penalty = ts.Penalty {
    3. unitEnd: 1,
    4. width: 0pt,
    5. rule: ts.BreakRule.Forced(),
    6. kind: ts.BreakKind.ForcedEnd(),
    7. flagged: false
    8. }
    9. let distance: Length<Pt> = value.width
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in Penalty

    링크
    main.tpzReject untyped physical distances in Penalty플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.Penalty = ts.Penalty {
    3. unitEnd: 1,
    4. width: 0,
    5. rule: ts.BreakRule.Forced(),
    6. kind: ts.BreakKind.ForcedEnd(),
    7. flagged: false
    8. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:4:10

    Use point lengths in BreakPolicy

    링크
    main.tpzUse point lengths in BreakPolicy플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.BreakPolicy = ts.BreakPolicy {
    3. mode: ts.BreakMode.Character(),
    4. rules: ts.KinsokuRules.Unicode16Ja(),
    5. forbidBefore: [],
    6. forbidAfter: [],
    7. boundaryAllowed: [true],
    8. generatedHyphenEnds: [],
    9. protectFittingLatin: true,
    10. preserveShortWords: true,
    11. narrowestWordTarget: 12pt,
    12. bodyWordTarget: 24pt
    13. }
    14. let distance: Length<Pt> = value.narrowestWordTarget
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in BreakPolicy

    링크
    main.tpzReject untyped physical distances in BreakPolicy플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.BreakPolicy = ts.BreakPolicy {
    3. mode: ts.BreakMode.Character(),
    4. rules: ts.KinsokuRules.Unicode16Ja(),
    5. forbidBefore: [],
    6. forbidAfter: [],
    7. boundaryAllowed: [true],
    8. generatedHyphenEnds: [],
    9. protectFittingLatin: true,
    10. preserveShortWords: true,
    11. narrowestWordTarget: 12,
    12. bodyWordTarget: 24
    13. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:11:24

    Use point lengths in BreakCluster

    링크
    main.tpzUse point lengths in BreakCluster플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.BreakCluster = ts.BreakCluster {
    3. text: "A",
    4. advance: 12pt,
    5. trackingAfter: 0pt
    6. }
    7. let distance: Length<Pt> = value.advance
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in BreakCluster

    링크
    main.tpzReject untyped physical distances in BreakCluster플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.BreakCluster = ts.BreakCluster {
    3. text: "A",
    4. advance: 12,
    5. trackingAfter: 0
    6. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:4:12

    Use point lengths in LatinSpacing

    링크
    main.tpzUse point lengths in LatinSpacing플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.LatinSpacing = ts.LatinSpacing {
    3. minWordSpaceRatio: 0.8,
    4. maxWordSpaceRatio: 1.33,
    5. maxLetterSpacingEm: 0.01em,
    6. fontSizePt: 12pt
    7. }
    8. let distance: Length<Pt> = value.fontSizePt
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in LatinSpacing

    링크
    main.tpzReject untyped physical distances in LatinSpacing플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.LatinSpacing = ts.LatinSpacing {
    3. minWordSpaceRatio: 0.8,
    4. maxWordSpaceRatio: 1.33,
    5. maxLetterSpacingEm: 0.01em,
    6. fontSizePt: 12.0
    7. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:6:15

    Use point lengths in JustificationPolicy

    링크
    main.tpzUse point lengths in JustificationPolicy플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.JustificationPolicy = ts.JustificationPolicy {
    3. mode: ts.JustificationMode.Unjustified(),
    4. minGapCount: 0,
    5. minLineWidthRatioM: 0,
    6. minFinalLineWidthRatioM: None(),
    7. maxAdjustment: 12pt,
    8. maxGapAdjustment: 3pt,
    9. maxGapRatioR: 0,
    10. latinSpacing: None(),
    11. cjkStretchRatio: 0.0
    12. }
    13. let distance: Length<Pt> = value.maxAdjustment
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in JustificationPolicy

    링크
    main.tpzReject untyped physical distances in JustificationPolicy플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.JustificationPolicy = ts.JustificationPolicy {
    3. mode: ts.JustificationMode.Unjustified(),
    4. minGapCount: 0,
    5. minLineWidthRatioM: 0,
    6. minFinalLineWidthRatioM: None(),
    7. maxAdjustment: 12,
    8. maxGapAdjustment: 3,
    9. maxGapRatioR: 0,
    10. latinSpacing: None(),
    11. cjkStretchRatio: 0.0
    12. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:7:18

    Use point lengths in LineGeometry

    링크
    main.tpzUse point lengths in LineGeometry플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.LineGeometry = ts.LineGeometry {
    3. bodyTarget: 24pt,
    4. firstTarget: 20pt,
    5. dropCapSpan: 0,
    6. dropCapInset: 0pt
    7. }
    8. let distance: Length<Pt> = value.bodyTarget
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in LineGeometry

    링크
    main.tpzReject untyped physical distances in LineGeometry플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.LineGeometry = ts.LineGeometry {
    3. bodyTarget: 24,
    4. firstTarget: 20,
    5. dropCapSpan: 0,
    6. dropCapInset: 0
    7. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:3:15

    Use point lengths in PlanLine

    링크
    main.tpzUse point lengths in PlanLine플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.PlanLine = ts.PlanLine {
    3. start: 0,
    4. endExclusive: 1,
    5. trimmedEndExclusive: 1,
    6. displayTextScalarLength: 1,
    7. kind: ts.BreakKind.ForcedEnd(),
    8. target: 12pt,
    9. rawTextWidth: 10pt,
    10. trimmedTextWidth: 10pt,
    11. costTextWidth: 10pt,
    12. selectedPenaltyWidth: 0pt,
    13. postValidationWidthLimit: Some(13pt),
    14. cost: 0,
    15. adjustmentRatioR: 0
    16. }
    17. let distance: Length<Pt> = value.target
    18. let limit: Option<Length<Pt>> = value.postValidationWidthLimit
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject untyped physical distances in PlanLine

    링크
    main.tpzReject untyped physical distances in PlanLine플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value: ts.PlanLine = ts.PlanLine {
    3. start: 0,
    4. endExclusive: 1,
    5. trimmedEndExclusive: 1,
    6. displayTextScalarLength: 1,
    7. kind: ts.BreakKind.ForcedEnd(),
    8. target: 12,
    9. rawTextWidth: 10,
    10. trimmedTextWidth: 10,
    11. costTextWidth: 10,
    12. selectedPenaltyWidth: 0,
    13. postValidationWidthLimit: Some(13),
    14. cost: 0,
    15. adjustmentRatioR: 0
    16. }
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:8:11

    Pass typed distances to the line-cost function

    링크
    main.tpzPass typed distances to the line-cost function플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value = ts.lineBadness(20pt, 20pt, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0pt)
    기대 출력종료 코드 0
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    검사가 프로그램을 받아들입니다. 종료 코드 0.

    Reject raw distances at the line-cost boundary

    링크
    main.tpzReject raw distances at the line-cost boundary플레이그라운드 열기 →
    1. import std.typeset as ts
    2. let value = ts.lineBadness(20, 20, 4, 1, ts.BreakKind.ForcedEnd(), false, 0, 0)
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz check main.tpz --format json · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 check. 종료 코드가 0이 아닙니다.

    • TPZ5001 →

      stdlib-physical-distance-requires-points at main.tpz:2:28

    Diagnostics

    링크

    TPZ5001 →

    Classify measured clusters into an ordered boundary sequence

    링크
    규칙topaz.stdlib.contract.typeset-break-inputs.rule

    Classify measured clusters into an ordered boundary sequence

    classifyBreaks reads measured clusters in array order and returns Result<Array<BreakOpportunity>, TypesetError>. It does not shape text, normalize strings, split a cluster, or change any supplied record or array.

    Each BreakCluster.text is the scalar string for one indivisible measured unit. Empty text still occupies one cluster index. advance includes trackingAfter. A span width sums its advances and removes the trackingAfter of its final cluster.

    advance and advance minus trackingAfter must be nonnegative point lengths. Zero advance and signed trackingAfter are accepted. Invalid extents return TypesetError.InvalidInput. Length arithmetic follows the common Length contract.

    classifyBreaks sums stored point ticks and compares them with the stored point targets. It has no DistanceGrid argument and does not quantize to a paragraph grid. Exact equality with a target counts as fitting.

    boundaryAllowed has exactly one entry for each cluster. Entry i governs the boundary after cluster i. The last entry must be true for nonempty input. A wrong mask length or a false last entry returns TypesetError.InvalidInput.

    Validation checks mask length and terminal permission, word targets, forbidBefore, forbidAfter, generated hyphen indices, and measured extents in that order. Array checks visit entries in input order. Unicode mandatory crossings are checked before boundary conflicts are visited in increasing cluster order. An empty result follows successful structural and policy validation.

    An empty cluster array with a valid empty boundary mask returns Ok with an empty opportunity array. It does not create a synthetic unit or terminal opportunity.

    Successful nonempty results contain increasing, unique unitEnd values from one through the cluster count. unitEnd is an exclusive cluster index rather than a byte or scalar offset. The final opportunity has unitEnd equal to the cluster count and kind ForcedEnd.

    Repeated calls with equal cluster values and equal policies produce the same ordered opportunities and categories. Validation and classification do not read host locale, perform I/O, invoke caller callbacks, or mutate input values. Argument expressions use the ordinary language evaluation order.

    A BreakOpportunity carries a boundary and its category. It does not carry a penalty width or BreakRule. A caller preserving mandatory boundaries maps every ForcedEnd opportunity to a Forced penalty before calling breakParagraph.

    이유

    A measured cluster is the unit that shaping can safely keep together. Exclusive indices connect classification to paragraph items without converting through text offsets. A complete terminal boundary and deterministic order make the output suitable for reproducible layout.

    Classify atomic clusters in repeatable boundary order

    링크
    main.tpzClassify atomic clusters in repeatable boundary order플레이그라운드 열기 →
    1. import std.typeset as ts
    2. import std.io
    3. import std.test
    4. let clusters = [ts.BreakCluster { text: "한", advance: 1pt, trackingAfter: 0pt }, ts.BreakCluster { text: "글", advance: 1pt, trackingAfter: 0pt }]
    5. let selected = ts.BreakPolicy {
    6. mode: ts.BreakMode.Character(),
    7. rules: ts.KinsokuRules.AtlasDefault(),
    8. forbidBefore: [],
    9. forbidAfter: [],
    10. boundaryAllowed: [true, true],
    11. generatedHyphenEnds: [],
    12. protectFittingLatin: false,
    13. preserveShortWords: false,
    14. narrowestWordTarget: 0pt,
    15. bodyWordTarget: 0pt
    16. }
    17. for pass in ([0, 1]) {
    18. let breaks = test.assertOk(ts.classifyBreaks(clusters, selected))
    19. for boundary in (breaks) {
    20. let category = match (boundary.kind) {
    21. case CjkCluster() => "CJK"
    22. case ForcedEnd() => "end"
    23. case _ => "unexpected kind"
    24. }
    25. io.writeLine("{pass} {boundary.unitEnd} {category}")
    26. }
    27. }
    28. io.writeLine(clusters[0].text)
    기대 출력종료 코드 0
    0 1 CJK
    0 2 end
    1 1 CJK
    1 2 end
    한
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. 0 1 CJK
    2. 0 2 end
    3. 1 1 CJK
    4. 1 2 end
    5. 한

    Classify an empty cluster sequence

    링크
    main.tpzClassify an empty cluster sequence플레이그라운드 열기 →
    1. import std.typeset as ts
    2. import std.io
    3. import std.test
    4. let clusters: Array<ts.BreakCluster> = []
    5. let selected = ts.BreakPolicy {
    6. mode: ts.BreakMode.Character(),
    7. rules: ts.KinsokuRules.AtlasDefault(),
    8. forbidBefore: [],
    9. forbidAfter: [],
    10. boundaryAllowed: [],
    11. generatedHyphenEnds: [],
    12. protectFittingLatin: false,
    13. preserveShortWords: false,
    14. narrowestWordTarget: 0pt,
    15. bodyWordTarget: 0pt
    16. }
    17. let breaks = test.assertOk(ts.classifyBreaks(clusters, selected))
    18. io.writeLine("{breaks.length}")
    기대 출력종료 코드 0
    0
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. 0

    Reject a mask with the wrong number of entries

    링크
    main.tpzReject a mask with the wrong number of entries플레이그라운드 열기 →
    1. import std.typeset as ts
    2. import std.io
    3. import std.test
    4. function outcome(value: Result<Array<ts.BreakOpportunity>, ts.TypesetError>) -> string {
    5. match (value) {
    6. case Ok(_) => "Ok"
    7. case Err(InvalidInput(_)) => "InvalidInput"
    8. case Err(InvalidPolicy(_)) => "InvalidPolicy"
    9. case Err(_) => "unexpected error"
    10. }
    11. }
    12. let clusters = [ts.BreakCluster { text: "a", advance: 1pt, trackingAfter: 0pt }]
    13. let selected = ts.BreakPolicy {
    14. mode: ts.BreakMode.Character(),
    15. rules: ts.KinsokuRules.AtlasDefault(),
    16. forbidBefore: [],
    17. forbidAfter: [],
    18. boundaryAllowed: [],
    19. generatedHyphenEnds: [],
    20. protectFittingLatin: false,
    21. preserveShortWords: false,
    22. narrowestWordTarget: 0pt,
    23. bodyWordTarget: 0pt
    24. }
    25. io.writeLine(outcome(ts.classifyBreaks(clusters, selected)))
    기대 출력종료 코드 0
    InvalidInput
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. InvalidInput

    Reject negative measured and untracked cluster extents

    링크
    main.tpzReject negative measured and untracked cluster extents플레이그라운드 열기 →
    1. import std.typeset as ts
    2. import std.io
    3. import std.test
    4. function outcome(value: Result<Array<ts.BreakOpportunity>, ts.TypesetError>) -> string {
    5. match (value) {
    6. case Ok(_) => "Ok"
    7. case Err(InvalidInput(_)) => "InvalidInput"
    8. case Err(InvalidPolicy(_)) => "InvalidPolicy"
    9. case Err(_) => "unexpected error"
    10. }
    11. }
    12. let selected = ts.BreakPolicy {
    13. mode: ts.BreakMode.Character(),
    14. rules: ts.KinsokuRules.AtlasDefault(),
    15. forbidBefore: [],
    16. forbidAfter: [],
    17. boundaryAllowed: [true],
    18. generatedHyphenEnds: [],
    19. protectFittingLatin: false,
    20. preserveShortWords: false,
    21. narrowestWordTarget: 0pt,
    22. bodyWordTarget: 0pt
    23. }
    24. io.writeLine(outcome(ts.classifyBreaks([ts.BreakCluster { text: "a", advance: -1pt, trackingAfter: 0pt }], selected)))
    25. io.writeLine(outcome(ts.classifyBreaks([ts.BreakCluster { text: "b", advance: 1pt, trackingAfter: 2pt }], selected)))
    기대 출력종료 코드 0
    InvalidInput
    InvalidInput
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. InvalidInput
    2. InvalidInput

    Reject a masked paragraph end in every ruleset

    링크
    main.tpzReject a masked paragraph end in every ruleset플레이그라운드 열기 →
    1. import std.typeset as ts
    2. import std.io
    3. import std.test
    4. function outcome(value: Result<Array<ts.BreakOpportunity>, ts.TypesetError>) -> string {
    5. match (value) {
    6. case Ok(_) => "Ok"
    7. case Err(InvalidInput(_)) => "InvalidInput"
    8. case Err(InvalidPolicy(_)) => "InvalidPolicy"
    9. case Err(_) => "unexpected error"
    10. }
    11. }
    12. let clusters = [ts.BreakCluster { text: "a", advance: 1pt, trackingAfter: 0pt }]
    13. let atlas = ts.BreakPolicy {
    14. mode: ts.BreakMode.Character(),
    15. rules: ts.KinsokuRules.AtlasDefault(),
    16. forbidBefore: [],
    17. forbidAfter: [],
    18. boundaryAllowed: [false],
    19. generatedHyphenEnds: [],
    20. protectFittingLatin: false,
    21. preserveShortWords: false,
    22. narrowestWordTarget: 0pt,
    23. bodyWordTarget: 0pt
    24. }
    25. let unicode = ts.BreakPolicy {
    26. mode: ts.BreakMode.Character(),
    27. rules: ts.KinsokuRules.Unicode16Ja(),
    28. forbidBefore: [],
    29. forbidAfter: [],
    30. boundaryAllowed: [false],
    31. generatedHyphenEnds: [],
    32. protectFittingLatin: false,
    33. preserveShortWords: false,
    34. narrowestWordTarget: 0pt,
    35. bodyWordTarget: 0pt
    36. }
    37. io.writeLine(outcome(ts.classifyBreaks(clusters, atlas)))
    38. io.writeLine(outcome(ts.classifyBreaks(clusters, unicode)))
    기대 출력종료 코드 0
    InvalidInput
    InvalidInput
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. InvalidInput
    2. InvalidInput

    Keep exact point measurements at the classifier boundary

    링크
    main.tpzKeep exact point measurements at the classifier boundary플레이그라운드 열기 →
    1. import std.typeset as ts
    2. import std.test
    3. import std.io
    4. let clusters = [
    5. ts.BreakCluster { text: "a", advance: 0.5002pt, trackingAfter: 0pt },
    6. ts.BreakCluster { text: "b", advance: 0.5002pt, trackingAfter: 0pt }
    7. ]
    8. let policy = ts.BreakPolicy {
    9. mode: ts.BreakMode.Word(), rules: ts.KinsokuRules.AtlasDefault(),
    10. forbidBefore: [], forbidAfter: [], boundaryAllowed: [true, true],
    11. generatedHyphenEnds: [], protectFittingLatin: false, preserveShortWords: false,
    12. narrowestWordTarget: 0pt, bodyWordTarget: 1pt
    13. }
    14. let result = test.assertOk(ts.classifyBreaks(clusters, policy))
    15. for boundary in (result) {
    16. io.writeLine("{boundary.unitEnd}")
    17. }
    기대 출력종료 코드 0
    1
    2
    
    $ topaz run main.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. 1
    2. 2

    메뉴

    다운로드 →