@tiqian/engine 0.0.1 → 0.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
- package/dist/org/tiqian/clreq/BopomofoParser.d.ts +10 -0
- package/dist/org/tiqian/clreq/BopomofoParser.js +46 -0
- package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
- package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
- package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
- package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphSubstitution.d.ts +8 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphSubstitution.js +25 -0
- package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
- package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
- package/dist/org/tiqian/clreq/ClreqProfileResolver.d.ts +10 -0
- package/dist/org/tiqian/clreq/ClreqProfileResolver.js +13 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationAdvancePolicy.d.ts +7 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationAdvancePolicy.js +40 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationGlyphSubstitutor.d.ts +19 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationGlyphSubstitutor.js +93 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationPolicies.d.ts +26 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationPolicies.js +137 -0
- package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
- package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
- package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
- package/dist/org/tiqian/clreq/GlueSide.js +17 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
- package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
- package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
- package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
- package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/NumberSymbolCohesion.d.ts +8 -0
- package/dist/org/tiqian/clreq/NumberSymbolCohesion.js +56 -0
- package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
- package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
- package/dist/org/tiqian/clreq/PunctuationPolicy.d.ts +10 -0
- package/dist/org/tiqian/clreq/PunctuationPolicy.js +18 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
- package/dist/org/tiqian/core/AccurateSum.d.ts +3 -0
- package/dist/org/tiqian/core/AccurateSum.js +9 -0
- package/dist/org/tiqian/core/AutoSpaceDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/AutoSpaceDecisionInfo.js +24 -0
- package/dist/org/tiqian/core/BopomofoDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/BopomofoDecisionInfo.js +32 -0
- package/dist/org/tiqian/core/BopomofoGlyphPlacement.d.ts +16 -0
- package/dist/org/tiqian/core/BopomofoGlyphPlacement.js +33 -0
- package/dist/org/tiqian/core/BopomofoGlyphRole.d.ts +16 -0
- package/dist/org/tiqian/core/BopomofoGlyphRole.js +17 -0
- package/dist/org/tiqian/core/BreakOpportunityDecisionInfo.d.ts +11 -0
- package/dist/org/tiqian/core/BreakOpportunityDecisionInfo.js +52 -0
- package/dist/org/tiqian/core/BuiltInLayoutProfiles.d.ts +4 -0
- package/dist/org/tiqian/core/BuiltInLayoutProfiles.js +5 -0
- package/dist/org/tiqian/core/Cluster.d.ts +13 -0
- package/dist/org/tiqian/core/Cluster.js +24 -0
- package/dist/org/tiqian/core/ClusterGeometryDecisionInfo.d.ts +21 -0
- package/dist/org/tiqian/core/ClusterGeometryDecisionInfo.js +40 -0
- package/dist/org/tiqian/core/ColorSpan.d.ts +8 -0
- package/dist/org/tiqian/core/ColorSpan.js +25 -0
- package/dist/org/tiqian/core/ContextualKinsokuDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/ContextualKinsokuDecisionInfo.js +47 -0
- package/dist/org/tiqian/core/DecorationDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/DecorationDecisionInfo.js +24 -0
- package/dist/org/tiqian/core/DecorationKind.d.ts +20 -0
- package/dist/org/tiqian/core/DecorationKind.js +20 -0
- package/dist/org/tiqian/core/DecorationSegmentInfo.d.ts +15 -0
- package/dist/org/tiqian/core/DecorationSegmentInfo.js +28 -0
- package/dist/org/tiqian/core/DecorationSpan.d.ts +10 -0
- package/dist/org/tiqian/core/DecorationSpan.js +36 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
- package/dist/org/tiqian/core/EmergencyTrackingEligibilityDecisionInfo.d.ts +9 -0
- package/dist/org/tiqian/core/EmergencyTrackingEligibilityDecisionInfo.js +29 -0
- package/dist/org/tiqian/core/FirstLineIndentDecisionInfo.d.ts +8 -0
- package/dist/org/tiqian/core/FirstLineIndentDecisionInfo.js +16 -0
- package/dist/org/tiqian/core/FittedLinePatternGeometry.d.ts +2 -0
- package/dist/org/tiqian/core/FittedLinePatternGeometry.js +84 -0
- package/dist/org/tiqian/core/FontDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/FontDecisionInfo.js +45 -0
- package/dist/org/tiqian/core/Glyph.d.ts +15 -0
- package/dist/org/tiqian/core/Glyph.js +30 -0
- package/dist/org/tiqian/core/GlyphRun.d.ts +11 -0
- package/dist/org/tiqian/core/GlyphRun.js +28 -0
- package/dist/org/tiqian/core/Ic.d.ts +7 -0
- package/dist/org/tiqian/core/Ic.js +17 -0
- package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
- package/dist/org/tiqian/core/IllegalStateException.js +8 -0
- package/dist/org/tiqian/core/InlineAttachment.d.ts +12 -0
- package/dist/org/tiqian/core/InlineAttachment.js +14 -0
- package/dist/org/tiqian/core/InlineBoxDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/InlineBoxDecisionInfo.js +22 -0
- package/dist/org/tiqian/core/InlineBoxOuterSpacing.d.ts +12 -0
- package/dist/org/tiqian/core/InlineBoxOuterSpacing.js +14 -0
- package/dist/org/tiqian/core/InlineBoxSpan.d.ts +10 -0
- package/dist/org/tiqian/core/InlineBoxSpan.js +17 -0
- package/dist/org/tiqian/core/InlineObjectBoundaryAdjustment.d.ts +12 -0
- package/dist/org/tiqian/core/InlineObjectBoundaryAdjustment.js +31 -0
- package/dist/org/tiqian/core/InlineObjectDecisionInfo.d.ts +28 -0
- package/dist/org/tiqian/core/InlineObjectDecisionInfo.js +54 -0
- package/dist/org/tiqian/core/InlineObjectLineHeightDecisionInfo.d.ts +16 -0
- package/dist/org/tiqian/core/InlineObjectLineHeightDecisionInfo.js +57 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretch.d.ts +11 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretch.js +30 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretchKind.d.ts +16 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretchKind.js +17 -0
- package/dist/org/tiqian/core/InlineObjectPunctuationAttachmentDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/InlineObjectPunctuationAttachmentDecisionInfo.js +22 -0
- package/dist/org/tiqian/core/InlineObjectSpan.d.ts +13 -0
- package/dist/org/tiqian/core/InlineObjectSpan.js +22 -0
- package/dist/org/tiqian/core/IntRange.d.ts +12 -0
- package/dist/org/tiqian/core/IntRange.js +30 -0
- package/dist/org/tiqian/core/IntRangeFns.d.ts +2 -0
- package/dist/org/tiqian/core/IntRangeFns.js +4 -0
- package/dist/org/tiqian/core/JustificationAllocationInfo.d.ts +10 -0
- package/dist/org/tiqian/core/JustificationAllocationInfo.js +18 -0
- package/dist/org/tiqian/core/JustificationDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/JustificationDecisionInfo.js +21 -0
- package/dist/org/tiqian/core/KinsokuDecisionInfo.d.ts +8 -0
- package/dist/org/tiqian/core/KinsokuDecisionInfo.js +16 -0
- package/dist/org/tiqian/core/LastLineAlignment.d.ts +16 -0
- package/dist/org/tiqian/core/LastLineAlignment.js +17 -0
- package/dist/org/tiqian/core/LayoutConstraints.d.ts +7 -0
- package/dist/org/tiqian/core/LayoutConstraints.js +24 -0
- package/dist/org/tiqian/core/LayoutDebugInfo.d.ts +70 -0
- package/dist/org/tiqian/core/LayoutDebugInfo.js +205 -0
- package/dist/org/tiqian/core/LayoutInput.d.ts +22 -0
- package/dist/org/tiqian/core/LayoutInput.js +56 -0
- package/dist/org/tiqian/core/LayoutPaintBounds.d.ts +18 -0
- package/dist/org/tiqian/core/LayoutPaintBounds.js +131 -0
- package/dist/org/tiqian/core/LayoutProfileId.d.ts +6 -0
- package/dist/org/tiqian/core/LayoutProfileId.js +17 -0
- package/dist/org/tiqian/core/LayoutQueries.d.ts +121 -0
- package/dist/org/tiqian/core/LayoutQueries.js +1297 -0
- package/dist/org/tiqian/core/LayoutQueryFns.d.ts +27 -0
- package/dist/org/tiqian/core/LayoutQueryFns.js +65 -0
- package/dist/org/tiqian/core/LayoutResult.d.ts +16 -0
- package/dist/org/tiqian/core/LayoutResult.js +36 -0
- package/dist/org/tiqian/core/LayoutResultFns.d.ts +3 -0
- package/dist/org/tiqian/core/LayoutResultFns.js +5 -0
- package/dist/org/tiqian/core/LayoutResultLineFns.d.ts +4 -0
- package/dist/org/tiqian/core/LayoutResultLineFns.js +5 -0
- package/dist/org/tiqian/core/LayoutResultReplayIndex.d.ts +37 -0
- package/dist/org/tiqian/core/LayoutResultReplayIndex.js +379 -0
- package/dist/org/tiqian/core/LineBox.d.ts +23 -0
- package/dist/org/tiqian/core/LineBox.js +43 -0
- package/dist/org/tiqian/core/LineBreakPolicy.d.ts +8 -0
- package/dist/org/tiqian/core/LineBreakPolicy.js +11 -0
- package/dist/org/tiqian/core/LineBreakSpan.d.ts +10 -0
- package/dist/org/tiqian/core/LineBreakSpan.js +30 -0
- package/dist/org/tiqian/core/LineDebugInfo.d.ts +7 -0
- package/dist/org/tiqian/core/LineDebugInfo.js +18 -0
- package/dist/org/tiqian/core/LineDecisionInfo.d.ts +14 -0
- package/dist/org/tiqian/core/LineDecisionInfo.js +32 -0
- package/dist/org/tiqian/core/LineEdgeTrimDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/LineEdgeTrimDecisionInfo.js +22 -0
- package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
- package/dist/org/tiqian/core/LineEndReason.js +17 -0
- package/dist/org/tiqian/core/LineLengthGrid.d.ts +7 -0
- package/dist/org/tiqian/core/LineLengthGrid.js +12 -0
- package/dist/org/tiqian/core/LineLengthGridDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/LineLengthGridDecisionInfo.js +26 -0
- package/dist/org/tiqian/core/LineRepairAllocationInfo.d.ts +8 -0
- package/dist/org/tiqian/core/LineRepairAllocationInfo.js +14 -0
- package/dist/org/tiqian/core/LineRepairCandidateInfo.d.ts +16 -0
- package/dist/org/tiqian/core/LineRepairCandidateInfo.js +30 -0
- package/dist/org/tiqian/core/LineRepairDecisionInfo.d.ts +15 -0
- package/dist/org/tiqian/core/LineRepairDecisionInfo.js +31 -0
- package/dist/org/tiqian/core/LineSpacingDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/LineSpacingDecisionInfo.js +20 -0
- package/dist/org/tiqian/core/LinkAddressDisplay.d.ts +3 -0
- package/dist/org/tiqian/core/LinkAddressDisplay.js +12 -0
- package/dist/org/tiqian/core/MandatoryBreakDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/MandatoryBreakDecisionInfo.js +33 -0
- package/dist/org/tiqian/core/MaxLinesDecisionInfo.d.ts +8 -0
- package/dist/org/tiqian/core/MaxLinesDecisionInfo.js +25 -0
- package/dist/org/tiqian/core/MeasureAdaptiveFirstLineIndent.d.ts +8 -0
- package/dist/org/tiqian/core/MeasureAdaptiveFirstLineIndent.js +17 -0
- package/dist/org/tiqian/core/MetricDecisionInfo.d.ts +19 -0
- package/dist/org/tiqian/core/MetricDecisionInfo.js +36 -0
- package/dist/org/tiqian/core/ParagraphStyle.d.ts +22 -0
- package/dist/org/tiqian/core/ParagraphStyle.js +36 -0
- package/dist/org/tiqian/core/PositionedCluster.d.ts +22 -0
- package/dist/org/tiqian/core/PositionedCluster.js +52 -0
- package/dist/org/tiqian/core/PunctuationDecisionInfo.d.ts +29 -0
- package/dist/org/tiqian/core/PunctuationDecisionInfo.js +54 -0
- package/dist/org/tiqian/core/Rect.d.ts +12 -0
- package/dist/org/tiqian/core/Rect.js +28 -0
- package/dist/org/tiqian/core/RichTextBackgroundDrawStyle.d.ts +15 -0
- package/dist/org/tiqian/core/RichTextBackgroundDrawStyle.js +25 -0
- package/dist/org/tiqian/core/RichTextBackgroundMetricPolicy.d.ts +16 -0
- package/dist/org/tiqian/core/RichTextBackgroundMetricPolicy.js +17 -0
- package/dist/org/tiqian/core/RichTextBackgroundPaint.d.ts +19 -0
- package/dist/org/tiqian/core/RichTextBackgroundPaint.js +51 -0
- package/dist/org/tiqian/core/RichTextCornerRadii.d.ts +12 -0
- package/dist/org/tiqian/core/RichTextCornerRadii.js +28 -0
- package/dist/org/tiqian/core/RichTextLayoutProjection.d.ts +6 -0
- package/dist/org/tiqian/core/RichTextLayoutProjection.js +62 -0
- package/dist/org/tiqian/core/RichTextLinePattern.d.ts +24 -0
- package/dist/org/tiqian/core/RichTextLinePattern.js +46 -0
- package/dist/org/tiqian/core/RichTextLineSegment.d.ts +25 -0
- package/dist/org/tiqian/core/RichTextLineSegment.js +55 -0
- package/dist/org/tiqian/core/RichTextPaint.d.ts +17 -0
- package/dist/org/tiqian/core/RichTextPaint.js +64 -0
- package/dist/org/tiqian/core/RichTextProjectionFns.d.ts +7 -0
- package/dist/org/tiqian/core/RichTextProjectionFns.js +102 -0
- package/dist/org/tiqian/core/RichTextRole.d.ts +35 -0
- package/dist/org/tiqian/core/RichTextRole.js +57 -0
- package/dist/org/tiqian/core/RichTextSpan.d.ts +11 -0
- package/dist/org/tiqian/core/RichTextSpan.js +34 -0
- package/dist/org/tiqian/core/RoleOverrideInfo.d.ts +12 -0
- package/dist/org/tiqian/core/RoleOverrideInfo.js +41 -0
- package/dist/org/tiqian/core/RubyDecisionInfo.d.ts +20 -0
- package/dist/org/tiqian/core/RubyDecisionInfo.js +46 -0
- package/dist/org/tiqian/core/RubyKind.d.ts +12 -0
- package/dist/org/tiqian/core/RubyKind.js +14 -0
- package/dist/org/tiqian/core/RubyLineHeightDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/RubyLineHeightDecisionInfo.js +36 -0
- package/dist/org/tiqian/core/RubyLineHeightMode.d.ts +12 -0
- package/dist/org/tiqian/core/RubyLineHeightMode.js +14 -0
- package/dist/org/tiqian/core/RubySpan.d.ts +13 -0
- package/dist/org/tiqian/core/RubySpan.js +60 -0
- package/dist/org/tiqian/core/ShapingDecisionInfo.d.ts +21 -0
- package/dist/org/tiqian/core/ShapingDecisionInfo.js +40 -0
- package/dist/org/tiqian/core/Size.d.ts +6 -0
- package/dist/org/tiqian/core/Size.js +12 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
- package/dist/org/tiqian/core/SpacingDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/SpacingDecisionInfo.js +24 -0
- package/dist/org/tiqian/core/TextRange.d.ts +11 -0
- package/dist/org/tiqian/core/TextRange.js +40 -0
- package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
- package/dist/org/tiqian/core/TextRangeError.js +2 -0
- package/dist/org/tiqian/core/TextSpan.d.ts +8 -0
- package/dist/org/tiqian/core/TextSpan.js +12 -0
- package/dist/org/tiqian/core/TextStyle.d.ts +12 -0
- package/dist/org/tiqian/core/TextStyle.js +28 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
- package/dist/org/tiqian/core/TiqianTextContent.d.ts +12 -0
- package/dist/org/tiqian/core/TiqianTextContent.js +38 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
- package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
- package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
- package/dist/org/tiqian/core/Units.d.ts +7 -0
- package/dist/org/tiqian/core/Units.js +11 -0
- package/dist/org/tiqian/core/WritingMode.d.ts +12 -0
- package/dist/org/tiqian/core/WritingMode.js +14 -0
- package/dist/org/tiqian/core/ZeroWidthBreakDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/ZeroWidthBreakDecisionInfo.js +33 -0
- package/dist/org/tiqian/font/BaselineClass.d.ts +24 -0
- package/dist/org/tiqian/font/BaselineClass.js +23 -0
- package/dist/org/tiqian/font/BaselinePolicy.d.ts +17 -0
- package/dist/org/tiqian/font/BaselinePolicy.js +18 -0
- package/dist/org/tiqian/font/CjkDashCapabilityPolicy.d.ts +4 -0
- package/dist/org/tiqian/font/CjkDashCapabilityPolicy.js +9 -0
- package/dist/org/tiqian/font/CjkFontRoleClassifier.d.ts +8 -0
- package/dist/org/tiqian/font/CjkFontRoleClassifier.js +43 -0
- package/dist/org/tiqian/font/FontMetricSource.d.ts +24 -0
- package/dist/org/tiqian/font/FontMetricSource.js +23 -0
- package/dist/org/tiqian/font/FontMetrics.d.ts +39 -0
- package/dist/org/tiqian/font/FontMetrics.js +106 -0
- package/dist/org/tiqian/font/FontMetricsPolicy.d.ts +21 -0
- package/dist/org/tiqian/font/FontMetricsPolicy.js +21 -0
- package/dist/org/tiqian/font/FontPolicy.d.ts +36 -0
- package/dist/org/tiqian/font/FontPolicy.js +157 -0
- package/dist/org/tiqian/font/FontRole.d.ts +29 -0
- package/dist/org/tiqian/font/FontRole.js +27 -0
- package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
- package/dist/org/tiqian/font/FontRoleContext.js +28 -0
- package/dist/org/tiqian/font/InlineShapingStylePolicy.d.ts +4 -0
- package/dist/org/tiqian/font/InlineShapingStylePolicy.js +18 -0
- package/dist/org/tiqian/font/LayoutFontMetrics.d.ts +18 -0
- package/dist/org/tiqian/font/LayoutFontMetrics.js +29 -0
- package/dist/org/tiqian/font/MetricBox.d.ts +20 -0
- package/dist/org/tiqian/font/MetricBox.js +20 -0
- package/dist/org/tiqian/font/PreferCjkForAmbiguousPunctuationResolver.d.ts +10 -0
- package/dist/org/tiqian/font/PreferCjkForAmbiguousPunctuationResolver.js +30 -0
- package/dist/org/tiqian/font/PunctuationFontPolicy.d.ts +21 -0
- package/dist/org/tiqian/font/PunctuationFontPolicy.js +21 -0
- package/dist/org/tiqian/font/RawFontMetrics.d.ts +11 -0
- package/dist/org/tiqian/font/RawFontMetrics.js +23 -0
- package/dist/org/tiqian/font/UnicodeEmojiData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeEmojiData.js +63 -0
- package/dist/org/tiqian/font/UnicodeEmojiPresentationData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeEmojiPresentationData.js +46 -0
- package/dist/org/tiqian/font/UnicodeEmojiStyleVariationData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeEmojiStyleVariationData.js +71 -0
- package/dist/org/tiqian/font/UnicodeSymbolData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeSymbolData.js +88 -0
- package/dist/org/tiqian/layout/AnnotationGeometryStage.d.ts +57 -0
- package/dist/org/tiqian/layout/AnnotationGeometryStage.js +622 -0
- package/dist/org/tiqian/layout/AsciiPointMarkKinsokuTestSupport.d.ts +52 -0
- package/dist/org/tiqian/layout/AsciiPointMarkKinsokuTestSupport.js +209 -0
- package/dist/org/tiqian/layout/ClusterRoleResolution.d.ts +30 -0
- package/dist/org/tiqian/layout/ClusterRoleResolution.js +215 -0
- package/dist/org/tiqian/layout/ContextualDashEllipsisRoleResolver.d.ts +54 -0
- package/dist/org/tiqian/layout/ContextualDashEllipsisRoleResolver.js +326 -0
- package/dist/org/tiqian/layout/ContextualPunctuationDisplaySubstitution.d.ts +6 -0
- package/dist/org/tiqian/layout/ContextualPunctuationDisplaySubstitution.js +8 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
- package/dist/org/tiqian/layout/DefaultHyphenator.d.ts +4 -0
- package/dist/org/tiqian/layout/DefaultHyphenator.js +7 -0
- package/dist/org/tiqian/layout/Justifier.d.ts +64 -0
- package/dist/org/tiqian/layout/Justifier.js +474 -0
- package/dist/org/tiqian/layout/KinsokuRule.d.ts +15 -0
- package/dist/org/tiqian/layout/KinsokuRule.js +24 -0
- package/dist/org/tiqian/layout/LayoutDebugAssembly.d.ts +87 -0
- package/dist/org/tiqian/layout/LayoutDebugAssembly.js +371 -0
- package/dist/org/tiqian/layout/LineAdjustmentStage.d.ts +29 -0
- package/dist/org/tiqian/layout/LineAdjustmentStage.js +797 -0
- package/dist/org/tiqian/layout/LineBreakPlanningStage.d.ts +149 -0
- package/dist/org/tiqian/layout/LineBreakPlanningStage.js +769 -0
- package/dist/org/tiqian/layout/LineBreaker.d.ts +54 -0
- package/dist/org/tiqian/layout/LineBreaker.js +457 -0
- package/dist/org/tiqian/layout/LineGeometryStage.d.ts +63 -0
- package/dist/org/tiqian/layout/LineGeometryStage.js +344 -0
- package/dist/org/tiqian/layout/LineOptimization.d.ts +125 -0
- package/dist/org/tiqian/layout/LineOptimization.js +299 -0
- package/dist/org/tiqian/layout/LineRepair.d.ts +30 -0
- package/dist/org/tiqian/layout/LineRepair.js +471 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreaker.d.ts +80 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreaker.js +556 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreakerTestSupport.d.ts +23 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreakerTestSupport.js +135 -0
- package/dist/org/tiqian/layout/ParagraphLayoutEngine.d.ts +48 -0
- package/dist/org/tiqian/layout/ParagraphLayoutEngine.js +199 -0
- package/dist/org/tiqian/layout/ParagraphShapingStage.d.ts +63 -0
- package/dist/org/tiqian/layout/ParagraphShapingStage.js +1471 -0
- package/dist/org/tiqian/layout/PlanLowering.d.ts +10 -0
- package/dist/org/tiqian/layout/PlanLowering.js +329 -0
- package/dist/org/tiqian/layout/PreparedParagraph.d.ts +32 -0
- package/dist/org/tiqian/layout/PreparedParagraph.js +114 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
- package/dist/org/tiqian/layout/PunctuationGeometryLedger.d.ts +92 -0
- package/dist/org/tiqian/layout/PunctuationGeometryLedger.js +617 -0
- package/dist/org/tiqian/layout/PunctuationGeometryStage.d.ts +73 -0
- package/dist/org/tiqian/layout/PunctuationGeometryStage.js +631 -0
- package/dist/org/tiqian/layout/PunctuationModel.d.ts +181 -0
- package/dist/org/tiqian/layout/PunctuationModel.js +414 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
- package/dist/org/tiqian/layout/UnicodePunctuationBoundaryResolver.d.ts +88 -0
- package/dist/org/tiqian/layout/UnicodePunctuationBoundaryResolver.js +495 -0
- package/dist/org/tiqian/layout/WidthIndependentAnnotationCache.d.ts +102 -0
- package/dist/org/tiqian/layout/WidthIndependentAnnotationCache.js +1207 -0
- package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
- package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
- package/dist/org/tiqian/linebreak/BreakOpportunity.d.ts +19 -0
- package/dist/org/tiqian/linebreak/BreakOpportunity.js +64 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenation.d.ts +5 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenation.js +14 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenationPatterns.d.ts +4 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenationPatterns.js +4294 -0
- package/dist/org/tiqian/linebreak/Hyphenator.d.ts +17 -0
- package/dist/org/tiqian/linebreak/Hyphenator.js +24 -0
- package/dist/org/tiqian/linebreak/LiangHyphenator.d.ts +10 -0
- package/dist/org/tiqian/linebreak/LiangHyphenator.js +67 -0
- package/dist/org/tiqian/linebreak/LineBreakAnalyzer.d.ts +9 -0
- package/dist/org/tiqian/linebreak/LineBreakAnalyzer.js +23 -0
- package/dist/org/tiqian/linebreak/LineBreakFns.d.ts +2 -0
- package/dist/org/tiqian/linebreak/LineBreakFns.js +7 -0
- package/dist/org/tiqian/linebreak/ParseTexHyphenationPatterns.d.ts +7 -0
- package/dist/org/tiqian/linebreak/ParseTexHyphenationPatterns.js +108 -0
- package/dist/org/tiqian/linebreak/ParsedTexHyphenation.d.ts +6 -0
- package/dist/org/tiqian/linebreak/ParsedTexHyphenation.js +9 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreak.d.ts +63 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreak.js +103 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreakData.d.ts +3 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreakData.js +164 -0
- package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
- package/dist/org/tiqian/protocol/NamedError.js +71 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
- package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
- package/dist/org/tiqian/protocol/Plan.js +10 -0
- package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
- package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
- package/dist/org/tiqian/protocol/PlanJson.d.ts +10 -0
- package/dist/org/tiqian/protocol/PlanJson.js +442 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
- package/dist/org/tiqian/protocol/PlanPacked.d.ts +34 -0
- package/dist/org/tiqian/protocol/PlanPacked.js +1166 -0
- package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
- package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
- package/dist/org/tiqian/shaping/ReplayableFontBackend.d.ts +48 -0
- package/dist/org/tiqian/shaping/ReplayableFontBackend.js +97 -0
- package/dist/org/tiqian/shaping/TextShaper.d.ts +71 -0
- package/dist/org/tiqian/shaping/TextShaper.js +176 -0
- package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
- package/dist/org/tiqian/test/TestHelpers.js +27 -0
- package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
- package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceField.js +10 -0
- package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
- package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
- package/dist/runtime.d.ts +96 -0
- package/dist/runtime.js +1612 -0
- package/dist/std/FsError.d.ts +48 -0
- package/dist/std/FsError.js +2 -0
- package/dist/std/FsException.d.ts +6 -0
- package/dist/std/FsException.js +45 -0
- package/dist/std/UStringException.d.ts +6 -0
- package/dist/std/UStringException.js +21 -0
- package/dist/std/UStringFault.d.ts +9 -0
- package/dist/std/UStringFault.js +2 -0
- package/package.json +22 -4
- package/README.md +0 -3
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { AccurateSum } from "./../core/AccurateSum.js";
|
|
3
|
+
import { IntRange } from "./../core/IntRange.js";
|
|
4
|
+
import { LineEndReason } from "./../core/LineEndReason.js";
|
|
5
|
+
import { TextRange } from "./../core/TextRange.js";
|
|
6
|
+
import { TiqianIllegalArgumentException } from "./../core/TiqianIllegalArgumentException.js";
|
|
7
|
+
import { LineBreakerLines, lineGapCount } from "./LineBreaker.js";
|
|
8
|
+
import { LineCandidate, LineSolution, PushInAllocation, RepairCandidate, RepairOptions } from "./LineOptimization.js";
|
|
9
|
+
import { ShrinkOpportunity, UnbreakableRanges, lineLimit } from "./ProgressiveBreakDecisions.js";
|
|
10
|
+
import { ProgressiveBreakTierPriority } from "./ProgressiveBreakTierPriority.js";
|
|
11
|
+
import { SortedTable } from "../../../runtime.js";
|
|
12
|
+
export class PushInResult {
|
|
13
|
+
previous;
|
|
14
|
+
current;
|
|
15
|
+
candidate;
|
|
16
|
+
constructor(previous, current, candidate) {
|
|
17
|
+
this.previous = previous;
|
|
18
|
+
this.current = current;
|
|
19
|
+
this.candidate = candidate;
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return `PushInResult(previous=${this.previous.toString()}, current=${(this.current === null ? "null" : this.current.toString())}, candidate=${this.candidate.toString()})`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class LineRepair {
|
|
26
|
+
static applyKinsokuRepairs(initial, naturalClusters, adjustedClusters, maxWidth, kinsoku, shrinkOpportunities, pushInPenalty, carryPreviousPenalty, leaveRaggedPenalty, unbreakableRanges, firstLineIndent, hangableClusters, extendableHangRanges, hangPenalty, forbiddenLineStartClusters) {
|
|
27
|
+
unbreakableRanges = unbreakableRanges ?? null;
|
|
28
|
+
firstLineIndent = firstLineIndent ?? null;
|
|
29
|
+
hangableClusters = hangableClusters ?? null;
|
|
30
|
+
extendableHangRanges = extendableHangRanges ?? null;
|
|
31
|
+
hangPenalty = hangPenalty ?? null;
|
|
32
|
+
forbiddenLineStartClusters = forbiddenLineStartClusters ?? null;
|
|
33
|
+
if (initial.length < 2) {
|
|
34
|
+
return new LineSolution(initial);
|
|
35
|
+
}
|
|
36
|
+
const ranges = unbreakableRanges ?? UnbreakableRanges.Empty;
|
|
37
|
+
const indent = firstLineIndent ?? 0;
|
|
38
|
+
const hangables = hangableClusters ?? LineRepair.emptyIntSet();
|
|
39
|
+
const extendables = extendableHangRanges ?? [];
|
|
40
|
+
const hangCost = hangPenalty ?? 5;
|
|
41
|
+
const mutable = initial.slice();
|
|
42
|
+
let i = 1;
|
|
43
|
+
while (i < mutable.length) {
|
|
44
|
+
const curr = mutable[i];
|
|
45
|
+
const firstIndex = curr.clusterRange.start;
|
|
46
|
+
const prev = mutable[i - 1];
|
|
47
|
+
if (prev.endReason.kind === "MandatoryBreak" || curr.clusterRange.isEmpty) {
|
|
48
|
+
i++;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const firstCluster = adjustedClusters[firstIndex];
|
|
52
|
+
const forbidden = (forbiddenLineStartClusters !== null ? forbiddenLineStartClusters.has(firstIndex) : kinsoku.forbiddenAtLineStart(firstCluster));
|
|
53
|
+
if (!forbidden) {
|
|
54
|
+
i++;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const repairCandidates = [];
|
|
58
|
+
const pushIn = LineRepair.tryPushIn(prev, curr, naturalClusters, adjustedClusters, lineLimit(maxWidth, (indent), prev.clusterRange.start), shrinkOpportunities, pushInPenalty, null, "ForbiddenAtLineStart");
|
|
59
|
+
repairCandidates.push(pushIn.candidate);
|
|
60
|
+
if (pushIn.candidate.accepted) {
|
|
61
|
+
mutable[i - 1] = pushIn.previous;
|
|
62
|
+
if (pushIn.current === null) {
|
|
63
|
+
mutable.splice(i, 1);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
mutable[i] = pushIn.current;
|
|
67
|
+
}
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const offenderIndex = curr.clusterRange.start;
|
|
71
|
+
const existingHanging = prev.hangingClusterIndices;
|
|
72
|
+
let extendsContextualHang = false;
|
|
73
|
+
if (existingHanging.size() > 0 && prev.clusterRange.end + 1 === offenderIndex) {
|
|
74
|
+
let gi = 0;
|
|
75
|
+
while (gi < extendables.length) {
|
|
76
|
+
const group = extendables[gi];
|
|
77
|
+
if (offenderIndex >= group.start && offenderIndex <= group.end) {
|
|
78
|
+
let all = true;
|
|
79
|
+
let hi = 0;
|
|
80
|
+
while (hi < existingHanging.size()) {
|
|
81
|
+
const idx = existingHanging.at(hi);
|
|
82
|
+
if (idx < group.start || idx > group.end) {
|
|
83
|
+
all = false;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
hi++;
|
|
87
|
+
}
|
|
88
|
+
if (all) {
|
|
89
|
+
extendsContextualHang = true;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
gi++;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (hangables.has(offenderIndex) && (existingHanging.size() === 0 || extendsContextualHang)) {
|
|
97
|
+
const mergeEndIndex = LineRepair.mandatoryBreakTailEnd(curr, offenderIndex, adjustedClusters);
|
|
98
|
+
const hangCandidate = new RepairCandidate("Hang", "ForbiddenAtLineStart", offenderIndex, (hangCost), true, null, null, null);
|
|
99
|
+
repairCandidates.push(hangCandidate);
|
|
100
|
+
const mergedRange = new IntRange(prev.clusterRange.start, mergeEndIndex);
|
|
101
|
+
const mergedTerms = [];
|
|
102
|
+
let wi = prev.clusterRange.end + 1;
|
|
103
|
+
while (wi <= mergeEndIndex) {
|
|
104
|
+
mergedTerms.push(naturalClusters[wi].advance);
|
|
105
|
+
wi++;
|
|
106
|
+
}
|
|
107
|
+
const mergedNatural = prev.naturalWidth + AccurateSum.of(mergedTerms);
|
|
108
|
+
const hangIndices = SortedTable.setBuilder(SortedTable.compareInts);
|
|
109
|
+
let ai = 0;
|
|
110
|
+
while (ai < existingHanging.size()) {
|
|
111
|
+
hangIndices.put(existingHanging.at(ai));
|
|
112
|
+
ai++;
|
|
113
|
+
}
|
|
114
|
+
let xi = offenderIndex;
|
|
115
|
+
while (xi <= mergeEndIndex) {
|
|
116
|
+
hangIndices.put(xi);
|
|
117
|
+
xi++;
|
|
118
|
+
}
|
|
119
|
+
const candidateList = prev.repairCandidates.slice();
|
|
120
|
+
let cpi = 0;
|
|
121
|
+
while (cpi < repairCandidates.length) {
|
|
122
|
+
candidateList.push(repairCandidates[cpi]);
|
|
123
|
+
cpi++;
|
|
124
|
+
}
|
|
125
|
+
mutable[i - 1] = new LineCandidate(mergedRange, new TextRange(adjustedClusters[mergedRange.start].range.start, adjustedClusters[mergeEndIndex].range.end), mergedNatural, prev.adjustedWidth, ((mergeEndIndex === curr.clusterRange.end ? curr.endReason : prev.endReason) ?? LineEndReason.AutoWrap), { kind: "Hang", penalty: hangCost, reason: `ForbiddenAtLineStart:${firstCluster.text}:hang`, offenderClusterIndex: offenderIndex }, candidateList, hangIndices.build());
|
|
126
|
+
if (mergeEndIndex === curr.clusterRange.end) {
|
|
127
|
+
mutable.splice(i, 1);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
mutable[i] = LineBreakerLines.rebuildLine(new IntRange(mergeEndIndex + 1, curr.clusterRange.end), naturalClusters, adjustedClusters, curr.endReason, null, null);
|
|
131
|
+
}
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const canCarry = prev.clusterRange.start < prev.clusterRange.end;
|
|
135
|
+
if (!canCarry) {
|
|
136
|
+
repairCandidates.push(new RepairCandidate("CarryPrevious", "ForbiddenAtLineStart", firstIndex, carryPreviousPenalty, false, "no-room-to-carry", null, null));
|
|
137
|
+
repairCandidates.push(new RepairCandidate("LeaveRagged", "ForbiddenAtLineStart", firstIndex, leaveRaggedPenalty, true, null, null, null));
|
|
138
|
+
mutable[i] = new LineCandidate(curr.clusterRange, curr.sourceRange, curr.naturalWidth, curr.adjustedWidth, curr.endReason, { kind: "LeaveRagged", penalty: leaveRaggedPenalty, reason: `ForbiddenAtLineStart:${firstCluster.text}:no-room-to-carry`, offenderClusterIndex: firstIndex }, repairCandidates, curr.hangingClusterIndices);
|
|
139
|
+
i++;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const carriedIndex = prev.clusterRange.end;
|
|
143
|
+
if (ranges.containsBoundary(carriedIndex)) {
|
|
144
|
+
repairCandidates.push(new RepairCandidate("CarryPrevious", "ForbiddenAtLineStart", firstIndex, carryPreviousPenalty, false, "carry-would-split-mourning-span", null, carriedIndex));
|
|
145
|
+
repairCandidates.push(new RepairCandidate("LeaveRagged", "ForbiddenAtLineStart", firstIndex, leaveRaggedPenalty, true, null, null, null));
|
|
146
|
+
mutable[i] = new LineCandidate(curr.clusterRange, curr.sourceRange, curr.naturalWidth, curr.adjustedWidth, curr.endReason, { kind: "LeaveRagged", penalty: leaveRaggedPenalty, reason: `ForbiddenAtLineStart:${firstCluster.text}:carry-would-split-mourning-span`, offenderClusterIndex: firstIndex }, repairCandidates, curr.hangingClusterIndices);
|
|
147
|
+
i++;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const newPrevRange = new IntRange(prev.clusterRange.start, carriedIndex - 1);
|
|
151
|
+
const newCurrRange = new IntRange(carriedIndex, curr.clusterRange.end);
|
|
152
|
+
const carriedCurrent = LineBreakerLines.rebuildLine(newCurrRange, naturalClusters, adjustedClusters, curr.endReason, null, null);
|
|
153
|
+
if (carriedCurrent.adjustedWidth > maxWidth) {
|
|
154
|
+
repairCandidates.push(new RepairCandidate("CarryPrevious", "ForbiddenAtLineStart", firstIndex, carryPreviousPenalty, false, "carry-overflows", null, carriedIndex));
|
|
155
|
+
repairCandidates.push(new RepairCandidate("LeaveRagged", "ForbiddenAtLineStart", firstIndex, leaveRaggedPenalty, true, null, null, null));
|
|
156
|
+
mutable[i] = new LineCandidate(curr.clusterRange, curr.sourceRange, curr.naturalWidth, curr.adjustedWidth, curr.endReason, { kind: "LeaveRagged", penalty: leaveRaggedPenalty, reason: `ForbiddenAtLineStart:${firstCluster.text}:carry-overflows`, offenderClusterIndex: firstIndex }, repairCandidates, curr.hangingClusterIndices);
|
|
157
|
+
i++;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
repairCandidates.push(new RepairCandidate("CarryPrevious", "ForbiddenAtLineStart", firstIndex, carryPreviousPenalty, true, null, null, carriedIndex));
|
|
161
|
+
mutable[i - 1] = LineBreakerLines.rebuildLine(newPrevRange, naturalClusters, adjustedClusters, prev.endReason, null, null);
|
|
162
|
+
mutable[i] = new LineCandidate(carriedCurrent.clusterRange, carriedCurrent.sourceRange, carriedCurrent.naturalWidth, carriedCurrent.adjustedWidth, carriedCurrent.endReason, { kind: "CarryPrevious", penalty: carryPreviousPenalty, reason: `ForbiddenAtLineStart:${firstCluster.text}:carried=${adjustedClusters[carriedIndex].text}`, offenderClusterIndex: firstIndex, carriedClusterIndex: carriedIndex }, repairCandidates, carriedCurrent.hangingClusterIndices);
|
|
163
|
+
i++;
|
|
164
|
+
}
|
|
165
|
+
const badnessTerms = [];
|
|
166
|
+
for (let bi = 0, count = mutable.length; bi < count; bi += 1) {
|
|
167
|
+
badnessTerms.push((mutable[bi].repair === null ? 0.0 : RepairOptions.penalty((mutable[bi].repair)) * 1.0));
|
|
168
|
+
}
|
|
169
|
+
const totalBadness = AccurateSum.of(badnessTerms);
|
|
170
|
+
return new LineSolution(mutable, totalBadness);
|
|
171
|
+
}
|
|
172
|
+
static tryPushIn(prev, curr, naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, pushInPenalty, mergeThroughClusterIndex, reasonCode) {
|
|
173
|
+
mergeThroughClusterIndex = mergeThroughClusterIndex ?? null;
|
|
174
|
+
reasonCode = reasonCode ?? null;
|
|
175
|
+
const code = reasonCode ?? "ForbiddenAtLineStart";
|
|
176
|
+
const offenderIndex = mergeThroughClusterIndex ?? curr.clusterRange.start;
|
|
177
|
+
if (offenderIndex < curr.clusterRange.start || offenderIndex > curr.clusterRange.end) {
|
|
178
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "PushIn merge-through cluster must belong to the current line." });
|
|
179
|
+
}
|
|
180
|
+
const mergeEndIndex = LineRepair.mandatoryBreakTailEnd(curr, (offenderIndex), adjustedClusters);
|
|
181
|
+
const expandedRange = new IntRange(prev.clusterRange.start, mergeEndIndex);
|
|
182
|
+
const expanded = LineBreakerLines.rebuildLine(expandedRange, naturalClusters, adjustedClusters, null, null, null);
|
|
183
|
+
const overflow = expanded.adjustedWidth - maxWidth;
|
|
184
|
+
const pipeline_result = new Array();
|
|
185
|
+
for (let pipeline_index = 0, count2 = shrinkOpportunities.length; pipeline_index < count2; pipeline_index += 1) {
|
|
186
|
+
const v = shrinkOpportunities[pipeline_index];
|
|
187
|
+
if (v.clusterIndex >= expandedRange.start && v.clusterIndex <= expandedRange.end && v.capacity > 0 && (!v.lineEndOnly || v.clusterIndex === offenderIndex)) {
|
|
188
|
+
pipeline_result.push(v);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const _this = pipeline_result;
|
|
192
|
+
const count3 = _this.length;
|
|
193
|
+
const pipeline_result1 = new Array(count3);
|
|
194
|
+
for (let pipeline_index1 = 0; pipeline_index1 < count3; pipeline_index1 += 1) {
|
|
195
|
+
const v2 = _this[pipeline_index1];
|
|
196
|
+
pipeline_result1[pipeline_index1] = (v2.clusterIndex === offenderIndex && (v2.channel.kind === "TrailingGlue" || v2.channel.kind === "LeadingAndTrailingGlue") ? new ShrinkOpportunity(v2.clusterIndex, 1, v2.capacity, v2.channel, v2.lineEndOnly) : v2);
|
|
197
|
+
}
|
|
198
|
+
const inLine = pipeline_result1;
|
|
199
|
+
const capacityTerms = [];
|
|
200
|
+
for (let ci = 0, count4 = inLine.length; ci < count4; ci += 1) {
|
|
201
|
+
capacityTerms.push(inLine[ci].capacity);
|
|
202
|
+
}
|
|
203
|
+
const totalCapacity = AccurateSum.of(capacityTerms);
|
|
204
|
+
if (overflow > totalCapacity) {
|
|
205
|
+
const required = (overflow > 0 ? overflow : 0);
|
|
206
|
+
return new PushInResult(prev, curr, new RepairCandidate("PushIn", (code), (offenderIndex), pushInPenalty, false, "insufficient-capacity", offenderIndex, null, 0, required, totalCapacity));
|
|
207
|
+
}
|
|
208
|
+
const shrink = (overflow > 0 ? overflow : 0);
|
|
209
|
+
const allocations = (shrink > 0 ? LineRepair.distributePushInShrink(inLine, shrink) : []);
|
|
210
|
+
const offender = adjustedClusters[offenderIndex];
|
|
211
|
+
const candidate = new RepairCandidate("PushIn", (code), (offenderIndex), pushInPenalty, true, null, offenderIndex, null, shrink, shrink, totalCapacity);
|
|
212
|
+
const reasonText = (shrink > 0 ? code + ":" + offender.text + ":pushed-in=" + LineRepair.toPortableDebugString(shrink) + "/" + LineRepair.toPortableDebugString(totalCapacity) : code + ":" + offender.text + ":fits-no-shrink");
|
|
213
|
+
const candidateList = prev.repairCandidates.slice();
|
|
214
|
+
candidateList.push(candidate);
|
|
215
|
+
const repairedPrevious = new LineCandidate(expanded.clusterRange, expanded.sourceRange, expanded.naturalWidth, expanded.adjustedWidth - shrink, ((mergeEndIndex === curr.clusterRange.end ? curr.endReason : prev.endReason) ?? LineEndReason.AutoWrap), { kind: "PushIn", penalty: pushInPenalty, reason: reasonText, offenderClusterIndex: offenderIndex, allocations, totalShrink: shrink, totalAvailableCapacity: totalCapacity }, candidateList, expanded.hangingClusterIndices);
|
|
216
|
+
const repairedCurrent = (mergeEndIndex === curr.clusterRange.end ? null : LineBreakerLines.rebuildLine(new IntRange(mergeEndIndex + 1, curr.clusterRange.end), naturalClusters, adjustedClusters, curr.endReason, null, null));
|
|
217
|
+
return new PushInResult(repairedPrevious, repairedCurrent, candidate);
|
|
218
|
+
}
|
|
219
|
+
static mandatoryBreakTailEnd(curr, mergeThroughClusterIndex, adjustedClusters) {
|
|
220
|
+
if (curr.endReason.kind !== "MandatoryBreak") {
|
|
221
|
+
return mergeThroughClusterIndex;
|
|
222
|
+
}
|
|
223
|
+
if (mergeThroughClusterIndex >= curr.clusterRange.end) {
|
|
224
|
+
return mergeThroughClusterIndex;
|
|
225
|
+
}
|
|
226
|
+
let tailIsZeroWidthBreak = true;
|
|
227
|
+
let idx = mergeThroughClusterIndex + 1;
|
|
228
|
+
while (idx <= curr.clusterRange.end) {
|
|
229
|
+
if (!(adjustedClusters[idx].displayText.length === 0 && adjustedClusters[idx].advance === 0)) {
|
|
230
|
+
tailIsZeroWidthBreak = false;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
idx++;
|
|
234
|
+
}
|
|
235
|
+
return (tailIsZeroWidthBreak ? curr.clusterRange.end : mergeThroughClusterIndex);
|
|
236
|
+
}
|
|
237
|
+
static distributePushInShrink(opportunities, totalShrink) {
|
|
238
|
+
const count5 = opportunities.length;
|
|
239
|
+
if (count5 === 0 || totalShrink <= 0) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
const allocations = [];
|
|
243
|
+
let remaining = totalShrink;
|
|
244
|
+
const pipeline_builder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
245
|
+
for (let pipeline_index = 0; pipeline_index < count5; pipeline_index += 1) {
|
|
246
|
+
const opp = opportunities[pipeline_index];
|
|
247
|
+
{
|
|
248
|
+
const pipeline_entry = { key: opp.tier, value: opp };
|
|
249
|
+
let pipeline_bucket = pipeline_builder.get(pipeline_entry.key);
|
|
250
|
+
if (pipeline_bucket === null) {
|
|
251
|
+
pipeline_bucket = new Array();
|
|
252
|
+
pipeline_builder.put(pipeline_entry.key, pipeline_bucket);
|
|
253
|
+
}
|
|
254
|
+
pipeline_bucket.push(pipeline_entry.value);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const pipeline_result = pipeline_builder.build();
|
|
258
|
+
const byTier = pipeline_result;
|
|
259
|
+
let tierIdx = 0;
|
|
260
|
+
while (tierIdx < byTier.size()) {
|
|
261
|
+
const tierOpps = byTier.valueAt(tierIdx);
|
|
262
|
+
const tierTerms = [];
|
|
263
|
+
for (let ti = 0, count6 = tierOpps.length; ti < count6; ti += 1) {
|
|
264
|
+
tierTerms.push(tierOpps[ti].capacity);
|
|
265
|
+
}
|
|
266
|
+
const tierCapacity = AccurateSum.of(tierTerms);
|
|
267
|
+
if (tierCapacity > 0) {
|
|
268
|
+
const tierShrink = (remaining < tierCapacity ? remaining : tierCapacity);
|
|
269
|
+
let tierRemaining = tierShrink;
|
|
270
|
+
const ordered = LineRepair.sortByClusterIndex(tierOpps);
|
|
271
|
+
let i2 = 0;
|
|
272
|
+
while (i2 < ordered.length) {
|
|
273
|
+
const opp2 = ordered[i2];
|
|
274
|
+
const isLast = i2 === tierOpps.length - 1;
|
|
275
|
+
let share = 0.0;
|
|
276
|
+
if (isLast) {
|
|
277
|
+
share = (tierRemaining < opp2.capacity ? tierRemaining : opp2.capacity);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const proportional = tierShrink * opp2.capacity / tierCapacity;
|
|
281
|
+
share = (proportional < opp2.capacity ? proportional : opp2.capacity);
|
|
282
|
+
}
|
|
283
|
+
if (share > 0) {
|
|
284
|
+
allocations.push(new PushInAllocation(opp2.clusterIndex, share, opp2.capacity, opp2.channel));
|
|
285
|
+
tierRemaining -= share;
|
|
286
|
+
}
|
|
287
|
+
i2++;
|
|
288
|
+
}
|
|
289
|
+
remaining -= tierShrink - (tierRemaining > 0 ? tierRemaining : 0);
|
|
290
|
+
}
|
|
291
|
+
tierIdx++;
|
|
292
|
+
}
|
|
293
|
+
return allocations;
|
|
294
|
+
}
|
|
295
|
+
static sortByClusterIndex(opportunities) {
|
|
296
|
+
const pipeline_result = opportunities.slice().sort((_a, _b) => { const _ka = _a.clusterIndex; const _kb = _b.clusterIndex; return _ka < _kb ? -1 : (_ka > _kb ? 1 : 0); });
|
|
297
|
+
return pipeline_result;
|
|
298
|
+
}
|
|
299
|
+
static toPortableDebugString(value) {
|
|
300
|
+
const text = `${value}`;
|
|
301
|
+
if (text.indexOf(".") === -1 && text.toLowerCase().indexOf("e") === -1) {
|
|
302
|
+
return text + ".0";
|
|
303
|
+
}
|
|
304
|
+
return text;
|
|
305
|
+
}
|
|
306
|
+
static emptyIntSet() {
|
|
307
|
+
const b = SortedTable.setBuilder(SortedTable.compareInts);
|
|
308
|
+
return b.build();
|
|
309
|
+
}
|
|
310
|
+
static isContinuableZeroShrinkFillPushIn(repair) {
|
|
311
|
+
if (repair === null) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
const r = repair;
|
|
315
|
+
switch (r.kind) {
|
|
316
|
+
case "PushIn":
|
|
317
|
+
{
|
|
318
|
+
return r.totalShrink <= 0.001 && r.reason.startsWith("LineAdjustmentPushIn:");
|
|
319
|
+
}
|
|
320
|
+
case "Hang":
|
|
321
|
+
return false;
|
|
322
|
+
case "CarryPrevious":
|
|
323
|
+
return false;
|
|
324
|
+
case "CarryNext":
|
|
325
|
+
return false;
|
|
326
|
+
case "LeaveRagged":
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
static fillPushInGroupEnd(curr, forbiddenLineStartClusters, forbiddenLineEndClusters, unbreakableRanges) {
|
|
331
|
+
let groupEnd = curr.clusterRange.start;
|
|
332
|
+
while (groupEnd <= curr.clusterRange.end) {
|
|
333
|
+
const containing = unbreakableRanges.containingFromClosedStartOrNull(groupEnd);
|
|
334
|
+
if (containing !== null) {
|
|
335
|
+
groupEnd = containing.end;
|
|
336
|
+
if (groupEnd > curr.clusterRange.end) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
if (forbiddenLineEndClusters.has(groupEnd)) {
|
|
342
|
+
groupEnd += 1;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
const nextHead = groupEnd + 1;
|
|
346
|
+
if (nextHead <= curr.clusterRange.end && forbiddenLineStartClusters !== null && forbiddenLineStartClusters.has(nextHead)) {
|
|
347
|
+
groupEnd = nextHead;
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
return groupEnd;
|
|
351
|
+
}
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
static applyFillPushIn(lines, naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, firstLineIndent, compressBias, forbiddenLineStartClusters, forbiddenLineEndClusters, unbreakableRanges, pushInPenalty, gapBoundaries, progressiveBreakOpportunities) {
|
|
355
|
+
gapBoundaries = gapBoundaries ?? null;
|
|
356
|
+
progressiveBreakOpportunities = progressiveBreakOpportunities ?? null;
|
|
357
|
+
if (lines.length < 2 || compressBias <= 0) {
|
|
358
|
+
return lines;
|
|
359
|
+
}
|
|
360
|
+
const gaps = gapBoundaries ?? LineBreakerLines.emptyIntSet();
|
|
361
|
+
const progressive = progressiveBreakOpportunities ?? LineBreakerLines.emptyProgressiveMap();
|
|
362
|
+
const out = lines.slice();
|
|
363
|
+
let i = 0;
|
|
364
|
+
while (i < out.length - 1) {
|
|
365
|
+
const prev = out[i];
|
|
366
|
+
const curr = out[i + 1];
|
|
367
|
+
const canExtendZeroShrinkFill = LineRepair.isContinuableZeroShrinkFillPushIn(prev.repair);
|
|
368
|
+
if (prev.repair !== null && !canExtendZeroShrinkFill || prev.hangingClusterIndex !== null || prev.endReason.kind !== "AutoWrap") {
|
|
369
|
+
i += 1;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
const limit = lineLimit(maxWidth, firstLineIndent, prev.clusterRange.start);
|
|
373
|
+
const deficit = limit - prev.adjustedWidth;
|
|
374
|
+
if (deficit <= 0) {
|
|
375
|
+
i += 1;
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
const curr0 = curr.clusterRange.start;
|
|
379
|
+
let groupEnd = LineRepair.fillPushInGroupEnd(curr, forbiddenLineStartClusters, forbiddenLineEndClusters, unbreakableRanges);
|
|
380
|
+
if (groupEnd === null) {
|
|
381
|
+
i += 1;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
const currentBreak = progressive.get(prev.clusterRange.end + 1);
|
|
385
|
+
let resultingBreak = progressive.get(groupEnd + 1);
|
|
386
|
+
const addedTerms = [];
|
|
387
|
+
let cIdx = curr0;
|
|
388
|
+
while (cIdx <= groupEnd) {
|
|
389
|
+
addedTerms.push(adjustedClusters[cIdx].advance);
|
|
390
|
+
cIdx++;
|
|
391
|
+
}
|
|
392
|
+
let addedAdvance = AccurateSum.of(addedTerms);
|
|
393
|
+
let promotesProgressiveTier = currentBreak !== null && resultingBreak !== null && currentBreak.spanRange.start === resultingBreak.spanRange.start && currentBreak.spanRange.end === resultingBreak.spanRange.end && ProgressiveBreakTierPriority.priority(resultingBreak.tier) < ProgressiveBreakTierPriority.priority(currentBreak.tier);
|
|
394
|
+
if (promotesProgressiveTier && addedAdvance < deficit - 0.001) {
|
|
395
|
+
const activeBreak = currentBreak;
|
|
396
|
+
const searchStart = groupEnd + 2;
|
|
397
|
+
const searchEnd = curr.clusterRange.end + 1;
|
|
398
|
+
let matchingTierBoundary = null;
|
|
399
|
+
if (searchStart <= searchEnd) {
|
|
400
|
+
let boundary = searchStart;
|
|
401
|
+
while (boundary <= searchEnd) {
|
|
402
|
+
const opp = progressive.get(boundary);
|
|
403
|
+
if (opp !== null && opp.spanRange.start === activeBreak.spanRange.start && opp.spanRange.end === activeBreak.spanRange.end && opp.tier === activeBreak.tier) {
|
|
404
|
+
matchingTierBoundary = boundary;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
boundary++;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (matchingTierBoundary !== null) {
|
|
411
|
+
groupEnd = matchingTierBoundary - 1;
|
|
412
|
+
resultingBreak = progressive.get((matchingTierBoundary));
|
|
413
|
+
const reassignedTerms = [];
|
|
414
|
+
let cIdx2 = curr0;
|
|
415
|
+
while (cIdx2 <= groupEnd) {
|
|
416
|
+
reassignedTerms.push(adjustedClusters[cIdx2].advance);
|
|
417
|
+
cIdx2++;
|
|
418
|
+
}
|
|
419
|
+
addedAdvance = AccurateSum.of(reassignedTerms);
|
|
420
|
+
promotesProgressiveTier = false;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
if (currentBreak !== null && resultingBreak !== null && currentBreak.spanRange.start === resultingBreak.spanRange.start && currentBreak.spanRange.end === resultingBreak.spanRange.end && ProgressiveBreakTierPriority.priority(resultingBreak.tier) > ProgressiveBreakTierPriority.priority(currentBreak.tier)) {
|
|
424
|
+
i += 1;
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
const overflow = addedAdvance - deficit;
|
|
428
|
+
if (promotesProgressiveTier && overflow < -0.001) {
|
|
429
|
+
i += 1;
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
if (overflow >= deficit * compressBias) {
|
|
433
|
+
i += 1;
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if (overflow > 0.0 && !promotesProgressiveTier) {
|
|
437
|
+
const prevGaps = lineGapCount(prev.clusterRange, (gaps));
|
|
438
|
+
const dStretchCured = (prevGaps === 0 ? 0.0 : deficit / prevGaps);
|
|
439
|
+
const groupGaps = lineGapCount(new IntRange(prev.clusterRange.start, (groupEnd)), (gaps));
|
|
440
|
+
const dCompressionIntroduced = overflow / (groupGaps > 1 ? groupGaps : 1);
|
|
441
|
+
if (dCompressionIntroduced > dStretchCured) {
|
|
442
|
+
i += 1;
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
const result = LineRepair.tryPushIn(prev, curr, naturalClusters, adjustedClusters, limit, shrinkOpportunities, pushInPenalty, groupEnd, (promotesProgressiveTier ? "ProgressiveTechnicalTierPromotion" : "LineAdjustmentPushIn"));
|
|
447
|
+
if (result.candidate.accepted) {
|
|
448
|
+
out[i] = result.previous;
|
|
449
|
+
if (result.current === null) {
|
|
450
|
+
out.splice(i + 1, 1);
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
out[i + 1] = result.current;
|
|
454
|
+
}
|
|
455
|
+
if (LineRepair.isContinuableZeroShrinkFillPushIn(result.previous.repair) && result.current !== null) {
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
i += 1;
|
|
460
|
+
}
|
|
461
|
+
return out;
|
|
462
|
+
}
|
|
463
|
+
static withFillPushIn(solution, enabled, naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, firstLineIndent, compressBias, forbiddenLineStartClusters, forbiddenLineEndClusters, unbreakableRanges, pushInPenalty, gapBoundaries, progressiveBreakOpportunities) {
|
|
464
|
+
gapBoundaries = gapBoundaries ?? null;
|
|
465
|
+
progressiveBreakOpportunities = progressiveBreakOpportunities ?? null;
|
|
466
|
+
if (!enabled) {
|
|
467
|
+
return solution;
|
|
468
|
+
}
|
|
469
|
+
return new LineSolution(LineRepair.applyFillPushIn(solution.lines, naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, firstLineIndent, compressBias, forbiddenLineStartClusters, forbiddenLineEndClusters, unbreakableRanges, pushInPenalty, gapBoundaries, progressiveBreakOpportunities), solution.totalBadness);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type Cluster } from "./../core/Cluster.js";
|
|
2
|
+
import { IntRange } from "./../core/IntRange.js";
|
|
3
|
+
import { LineEndReason } from "./../core/LineEndReason.js";
|
|
4
|
+
import { type KinsokuRule } from "./KinsokuRule.js";
|
|
5
|
+
import { type LineBreaker } from "./LineBreaker.js";
|
|
6
|
+
import { LineCandidate, LineSolution } from "./LineOptimization.js";
|
|
7
|
+
import { type ProgressiveBreakOpportunity, type ShrinkOpportunity, UnbreakableRanges } from "./ProgressiveBreakDecisions.js";
|
|
8
|
+
import { SortedMapTable, SortedSetTable } from "../../../runtime.js";
|
|
9
|
+
export declare class ParagraphDpLineBreaker implements LineBreaker {
|
|
10
|
+
private readonly candidateWindow;
|
|
11
|
+
private readonly raggednessWeight;
|
|
12
|
+
private readonly kinsoku;
|
|
13
|
+
private readonly pushInPenalty;
|
|
14
|
+
private readonly carryPreviousPenalty;
|
|
15
|
+
private readonly leaveRaggedPenalty;
|
|
16
|
+
private readonly syntheticHyphenBreakPenalty;
|
|
17
|
+
private readonly consecutiveSyntheticHyphenPenalty;
|
|
18
|
+
private readonly consecutiveStretchPenalty;
|
|
19
|
+
private readonly compressionVisibility;
|
|
20
|
+
private static readonly HYPHEN_RUN_STATE_CAP;
|
|
21
|
+
private static readonly STRETCH_RUN_STATE_CAP;
|
|
22
|
+
private static readonly VISIBLE_STRETCH_FLOOR_PX;
|
|
23
|
+
constructor(candidateWindow?: number | null, raggednessWeight?: number | null, kinsoku?: KinsokuRule | null, pushInPenalty?: number | null, carryPreviousPenalty?: number | null, leaveRaggedPenalty?: number | null, syntheticHyphenBreakPenalty?: number | null, consecutiveSyntheticHyphenPenalty?: number | null, consecutiveStretchPenalty?: number | null, compressionVisibility?: number | null);
|
|
24
|
+
get strategyName(): string;
|
|
25
|
+
get_strategyName(): string;
|
|
26
|
+
breakLines(naturalClusters: Cluster[], adjustedClusters: Cluster[], maxWidth: number, shrinkOpportunities: ShrinkOpportunity[] | null, unbreakableRanges: UnbreakableRanges | null, firstLineIndent: number, hangableClusters: SortedSetTable<number> | null, extendableHangRanges: IntRange[] | null, forbiddenLineStartClusters: SortedSetTable<number> | null, forbiddenLineEndClusters: SortedSetTable<number> | null, hyphenBreakClusters: SortedSetTable<number> | null, cjkInterCharBoundaries: SortedSetTable<number> | null, maxCjkStretchPerGap: number | null, sinoWesternBoundaries: SortedSetTable<number> | null, sinoWesternStretchCap: number, lineAdjustmentPushIn: boolean, _lineAdjustmentCompressBias: number, hardBreakAfterClusters?: SortedSetTable<number> | null, nonRenderingControlClusters?: SortedSetTable<number> | null, progressiveBreakOpportunities?: SortedMapTable<number, ProgressiveBreakOpportunity> | null): LineSolution;
|
|
27
|
+
private candidateEnds;
|
|
28
|
+
private edgeGeometry;
|
|
29
|
+
private solveSegment;
|
|
30
|
+
private greedyFallbackEnds;
|
|
31
|
+
private commitSegment;
|
|
32
|
+
private static rangeHasOnlyNonControlClusters;
|
|
33
|
+
}
|
|
34
|
+
export declare class DpContext {
|
|
35
|
+
readonly naturalClusters: Cluster[];
|
|
36
|
+
readonly adjustedClusters: Cluster[];
|
|
37
|
+
readonly maxWidth: number;
|
|
38
|
+
readonly shrinkOpportunities: ShrinkOpportunity[];
|
|
39
|
+
readonly unbreakableRanges: UnbreakableRanges;
|
|
40
|
+
readonly firstLineIndent: number;
|
|
41
|
+
readonly forbiddenLineStartClusters: SortedSetTable<number> | null;
|
|
42
|
+
readonly forbiddenLineEndClusters: SortedSetTable<number>;
|
|
43
|
+
readonly hyphenBreakClusters: SortedSetTable<number>;
|
|
44
|
+
readonly cjkInterCharBoundaries: SortedSetTable<number>;
|
|
45
|
+
readonly maxCjkStretchPerGap: number;
|
|
46
|
+
readonly sinoWesternBoundaries: SortedSetTable<number>;
|
|
47
|
+
readonly sinoWesternStretchCap: number;
|
|
48
|
+
readonly nonRenderingControlClusters: SortedSetTable<number>;
|
|
49
|
+
readonly gapBoundaries: SortedSetTable<number>;
|
|
50
|
+
readonly dRef: number;
|
|
51
|
+
readonly allowCompressionEdges: boolean;
|
|
52
|
+
readonly progressiveBreakOpportunities: SortedMapTable<number, ProgressiveBreakOpportunity>;
|
|
53
|
+
private readonly gapPrefix;
|
|
54
|
+
private readonly sinoPrefix;
|
|
55
|
+
private readonly cjkPrefix;
|
|
56
|
+
private readonly naturalPrefix;
|
|
57
|
+
private readonly adjustedPrefix;
|
|
58
|
+
private readonly shrinkPrefix;
|
|
59
|
+
private readonly lineEndOnlyCapacity;
|
|
60
|
+
constructor(naturalClusters: Cluster[], adjustedClusters: Cluster[], maxWidth: number, shrinkOpportunities: ShrinkOpportunity[], unbreakableRanges: UnbreakableRanges, firstLineIndent: number, forbiddenLineStartClusters: SortedSetTable<number> | null, forbiddenLineEndClusters: SortedSetTable<number>, hyphenBreakClusters: SortedSetTable<number>, cjkInterCharBoundaries: SortedSetTable<number>, maxCjkStretchPerGap: number, sinoWesternBoundaries: SortedSetTable<number>, sinoWesternStretchCap: number, nonRenderingControlClusters: SortedSetTable<number>, gapBoundaries: SortedSetTable<number>, dRef: number, allowCompressionEdges: boolean, progressiveBreakOpportunities: SortedMapTable<number, ProgressiveBreakOpportunity>);
|
|
61
|
+
buildLine(clusterRange: IntRange, endReason: LineEndReason): LineCandidate;
|
|
62
|
+
gapCount(range: IntRange): number;
|
|
63
|
+
sinoGapCount(range: IntRange): number;
|
|
64
|
+
cjkGapCount(range: IntRange): number;
|
|
65
|
+
shrinkCapacity(range: IntRange): number;
|
|
66
|
+
}
|
|
67
|
+
export declare class EdgeState {
|
|
68
|
+
readonly start: number;
|
|
69
|
+
readonly end: number;
|
|
70
|
+
readonly hyphenRun: number;
|
|
71
|
+
readonly stretchRun: number;
|
|
72
|
+
readonly cost: number;
|
|
73
|
+
readonly parent: EdgeState | null;
|
|
74
|
+
constructor(start: number, end: number, hyphenRun: number, stretchRun: number, cost: number, parent: EdgeState | null);
|
|
75
|
+
}
|
|
76
|
+
export declare class EdgeGeometry {
|
|
77
|
+
readonly baseCost: number;
|
|
78
|
+
readonly visibleStretch: boolean;
|
|
79
|
+
constructor(baseCost: number, visibleStretch: boolean);
|
|
80
|
+
}
|