@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,54 @@
|
|
|
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 { LineCandidate, LineSolution, type RepairCandidate, type RepairOption } from "./LineOptimization.js";
|
|
6
|
+
import { type ProgressiveBreakOpportunity, type ShrinkOpportunity, UnbreakableRanges } from "./ProgressiveBreakDecisions.js";
|
|
7
|
+
import { SortedMapTable, SortedSetTable } from "../../../runtime.js";
|
|
8
|
+
export type LineBreakerBreakLinesFn = (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;
|
|
9
|
+
export interface LineBreaker {
|
|
10
|
+
readonly strategyName: string;
|
|
11
|
+
readonly breakLines: LineBreakerBreakLinesFn;
|
|
12
|
+
}
|
|
13
|
+
export declare class GreedyLineBreaker implements LineBreaker {
|
|
14
|
+
private kinsoku;
|
|
15
|
+
private pushInPenalty;
|
|
16
|
+
private carryPreviousPenalty;
|
|
17
|
+
private leaveRaggedPenalty;
|
|
18
|
+
constructor(kinsoku: KinsokuRule | null, pushInPenalty: number, carryPreviousPenalty: number, leaveRaggedPenalty: number);
|
|
19
|
+
get strategyName(): string;
|
|
20
|
+
private get_strategyName;
|
|
21
|
+
breakLines(n: Cluster[], a: 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;
|
|
22
|
+
private greedyFill;
|
|
23
|
+
}
|
|
24
|
+
export declare class LookaheadLineBreaker implements LineBreaker {
|
|
25
|
+
private readonly window;
|
|
26
|
+
private readonly futureLineHorizon;
|
|
27
|
+
private readonly raggednessWeight;
|
|
28
|
+
private readonly kinsoku;
|
|
29
|
+
private readonly pushInPenalty;
|
|
30
|
+
private readonly carryPreviousPenalty;
|
|
31
|
+
private readonly leaveRaggedPenalty;
|
|
32
|
+
private readonly consecutiveSyntheticHyphenPenalty;
|
|
33
|
+
constructor(window?: number | null, futureLineHorizon?: number | null, raggednessWeight?: number | null, kinsoku?: KinsokuRule | null, pushInPenalty?: number | null, carryPreviousPenalty?: number | null, leaveRaggedPenalty?: number | null, consecutiveSyntheticHyphenPenalty?: number | null);
|
|
34
|
+
get strategyName(): string;
|
|
35
|
+
private get_strategyName;
|
|
36
|
+
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;
|
|
37
|
+
private scoreCandidate;
|
|
38
|
+
private rawGreedyLinesFrom;
|
|
39
|
+
private badness;
|
|
40
|
+
private static hasRenderingContentInRange;
|
|
41
|
+
}
|
|
42
|
+
export declare function lineGapCount(range: IntRange, gapBoundaries: SortedSetTable<number>): number;
|
|
43
|
+
export declare function lineAdjustmentDensity(line: LineCandidate, limit: number, isLast: boolean, gapBoundaries: SortedSetTable<number>): number;
|
|
44
|
+
export declare class LineBreakerLines {
|
|
45
|
+
static closeFilledLine(range: IntRange, naturalBreakAt: number, n: Cluster[], a: Cluster[]): LineCandidate;
|
|
46
|
+
static rebuildLine(clusterRange: IntRange, n: Cluster[], a: Cluster[], endReason?: LineEndReason | null, repair?: RepairOption | null, repairCandidates?: RepairCandidate[] | null): LineCandidate;
|
|
47
|
+
static emptyLineCandidate(sourceOffset: number, endReason?: LineEndReason | null): LineCandidate;
|
|
48
|
+
static emptyIntSet(): SortedSetTable<number>;
|
|
49
|
+
static emptyProgressiveMap(): SortedMapTable<number, ProgressiveBreakOpportunity>;
|
|
50
|
+
static endsWithSyntheticHyphen(line: LineCandidate, hyphenBreakClusters: SortedSetTable<number>): boolean;
|
|
51
|
+
static endsWithProgressiveBreak(candidate: LineCandidate, opportunities: SortedMapTable<number, ProgressiveBreakOpportunity>): boolean;
|
|
52
|
+
static amortizedAdjustmentCost(d: number, prevD: number, dRef: number): number;
|
|
53
|
+
static findGreedyEnd(clusters: Cluster[], start: number, maxWidth: number, endExclusive?: number | null, nonRenderingControlClusters?: SortedSetTable<number> | null): number;
|
|
54
|
+
}
|
|
@@ -0,0 +1,457 @@
|
|
|
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 { LineCandidate, LineSolution, RepairOptions } from "./LineOptimization.js";
|
|
9
|
+
import { LineRepair } from "./LineRepair.js";
|
|
10
|
+
import { ProgressiveBreakDecisions, UnbreakableRanges, lineLimit } from "./ProgressiveBreakDecisions.js";
|
|
11
|
+
import { SortedTable } from "../../../runtime.js";
|
|
12
|
+
export class GreedyLineBreaker {
|
|
13
|
+
kinsoku;
|
|
14
|
+
pushInPenalty;
|
|
15
|
+
carryPreviousPenalty;
|
|
16
|
+
leaveRaggedPenalty;
|
|
17
|
+
constructor(kinsoku, pushInPenalty, carryPreviousPenalty, leaveRaggedPenalty) {
|
|
18
|
+
if (kinsoku === null) {
|
|
19
|
+
this.kinsoku = new ClreqKinsokuRule();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.kinsoku = (kinsoku);
|
|
23
|
+
}
|
|
24
|
+
this.pushInPenalty = (pushInPenalty);
|
|
25
|
+
this.carryPreviousPenalty = (carryPreviousPenalty);
|
|
26
|
+
this.leaveRaggedPenalty = (leaveRaggedPenalty);
|
|
27
|
+
}
|
|
28
|
+
get strategyName() {
|
|
29
|
+
return this.get_strategyName();
|
|
30
|
+
}
|
|
31
|
+
get_strategyName() {
|
|
32
|
+
return "greedy";
|
|
33
|
+
}
|
|
34
|
+
breakLines(n, a, maxWidth, shrinkOpportunities, unbreakableRanges, firstLineIndent, hangableClusters, extendableHangRanges, forbiddenLineStartClusters, forbiddenLineEndClusters, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, lineAdjustmentPushIn, lineAdjustmentCompressBias, hardBreakAfterClusters, nonRenderingControlClusters, progressiveBreakOpportunities) {
|
|
35
|
+
hardBreakAfterClusters = hardBreakAfterClusters ?? null;
|
|
36
|
+
nonRenderingControlClusters = nonRenderingControlClusters ?? null;
|
|
37
|
+
progressiveBreakOpportunities = progressiveBreakOpportunities ?? null;
|
|
38
|
+
if (a.length === 0) {
|
|
39
|
+
return new LineSolution([]);
|
|
40
|
+
}
|
|
41
|
+
if (n.length !== a.length) {
|
|
42
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "naturalClusters and adjustedClusters must align cluster-for-cluster." });
|
|
43
|
+
}
|
|
44
|
+
const shrinkOps = shrinkOpportunities ?? [];
|
|
45
|
+
const ranges = unbreakableRanges ?? UnbreakableRanges.Empty;
|
|
46
|
+
const indent = firstLineIndent;
|
|
47
|
+
const hangables = hangableClusters ?? LineBreakerLines.emptyIntSet();
|
|
48
|
+
const extendables = extendableHangRanges ?? [];
|
|
49
|
+
const forbidEnd = forbiddenLineEndClusters ?? LineBreakerLines.emptyIntSet();
|
|
50
|
+
const hyphens = hyphenBreakClusters ?? LineBreakerLines.emptyIntSet();
|
|
51
|
+
const cjk = cjkInterCharBoundaries ?? LineBreakerLines.emptyIntSet();
|
|
52
|
+
const maxStretch = maxCjkStretchPerGap ?? Infinity;
|
|
53
|
+
const sino = sinoWesternBoundaries ?? LineBreakerLines.emptyIntSet();
|
|
54
|
+
const sinoCap = sinoWesternStretchCap;
|
|
55
|
+
const hard = hardBreakAfterClusters ?? LineBreakerLines.emptyIntSet();
|
|
56
|
+
const controls = nonRenderingControlClusters ?? LineBreakerLines.emptyIntSet();
|
|
57
|
+
const progressive = progressiveBreakOpportunities ?? LineBreakerLines.emptyProgressiveMap();
|
|
58
|
+
const greedy = this.greedyFill(n, a, maxWidth, (ranges), indent, (forbidEnd), (hyphens), (cjk), (maxStretch), (sino), sinoCap, (hard), (controls), (progressive));
|
|
59
|
+
const repaired = LineRepair.applyKinsokuRepairs(greedy, n, a, maxWidth, this.kinsoku, (shrinkOps), this.pushInPenalty, this.carryPreviousPenalty, this.leaveRaggedPenalty, ranges, indent, hangables, extendables, 5, forbiddenLineStartClusters);
|
|
60
|
+
const gapBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
61
|
+
let gi = 0;
|
|
62
|
+
while (gi < cjk.size()) {
|
|
63
|
+
gapBuilder.put(cjk.at(gi));
|
|
64
|
+
gi++;
|
|
65
|
+
}
|
|
66
|
+
let si = 0;
|
|
67
|
+
while (si < sino.size()) {
|
|
68
|
+
gapBuilder.put(sino.at(si));
|
|
69
|
+
si++;
|
|
70
|
+
}
|
|
71
|
+
const gapBoundaries = gapBuilder.build();
|
|
72
|
+
const pushIn = lineAdjustmentPushIn;
|
|
73
|
+
const compressBias = lineAdjustmentCompressBias;
|
|
74
|
+
return LineRepair.withFillPushIn(repaired, pushIn, n, a, maxWidth, (shrinkOps), indent, compressBias, (forbiddenLineStartClusters), (forbidEnd), (ranges), this.pushInPenalty, gapBoundaries, progressive);
|
|
75
|
+
}
|
|
76
|
+
greedyFill(n, a, maxWidth, unbreakableRanges, firstLineIndent, forbiddenLineEndClusters, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, hardBreakAfterClusters, nonRenderingControlClusters, progressiveBreakOpportunities) {
|
|
77
|
+
const lines = [];
|
|
78
|
+
let lineStart = 0;
|
|
79
|
+
let adjustedAccum = 0.0;
|
|
80
|
+
let naturalAccum = 0.0;
|
|
81
|
+
let hasRenderingContent = false;
|
|
82
|
+
let i = 0;
|
|
83
|
+
while (i < a.length) {
|
|
84
|
+
const nextAdjusted = adjustedAccum + a[i].advance;
|
|
85
|
+
const limit = lineLimit(maxWidth, firstLineIndent, lineStart);
|
|
86
|
+
if (nextAdjusted > limit && hasRenderingContent) {
|
|
87
|
+
const progressive = ProgressiveBreakDecisions.decideProgressiveBreak(lineStart, i, progressiveBreakOpportunities, a, limit, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap);
|
|
88
|
+
const decided = ProgressiveBreakDecisions.decideHyphenBreak(lineStart, progressive, a, limit, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap);
|
|
89
|
+
const afterUnbreak = ProgressiveBreakDecisions.adjustBreakForUnbreakables(decided, lineStart, unbreakableRanges);
|
|
90
|
+
const breakAt = ProgressiveBreakDecisions.adjustBreakForLineEnd(afterUnbreak, lineStart, forbiddenLineEndClusters);
|
|
91
|
+
lines.push(LineBreakerLines.closeFilledLine(new IntRange(lineStart, breakAt - 1), afterUnbreak, n, a));
|
|
92
|
+
lineStart = breakAt;
|
|
93
|
+
adjustedAccum = a[breakAt].advance;
|
|
94
|
+
naturalAccum = n[breakAt].advance;
|
|
95
|
+
hasRenderingContent = !nonRenderingControlClusters.has(breakAt);
|
|
96
|
+
i = breakAt + 1;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
adjustedAccum = nextAdjusted;
|
|
100
|
+
naturalAccum += n[i].advance;
|
|
101
|
+
if (!nonRenderingControlClusters.has(i)) {
|
|
102
|
+
hasRenderingContent = true;
|
|
103
|
+
}
|
|
104
|
+
if (hardBreakAfterClusters.has(i)) {
|
|
105
|
+
lines.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, i), n, a, LineEndReason.MandatoryBreak, null, null));
|
|
106
|
+
lineStart = i + 1;
|
|
107
|
+
adjustedAccum = 0;
|
|
108
|
+
naturalAccum = 0;
|
|
109
|
+
hasRenderingContent = false;
|
|
110
|
+
}
|
|
111
|
+
i++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (lineStart < a.length) {
|
|
115
|
+
lines.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, a.length - 1), n, a, LineEndReason.ParagraphEnd, null, null));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (hardBreakAfterClusters.has(a.length - 1)) {
|
|
119
|
+
lines.push(LineBreakerLines.emptyLineCandidate(a[a.length - 1].range.end, LineEndReason.ParagraphEnd));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return lines;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export class LookaheadLineBreaker {
|
|
126
|
+
window;
|
|
127
|
+
futureLineHorizon;
|
|
128
|
+
raggednessWeight;
|
|
129
|
+
kinsoku;
|
|
130
|
+
pushInPenalty;
|
|
131
|
+
carryPreviousPenalty;
|
|
132
|
+
leaveRaggedPenalty;
|
|
133
|
+
consecutiveSyntheticHyphenPenalty;
|
|
134
|
+
constructor(window = null, futureLineHorizon = null, raggednessWeight = null, kinsoku = null, pushInPenalty = null, carryPreviousPenalty = null, leaveRaggedPenalty = null, consecutiveSyntheticHyphenPenalty = null) {
|
|
135
|
+
this.window = window ?? 2;
|
|
136
|
+
this.futureLineHorizon = futureLineHorizon ?? 2;
|
|
137
|
+
this.raggednessWeight = raggednessWeight ?? 0.5;
|
|
138
|
+
this.kinsoku = kinsoku ?? new ClreqKinsokuRule(KinsokuLevel.Basic);
|
|
139
|
+
this.pushInPenalty = pushInPenalty ?? 2;
|
|
140
|
+
this.carryPreviousPenalty = carryPreviousPenalty ?? 10;
|
|
141
|
+
this.leaveRaggedPenalty = leaveRaggedPenalty ?? 20;
|
|
142
|
+
this.consecutiveSyntheticHyphenPenalty = consecutiveSyntheticHyphenPenalty ?? 12.0;
|
|
143
|
+
}
|
|
144
|
+
get strategyName() {
|
|
145
|
+
return this.get_strategyName();
|
|
146
|
+
}
|
|
147
|
+
get_strategyName() {
|
|
148
|
+
return "lookahead";
|
|
149
|
+
}
|
|
150
|
+
breakLines(naturalClusters, adjustedClusters, maxWidth, shrinkOpportunities, unbreakableRanges, firstLineIndent, hangableClusters, extendableHangRanges, forbiddenLineStartClusters, forbiddenLineEndClusters, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, lineAdjustmentPushIn, lineAdjustmentCompressBias, hardBreakAfterClusters, nonRenderingControlClusters, progressiveBreakOpportunities) {
|
|
151
|
+
hardBreakAfterClusters = hardBreakAfterClusters ?? null;
|
|
152
|
+
nonRenderingControlClusters = nonRenderingControlClusters ?? null;
|
|
153
|
+
progressiveBreakOpportunities = progressiveBreakOpportunities ?? null;
|
|
154
|
+
if (adjustedClusters.length === 0) {
|
|
155
|
+
return new LineSolution([]);
|
|
156
|
+
}
|
|
157
|
+
if (naturalClusters.length !== adjustedClusters.length) {
|
|
158
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "naturalClusters and adjustedClusters must align cluster-for-cluster." });
|
|
159
|
+
}
|
|
160
|
+
if (this.window < 0) {
|
|
161
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "window must be non-negative." });
|
|
162
|
+
}
|
|
163
|
+
if (this.futureLineHorizon < 0) {
|
|
164
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "futureLineHorizon must be non-negative." });
|
|
165
|
+
}
|
|
166
|
+
const shrinkOps = shrinkOpportunities ?? [];
|
|
167
|
+
const ranges = unbreakableRanges ?? UnbreakableRanges.Empty;
|
|
168
|
+
const indent = firstLineIndent;
|
|
169
|
+
const hangables = hangableClusters ?? LineBreakerLines.emptyIntSet();
|
|
170
|
+
const extendables = extendableHangRanges ?? [];
|
|
171
|
+
const forbidEnd = forbiddenLineEndClusters ?? LineBreakerLines.emptyIntSet();
|
|
172
|
+
const hyphens = hyphenBreakClusters ?? LineBreakerLines.emptyIntSet();
|
|
173
|
+
const cjk = cjkInterCharBoundaries ?? LineBreakerLines.emptyIntSet();
|
|
174
|
+
const maxStretch = maxCjkStretchPerGap ?? Infinity;
|
|
175
|
+
const sino = sinoWesternBoundaries ?? LineBreakerLines.emptyIntSet();
|
|
176
|
+
const sinoCap = sinoWesternStretchCap;
|
|
177
|
+
const pushIn = lineAdjustmentPushIn;
|
|
178
|
+
const compressBias = lineAdjustmentCompressBias;
|
|
179
|
+
const hard = hardBreakAfterClusters ?? LineBreakerLines.emptyIntSet();
|
|
180
|
+
const controls = nonRenderingControlClusters ?? LineBreakerLines.emptyIntSet();
|
|
181
|
+
const progressive = progressiveBreakOpportunities ?? LineBreakerLines.emptyProgressiveMap();
|
|
182
|
+
const committed = [];
|
|
183
|
+
let lineStart = 0;
|
|
184
|
+
const gapBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
185
|
+
let gi = 0;
|
|
186
|
+
while (gi < cjk.size()) {
|
|
187
|
+
gapBuilder.put(cjk.at(gi));
|
|
188
|
+
gi++;
|
|
189
|
+
}
|
|
190
|
+
let si = 0;
|
|
191
|
+
while (si < sino.size()) {
|
|
192
|
+
gapBuilder.put(sino.at(si));
|
|
193
|
+
si++;
|
|
194
|
+
}
|
|
195
|
+
const gapBoundaries = gapBuilder.build();
|
|
196
|
+
const dRef = maxStretch;
|
|
197
|
+
let committedDensity = 0.0;
|
|
198
|
+
let committedSyntheticHyphenRun = 0;
|
|
199
|
+
const sortedBreaks = [];
|
|
200
|
+
let bi = 0;
|
|
201
|
+
while (bi < hard.size()) {
|
|
202
|
+
sortedBreaks.push(hard.at(bi));
|
|
203
|
+
bi++;
|
|
204
|
+
}
|
|
205
|
+
let breakCursor = 0;
|
|
206
|
+
while (lineStart < adjustedClusters.length) {
|
|
207
|
+
while (breakCursor < sortedBreaks.length && sortedBreaks[breakCursor] < lineStart) {
|
|
208
|
+
breakCursor++;
|
|
209
|
+
}
|
|
210
|
+
const mandatoryEnd = (breakCursor < sortedBreaks.length ? sortedBreaks[breakCursor] : null);
|
|
211
|
+
const segmentEndExclusive = (mandatoryEnd !== null ? mandatoryEnd + 1 : adjustedClusters.length);
|
|
212
|
+
const rawGreedyEnd = LineBreakerLines.findGreedyEnd(adjustedClusters, lineStart, lineLimit(maxWidth, indent, lineStart), segmentEndExclusive, controls);
|
|
213
|
+
const progBreak = ProgressiveBreakDecisions.decideProgressiveBreak(lineStart, rawGreedyEnd, (progressive), adjustedClusters, lineLimit(maxWidth, indent, lineStart), cjk, maxStretch, sino, sinoCap);
|
|
214
|
+
const hyphenBreak = ProgressiveBreakDecisions.decideHyphenBreak(lineStart, progBreak, adjustedClusters, lineLimit(maxWidth, indent, lineStart), (hyphens), (cjk), (maxStretch), sino, sinoCap);
|
|
215
|
+
const greedyEnd = ProgressiveBreakDecisions.adjustBreakForUnbreakables(hyphenBreak, lineStart, (ranges));
|
|
216
|
+
if (greedyEnd >= segmentEndExclusive) {
|
|
217
|
+
if (mandatoryEnd !== null) {
|
|
218
|
+
committed.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, (mandatoryEnd)), naturalClusters, adjustedClusters, LineEndReason.MandatoryBreak, null, null));
|
|
219
|
+
committedDensity = 0.0;
|
|
220
|
+
committedSyntheticHyphenRun = 0;
|
|
221
|
+
lineStart = mandatoryEnd + 1;
|
|
222
|
+
if (lineStart === adjustedClusters.length) {
|
|
223
|
+
committed.push(LineBreakerLines.emptyLineCandidate(adjustedClusters[adjustedClusters.length - 1].range.end, LineEndReason.ParagraphEnd));
|
|
224
|
+
}
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
committed.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, adjustedClusters.length - 1), naturalClusters, adjustedClusters, LineEndReason.ParagraphEnd, null, null));
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
const candidates = [];
|
|
231
|
+
const candStart = greedyEnd - this.window;
|
|
232
|
+
let c = candStart;
|
|
233
|
+
while (c <= greedyEnd) {
|
|
234
|
+
if (c >= lineStart + 1 && c <= adjustedClusters.length && c <= segmentEndExclusive && !ranges.containsBoundary(c) && ProgressiveBreakDecisions.progressiveCandidateAllowed(lineStart, rawGreedyEnd, c, (progressive), adjustedClusters, lineLimit(maxWidth, indent, lineStart), cjk, maxStretch, sino, sinoCap) && (LookaheadLineBreaker.hasRenderingContentInRange(lineStart, c, (controls)) || c === segmentEndExclusive)) {
|
|
235
|
+
if (candidates.indexOf(c) === -1) {
|
|
236
|
+
candidates.push(c);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
c++;
|
|
240
|
+
}
|
|
241
|
+
if (candidates.length === 0) {
|
|
242
|
+
candidates.push(ProgressiveBreakDecisions.adjustBreakForUnbreakables(greedyEnd, lineStart, (ranges)));
|
|
243
|
+
}
|
|
244
|
+
let bestEnd = greedyEnd;
|
|
245
|
+
let bestScore = Infinity;
|
|
246
|
+
for (let _g_index = 0, count = candidates.length; _g_index < count; _g_index += 1) {
|
|
247
|
+
const e = candidates[_g_index];
|
|
248
|
+
const score = this.scoreCandidate(lineStart, e, naturalClusters, adjustedClusters, maxWidth, (shrinkOps), indent, (hangables), (extendables), (forbiddenLineStartClusters), (hyphens), (cjk), (maxStretch), (sino), sinoCap, segmentEndExclusive, committedDensity, committedSyntheticHyphenRun, gapBoundaries, (dRef), (ranges), (controls), (progressive));
|
|
249
|
+
if (score < bestScore) {
|
|
250
|
+
bestScore = score;
|
|
251
|
+
bestEnd = e;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const committedEnd = ProgressiveBreakDecisions.adjustBreakForLineEnd(bestEnd, lineStart, (forbidEnd));
|
|
255
|
+
if (hard.has(committedEnd) && lineStart < committedEnd) {
|
|
256
|
+
committed.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, committedEnd), naturalClusters, adjustedClusters, LineEndReason.MandatoryBreak, null, null));
|
|
257
|
+
committedDensity = 0.0;
|
|
258
|
+
committedSyntheticHyphenRun = 0;
|
|
259
|
+
lineStart = committedEnd + 1;
|
|
260
|
+
if (lineStart === adjustedClusters.length) {
|
|
261
|
+
committed.push(LineBreakerLines.emptyLineCandidate(adjustedClusters[adjustedClusters.length - 1].range.end, LineEndReason.ParagraphEnd));
|
|
262
|
+
}
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
committed.push(LineBreakerLines.closeFilledLine(new IntRange(lineStart, committedEnd - 1), bestEnd, naturalClusters, adjustedClusters));
|
|
266
|
+
const lastLine = committed[committed.length - 1];
|
|
267
|
+
const limit = lineLimit(maxWidth, indent, lastLine.clusterRange.start);
|
|
268
|
+
committedDensity = lineAdjustmentDensity(lastLine, limit, false, gapBoundaries);
|
|
269
|
+
committedSyntheticHyphenRun = (LineBreakerLines.endsWithSyntheticHyphen(lastLine, (hyphens)) ? committedSyntheticHyphenRun + 1 : 0);
|
|
270
|
+
lineStart = committedEnd;
|
|
271
|
+
}
|
|
272
|
+
const repaired = LineRepair.applyKinsokuRepairs(committed, naturalClusters, adjustedClusters, maxWidth, this.kinsoku, (shrinkOps), this.pushInPenalty, this.carryPreviousPenalty, this.leaveRaggedPenalty, ranges, indent, hangables, extendables, 5, forbiddenLineStartClusters);
|
|
273
|
+
return LineRepair.withFillPushIn(repaired, pushIn, naturalClusters, adjustedClusters, maxWidth, (shrinkOps), indent, compressBias, (forbiddenLineStartClusters), (forbidEnd), (ranges), this.pushInPenalty, gapBoundaries, progressive);
|
|
274
|
+
}
|
|
275
|
+
scoreCandidate(s, e, natural, adjusted, maxWidth, shrinkOpportunities, firstLineIndent, hangableClusters, extendableHangRanges, forbiddenLineStartClusters, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, segmentEndExclusive, prevCommittedDensity, prevSyntheticHyphenRun, gapBoundaries, dRef, unbreakableRanges, nonRenderingControlClusters, progressiveBreakOpportunities) {
|
|
276
|
+
const firstLine = LineBreakerLines.rebuildLine(new IntRange(s, e - 1), natural, adjusted, null, null, null);
|
|
277
|
+
const future = this.rawGreedyLinesFrom(e, natural, adjusted, maxWidth, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, segmentEndExclusive, unbreakableRanges, nonRenderingControlClusters, this.futureLineHorizon + 1, progressiveBreakOpportunities);
|
|
278
|
+
const spliced = LineRepair.applyKinsokuRepairs([firstLine].concat(future), natural, adjusted, maxWidth, this.kinsoku, shrinkOpportunities, this.pushInPenalty, this.carryPreviousPenalty, this.leaveRaggedPenalty, unbreakableRanges, firstLineIndent, hangableClusters, extendableHangRanges, 5, forbiddenLineStartClusters).lines;
|
|
279
|
+
const horizon = Math.trunc(Math.min(1 + this.futureLineHorizon, spliced.length));
|
|
280
|
+
let score = 0.0;
|
|
281
|
+
let prevD = prevCommittedDensity;
|
|
282
|
+
let syntheticHyphenRun = prevSyntheticHyphenRun;
|
|
283
|
+
let idx = 0;
|
|
284
|
+
while (idx < horizon) {
|
|
285
|
+
const line = spliced[idx];
|
|
286
|
+
const isLast = idx === spliced.length - 1;
|
|
287
|
+
score += this.badness(line, maxWidth, isLast, firstLineIndent, prevD, gapBoundaries, dRef);
|
|
288
|
+
if (LineBreakerLines.endsWithSyntheticHyphen(line, hyphenBreakClusters)) {
|
|
289
|
+
score += this.consecutiveSyntheticHyphenPenalty * syntheticHyphenRun;
|
|
290
|
+
syntheticHyphenRun += 1;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
syntheticHyphenRun = 0;
|
|
294
|
+
}
|
|
295
|
+
const limit = lineLimit(maxWidth, firstLineIndent, line.clusterRange.start);
|
|
296
|
+
prevD = lineAdjustmentDensity(line, limit, isLast, gapBoundaries);
|
|
297
|
+
idx++;
|
|
298
|
+
}
|
|
299
|
+
return score;
|
|
300
|
+
}
|
|
301
|
+
rawGreedyLinesFrom(start, natural, adjusted, maxWidth, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap, endExclusive, unbreakableRanges, nonRenderingControlClusters, maxLines, progressiveBreakOpportunities) {
|
|
302
|
+
if (start >= endExclusive) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
if (maxLines <= 0) {
|
|
306
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "maxLines must be positive" });
|
|
307
|
+
}
|
|
308
|
+
const lines = [];
|
|
309
|
+
let lineStart = start;
|
|
310
|
+
let adjustedAccum = 0.0;
|
|
311
|
+
let hasRenderingContent = false;
|
|
312
|
+
let i = start;
|
|
313
|
+
while (i < endExclusive) {
|
|
314
|
+
const nextAdjusted = adjustedAccum + adjusted[i].advance;
|
|
315
|
+
const overflows = nextAdjusted > maxWidth && hasRenderingContent;
|
|
316
|
+
if (overflows) {
|
|
317
|
+
const prog = ProgressiveBreakDecisions.decideProgressiveBreak(lineStart, i, progressiveBreakOpportunities, adjusted, maxWidth, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap);
|
|
318
|
+
const decided = ProgressiveBreakDecisions.decideHyphenBreak(lineStart, prog, adjusted, maxWidth, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap);
|
|
319
|
+
const breakAt = ProgressiveBreakDecisions.adjustBreakForUnbreakables(decided, lineStart, unbreakableRanges);
|
|
320
|
+
lines.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, breakAt - 1), natural, adjusted, null, null, null));
|
|
321
|
+
if (lines.length >= maxLines) {
|
|
322
|
+
return lines;
|
|
323
|
+
}
|
|
324
|
+
lineStart = breakAt;
|
|
325
|
+
adjustedAccum = adjusted[breakAt].advance;
|
|
326
|
+
hasRenderingContent = !nonRenderingControlClusters.has(breakAt);
|
|
327
|
+
i = breakAt + 1;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
adjustedAccum = nextAdjusted;
|
|
331
|
+
if (!nonRenderingControlClusters.has(i)) {
|
|
332
|
+
hasRenderingContent = true;
|
|
333
|
+
}
|
|
334
|
+
i++;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
lines.push(LineBreakerLines.rebuildLine(new IntRange(lineStart, endExclusive - 1), natural, adjusted, LineEndReason.ParagraphEnd, null, null));
|
|
338
|
+
return lines;
|
|
339
|
+
}
|
|
340
|
+
badness(line, maxWidth, isLast, firstLineIndent, prevDensity, gapBoundaries, dRef) {
|
|
341
|
+
const limit = lineLimit(maxWidth, firstLineIndent, line.clusterRange.start);
|
|
342
|
+
const ragged = (isLast ? 0.0 : Math.max(0.0, limit - line.adjustedWidth));
|
|
343
|
+
const inMeasureRange = line.inMeasureClusterRange;
|
|
344
|
+
const gaps = lineGapCount(inMeasureRange, gapBoundaries);
|
|
345
|
+
const residual = (gaps === 0 ? ragged : 0.0);
|
|
346
|
+
const d = lineAdjustmentDensity(line, limit, isLast, gapBoundaries);
|
|
347
|
+
const orphan = (!isLast && !inMeasureRange.isEmpty && inMeasureRange.start === inMeasureRange.end ? this.leaveRaggedPenalty * 1.0 : 0.0);
|
|
348
|
+
const repairPenalty = (line.repair !== null ? RepairOptions.penalty((line.repair)) * 1.0 : 0.0);
|
|
349
|
+
return residual * this.raggednessWeight + orphan + LineBreakerLines.amortizedAdjustmentCost(d, prevDensity, dRef) * this.raggednessWeight + repairPenalty;
|
|
350
|
+
}
|
|
351
|
+
static hasRenderingContentInRange(start, end, controls) {
|
|
352
|
+
let i = start;
|
|
353
|
+
while (i < end) {
|
|
354
|
+
if (!controls.has(i)) {
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
i++;
|
|
358
|
+
}
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
export function lineGapCount(range, gapBoundaries) {
|
|
363
|
+
if (range.isEmpty) {
|
|
364
|
+
return 0;
|
|
365
|
+
}
|
|
366
|
+
let n = 0;
|
|
367
|
+
let i = range.start;
|
|
368
|
+
while (i < range.end) {
|
|
369
|
+
if (gapBoundaries.has(i)) {
|
|
370
|
+
n++;
|
|
371
|
+
}
|
|
372
|
+
i++;
|
|
373
|
+
}
|
|
374
|
+
return n;
|
|
375
|
+
}
|
|
376
|
+
export function lineAdjustmentDensity(line, limit, isLast, gapBoundaries) {
|
|
377
|
+
if (isLast || line.endReason.kind !== "AutoWrap") {
|
|
378
|
+
return 0.0;
|
|
379
|
+
}
|
|
380
|
+
const gaps = lineGapCount(line.inMeasureClusterRange, gapBoundaries);
|
|
381
|
+
if (gaps === 0) {
|
|
382
|
+
return 0.0;
|
|
383
|
+
}
|
|
384
|
+
const delta = Math.max(0.0, limit - line.adjustedWidth);
|
|
385
|
+
return delta / gaps;
|
|
386
|
+
}
|
|
387
|
+
export class LineBreakerLines {
|
|
388
|
+
static closeFilledLine(range, naturalBreakAt, n, a) {
|
|
389
|
+
const line = LineBreakerLines.rebuildLine(range, n, a, null, null, null);
|
|
390
|
+
if (range.end + 1 === naturalBreakAt) {
|
|
391
|
+
return line;
|
|
392
|
+
}
|
|
393
|
+
const moved = range.end + 1;
|
|
394
|
+
return new LineCandidate(line.clusterRange, line.sourceRange, line.naturalWidth, line.adjustedWidth, line.endReason, { kind: "CarryNext", penalty: 0, reason: `ForbiddenAtLineEnd:${a[moved].text}:moved-to-next-line`, movedClusterIndex: moved }, line.repairCandidates, line.hangingClusterIndices);
|
|
395
|
+
}
|
|
396
|
+
static rebuildLine(clusterRange, n, a, endReason, repair, repairCandidates) {
|
|
397
|
+
endReason = endReason ?? null;
|
|
398
|
+
repair = repair ?? null;
|
|
399
|
+
repairCandidates = repairCandidates ?? null;
|
|
400
|
+
if (clusterRange.isEmpty) {
|
|
401
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: "Use emptyLineCandidate for an empty line." });
|
|
402
|
+
}
|
|
403
|
+
let natural = 0.0;
|
|
404
|
+
let adjusted = 0.0;
|
|
405
|
+
let idx = clusterRange.start;
|
|
406
|
+
while (idx <= clusterRange.end) {
|
|
407
|
+
natural += n[idx].advance;
|
|
408
|
+
adjusted += a[idx].advance;
|
|
409
|
+
idx++;
|
|
410
|
+
}
|
|
411
|
+
return new LineCandidate(clusterRange, new TextRange(a[clusterRange.start].range.start, a[clusterRange.end].range.end), natural, adjusted, (endReason ?? LineEndReason.AutoWrap), repair, (repairCandidates ?? []));
|
|
412
|
+
}
|
|
413
|
+
static emptyLineCandidate(sourceOffset, endReason) {
|
|
414
|
+
endReason = endReason ?? null;
|
|
415
|
+
return new LineCandidate(new IntRange(1, 0), new TextRange(sourceOffset, sourceOffset), 0, 0, (endReason ?? LineEndReason.AutoWrap), null, []);
|
|
416
|
+
}
|
|
417
|
+
static emptyIntSet() {
|
|
418
|
+
const b = SortedTable.setBuilder(SortedTable.compareInts);
|
|
419
|
+
return b.build();
|
|
420
|
+
}
|
|
421
|
+
static emptyProgressiveMap() {
|
|
422
|
+
const b = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
423
|
+
return b.build();
|
|
424
|
+
}
|
|
425
|
+
static endsWithSyntheticHyphen(line, hyphenBreakClusters) {
|
|
426
|
+
return line.endReason.kind === "AutoWrap" && !line.clusterRange.isEmpty && hyphenBreakClusters.has(line.clusterRange.end + 1);
|
|
427
|
+
}
|
|
428
|
+
static endsWithProgressiveBreak(candidate, opportunities) {
|
|
429
|
+
return candidate.endReason.kind === "AutoWrap" && !candidate.clusterRange.isEmpty && opportunities.get(candidate.clusterRange.end + 1) !== null;
|
|
430
|
+
}
|
|
431
|
+
static amortizedAdjustmentCost(d, prevD, dRef) {
|
|
432
|
+
const ref = (dRef < 1.0 ? 1.0 : dRef);
|
|
433
|
+
const diff = d - prevD;
|
|
434
|
+
return (d * d + diff * diff) / ref;
|
|
435
|
+
}
|
|
436
|
+
static findGreedyEnd(clusters, start, maxWidth, endExclusive, nonRenderingControlClusters) {
|
|
437
|
+
endExclusive = endExclusive ?? null;
|
|
438
|
+
nonRenderingControlClusters = nonRenderingControlClusters ?? null;
|
|
439
|
+
const end = endExclusive ?? clusters.length;
|
|
440
|
+
const controls = nonRenderingControlClusters ?? LineBreakerLines.emptyIntSet();
|
|
441
|
+
let accum = 0.0;
|
|
442
|
+
let i = start;
|
|
443
|
+
let hasRenderingContent = false;
|
|
444
|
+
while (i < end) {
|
|
445
|
+
const next = accum + clusters[i].advance;
|
|
446
|
+
if (next > maxWidth && hasRenderingContent) {
|
|
447
|
+
return i;
|
|
448
|
+
}
|
|
449
|
+
accum = next;
|
|
450
|
+
if (!controls.has(i)) {
|
|
451
|
+
hasRenderingContent = true;
|
|
452
|
+
}
|
|
453
|
+
i++;
|
|
454
|
+
}
|
|
455
|
+
return end;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Cluster } from "./../core/Cluster.js";
|
|
2
|
+
import { InlineObjectLineHeightDecisionInfo } from "./../core/InlineObjectLineHeightDecisionInfo.js";
|
|
3
|
+
import { type InlineObjectSpan } from "./../core/InlineObjectSpan.js";
|
|
4
|
+
import { type IntRange } from "./../core/IntRange.js";
|
|
5
|
+
import { type LayoutInput } from "./../core/LayoutInput.js";
|
|
6
|
+
import { type LineBox } from "./../core/LineBox.js";
|
|
7
|
+
import { type MaxLinesDecisionInfo } from "./../core/MaxLinesDecisionInfo.js";
|
|
8
|
+
import { RubyLineHeightDecisionInfo } from "./../core/RubyLineHeightDecisionInfo.js";
|
|
9
|
+
import { type RubySpan } from "./../core/RubySpan.js";
|
|
10
|
+
import { type TextRange } from "./../core/TextRange.js";
|
|
11
|
+
import { type FontMetricsRequest } from "./../font/FontMetrics.js";
|
|
12
|
+
import { type LayoutFontMetrics } from "./../font/LayoutFontMetrics.js";
|
|
13
|
+
import { type RawFontMetrics } from "./../font/RawFontMetrics.js";
|
|
14
|
+
import { type RubyFontGeometry } from "./AnnotationGeometryStage.js";
|
|
15
|
+
import { type LineSolution } from "./LineOptimization.js";
|
|
16
|
+
import { SortedMapTable } from "../../../runtime.js";
|
|
17
|
+
export declare class LineBoxStageResult {
|
|
18
|
+
readonly laidOutLines: LineBox[];
|
|
19
|
+
readonly visibleLines: LineBox[];
|
|
20
|
+
readonly maxLinesDecision: MaxLinesDecisionInfo | null;
|
|
21
|
+
readonly visibleLineRanges: IntRange[];
|
|
22
|
+
constructor(laidOutLines: LineBox[], visibleLines: LineBox[], maxLinesDecision: MaxLinesDecisionInfo | null, visibleLineRanges: IntRange[]);
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
25
|
+
export declare class LineVerticalGeometryStageResult {
|
|
26
|
+
readonly rubyLineHeightDecision: RubyLineHeightDecisionInfo | null;
|
|
27
|
+
readonly inlineObjectLineHeightDecision: InlineObjectLineHeightDecisionInfo | null;
|
|
28
|
+
readonly lineBaseline: number[];
|
|
29
|
+
readonly lineTop: number[];
|
|
30
|
+
readonly lineBottom: number[];
|
|
31
|
+
constructor(rubyLineHeightDecision: RubyLineHeightDecisionInfo | null, inlineObjectLineHeightDecision: InlineObjectLineHeightDecisionInfo | null, lineBaseline: number[], lineTop: number[], lineBottom: number[]);
|
|
32
|
+
toString(): string;
|
|
33
|
+
}
|
|
34
|
+
export declare class ClusterMetricDecision {
|
|
35
|
+
readonly range: TextRange;
|
|
36
|
+
readonly sourceText: string;
|
|
37
|
+
readonly request: FontMetricsRequest;
|
|
38
|
+
readonly rawMetrics: RawFontMetrics;
|
|
39
|
+
readonly layoutMetrics: LayoutFontMetrics;
|
|
40
|
+
constructor(range: TextRange, sourceText: string, request: FontMetricsRequest, rawMetrics: RawFontMetrics, layoutMetrics: LayoutFontMetrics);
|
|
41
|
+
toString(): string;
|
|
42
|
+
}
|
|
43
|
+
export declare class ResolvedLineMetrics {
|
|
44
|
+
readonly baseline: number;
|
|
45
|
+
readonly height: number;
|
|
46
|
+
readonly extraLeading: number;
|
|
47
|
+
constructor(baseline: number, height: number, extraLeading?: number | null);
|
|
48
|
+
toString(): string;
|
|
49
|
+
}
|
|
50
|
+
export declare class RubyClusterRange {
|
|
51
|
+
readonly ruby: RubySpan;
|
|
52
|
+
readonly range: IntRange;
|
|
53
|
+
constructor(ruby: RubySpan, range: IntRange);
|
|
54
|
+
}
|
|
55
|
+
export declare class LineGeometryStageFns {
|
|
56
|
+
static resolveLineVerticalGeometry(input: LayoutInput, fontSize: number, pinyinSpans: RubySpan[], naturalClusters: Cluster[], lineSolution: LineSolution, rubyFontGeometryBySpan: SortedMapTable<RubySpan, RubyFontGeometry>, existingInterlineSpace: number, baseLineMetrics: ResolvedLineMetrics, baseFaceHeight: number, rubyExtent: number, inlineObjectByClusterIndex: Map<number, InlineObjectSpan>, baseAscent: number, baseDescent: number): LineVerticalGeometryStageResult;
|
|
57
|
+
private static sortedInlineObjectByClusterIndex;
|
|
58
|
+
static resolveLineVerticalGeometrySorted(input: LayoutInput, fontSize: number, pinyinSpans: RubySpan[], naturalClusters: Cluster[], lineSolution: LineSolution, rubyFontGeometryBySpan: SortedMapTable<RubySpan, RubyFontGeometry>, existingInterlineSpace: number, baseLineMetrics: ResolvedLineMetrics, baseFaceHeight: number, rubyExtent: number, inlineObjectByClusterIndex: SortedMapTable<number, InlineObjectSpan> | null, baseAscent: number, baseDescent: number): LineVerticalGeometryStageResult;
|
|
59
|
+
static lineMetrics(self: ClusterMetricDecision[], explicitLineHeight: number | null, defaultLineHeight: number, spacingFloor?: number | null): ResolvedLineMetrics;
|
|
60
|
+
private static f32;
|
|
61
|
+
static resolveInlineObjectLineBoundaryExtent(nominalBoundaryExtent: number, currentContentBottomExtent: number, baselineDistance: number, nextContentTopExtent: number): number;
|
|
62
|
+
static clusterIndexRangeFor(self: Cluster[], r: TextRange): IntRange | null;
|
|
63
|
+
}
|