@tiqian/engine 0.0.1 → 0.1.0-alpha.10
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,556 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { KinsokuLevel } from "./../clreq/KinsokuLevel.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 { ClreqKinsokuRule } from "./KinsokuRule.js";
|
|
8
|
+
import { LineBreakerLines } from "./LineBreaker.js";
|
|
9
|
+
import { LineCandidate, LineSolution } from "./LineOptimization.js";
|
|
10
|
+
import { LineRepair } from "./LineRepair.js";
|
|
11
|
+
import { ProgressiveBreakDecisions, UnbreakableRanges, lineLimit } from "./ProgressiveBreakDecisions.js";
|
|
12
|
+
import { ProgressiveBreakTierPriority } from "./ProgressiveBreakTierPriority.js";
|
|
13
|
+
import { SortedTable } from "../../../runtime.js";
|
|
14
|
+
export class ParagraphDpLineBreaker {
|
|
15
|
+
candidateWindow;
|
|
16
|
+
raggednessWeight;
|
|
17
|
+
kinsoku;
|
|
18
|
+
pushInPenalty;
|
|
19
|
+
carryPreviousPenalty;
|
|
20
|
+
leaveRaggedPenalty;
|
|
21
|
+
syntheticHyphenBreakPenalty;
|
|
22
|
+
consecutiveSyntheticHyphenPenalty;
|
|
23
|
+
consecutiveStretchPenalty;
|
|
24
|
+
compressionVisibility;
|
|
25
|
+
static HYPHEN_RUN_STATE_CAP = 3;
|
|
26
|
+
static STRETCH_RUN_STATE_CAP = 3;
|
|
27
|
+
static VISIBLE_STRETCH_FLOOR_PX = 0.5;
|
|
28
|
+
constructor(candidateWindow = null, raggednessWeight = null, kinsoku = null, pushInPenalty = null, carryPreviousPenalty = null, leaveRaggedPenalty = null, syntheticHyphenBreakPenalty = null, consecutiveSyntheticHyphenPenalty = null, consecutiveStretchPenalty = null, compressionVisibility = null) {
|
|
29
|
+
this.candidateWindow = candidateWindow ?? 8;
|
|
30
|
+
if (this.candidateWindow < 0) {
|
|
31
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "candidateWindow must be non-negative." });
|
|
32
|
+
}
|
|
33
|
+
this.raggednessWeight = raggednessWeight ?? 0.5;
|
|
34
|
+
this.kinsoku = kinsoku ?? new ClreqKinsokuRule(KinsokuLevel.Basic);
|
|
35
|
+
this.pushInPenalty = pushInPenalty ?? 2;
|
|
36
|
+
this.carryPreviousPenalty = carryPreviousPenalty ?? 10;
|
|
37
|
+
this.leaveRaggedPenalty = leaveRaggedPenalty ?? 20;
|
|
38
|
+
this.syntheticHyphenBreakPenalty = syntheticHyphenBreakPenalty ?? 12;
|
|
39
|
+
this.consecutiveSyntheticHyphenPenalty = consecutiveSyntheticHyphenPenalty ?? 12;
|
|
40
|
+
this.consecutiveStretchPenalty = consecutiveStretchPenalty ?? 3;
|
|
41
|
+
this.compressionVisibility = compressionVisibility ?? 1;
|
|
42
|
+
}
|
|
43
|
+
get strategyName() {
|
|
44
|
+
return this.get_strategyName();
|
|
45
|
+
}
|
|
46
|
+
get_strategyName() {
|
|
47
|
+
return "paragraph-dp";
|
|
48
|
+
}
|
|
49
|
+
breakLines(naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, unbreakableRanges, firstLineIndent, hangableClusters, extendableHangRanges, forbiddenLineStartClusters, forbiddenLineEndClusters, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, lineAdjustmentPushIn, _lineAdjustmentCompressBias, hardBreakAfterClusters, nonRenderingControlClusters, progressiveBreakOpportunities) {
|
|
50
|
+
hardBreakAfterClusters = hardBreakAfterClusters ?? null;
|
|
51
|
+
nonRenderingControlClusters = nonRenderingControlClusters ?? null;
|
|
52
|
+
progressiveBreakOpportunities = progressiveBreakOpportunities ?? null;
|
|
53
|
+
if (adjustedClusters.length === 0) {
|
|
54
|
+
return new LineSolution([]);
|
|
55
|
+
}
|
|
56
|
+
if (naturalClusters.length !== adjustedClusters.length) {
|
|
57
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "naturalClusters and adjustedClusters must align cluster-for-cluster." });
|
|
58
|
+
}
|
|
59
|
+
const shrink = shrinkOpportunities ?? [];
|
|
60
|
+
const ranges = unbreakableRanges ?? new UnbreakableRanges([]);
|
|
61
|
+
const indent = firstLineIndent;
|
|
62
|
+
const forbidStart = forbiddenLineStartClusters;
|
|
63
|
+
const forbidEnd = forbiddenLineEndClusters ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
64
|
+
const hyphens = hyphenBreakClusters ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
65
|
+
const cjk = cjkInterCharBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
66
|
+
const sino = sinoWesternBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
67
|
+
const gapBoundariesBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
68
|
+
for (let i = 0, count = cjk.size(); i < count; i += 1) {
|
|
69
|
+
gapBoundariesBuilder.put(cjk.at(i));
|
|
70
|
+
}
|
|
71
|
+
for (let i2 = 0, count2 = sino.size(); i2 < count2; i2 += 1) {
|
|
72
|
+
gapBoundariesBuilder.put(sino.at(i2));
|
|
73
|
+
}
|
|
74
|
+
const gapBoundaries = gapBoundariesBuilder.build();
|
|
75
|
+
const controls = nonRenderingControlClusters ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
76
|
+
const progressive = progressiveBreakOpportunities ?? SortedTable.mapBuilder(SortedTable.compareInts).build();
|
|
77
|
+
const hard = hardBreakAfterClusters ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
78
|
+
const hangables = hangableClusters ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
79
|
+
const maxStretch = maxCjkStretchPerGap ?? Infinity;
|
|
80
|
+
const sinoCap = sinoWesternStretchCap;
|
|
81
|
+
const context = new DpContext(naturalClusters, adjustedClusters, maxWidth, (shrink), (ranges), indent, (forbiddenLineStartClusters), (forbidEnd), (hyphens), (cjk), (maxStretch), (sino), sinoCap, (controls), gapBoundaries, (maxStretch), lineAdjustmentPushIn === true, (progressive));
|
|
82
|
+
const committed = [];
|
|
83
|
+
const sortedBreaks = [];
|
|
84
|
+
if (hard.size() > 0) {
|
|
85
|
+
for (let i3 = 0, count3 = hard.size(); i3 < count3; i3 += 1) {
|
|
86
|
+
sortedBreaks.push(hard.at(i3));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
let cursor = 0;
|
|
90
|
+
let segmentStart = 0;
|
|
91
|
+
while (segmentStart < adjustedClusters.length) {
|
|
92
|
+
while (cursor < sortedBreaks.length && sortedBreaks[cursor] < segmentStart) {
|
|
93
|
+
cursor++;
|
|
94
|
+
}
|
|
95
|
+
const mandatory = (cursor < sortedBreaks.length ? sortedBreaks[cursor] : null);
|
|
96
|
+
const end = (mandatory === null ? adjustedClusters.length : mandatory + 1);
|
|
97
|
+
const ends = this.solveSegment(context, segmentStart, end, mandatory !== null);
|
|
98
|
+
this.commitSegment(committed, ends, segmentStart, mandatory, context, (hard));
|
|
99
|
+
segmentStart = end;
|
|
100
|
+
}
|
|
101
|
+
return LineRepair.applyKinsokuRepairs(committed, naturalClusters, adjustedClusters, maxWidth, this.kinsoku, (shrink), this.pushInPenalty, this.carryPreviousPenalty, this.leaveRaggedPenalty, ranges, indent, hangables, (extendableHangRanges === null ? [] : extendableHangRanges), 5, forbidStart);
|
|
102
|
+
}
|
|
103
|
+
candidateEnds(context, start, segmentEndExclusive, endsWithMandatory) {
|
|
104
|
+
const limit = lineLimit(context.maxWidth, context.firstLineIndent, start);
|
|
105
|
+
const raw = LineBreakerLines.findGreedyEnd(context.adjustedClusters, start, limit, segmentEndExclusive, context.nonRenderingControlClusters);
|
|
106
|
+
if (raw >= segmentEndExclusive) {
|
|
107
|
+
return [segmentEndExclusive];
|
|
108
|
+
}
|
|
109
|
+
const progressive = ProgressiveBreakDecisions.decideProgressiveBreak(start, raw, context.progressiveBreakOpportunities, context.adjustedClusters, limit, context.cjkInterCharBoundaries, context.maxCjkStretchPerGap, context.sinoWesternBoundaries, context.sinoWesternStretchCap);
|
|
110
|
+
const baseline = ProgressiveBreakDecisions.adjustBreakForUnbreakables(ProgressiveBreakDecisions.decideHyphenBreak(start, progressive, context.adjustedClusters, limit, context.hyphenBreakClusters, context.cjkInterCharBoundaries, context.maxCjkStretchPerGap, context.sinoWesternBoundaries, context.sinoWesternStretchCap), start, context.unbreakableRanges);
|
|
111
|
+
const compressed = [];
|
|
112
|
+
if (context.allowCompressionEdges) {
|
|
113
|
+
let width = 0.0;
|
|
114
|
+
let i = start;
|
|
115
|
+
while (i < raw) {
|
|
116
|
+
width += context.adjustedClusters[i].advance;
|
|
117
|
+
i++;
|
|
118
|
+
}
|
|
119
|
+
let e = raw + 1;
|
|
120
|
+
while (e <= segmentEndExclusive && compressed.length < this.candidateWindow) {
|
|
121
|
+
width += context.adjustedClusters[e - 1].advance;
|
|
122
|
+
if (width - limit > context.shrinkCapacity(new IntRange(start, e - 1))) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
compressed.push(e);
|
|
126
|
+
e++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const isPromotion = (e) => {
|
|
130
|
+
if (e <= raw) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
const current = context.progressiveBreakOpportunities.get(progressive);
|
|
134
|
+
const resulting = context.progressiveBreakOpportunities.get(e);
|
|
135
|
+
return current !== null && resulting !== null && current.spanRange.start === resulting.spanRange.start && current.spanRange.end === resulting.spanRange.end && ProgressiveBreakTierPriority.priority(resulting.tier) < ProgressiveBreakTierPriority.priority(current.tier);
|
|
136
|
+
};
|
|
137
|
+
const filtered = [];
|
|
138
|
+
let i2 = raw - this.candidateWindow;
|
|
139
|
+
if (i2 < start + 1) {
|
|
140
|
+
i2 = start + 1;
|
|
141
|
+
}
|
|
142
|
+
while (i2 <= raw) {
|
|
143
|
+
if ((!endsWithMandatory || i2 !== segmentEndExclusive - 1) && !context.unbreakableRanges.containsBoundary(i2) && (isPromotion(i2) || ProgressiveBreakDecisions.progressiveCandidateAllowed(start, raw, i2, context.progressiveBreakOpportunities, context.adjustedClusters, limit, context.cjkInterCharBoundaries, context.maxCjkStretchPerGap, context.sinoWesternBoundaries, context.sinoWesternStretchCap)) && (i2 === segmentEndExclusive || ParagraphDpLineBreaker.rangeHasOnlyNonControlClusters(start, i2, context.nonRenderingControlClusters))) {
|
|
144
|
+
filtered.push(i2);
|
|
145
|
+
}
|
|
146
|
+
i2++;
|
|
147
|
+
}
|
|
148
|
+
for (let _g_index = 0, count4 = compressed.length; _g_index < count4; _g_index += 1) {
|
|
149
|
+
const e2 = compressed[_g_index];
|
|
150
|
+
if ((!endsWithMandatory || e2 !== segmentEndExclusive - 1) && !context.unbreakableRanges.containsBoundary(e2) && (isPromotion(e2) || ProgressiveBreakDecisions.progressiveCandidateAllowed(start, raw, e2, context.progressiveBreakOpportunities, context.adjustedClusters, limit, context.cjkInterCharBoundaries, context.maxCjkStretchPerGap, context.sinoWesternBoundaries, context.sinoWesternStretchCap)) && (e2 === segmentEndExclusive || ParagraphDpLineBreaker.rangeHasOnlyNonControlClusters(start, e2, context.nonRenderingControlClusters))) {
|
|
151
|
+
filtered.push(e2);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const clean = [];
|
|
155
|
+
for (let _g_index1 = 0, count5 = filtered.length; _g_index1 < count5; _g_index1 += 1) {
|
|
156
|
+
const e3 = filtered[_g_index1];
|
|
157
|
+
if (e3 === segmentEndExclusive || (context.forbiddenLineStartClusters === null || !context.forbiddenLineStartClusters.has(e3)) && !context.forbiddenLineEndClusters.has(e3 - 1)) {
|
|
158
|
+
clean.push(e3);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
let pool = (clean.length === 0 ? filtered : clean);
|
|
162
|
+
const promotions = [];
|
|
163
|
+
for (let _g_index2 = 0, count6 = pool.length; _g_index2 < count6; _g_index2 += 1) {
|
|
164
|
+
const e4 = pool[_g_index2];
|
|
165
|
+
if (isPromotion(e4)) {
|
|
166
|
+
promotions.push(e4);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (promotions.length > 0) {
|
|
170
|
+
let best = 999999;
|
|
171
|
+
const promoted = context.progressiveBreakOpportunities.get(promotions[0]).spanRange;
|
|
172
|
+
for (let _g_index3 = 0, count7 = promotions.length; _g_index3 < count7; _g_index3 += 1) {
|
|
173
|
+
const e5 = promotions[_g_index3];
|
|
174
|
+
const o = context.progressiveBreakOpportunities.get(e5);
|
|
175
|
+
if (ProgressiveBreakTierPriority.priority(o.tier) < best) {
|
|
176
|
+
best = ProgressiveBreakTierPriority.priority(o.tier);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const preferred = [];
|
|
180
|
+
for (let _g_index4 = 0, count8 = pool.length; _g_index4 < count8; _g_index4 += 1) {
|
|
181
|
+
const e6 = pool[_g_index4];
|
|
182
|
+
const o2 = context.progressiveBreakOpportunities.get(e6);
|
|
183
|
+
if (o2 === null || o2.spanRange.start !== promoted.start || o2.spanRange.end !== promoted.end || ProgressiveBreakTierPriority.priority(o2.tier) <= best) {
|
|
184
|
+
preferred.push(e6);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
pool = preferred;
|
|
188
|
+
}
|
|
189
|
+
if (baseline >= start + 1 && baseline <= segmentEndExclusive && promotions.length === 0) {
|
|
190
|
+
pool.push(baseline);
|
|
191
|
+
}
|
|
192
|
+
const unique = [];
|
|
193
|
+
for (let _g_index5 = 0, count9 = pool.length; _g_index5 < count9; _g_index5 += 1) {
|
|
194
|
+
const e7 = pool[_g_index5];
|
|
195
|
+
let seen = false;
|
|
196
|
+
{
|
|
197
|
+
let _g = 0;
|
|
198
|
+
while (_g < unique.length) {
|
|
199
|
+
const v = unique[_g];
|
|
200
|
+
_g++;
|
|
201
|
+
if (v === e7) {
|
|
202
|
+
seen = true;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (!seen) {
|
|
207
|
+
unique.push(e7);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return (unique.length > 0 ? unique : [(baseline < start + 1 ? start + 1 : baseline)]);
|
|
211
|
+
}
|
|
212
|
+
edgeGeometry(context, line, isSegmentLast, hyphenEnd) {
|
|
213
|
+
const limit = lineLimit(context.maxWidth, context.firstLineIndent, line.clusterRange.start);
|
|
214
|
+
const inMeasure = line.clusterRange;
|
|
215
|
+
const overflow = line.adjustedWidth - limit;
|
|
216
|
+
const orphan = (!isSegmentLast && inMeasure.start === inMeasure.end ? this.leaveRaggedPenalty : 0.0);
|
|
217
|
+
const hyphen = (hyphenEnd ? this.syntheticHyphenBreakPenalty : 0.0);
|
|
218
|
+
const ref = (context.dRef < 1.0 ? 1.0 : context.dRef);
|
|
219
|
+
if (overflow > 0.0) {
|
|
220
|
+
const gaps = (context.gapCount(inMeasure) < 1 ? 1 : context.gapCount(inMeasure));
|
|
221
|
+
const d = overflow / gaps * this.compressionVisibility;
|
|
222
|
+
return new EdgeGeometry(orphan + hyphen + d * d / ref * this.raggednessWeight, false);
|
|
223
|
+
}
|
|
224
|
+
const deficit = (isSegmentLast ? 0.0 : Math.max(limit - line.adjustedWidth, 0.0));
|
|
225
|
+
const sinoGaps = context.sinoGapCount(inMeasure);
|
|
226
|
+
const cjkGaps = context.cjkGapCount(inMeasure);
|
|
227
|
+
const sinoFill = (sinoGaps > 0 ? Math.min(deficit, sinoGaps * context.sinoWesternStretchCap) : 0.0);
|
|
228
|
+
const dSino = (sinoGaps > 0 ? sinoFill / sinoGaps : 0.0);
|
|
229
|
+
const cjkDeficit = deficit - sinoFill;
|
|
230
|
+
const dCjk = (cjkGaps > 0 ? cjkDeficit / cjkGaps : 0.0);
|
|
231
|
+
const residual = (cjkGaps === 0 ? cjkDeficit : 0.0);
|
|
232
|
+
return new EdgeGeometry(residual * this.raggednessWeight + orphan + hyphen + (dSino * dSino + dCjk * dCjk) / ref * this.raggednessWeight, Math.max(dSino, dCjk) > ParagraphDpLineBreaker.VISIBLE_STRETCH_FLOOR_PX);
|
|
233
|
+
}
|
|
234
|
+
solveSegment(context, segmentStart, segmentEndExclusive, endsWithMandatory) {
|
|
235
|
+
const statesBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
236
|
+
statesBuilder.put(segmentStart, []);
|
|
237
|
+
const bestBuilder = SortedTable.mapBuilder(SortedTable.compareStrings);
|
|
238
|
+
let terminalBest = null;
|
|
239
|
+
let start = segmentStart;
|
|
240
|
+
while (start < segmentEndExclusive) {
|
|
241
|
+
const bucket = statesBuilder.get(start);
|
|
242
|
+
const incoming = [];
|
|
243
|
+
if (start === segmentStart) {
|
|
244
|
+
incoming.push((null));
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
if (bucket !== null) {
|
|
248
|
+
let _g = 0;
|
|
249
|
+
while (_g < bucket.length) {
|
|
250
|
+
const state = bucket[_g];
|
|
251
|
+
_g++;
|
|
252
|
+
incoming.push(state);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (incoming.length === 0) {
|
|
257
|
+
start++;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
{
|
|
261
|
+
const _g1 = this.candidateEnds(context, start, segmentEndExclusive, endsWithMandatory);
|
|
262
|
+
for (let _g_index = 0, count10 = _g1.length; _g_index < count10; _g_index += 1) {
|
|
263
|
+
const e = _g1[_g_index];
|
|
264
|
+
const last = e >= segmentEndExclusive;
|
|
265
|
+
const reason = (!last ? LineEndReason.AutoWrap : (endsWithMandatory ? LineEndReason.MandatoryBreak : LineEndReason.ParagraphEnd));
|
|
266
|
+
const lineEnd = (e - 1 < segmentEndExclusive - 1 ? e - 1 : segmentEndExclusive - 1);
|
|
267
|
+
const line = context.buildLine(new IntRange(start, lineEnd), reason);
|
|
268
|
+
const hyphenEnd = !last && context.hyphenBreakClusters.has(e);
|
|
269
|
+
const geometry = this.edgeGeometry(context, line, last, hyphenEnd);
|
|
270
|
+
{
|
|
271
|
+
let _g2 = 0;
|
|
272
|
+
while (_g2 < incoming.length) {
|
|
273
|
+
const prev = incoming[_g2];
|
|
274
|
+
_g2++;
|
|
275
|
+
const ph = (prev === null ? 0 : prev.hyphenRun);
|
|
276
|
+
const ps = (prev === null ? 0 : prev.stretchRun);
|
|
277
|
+
const cost = (prev === null ? 0.0 : prev.cost) + geometry.baseCost + (hyphenEnd ? this.consecutiveSyntheticHyphenPenalty * ph : 0.0) + (geometry.visibleStretch ? this.consecutiveStretchPenalty * ps : 0.0);
|
|
278
|
+
let hr = 0;
|
|
279
|
+
if (hyphenEnd) {
|
|
280
|
+
hr = (ph + 1 > ParagraphDpLineBreaker.HYPHEN_RUN_STATE_CAP ? ParagraphDpLineBreaker.HYPHEN_RUN_STATE_CAP : ph + 1);
|
|
281
|
+
}
|
|
282
|
+
let sr = 0;
|
|
283
|
+
if (geometry.visibleStretch) {
|
|
284
|
+
sr = (ps + 1 > ParagraphDpLineBreaker.STRETCH_RUN_STATE_CAP ? ParagraphDpLineBreaker.STRETCH_RUN_STATE_CAP : ps + 1);
|
|
285
|
+
}
|
|
286
|
+
const key = start + ":" + e + ":" + hr + ":" + sr;
|
|
287
|
+
const existing = bestBuilder.get(key);
|
|
288
|
+
if (existing !== null && existing.cost <= cost) {
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const state2 = new EdgeState(start, e, hr, sr, cost, prev);
|
|
292
|
+
bestBuilder.put(key, state2);
|
|
293
|
+
if (last) {
|
|
294
|
+
if (terminalBest === null || cost < terminalBest.cost) {
|
|
295
|
+
terminalBest = state2;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
let next = statesBuilder.get(e);
|
|
300
|
+
if (next === null) {
|
|
301
|
+
next = [];
|
|
302
|
+
}
|
|
303
|
+
const kept = [];
|
|
304
|
+
{
|
|
305
|
+
let _g3 = 0;
|
|
306
|
+
while (_g3 < next.length) {
|
|
307
|
+
const old = next[_g3];
|
|
308
|
+
_g3++;
|
|
309
|
+
if (!(old.start === start && old.hyphenRun === hr && old.stretchRun === sr)) {
|
|
310
|
+
kept.push(old);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
kept.push(state2);
|
|
315
|
+
statesBuilder.put(e, kept);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
start++;
|
|
322
|
+
}
|
|
323
|
+
if (terminalBest === null) {
|
|
324
|
+
return this.greedyFallbackEnds(context, segmentStart, segmentEndExclusive);
|
|
325
|
+
}
|
|
326
|
+
const result = [];
|
|
327
|
+
let cursor = terminalBest;
|
|
328
|
+
while (cursor !== null) {
|
|
329
|
+
result.push(cursor.end);
|
|
330
|
+
cursor = cursor.parent;
|
|
331
|
+
}
|
|
332
|
+
result.reverse();
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
335
|
+
greedyFallbackEnds(context, segmentStart, segmentEndExclusive) {
|
|
336
|
+
const ends = [];
|
|
337
|
+
let start = segmentStart;
|
|
338
|
+
while (start < segmentEndExclusive) {
|
|
339
|
+
const limit = lineLimit(context.maxWidth, context.firstLineIndent, start);
|
|
340
|
+
const raw = LineBreakerLines.findGreedyEnd(context.adjustedClusters, start, limit, segmentEndExclusive, context.nonRenderingControlClusters);
|
|
341
|
+
let e = (raw >= segmentEndExclusive ? segmentEndExclusive : ProgressiveBreakDecisions.adjustBreakForUnbreakables(ProgressiveBreakDecisions.decideHyphenBreak(start, raw, context.adjustedClusters, limit, context.hyphenBreakClusters, context.cjkInterCharBoundaries, context.maxCjkStretchPerGap, context.sinoWesternBoundaries, context.sinoWesternStretchCap), start, context.unbreakableRanges));
|
|
342
|
+
if (e <= start) {
|
|
343
|
+
e = start + 1;
|
|
344
|
+
}
|
|
345
|
+
ends.push(e);
|
|
346
|
+
start = e;
|
|
347
|
+
}
|
|
348
|
+
return ends;
|
|
349
|
+
}
|
|
350
|
+
commitSegment(committed, ends, segmentStart, mandatoryEnd, context, hardBreakAfterClusters) {
|
|
351
|
+
let lineStart = segmentStart;
|
|
352
|
+
for (let _g_index = 0, count11 = ends.length; _g_index < count11; _g_index += 1) {
|
|
353
|
+
const chosenEnd = ends[_g_index];
|
|
354
|
+
if (lineStart >= chosenEnd) {
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
const finalLine = chosenEnd === ends[count11 - 1];
|
|
358
|
+
const reason = (finalLine && mandatoryEnd !== null ? LineEndReason.MandatoryBreak : (finalLine ? LineEndReason.ParagraphEnd : LineEndReason.AutoWrap));
|
|
359
|
+
const lastIndex = (finalLine && mandatoryEnd !== null ? mandatoryEnd : chosenEnd - 1);
|
|
360
|
+
const limit = lineLimit(context.maxWidth, context.firstLineIndent, lineStart);
|
|
361
|
+
const naturalLine = LineBreakerLines.rebuildLine(new IntRange(lineStart, (lastIndex)), context.naturalClusters, context.adjustedClusters, reason, null, null);
|
|
362
|
+
let compressed = null;
|
|
363
|
+
if (naturalLine.adjustedWidth > limit && lastIndex > lineStart) {
|
|
364
|
+
const resultingBreak = context.progressiveBreakOpportunities.get(chosenEnd);
|
|
365
|
+
const rawGreedy = LineBreakerLines.findGreedyEnd(context.adjustedClusters, lineStart, limit, ends[count11 - 1], context.nonRenderingControlClusters);
|
|
366
|
+
const originalBreak = context.progressiveBreakOpportunities.get(ProgressiveBreakDecisions.decideProgressiveBreak(lineStart, rawGreedy, context.progressiveBreakOpportunities, context.adjustedClusters, limit, context.cjkInterCharBoundaries, context.maxCjkStretchPerGap, context.sinoWesternBoundaries, context.sinoWesternStretchCap));
|
|
367
|
+
const promotesProgressiveTier = originalBreak !== null && resultingBreak !== null && originalBreak.spanRange.start === resultingBreak.spanRange.start && originalBreak.spanRange.end === resultingBreak.spanRange.end && ProgressiveBreakTierPriority.priority(resultingBreak.tier) < ProgressiveBreakTierPriority.priority(originalBreak.tier);
|
|
368
|
+
const result = LineRepair.tryPushIn(LineBreakerLines.rebuildLine(new IntRange(lineStart, lineStart), context.naturalClusters, context.adjustedClusters, null, null, null), LineBreakerLines.rebuildLine(new IntRange(lineStart + 1, (lastIndex)), context.naturalClusters, context.adjustedClusters, reason, null, null), context.naturalClusters, context.adjustedClusters, limit, context.shrinkOpportunities, this.pushInPenalty, lastIndex, (promotesProgressiveTier ? "ProgressiveTechnicalTierPromotion" : "LineAdjustmentPushIn"));
|
|
369
|
+
if (result.candidate.accepted && result.current === null) {
|
|
370
|
+
compressed = result.previous;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (finalLine) {
|
|
374
|
+
committed.push(((compressed === null ? naturalLine : compressed)));
|
|
375
|
+
lineStart = chosenEnd;
|
|
376
|
+
if (mandatoryEnd !== null && lineStart === context.adjustedClusters.length) {
|
|
377
|
+
committed.push(LineBreakerLines.emptyLineCandidate(context.adjustedClusters[context.adjustedClusters.length - 1].range.end, LineEndReason.ParagraphEnd));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
if (compressed !== null) {
|
|
382
|
+
committed.push((compressed));
|
|
383
|
+
lineStart = chosenEnd;
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
const committedEnd = ProgressiveBreakDecisions.adjustBreakForLineEnd(chosenEnd, lineStart, context.forbiddenLineEndClusters);
|
|
387
|
+
if (hardBreakAfterClusters.has(committedEnd) && lineStart < committedEnd) {
|
|
388
|
+
committed.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, committedEnd), context.naturalClusters, context.adjustedClusters, LineEndReason.MandatoryBreak, null, null));
|
|
389
|
+
lineStart = committedEnd + 1;
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
committed.push(LineBreakerLines.closeFilledLine(new IntRange(lineStart, committedEnd - 1), chosenEnd, context.naturalClusters, context.adjustedClusters));
|
|
393
|
+
lineStart = committedEnd;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
static rangeHasOnlyNonControlClusters(start, endExclusive, set) {
|
|
400
|
+
let i = start;
|
|
401
|
+
while (i < endExclusive) {
|
|
402
|
+
if (!set.has(i)) {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
i++;
|
|
406
|
+
}
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
export class DpContext {
|
|
411
|
+
naturalClusters;
|
|
412
|
+
adjustedClusters;
|
|
413
|
+
maxWidth;
|
|
414
|
+
shrinkOpportunities;
|
|
415
|
+
unbreakableRanges;
|
|
416
|
+
firstLineIndent;
|
|
417
|
+
forbiddenLineStartClusters;
|
|
418
|
+
forbiddenLineEndClusters;
|
|
419
|
+
hyphenBreakClusters;
|
|
420
|
+
cjkInterCharBoundaries;
|
|
421
|
+
maxCjkStretchPerGap;
|
|
422
|
+
sinoWesternBoundaries;
|
|
423
|
+
sinoWesternStretchCap;
|
|
424
|
+
nonRenderingControlClusters;
|
|
425
|
+
gapBoundaries;
|
|
426
|
+
dRef;
|
|
427
|
+
allowCompressionEdges;
|
|
428
|
+
progressiveBreakOpportunities;
|
|
429
|
+
gapPrefix;
|
|
430
|
+
sinoPrefix;
|
|
431
|
+
cjkPrefix;
|
|
432
|
+
naturalPrefix;
|
|
433
|
+
adjustedPrefix;
|
|
434
|
+
shrinkPrefix;
|
|
435
|
+
lineEndOnlyCapacity;
|
|
436
|
+
constructor(naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, unbreakableRanges, firstLineIndent, forbiddenLineStartClusters, forbiddenLineEndClusters, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, nonRenderingControlClusters, gapBoundaries, dRef, allowCompressionEdges, progressiveBreakOpportunities) {
|
|
437
|
+
this.naturalClusters = naturalClusters;
|
|
438
|
+
this.adjustedClusters = adjustedClusters;
|
|
439
|
+
this.maxWidth = maxWidth;
|
|
440
|
+
this.shrinkOpportunities = shrinkOpportunities;
|
|
441
|
+
this.unbreakableRanges = unbreakableRanges;
|
|
442
|
+
this.firstLineIndent = firstLineIndent;
|
|
443
|
+
this.forbiddenLineStartClusters = forbiddenLineStartClusters;
|
|
444
|
+
this.forbiddenLineEndClusters = forbiddenLineEndClusters;
|
|
445
|
+
this.hyphenBreakClusters = hyphenBreakClusters;
|
|
446
|
+
this.cjkInterCharBoundaries = cjkInterCharBoundaries;
|
|
447
|
+
this.maxCjkStretchPerGap = maxCjkStretchPerGap;
|
|
448
|
+
this.sinoWesternBoundaries = sinoWesternBoundaries;
|
|
449
|
+
this.sinoWesternStretchCap = sinoWesternStretchCap;
|
|
450
|
+
this.nonRenderingControlClusters = nonRenderingControlClusters;
|
|
451
|
+
this.gapBoundaries = gapBoundaries;
|
|
452
|
+
this.dRef = dRef;
|
|
453
|
+
this.allowCompressionEdges = allowCompressionEdges;
|
|
454
|
+
this.progressiveBreakOpportunities = progressiveBreakOpportunities;
|
|
455
|
+
const n = adjustedClusters.length;
|
|
456
|
+
this.gapPrefix = [];
|
|
457
|
+
this.sinoPrefix = [];
|
|
458
|
+
this.cjkPrefix = [];
|
|
459
|
+
this.naturalPrefix = [];
|
|
460
|
+
this.adjustedPrefix = [];
|
|
461
|
+
let init = 0;
|
|
462
|
+
while (init <= n) {
|
|
463
|
+
this.gapPrefix.push(0);
|
|
464
|
+
this.sinoPrefix.push(0);
|
|
465
|
+
this.cjkPrefix.push(0);
|
|
466
|
+
this.adjustedPrefix.push(0.0);
|
|
467
|
+
init++;
|
|
468
|
+
}
|
|
469
|
+
init = 0;
|
|
470
|
+
while (init <= naturalClusters.length) {
|
|
471
|
+
this.naturalPrefix.push(0.0);
|
|
472
|
+
init++;
|
|
473
|
+
}
|
|
474
|
+
let k = 0;
|
|
475
|
+
while (k < n) {
|
|
476
|
+
this.gapPrefix[k + 1] = this.gapPrefix[k] + (gapBoundaries.has(k) ? 1 : 0);
|
|
477
|
+
this.sinoPrefix[k + 1] = this.sinoPrefix[k] + (sinoWesternBoundaries.has(k) ? 1 : 0);
|
|
478
|
+
this.cjkPrefix[k + 1] = this.cjkPrefix[k] + (cjkInterCharBoundaries.has(k) ? 1 : 0);
|
|
479
|
+
this.naturalPrefix[k + 1] = this.naturalPrefix[k] + naturalClusters[k].advance;
|
|
480
|
+
this.adjustedPrefix[k + 1] = this.adjustedPrefix[k] + adjustedClusters[k].advance;
|
|
481
|
+
k++;
|
|
482
|
+
}
|
|
483
|
+
this.shrinkPrefix = [];
|
|
484
|
+
this.lineEndOnlyCapacity = [];
|
|
485
|
+
init = 0;
|
|
486
|
+
while (init <= n) {
|
|
487
|
+
this.shrinkPrefix.push(0.0);
|
|
488
|
+
init++;
|
|
489
|
+
}
|
|
490
|
+
for (let init = 0; init < n; init += 1) {
|
|
491
|
+
this.lineEndOnlyCapacity.push(0.0);
|
|
492
|
+
}
|
|
493
|
+
for (let _g_index = 0, count12 = shrinkOpportunities.length; _g_index < count12; _g_index += 1) {
|
|
494
|
+
const opp = shrinkOpportunities[_g_index];
|
|
495
|
+
if (opp.capacity <= 0 || opp.clusterIndex < 0 || opp.clusterIndex >= n) {
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
if (opp.lineEndOnly) {
|
|
499
|
+
const base = this.lineEndOnlyCapacity;
|
|
500
|
+
const index = opp.clusterIndex;
|
|
501
|
+
base[index] = base[index] + opp.capacity;
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
const base2 = this.shrinkPrefix;
|
|
505
|
+
const index2 = opp.clusterIndex + 1;
|
|
506
|
+
base2[index2] = base2[index2] + opp.capacity;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
k = 0;
|
|
510
|
+
while (k < n) {
|
|
511
|
+
const base3 = this.shrinkPrefix;
|
|
512
|
+
const index3 = k + 1;
|
|
513
|
+
base3[index3] = base3[index3] + this.shrinkPrefix[k];
|
|
514
|
+
k++;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
buildLine(clusterRange, endReason) {
|
|
518
|
+
return new LineCandidate(clusterRange, new TextRange(this.adjustedClusters[clusterRange.start].range.start, this.adjustedClusters[clusterRange.end].range.end), this.naturalPrefix[clusterRange.end + 1] - this.naturalPrefix[clusterRange.start], this.adjustedPrefix[clusterRange.end + 1] - this.adjustedPrefix[clusterRange.start], endReason, null, []);
|
|
519
|
+
}
|
|
520
|
+
gapCount(range) {
|
|
521
|
+
return (range.isEmpty ? 0 : this.gapPrefix[range.end] - this.gapPrefix[range.start]);
|
|
522
|
+
}
|
|
523
|
+
sinoGapCount(range) {
|
|
524
|
+
return (range.isEmpty ? 0 : this.sinoPrefix[range.end] - this.sinoPrefix[range.start]);
|
|
525
|
+
}
|
|
526
|
+
cjkGapCount(range) {
|
|
527
|
+
return (range.isEmpty ? 0 : this.cjkPrefix[range.end] - this.cjkPrefix[range.start]);
|
|
528
|
+
}
|
|
529
|
+
shrinkCapacity(range) {
|
|
530
|
+
return this.shrinkPrefix[range.end + 1] - this.shrinkPrefix[range.start] + this.lineEndOnlyCapacity[range.end];
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
export class EdgeState {
|
|
534
|
+
start;
|
|
535
|
+
end;
|
|
536
|
+
hyphenRun;
|
|
537
|
+
stretchRun;
|
|
538
|
+
cost;
|
|
539
|
+
parent;
|
|
540
|
+
constructor(start, end, hyphenRun, stretchRun, cost, parent) {
|
|
541
|
+
this.start = start;
|
|
542
|
+
this.end = end;
|
|
543
|
+
this.hyphenRun = hyphenRun;
|
|
544
|
+
this.stretchRun = stretchRun;
|
|
545
|
+
this.cost = cost;
|
|
546
|
+
this.parent = parent;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
export class EdgeGeometry {
|
|
550
|
+
baseCost;
|
|
551
|
+
visibleStretch;
|
|
552
|
+
constructor(baseCost, visibleStretch) {
|
|
553
|
+
this.baseCost = baseCost;
|
|
554
|
+
this.visibleStretch = visibleStretch;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Cluster } from "./../core/Cluster.js";
|
|
2
|
+
import { TextRange } from "./../core/TextRange.js";
|
|
3
|
+
import { type LineSolution, type RepairOption } from "./LineOptimization.js";
|
|
4
|
+
import { ProgressiveBreakOpportunity, type ProgressiveBreakTier, type ShrinkOpportunity, type UnbreakableRanges } from "./ProgressiveBreakDecisions.js";
|
|
5
|
+
import { SortedMapTable, SortedSetTable } from "../../../runtime.js";
|
|
6
|
+
export declare class ParagraphDpLineBreakerTestSupport {
|
|
7
|
+
static cluster(i: number, text?: string | null, advance?: number | null): Cluster;
|
|
8
|
+
static han(n: number, advance?: number | null): Cluster[];
|
|
9
|
+
static latin(): Cluster[];
|
|
10
|
+
static ints(v: number[]): SortedSetTable<number>;
|
|
11
|
+
static opportunities(v: number[], spans: TextRange[], tiers: ProgressiveBreakTier[]): SortedMapTable<number, ProgressiveBreakOpportunity>;
|
|
12
|
+
static solve(c: Cluster[], width: number, shrink?: ShrinkOpportunity[] | null, hard?: number[] | null, push?: boolean | null, ranges?: UnbreakableRanges | null, progressive?: SortedMapTable<number, ProgressiveBreakOpportunity> | null, window?: number | null, cjk?: number[] | null, maxStretch?: number | null, forbidStart?: number[] | null): LineSolution;
|
|
13
|
+
static solveTestDefaults(c: Cluster[], width: number, shrink?: ShrinkOpportunity[] | null, hard?: number[] | null, push?: boolean | null, ranges?: UnbreakableRanges | null, progressive?: SortedMapTable<number, ProgressiveBreakOpportunity> | null, forbidStart?: number[] | null): LineSolution;
|
|
14
|
+
static tiles(s: LineSolution, n: number): void;
|
|
15
|
+
static repairsString(s: LineSolution): string;
|
|
16
|
+
static renderRepair(r: RepairOption | null): string;
|
|
17
|
+
private static renderRepairOption;
|
|
18
|
+
static linesString(s: LineSolution): string;
|
|
19
|
+
static pushInReason(r: RepairOption | null): string | null;
|
|
20
|
+
static rangesString(s: LineSolution): string;
|
|
21
|
+
static rec(n: string): void;
|
|
22
|
+
static c(i: number, t: string, a: number): Cluster;
|
|
23
|
+
}
|