@tiqian/engine 0.0.0-stage.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,1207 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { AutoSpaceMode } from "./../clreq/AutoSpaceMode.js";
|
|
3
|
+
import { ClreqPunctuationGlyphSubstitutor } from "./../clreq/ClreqPunctuationGlyphSubstitutor.js";
|
|
4
|
+
import { KinsokuModes } from "./../clreq/KinsokuModes.js";
|
|
5
|
+
import { AccurateSum } from "./../core/AccurateSum.js";
|
|
6
|
+
import { AutoSpaceDecisionInfo } from "./../core/AutoSpaceDecisionInfo.js";
|
|
7
|
+
import { EastAsianSpacingEdges } from "./../core/EastAsianSpacingEdges.js";
|
|
8
|
+
import { EastAsianSpacingValue } from "./../core/EastAsianSpacingValue.js";
|
|
9
|
+
import { InlineObjectBoundaryAdjustment } from "./../core/InlineObjectBoundaryAdjustment.js";
|
|
10
|
+
import { InlineObjectPunctuationAttachmentDecisionInfo } from "./../core/InlineObjectPunctuationAttachmentDecisionInfo.js";
|
|
11
|
+
import { IntRange } from "./../core/IntRange.js";
|
|
12
|
+
import { LineLengthGridDecisionInfo } from "./../core/LineLengthGridDecisionInfo.js";
|
|
13
|
+
import { MandatoryBreakDecisionInfo } from "./../core/MandatoryBreakDecisionInfo.js";
|
|
14
|
+
import { RoleOverrideInfo } from "./../core/RoleOverrideInfo.js";
|
|
15
|
+
import { compareRubySpan } from "./../core/RubySpan.js";
|
|
16
|
+
import { TextRange, compareTextRange } from "./../core/TextRange.js";
|
|
17
|
+
import { TextStyle } from "./../core/TextStyle.js";
|
|
18
|
+
import { TiqianIllegalArgumentException } from "./../core/TiqianIllegalArgumentException.js";
|
|
19
|
+
import { UnicodeEastAsianSpacing } from "./../core/UnicodeEastAsianSpacing.js";
|
|
20
|
+
import { ZeroWidthBreakDecisionInfo } from "./../core/ZeroWidthBreakDecisionInfo.js";
|
|
21
|
+
import { FontMetricsRequest } from "./../font/FontMetrics.js";
|
|
22
|
+
import { FontRequest } from "./../font/FontPolicy.js";
|
|
23
|
+
import { FontRole } from "./../font/FontRole.js";
|
|
24
|
+
import { FontRoleContext } from "./../font/FontRoleContext.js";
|
|
25
|
+
import { RubyFontGeometry } from "./AnnotationGeometryStage.js";
|
|
26
|
+
import { ClusterRoleResolution } from "./ClusterRoleResolution.js";
|
|
27
|
+
import { ContextualDashEllipsisAwareFontRoleClassifier, ContextualDashEllipsisRoleResolver, ContextualDashEllipsisRoles } from "./ContextualDashEllipsisRoleResolver.js";
|
|
28
|
+
import { ClreqKinsokuRule } from "./KinsokuRule.js";
|
|
29
|
+
import { ParagraphLayoutPrep } from "./LineBreakPlanningStage.js";
|
|
30
|
+
import { ParagraphShapingStage } from "./ParagraphShapingStage.js";
|
|
31
|
+
import { ShrinkChannel, ShrinkOpportunity } from "./ProgressiveBreakDecisions.js";
|
|
32
|
+
import { PunctuationGeometryLedger } from "./PunctuationGeometryLedger.js";
|
|
33
|
+
import { PunctuationGeometryStage } from "./PunctuationGeometryStage.js";
|
|
34
|
+
import { PunctuationSpacingCompressionResult } from "./PunctuationModel.js";
|
|
35
|
+
import { QuotePairAwareFontRoleClassifier } from "./QuotePairAnalyzer.js";
|
|
36
|
+
import { ShapingInput } from "./../shaping/TextShaper.js";
|
|
37
|
+
import { SortedTable, dictKey } from "../../../runtime.js";
|
|
38
|
+
export class WidthIndependentAnnotationKey {
|
|
39
|
+
text;
|
|
40
|
+
spans;
|
|
41
|
+
lineBreakSpans;
|
|
42
|
+
sourceBoundaries;
|
|
43
|
+
textStyle;
|
|
44
|
+
decorations;
|
|
45
|
+
rubySpans;
|
|
46
|
+
inlineBoxes;
|
|
47
|
+
inlineObjects;
|
|
48
|
+
profileId;
|
|
49
|
+
emphasisDotGapEm;
|
|
50
|
+
rejectedTechnicalTiersBySpan;
|
|
51
|
+
constructor(text, spans, lineBreakSpans, sourceBoundaries, textStyle, decorations, rubySpans, inlineBoxes, inlineObjects, profileId, emphasisDotGapEm, rejectedTechnicalTiersBySpan) {
|
|
52
|
+
this.text = text;
|
|
53
|
+
this.spans = spans;
|
|
54
|
+
this.lineBreakSpans = lineBreakSpans;
|
|
55
|
+
this.sourceBoundaries = sourceBoundaries;
|
|
56
|
+
this.textStyle = textStyle;
|
|
57
|
+
this.decorations = decorations;
|
|
58
|
+
this.rubySpans = rubySpans;
|
|
59
|
+
this.inlineBoxes = inlineBoxes;
|
|
60
|
+
this.inlineObjects = inlineObjects;
|
|
61
|
+
this.profileId = profileId;
|
|
62
|
+
this.emphasisDotGapEm = emphasisDotGapEm;
|
|
63
|
+
this.rejectedTechnicalTiersBySpan = rejectedTechnicalTiersBySpan;
|
|
64
|
+
}
|
|
65
|
+
toString() {
|
|
66
|
+
return `WidthIndependentAnnotationKey(text=${this.text}, spans=${(() => { let out = "["; const n = this.spans.length; for (let i = 0; i < n; i += 1) {
|
|
67
|
+
if (i > 0) {
|
|
68
|
+
out += ", ";
|
|
69
|
+
}
|
|
70
|
+
out += this.spans[i].toString();
|
|
71
|
+
} out += "]"; return out; })()}, lineBreakSpans=${(() => { let out = "["; const n = this.lineBreakSpans.length; for (let i = 0; i < n; i += 1) {
|
|
72
|
+
if (i > 0) {
|
|
73
|
+
out += ", ";
|
|
74
|
+
}
|
|
75
|
+
out += this.lineBreakSpans[i].toString();
|
|
76
|
+
} out += "]"; return out; })()}, sourceBoundaries=${(() => { let out = "["; const n = this.sourceBoundaries.length; for (let i = 0; i < n; i += 1) {
|
|
77
|
+
if (i > 0) {
|
|
78
|
+
out += ", ";
|
|
79
|
+
}
|
|
80
|
+
out += this.sourceBoundaries[i];
|
|
81
|
+
} out += "]"; return out; })()}, textStyle=${this.textStyle.toString()}, decorations=${(() => { let out = "["; const n = this.decorations.length; for (let i = 0; i < n; i += 1) {
|
|
82
|
+
if (i > 0) {
|
|
83
|
+
out += ", ";
|
|
84
|
+
}
|
|
85
|
+
out += this.decorations[i].toString();
|
|
86
|
+
} out += "]"; return out; })()}, rubySpans=${(() => { let out = "["; const n = this.rubySpans.length; for (let i = 0; i < n; i += 1) {
|
|
87
|
+
if (i > 0) {
|
|
88
|
+
out += ", ";
|
|
89
|
+
}
|
|
90
|
+
out += this.rubySpans[i].toString();
|
|
91
|
+
} out += "]"; return out; })()}, inlineBoxes=${(() => { let out = "["; const n = this.inlineBoxes.length; for (let i = 0; i < n; i += 1) {
|
|
92
|
+
if (i > 0) {
|
|
93
|
+
out += ", ";
|
|
94
|
+
}
|
|
95
|
+
out += this.inlineBoxes[i].toString();
|
|
96
|
+
} out += "]"; return out; })()}, inlineObjects=${(() => { let out = "["; const n = this.inlineObjects.length; for (let i = 0; i < n; i += 1) {
|
|
97
|
+
if (i > 0) {
|
|
98
|
+
out += ", ";
|
|
99
|
+
}
|
|
100
|
+
out += this.inlineObjects[i].toString();
|
|
101
|
+
} out += "]"; return out; })()}, profileId=${this.profileId.toString()}, emphasisDotGapEm=${this.emphasisDotGapEm}, rejectedTechnicalTiersBySpan=${(() => { let out = "{"; const n = this.rejectedTechnicalTiersBySpan.size(); for (let i = 0; i < n; i += 1) {
|
|
102
|
+
if (i > 0) {
|
|
103
|
+
out += ", ";
|
|
104
|
+
}
|
|
105
|
+
out += this.rejectedTechnicalTiersBySpan.keyAt(i).toString() + "=" + (() => { let out = "["; const n = this.rejectedTechnicalTiersBySpan.valueAt(i).size(); for (let i1 = 0; i1 < n; i1 += 1) {
|
|
106
|
+
if (i1 > 0) {
|
|
107
|
+
out += ", ";
|
|
108
|
+
}
|
|
109
|
+
out += this.rejectedTechnicalTiersBySpan.valueAt(i).at(i1);
|
|
110
|
+
} out += "]"; return out; })();
|
|
111
|
+
} out += "}"; return out; })()})`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export class WidthIndependentParagraphAnnotation {
|
|
115
|
+
text;
|
|
116
|
+
fontSize;
|
|
117
|
+
styleAt;
|
|
118
|
+
fontSizeAt;
|
|
119
|
+
bopomofoFontWeightAt;
|
|
120
|
+
rubyFontSize;
|
|
121
|
+
rubyStackGap;
|
|
122
|
+
rubyFontWeight;
|
|
123
|
+
pinyinSpans;
|
|
124
|
+
clreqProfile;
|
|
125
|
+
punctuationGlyphSubstitutor;
|
|
126
|
+
quotePairs;
|
|
127
|
+
roleOverrideInfos;
|
|
128
|
+
fontDecisions;
|
|
129
|
+
clusterRanges;
|
|
130
|
+
fontDecisionByRange;
|
|
131
|
+
inlineObjectByRange;
|
|
132
|
+
segmentShapingCache;
|
|
133
|
+
substitutionRollbacks;
|
|
134
|
+
rubyFontGeometryBySpan;
|
|
135
|
+
baseShapingStage;
|
|
136
|
+
constructor(text, fontSize, styleAt, fontSizeAt, bopomofoFontWeightAt, rubyFontSize, rubyStackGap, rubyFontWeight, pinyinSpans, clreqProfile, punctuationGlyphSubstitutor, quotePairs, roleOverrideInfos, fontDecisions, clusterRanges, fontDecisionByRange, inlineObjectByRange, segmentShapingCache, substitutionRollbacks, rubyFontGeometryBySpan, baseShapingStage) {
|
|
137
|
+
this.text = text;
|
|
138
|
+
this.fontSize = fontSize;
|
|
139
|
+
this.styleAt = styleAt;
|
|
140
|
+
this.fontSizeAt = fontSizeAt;
|
|
141
|
+
this.bopomofoFontWeightAt = bopomofoFontWeightAt;
|
|
142
|
+
this.rubyFontSize = rubyFontSize;
|
|
143
|
+
this.rubyStackGap = rubyStackGap;
|
|
144
|
+
this.rubyFontWeight = rubyFontWeight;
|
|
145
|
+
this.pinyinSpans = pinyinSpans;
|
|
146
|
+
this.clreqProfile = clreqProfile;
|
|
147
|
+
this.punctuationGlyphSubstitutor = punctuationGlyphSubstitutor;
|
|
148
|
+
this.quotePairs = quotePairs;
|
|
149
|
+
this.roleOverrideInfos = roleOverrideInfos;
|
|
150
|
+
this.fontDecisions = fontDecisions;
|
|
151
|
+
this.clusterRanges = clusterRanges;
|
|
152
|
+
this.fontDecisionByRange = fontDecisionByRange;
|
|
153
|
+
this.inlineObjectByRange = inlineObjectByRange;
|
|
154
|
+
this.segmentShapingCache = segmentShapingCache;
|
|
155
|
+
this.substitutionRollbacks = substitutionRollbacks;
|
|
156
|
+
this.rubyFontGeometryBySpan = rubyFontGeometryBySpan;
|
|
157
|
+
this.baseShapingStage = baseShapingStage;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export class LruWidthIndependentAnnotationCache {
|
|
161
|
+
maxEntries;
|
|
162
|
+
map;
|
|
163
|
+
keys;
|
|
164
|
+
constructor(maxEntries) {
|
|
165
|
+
this.keys = [];
|
|
166
|
+
this.map = new Map();
|
|
167
|
+
this.maxEntries = (maxEntries);
|
|
168
|
+
}
|
|
169
|
+
get(key) {
|
|
170
|
+
const value = (this.map.get(dictKey(key)) ?? null);
|
|
171
|
+
if (value === null) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
LruWidthIndependentAnnotationCache.removeKeyFromList(this.keys, key);
|
|
175
|
+
this.keys.push(key);
|
|
176
|
+
return value;
|
|
177
|
+
}
|
|
178
|
+
put(key, annotation) {
|
|
179
|
+
if (this.map.has(dictKey(key))) {
|
|
180
|
+
LruWidthIndependentAnnotationCache.removeKeyFromList(this.keys, key);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
if (this.keys.length >= this.maxEntries) {
|
|
184
|
+
const oldest = this.keys[0];
|
|
185
|
+
this.keys.shift();
|
|
186
|
+
this.map.delete(dictKey(oldest));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
this.keys.push(key);
|
|
190
|
+
this.map.set(dictKey(key), annotation);
|
|
191
|
+
}
|
|
192
|
+
clear() {
|
|
193
|
+
this.map.clear();
|
|
194
|
+
this.keys.splice(0, this.keys.length);
|
|
195
|
+
}
|
|
196
|
+
get size() {
|
|
197
|
+
return this.get_size();
|
|
198
|
+
}
|
|
199
|
+
get_size() {
|
|
200
|
+
return this.keys.length;
|
|
201
|
+
}
|
|
202
|
+
static removeKeyFromList(keys, key) {
|
|
203
|
+
for (let i = 0, count = keys.length; i < count; i += 1) {
|
|
204
|
+
if (dictKey(keys[i]) === dictKey(key)) {
|
|
205
|
+
keys.splice(i, 1);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
export class WidthIndependentAnnotationCacheFns {
|
|
212
|
+
static renderNullableLastLineAlignment(value) {
|
|
213
|
+
return (value === null ? "null" : WidthIndependentAnnotationCacheFns.renderLastLineAlignment((value)));
|
|
214
|
+
}
|
|
215
|
+
static renderLastLineAlignment(value) {
|
|
216
|
+
return value.kind;
|
|
217
|
+
}
|
|
218
|
+
static copyFontFamilies(families) {
|
|
219
|
+
const count2 = families.length;
|
|
220
|
+
const result = [];
|
|
221
|
+
for (let i = 0; i < count2; i += 1) {
|
|
222
|
+
result.push(families[i]);
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
static isFixedBoundary(b) {
|
|
227
|
+
return !b.participatesInUniformStretch && b.preferredStretch === null && b.shrinkCapacity === 0.0 && b.lineEndDiscardableAdvance === 0.0 && !b.preventsLineBreak;
|
|
228
|
+
}
|
|
229
|
+
static isContainedIn(r, other) {
|
|
230
|
+
return r.start >= other.start && r.end <= other.end;
|
|
231
|
+
}
|
|
232
|
+
static containingFontDecisions(clusters, items) {
|
|
233
|
+
let itemIndex = 0;
|
|
234
|
+
const result = new Array();
|
|
235
|
+
for (let i = 0, count3 = clusters.length; i < count3; i += 1) {
|
|
236
|
+
const cluster = clusters[i];
|
|
237
|
+
while (itemIndex < items.length && items[itemIndex].range.end <= cluster.range.start) {
|
|
238
|
+
itemIndex += 1;
|
|
239
|
+
}
|
|
240
|
+
if (itemIndex < items.length) {
|
|
241
|
+
const item = items[itemIndex];
|
|
242
|
+
if (cluster.range.start >= item.range.start && cluster.range.end <= item.range.end) {
|
|
243
|
+
result.push(item);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
result.push((null));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
result.push((null));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return result;
|
|
254
|
+
}
|
|
255
|
+
static firstContainedAtom(clusters, items) {
|
|
256
|
+
let itemIndex = 0;
|
|
257
|
+
const result = new Array();
|
|
258
|
+
for (let i = 0, count4 = clusters.length; i < count4; i += 1) {
|
|
259
|
+
const cluster = clusters[i];
|
|
260
|
+
while (itemIndex < items.length && items[itemIndex].range.end <= cluster.range.start) {
|
|
261
|
+
itemIndex += 1;
|
|
262
|
+
}
|
|
263
|
+
if (itemIndex < items.length) {
|
|
264
|
+
const item = items[itemIndex];
|
|
265
|
+
if (item.range.start >= cluster.range.start && item.range.end <= cluster.range.end) {
|
|
266
|
+
result.push(item);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
result.push((null));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
result.push((null));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
static quoteToRoleOverrideInfos(decisions, text, baseClassifier, context) {
|
|
279
|
+
const count5 = decisions.length;
|
|
280
|
+
const sorted = [];
|
|
281
|
+
for (let i = 0; i < count5; i += 1) {
|
|
282
|
+
sorted.push(decisions[i]);
|
|
283
|
+
}
|
|
284
|
+
let rIdx = 1;
|
|
285
|
+
while (rIdx < sorted.length) {
|
|
286
|
+
const curr = sorted[rIdx];
|
|
287
|
+
let j = rIdx - 1;
|
|
288
|
+
while (j >= 0 && sorted[j].index > curr.index) {
|
|
289
|
+
sorted[j + 1] = sorted[j];
|
|
290
|
+
j--;
|
|
291
|
+
}
|
|
292
|
+
sorted[j + 1] = curr;
|
|
293
|
+
rIdx++;
|
|
294
|
+
}
|
|
295
|
+
const result = [];
|
|
296
|
+
for (let i2 = 0; i2 < sorted.length; i2 += 1) {
|
|
297
|
+
const decision = sorted[i2];
|
|
298
|
+
const index = decision.index;
|
|
299
|
+
const endIdx = (index + 1 < text.length ? index + 1 : text.length);
|
|
300
|
+
const sourceText = text.substring(index, endIdx);
|
|
301
|
+
const originalRole = baseClassifier.classify(text, new TextRange(index, index + 1), context);
|
|
302
|
+
result.push(new RoleOverrideInfo(new TextRange(index, index + 1), sourceText, originalRole.kind, decision.role.kind, decision.source, decision.reason));
|
|
303
|
+
}
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
static toWidthIndependentAnnotationKey(input, rejectedTechnicalTiersBySpan) {
|
|
307
|
+
rejectedTechnicalTiersBySpan = rejectedTechnicalTiersBySpan ?? null;
|
|
308
|
+
const tiers = (rejectedTechnicalTiersBySpan !== null ? rejectedTechnicalTiersBySpan : SortedTable.mapBuilder(compareTextRange).build());
|
|
309
|
+
return new WidthIndependentAnnotationKey(input.content.text, input.content.spans, input.content.lineBreakSpans, input.content.sourceBoundaries, input.textStyle, input.decorations, input.rubySpans, input.inlineBoxes, input.inlineObjects, input.profileId, input.paragraphStyle.emphasisDotGapEm, (tiers));
|
|
310
|
+
}
|
|
311
|
+
static clampInt(val, min, max) {
|
|
312
|
+
return (val < min ? min : (val > max ? max : val));
|
|
313
|
+
}
|
|
314
|
+
static isInlineStop(code) {
|
|
315
|
+
return code === 12290 || code === 65281 || code === 65311 || code === 65294;
|
|
316
|
+
}
|
|
317
|
+
static prepareWidthIndependentAnnotation(engine, input, rejectedTechnicalTiersBySpan) {
|
|
318
|
+
const text = input.content.text;
|
|
319
|
+
const fontSize = input.textStyle.fontSize;
|
|
320
|
+
const inlineObjectByRangeBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
321
|
+
for (let i = 0, count13 = input.inlineObjects.length; i < count13; i += 1) {
|
|
322
|
+
const obj = input.inlineObjects[i];
|
|
323
|
+
inlineObjectByRangeBuilder.put(obj.range, obj);
|
|
324
|
+
}
|
|
325
|
+
const inlineObjectByRange = inlineObjectByRangeBuilder.build();
|
|
326
|
+
const sizedSpans = new Array();
|
|
327
|
+
for (let i2 = 0, count14 = input.content.spans.length; i2 < count14; i2 += 1) {
|
|
328
|
+
const sp = input.content.spans[i2];
|
|
329
|
+
if (sp.range.start < sp.range.end) {
|
|
330
|
+
sizedSpans.push(sp);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const styleAt = (offset) => {
|
|
334
|
+
let lastSpan = null;
|
|
335
|
+
for (let i3 = 0, count15 = sizedSpans.length; i3 < count15; i3 += 1) {
|
|
336
|
+
const sp2 = sizedSpans[i3];
|
|
337
|
+
if (offset >= sp2.range.start && offset < sp2.range.end) {
|
|
338
|
+
lastSpan = sp2;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return (lastSpan !== null ? lastSpan.style : input.textStyle);
|
|
342
|
+
};
|
|
343
|
+
const fontSizeAt = (offset) => {
|
|
344
|
+
return styleAt(offset).fontSize;
|
|
345
|
+
};
|
|
346
|
+
const emphasisRanges = new Array();
|
|
347
|
+
for (let i4 = 0, count16 = input.decorations.length; i4 < count16; i4 += 1) {
|
|
348
|
+
const d = input.decorations[i4];
|
|
349
|
+
if (d.kind.kind === "Emphasis") {
|
|
350
|
+
emphasisRanges.push(d.range);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const emphasisItalicAt = (offset) => {
|
|
354
|
+
for (let i5 = 0, count17 = emphasisRanges.length; i5 < count17; i5 += 1) {
|
|
355
|
+
const r = emphasisRanges[i5];
|
|
356
|
+
if (offset >= r.start && offset < r.end) {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return false;
|
|
361
|
+
};
|
|
362
|
+
const rubyFontSize = fontSize * 0.5;
|
|
363
|
+
const rubyStackGap = fontSize * 0.0;
|
|
364
|
+
const rubyFontWeight = WidthIndependentAnnotationCacheFns.clampInt(input.textStyle.fontWeight + 100, 1, 900);
|
|
365
|
+
const bopomofoFontWeightAt = (offset) => {
|
|
366
|
+
return WidthIndependentAnnotationCacheFns.clampInt(styleAt(offset).fontWeight + 300, 1, 900);
|
|
367
|
+
};
|
|
368
|
+
const pinyinSpans = new Array();
|
|
369
|
+
for (let i6 = 0, count18 = input.rubySpans.length; i6 < count18; i6 += 1) {
|
|
370
|
+
const rs = input.rubySpans[i6];
|
|
371
|
+
if (rs.kind.kind === "Pinyin") {
|
|
372
|
+
pinyinSpans.push(rs);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const spanBoundariesBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
376
|
+
const addSpanBoundary = (offset) => {
|
|
377
|
+
if (offset > 0 && offset < text.length) {
|
|
378
|
+
spanBoundariesBuilder.put(offset);
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const addSpanRange = (range) => {
|
|
382
|
+
addSpanBoundary(range.start);
|
|
383
|
+
addSpanBoundary(range.end);
|
|
384
|
+
};
|
|
385
|
+
for (let i7 = 0, count6 = sizedSpans.length; i7 < count6; i7 += 1) {
|
|
386
|
+
addSpanRange(sizedSpans[i7].range);
|
|
387
|
+
}
|
|
388
|
+
for (let i8 = 0, count19 = input.decorations.length; i8 < count19; i8 += 1) {
|
|
389
|
+
addSpanRange(input.decorations[i8].range);
|
|
390
|
+
}
|
|
391
|
+
for (let i9 = 0, count20 = input.rubySpans.length; i9 < count20; i9 += 1) {
|
|
392
|
+
addSpanRange(input.rubySpans[i9].baseRange);
|
|
393
|
+
}
|
|
394
|
+
for (let i10 = 0, count21 = input.inlineBoxes.length; i10 < count21; i10 += 1) {
|
|
395
|
+
addSpanRange(input.inlineBoxes[i10].range);
|
|
396
|
+
}
|
|
397
|
+
for (let i11 = 0, count22 = input.inlineObjects.length; i11 < count22; i11 += 1) {
|
|
398
|
+
addSpanRange(input.inlineObjects[i11].range);
|
|
399
|
+
}
|
|
400
|
+
for (let i12 = 0, count23 = input.content.lineBreakSpans.length; i12 < count23; i12 += 1) {
|
|
401
|
+
addSpanRange(input.content.lineBreakSpans[i12].range);
|
|
402
|
+
}
|
|
403
|
+
for (let i13 = 0, count24 = input.content.sourceBoundaries.length; i13 < count24; i13 += 1) {
|
|
404
|
+
addSpanBoundary(input.content.sourceBoundaries[i13]);
|
|
405
|
+
}
|
|
406
|
+
const spanBoundaries = spanBoundariesBuilder.build();
|
|
407
|
+
const emojiShapingBoundariesBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
408
|
+
const addEmojiBoundary = (offset) => {
|
|
409
|
+
if (offset > 0 && offset < text.length) {
|
|
410
|
+
emojiShapingBoundariesBuilder.put(offset);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
const addEmojiRange = (range) => {
|
|
414
|
+
addEmojiBoundary(range.start);
|
|
415
|
+
addEmojiBoundary(range.end);
|
|
416
|
+
};
|
|
417
|
+
for (let i14 = 0, count25 = sizedSpans.length; i14 < count25; i14 += 1) {
|
|
418
|
+
addEmojiRange(sizedSpans[i14].range);
|
|
419
|
+
}
|
|
420
|
+
for (let i15 = 0, count26 = input.inlineBoxes.length; i15 < count26; i15 += 1) {
|
|
421
|
+
const box = input.inlineBoxes[i15];
|
|
422
|
+
if (box.inlineStart !== 0.0 || box.inlineEnd !== 0.0 || box.outerSpacing.kind === "Narrow") {
|
|
423
|
+
addEmojiRange(box.range);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
for (let i16 = 0, count27 = input.inlineObjects.length; i16 < count27; i16 += 1) {
|
|
427
|
+
addEmojiRange(input.inlineObjects[i16].range);
|
|
428
|
+
}
|
|
429
|
+
const emojiShapingBoundaries = emojiShapingBoundariesBuilder.build();
|
|
430
|
+
const clreqProfile = engine.clreqProfileResolver.resolve(input.profileId);
|
|
431
|
+
const context = new FontRoleContext(input.textStyle.locale, clreqProfile.region.kind);
|
|
432
|
+
const punctuationGlyphSubstitutor = new ClreqPunctuationGlyphSubstitutor(clreqProfile.punctuationGlyphPolicy);
|
|
433
|
+
const quotePairs = engine.quotePairAnalyzer.analyze(text);
|
|
434
|
+
const quoteRoleDecisions = engine.quotePairAnalyzer.classifyQuoteRoles(text, quotePairs, context);
|
|
435
|
+
const quoteRoleOverridesBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
436
|
+
for (let i17 = 0, count7 = quoteRoleDecisions.length; i17 < count7; i17 += 1) {
|
|
437
|
+
quoteRoleOverridesBuilder.put(quoteRoleDecisions[i17].index, quoteRoleDecisions[i17].role);
|
|
438
|
+
}
|
|
439
|
+
const quoteRoleOverrides = quoteRoleOverridesBuilder.build();
|
|
440
|
+
const quoteRoleOverrideInfos = WidthIndependentAnnotationCacheFns.quoteToRoleOverrideInfos(quoteRoleDecisions, text, engine.fontRoleClassifier, context);
|
|
441
|
+
const quoteAwareClassifier = (quoteRoleOverrides.size() > 0 ? new QuotePairAwareFontRoleClassifier(engine.fontRoleClassifier, quoteRoleOverrides) : engine.fontRoleClassifier);
|
|
442
|
+
const dashEllipsisRoleDecisions = new ContextualDashEllipsisRoleResolver().resolve(text, context);
|
|
443
|
+
const dashEllipsisRoleOverrideInfos = ContextualDashEllipsisRoles.toRoleOverrideInfos(dashEllipsisRoleDecisions, text, quoteAwareClassifier, context);
|
|
444
|
+
const effectiveClassifier = (dashEllipsisRoleDecisions.length > 0 ? new ContextualDashEllipsisAwareFontRoleClassifier(quoteAwareClassifier, dashEllipsisRoleDecisions) : quoteAwareClassifier);
|
|
445
|
+
const inlineObjectByStartBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
446
|
+
for (let i18 = 0, count28 = input.inlineObjects.length; i18 < count28; i18 += 1) {
|
|
447
|
+
const obj2 = input.inlineObjects[i18];
|
|
448
|
+
inlineObjectByStartBuilder.put(obj2.range.start, obj2);
|
|
449
|
+
}
|
|
450
|
+
const clusterRanges = ClusterRoleResolution.clusterRoleRanges(text, effectiveClassifier, context, clreqProfile, spanBoundaries, emojiShapingBoundaries, inlineObjectByStartBuilder.build());
|
|
451
|
+
const count8 = quoteRoleOverrideInfos.length;
|
|
452
|
+
const allRoleOverrides = [];
|
|
453
|
+
for (let i19 = 0; i19 < count8; i19 += 1) {
|
|
454
|
+
allRoleOverrides.push(quoteRoleOverrideInfos[i19]);
|
|
455
|
+
}
|
|
456
|
+
for (let i20 = 0, count9 = dashEllipsisRoleOverrideInfos.length; i20 < count9; i20 += 1) {
|
|
457
|
+
allRoleOverrides.push(dashEllipsisRoleOverrideInfos[i20]);
|
|
458
|
+
}
|
|
459
|
+
for (let i21 = 0, count10 = clusterRanges.length; i21 < count10; i21 += 1) {
|
|
460
|
+
const ro = clusterRanges[i21].roleOverride;
|
|
461
|
+
if (ro !== null) {
|
|
462
|
+
allRoleOverrides.push((ro));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
let rIdx = 1;
|
|
466
|
+
while (rIdx < allRoleOverrides.length) {
|
|
467
|
+
const curr = allRoleOverrides[rIdx];
|
|
468
|
+
let j = rIdx - 1;
|
|
469
|
+
while (j >= 0 && allRoleOverrides[j].range.start > curr.range.start) {
|
|
470
|
+
allRoleOverrides[j + 1] = allRoleOverrides[j];
|
|
471
|
+
j--;
|
|
472
|
+
}
|
|
473
|
+
allRoleOverrides[j + 1] = curr;
|
|
474
|
+
rIdx++;
|
|
475
|
+
}
|
|
476
|
+
const roleOverrideInfos = allRoleOverrides;
|
|
477
|
+
const shapeableRanges = new Array();
|
|
478
|
+
for (let i22 = 0, count29 = clusterRanges.length; i22 < count29; i22 += 1) {
|
|
479
|
+
const cr = clusterRanges[i22];
|
|
480
|
+
if (!cr.mandatoryBreak && !cr.zeroWidthSoftBreak && !inlineObjectByRange.has(cr.range)) {
|
|
481
|
+
shapeableRanges.push(cr);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
const fontDecisions = new Array();
|
|
485
|
+
const fontDecisionByRangeBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
486
|
+
for (let i23 = 0, count11 = shapeableRanges.length; i23 < count11; i23 += 1) {
|
|
487
|
+
const resolvedRange = shapeableRanges[i23];
|
|
488
|
+
const decision = engine.fallbackResolver.resolve(text, resolvedRange.range, new FontRequest(input.textStyle.fontFamilies, input.textStyle.locale, resolvedRange.role));
|
|
489
|
+
fontDecisions.push(decision);
|
|
490
|
+
fontDecisionByRangeBuilder.put(resolvedRange.range, decision);
|
|
491
|
+
}
|
|
492
|
+
const fontDecisionByRange = fontDecisionByRangeBuilder.build();
|
|
493
|
+
const baseShapingStage = ParagraphShapingStage.shapeParagraph(engine, input, text, fontSize, 1e9, clusterRanges, fontDecisionByRange, inlineObjectByRange, punctuationGlyphSubstitutor, styleAt, emphasisItalicAt, rejectedTechnicalTiersBySpan, null, null);
|
|
494
|
+
const rubyFontGeometryBuilder = SortedTable.mapBuilder(compareRubySpan);
|
|
495
|
+
for (let i24 = 0, count12 = pinyinSpans.length; i24 < count12; i24 += 1) {
|
|
496
|
+
const ruby = pinyinSpans[i24];
|
|
497
|
+
const metricText = (ruby.text.length === 0 ? "x" : ruby.text);
|
|
498
|
+
const range = new TextRange(0, metricText.length);
|
|
499
|
+
const preferredFamilies = ruby.fontFamilies;
|
|
500
|
+
const rubyLocale = (ruby.locale !== null ? ruby.locale : input.textStyle.locale);
|
|
501
|
+
const decision2 = engine.fallbackResolver.resolve(metricText, range, new FontRequest(preferredFamilies, (rubyLocale), FontRole.LatinText));
|
|
502
|
+
const raw = engine.fontMetricsResolver.resolve(new FontMetricsRequest(decision2.candidate.key, rubyFontSize, FontRole.LatinText, (rubyLocale), WidthIndependentAnnotationCacheFns.copyFontFamilies(preferredFamilies), rubyFontWeight, input.textStyle.italic, metricText));
|
|
503
|
+
const declaredAscent = (raw.typoAscent !== null ? raw.typoAscent : raw.ascent);
|
|
504
|
+
const declaredDescent = (raw.typoDescent !== null ? raw.typoDescent : raw.descent);
|
|
505
|
+
let shaped = null;
|
|
506
|
+
if (ruby.text.length > 0) {
|
|
507
|
+
shaped = engine.textShaper.shape(new ShapingInput(ruby.text, new TextRange(0, ruby.text.length), new TextStyle(WidthIndependentAnnotationCacheFns.copyFontFamilies(ruby.fontFamilies), rubyFontSize, (rubyLocale ?? "zh-Hans"), rubyFontWeight, input.textStyle.italic, input.textStyle.baselineShift, input.textStyle.inlineAttachment), decision2, ruby.text, []));
|
|
508
|
+
}
|
|
509
|
+
const rubyWidthTerms = [];
|
|
510
|
+
const glyphList = new Array();
|
|
511
|
+
if (shaped !== null) {
|
|
512
|
+
for (let c = 0, count30 = shaped.clusters.length; c < count30; c += 1) {
|
|
513
|
+
rubyWidthTerms.push(shaped.clusters[c].advance);
|
|
514
|
+
}
|
|
515
|
+
for (let r2 = 0, count31 = shaped.glyphRuns.length; r2 < count31; r2 += 1) {
|
|
516
|
+
const run = shaped.glyphRuns[r2];
|
|
517
|
+
for (let g = 0, count32 = run.glyphs.length; g < count32; g += 1) {
|
|
518
|
+
glyphList.push(run.glyphs[g]);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const rubyWidth = AccurateSum.of(rubyWidthTerms);
|
|
523
|
+
const requiredExtent = (ruby.text.length === 0 ? 0.0 : declaredAscent + declaredDescent + rubyStackGap);
|
|
524
|
+
const ascent = (ruby.text.length === 0 ? 0.0 : declaredAscent);
|
|
525
|
+
const descent = (ruby.text.length === 0 ? 0.0 : declaredDescent);
|
|
526
|
+
const geom = new RubyFontGeometry(rubyWidth, (ascent), (descent), requiredExtent, glyphList);
|
|
527
|
+
rubyFontGeometryBuilder.put(ruby, geom);
|
|
528
|
+
}
|
|
529
|
+
const rubyFontGeometryBySpan = rubyFontGeometryBuilder.build();
|
|
530
|
+
return new WidthIndependentParagraphAnnotation(text, fontSize, styleAt, fontSizeAt, bopomofoFontWeightAt, rubyFontSize, rubyStackGap, rubyFontWeight, pinyinSpans, clreqProfile, punctuationGlyphSubstitutor, quotePairs, roleOverrideInfos, fontDecisions, clusterRanges, fontDecisionByRange, inlineObjectByRange, baseShapingStage.segmentShapingCache, baseShapingStage.substitutionRollbacks, rubyFontGeometryBySpan, baseShapingStage);
|
|
531
|
+
}
|
|
532
|
+
static computeRubySpread(natural, rubySize, pinyinSpans, rubyFontGeometryBySpan) {
|
|
533
|
+
const count34 = pinyinSpans.length;
|
|
534
|
+
if (count34 === 0) {
|
|
535
|
+
return SortedTable.mapBuilder(SortedTable.compareInts).build();
|
|
536
|
+
}
|
|
537
|
+
const wordSpace = rubySize * 0.25;
|
|
538
|
+
const leftX = new Array();
|
|
539
|
+
let acc = 0.0;
|
|
540
|
+
for (let i = 0, count33 = natural.length; i < count33; i += 1) {
|
|
541
|
+
leftX.push(acc);
|
|
542
|
+
acc += natural[i].advance;
|
|
543
|
+
}
|
|
544
|
+
const measuresFirstCluster = new Array();
|
|
545
|
+
const measuresCenter = new Array();
|
|
546
|
+
const measuresRw = new Array();
|
|
547
|
+
for (let i2 = 0; i2 < count34; i2 += 1) {
|
|
548
|
+
const ruby = pinyinSpans[i2];
|
|
549
|
+
const idxRange = PunctuationGeometryLedger.clusterIndexRangeFor(natural, ruby.baseRange);
|
|
550
|
+
if (idxRange === null) {
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
const center = (leftX[idxRange.start] + leftX[idxRange.end] + natural[idxRange.end].advance) / 2.0;
|
|
554
|
+
const geom = rubyFontGeometryBySpan.get(ruby);
|
|
555
|
+
measuresFirstCluster.push(idxRange.start);
|
|
556
|
+
measuresCenter.push(center);
|
|
557
|
+
measuresRw.push(geom.width);
|
|
558
|
+
}
|
|
559
|
+
let mIdx = 1;
|
|
560
|
+
while (mIdx < measuresFirstCluster.length) {
|
|
561
|
+
const currFc = measuresFirstCluster[mIdx];
|
|
562
|
+
const currCenter = measuresCenter[mIdx];
|
|
563
|
+
const currRw = measuresRw[mIdx];
|
|
564
|
+
let j = mIdx - 1;
|
|
565
|
+
while (j >= 0 && measuresFirstCluster[j] > currFc) {
|
|
566
|
+
measuresFirstCluster[j + 1] = measuresFirstCluster[j];
|
|
567
|
+
measuresCenter[j + 1] = measuresCenter[j];
|
|
568
|
+
measuresRw[j + 1] = measuresRw[j];
|
|
569
|
+
j--;
|
|
570
|
+
}
|
|
571
|
+
measuresFirstCluster[j + 1] = currFc;
|
|
572
|
+
measuresCenter[j + 1] = currCenter;
|
|
573
|
+
measuresRw[j + 1] = currRw;
|
|
574
|
+
mIdx++;
|
|
575
|
+
}
|
|
576
|
+
const spreadBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
577
|
+
const spreadKeys = new Array();
|
|
578
|
+
const spreadValues = new Array();
|
|
579
|
+
const getSpread = (key) => {
|
|
580
|
+
for (let i3 = 0, count36 = spreadKeys.length; i3 < count36; i3 += 1) {
|
|
581
|
+
if (spreadKeys[i3] === key) {
|
|
582
|
+
return spreadValues[i3];
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return 0.0;
|
|
586
|
+
};
|
|
587
|
+
const putSpread = (key, val) => {
|
|
588
|
+
for (let i4 = 0, count37 = spreadKeys.length; i4 < count37; i4 += 1) {
|
|
589
|
+
if (spreadKeys[i4] === key) {
|
|
590
|
+
spreadValues[i4] = val;
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
spreadKeys.push(key);
|
|
595
|
+
spreadValues.push(val);
|
|
596
|
+
};
|
|
597
|
+
let shift = 0.0;
|
|
598
|
+
let prevRight = -1e9;
|
|
599
|
+
for (let m = 0, count38 = measuresFirstCluster.length; m < count38; m += 1) {
|
|
600
|
+
const firstCluster = measuresFirstCluster[m];
|
|
601
|
+
const rw = measuresRw[m];
|
|
602
|
+
let center2 = measuresCenter[m] + shift;
|
|
603
|
+
const needed = prevRight + wordSpace - (center2 - rw / 2.0);
|
|
604
|
+
if (needed > 0.0 && firstCluster > 0) {
|
|
605
|
+
const key = firstCluster - 1;
|
|
606
|
+
putSpread(key, getSpread(key) + needed);
|
|
607
|
+
shift += needed;
|
|
608
|
+
center2 += needed;
|
|
609
|
+
}
|
|
610
|
+
prevRight = center2 + rw / 2.0;
|
|
611
|
+
}
|
|
612
|
+
for (let i5 = 0, count35 = spreadKeys.length; i5 < count35; i5 += 1) {
|
|
613
|
+
spreadBuilder.put(spreadKeys[i5], spreadValues[i5]);
|
|
614
|
+
}
|
|
615
|
+
return spreadBuilder.build();
|
|
616
|
+
}
|
|
617
|
+
static addGeometryAwareOpportunity(shrinkOpportunities, caps, idx, tier, lineEndOnly) {
|
|
618
|
+
if (caps.paired) {
|
|
619
|
+
const minGlue = (caps.leading < caps.trailing ? caps.leading : caps.trailing);
|
|
620
|
+
const pairedCapacity = 2.0 * minGlue;
|
|
621
|
+
if (pairedCapacity > 0.0) {
|
|
622
|
+
shrinkOpportunities.push(new ShrinkOpportunity(idx, tier, pairedCapacity, ShrinkChannel.LeadingAndTrailingGlue, lineEndOnly));
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
if (caps.leading > 0.0) {
|
|
627
|
+
shrinkOpportunities.push(new ShrinkOpportunity(idx, tier, caps.leading, ShrinkChannel.LeadingGlue, lineEndOnly));
|
|
628
|
+
}
|
|
629
|
+
if (caps.trailing > 0.0) {
|
|
630
|
+
shrinkOpportunities.push(new ShrinkOpportunity(idx, tier, caps.trailing, ShrinkChannel.TrailingGlue, lineEndOnly));
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
static buildParagraphLayoutPrep(engine, input, annotation, rejectedTechnicalTiersBySpan) {
|
|
635
|
+
const text = annotation.text;
|
|
636
|
+
const fontSize = input.textStyle.fontSize;
|
|
637
|
+
const grid = input.paragraphStyle.lineLengthGrid;
|
|
638
|
+
const containerWidth = input.constraints.maxWidth;
|
|
639
|
+
let gridCells = Math.floor(containerWidth / fontSize);
|
|
640
|
+
if (gridCells < 1) {
|
|
641
|
+
gridCells = 1;
|
|
642
|
+
}
|
|
643
|
+
const gridCellsInt = Math.trunc(gridCells);
|
|
644
|
+
let measure = containerWidth;
|
|
645
|
+
if (grid.enabled) {
|
|
646
|
+
measure = gridCellsInt * fontSize;
|
|
647
|
+
if (measure > containerWidth) {
|
|
648
|
+
measure = containerWidth;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
const gridSlack = containerWidth - measure;
|
|
652
|
+
const gridBodyAlignment = (grid.bodyAlignment !== null ? grid.bodyAlignment : input.paragraphStyle.lastLineAlignment);
|
|
653
|
+
let gridBodyOffset = 0.0;
|
|
654
|
+
if (grid.enabled) {
|
|
655
|
+
if ((gridBodyAlignment !== null && gridBodyAlignment.kind === "Center")) {
|
|
656
|
+
gridBodyOffset = gridSlack / 2.0;
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
if ((gridBodyAlignment !== null && gridBodyAlignment.kind === "End")) {
|
|
660
|
+
gridBodyOffset = gridSlack;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
const lineLengthGridDecision = new LineLengthGridDecisionInfo(grid.enabled, containerWidth, fontSize, (grid.enabled ? gridCellsInt : Math.trunc(measure / fontSize)), measure, gridSlack, WidthIndependentAnnotationCacheFns.renderNullableLastLineAlignment(gridBodyAlignment), gridBodyOffset, (grid.enabled ? "LineLengthGridQuantization" : "GridBypassed"));
|
|
665
|
+
const measureEm = measure / fontSize;
|
|
666
|
+
const resolvedKinsoku = KinsokuModes.resolve(annotation.clreqProfile.kinsokuMode, measureEm);
|
|
667
|
+
const kinsokuRule = new ClreqKinsokuRule(resolvedKinsoku.level);
|
|
668
|
+
let hasProgSpan = false;
|
|
669
|
+
for (let i = 0, count48 = input.content.lineBreakSpans.length; i < count48; i += 1) {
|
|
670
|
+
if (input.content.lineBreakSpans[i].policy.kind === "ProgressiveTechnical") {
|
|
671
|
+
hasProgSpan = true;
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
let hasOverMeasureToken = false;
|
|
676
|
+
for (let i2 = 0, count49 = annotation.baseShapingStage.shapingResults.length; i2 < count49; i2 += 1) {
|
|
677
|
+
const res = annotation.baseShapingStage.shapingResults[i2];
|
|
678
|
+
const resTerms = [];
|
|
679
|
+
for (let c = 0, count50 = res.clusters.length; c < count50; c += 1) {
|
|
680
|
+
resTerms.push(res.clusters[c].advance);
|
|
681
|
+
}
|
|
682
|
+
if (AccurateSum.of(resTerms) > measure) {
|
|
683
|
+
hasOverMeasureToken = true;
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
const needsDynamicShaping = rejectedTechnicalTiersBySpan !== null && rejectedTechnicalTiersBySpan.size() > 0 || hasProgSpan || hasOverMeasureToken;
|
|
688
|
+
let shapingStage = annotation.baseShapingStage;
|
|
689
|
+
if (needsDynamicShaping) {
|
|
690
|
+
shapingStage = ParagraphShapingStage.shapeParagraph(engine, input, text, fontSize, measure, annotation.clusterRanges, annotation.fontDecisionByRange, annotation.inlineObjectByRange, annotation.punctuationGlyphSubstitutor, annotation.styleAt, (offset) => {
|
|
691
|
+
for (let i3 = 0, count51 = input.decorations.length; i3 < count51; i3 += 1) {
|
|
692
|
+
const d = input.decorations[i3];
|
|
693
|
+
if (d.kind.kind === "Emphasis" && offset >= d.range.start && offset < d.range.end) {
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return false;
|
|
698
|
+
}, rejectedTechnicalTiersBySpan, annotation.segmentShapingCache, annotation.substitutionRollbacks);
|
|
699
|
+
}
|
|
700
|
+
const shapingResults = shapingStage.shapingResults;
|
|
701
|
+
const rawNaturalClusters = new Array();
|
|
702
|
+
for (let i4 = 0, count39 = shapingResults.length; i4 < count39; i4 += 1) {
|
|
703
|
+
const res2 = shapingResults[i4];
|
|
704
|
+
for (let c2 = 0, count52 = res2.clusters.length; c2 < count52; c2 += 1) {
|
|
705
|
+
rawNaturalClusters.push(res2.clusters[c2]);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const shapedGlyphsByClusterRangeBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
709
|
+
const openTypeFeaturesByClusterRangeBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
710
|
+
const glyphsByClusterRangeKeys = new Array();
|
|
711
|
+
const glyphsByClusterRangeValues = new Array();
|
|
712
|
+
const openTypeFeatureKeys = new Array();
|
|
713
|
+
const openTypeFeatureValues = new Array();
|
|
714
|
+
const addGlyphToClusterRange = (range, g) => {
|
|
715
|
+
const keyCount = glyphsByClusterRangeKeys.length;
|
|
716
|
+
if (keyCount > 0) {
|
|
717
|
+
const lastKey = glyphsByClusterRangeKeys[keyCount - 1];
|
|
718
|
+
if (lastKey.start === range.start && lastKey.end === range.end) {
|
|
719
|
+
glyphsByClusterRangeValues[keyCount - 1].push(g);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
if (range.start > lastKey.start) {
|
|
723
|
+
glyphsByClusterRangeKeys.push(range);
|
|
724
|
+
glyphsByClusterRangeValues.push([g]);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
for (let i5 = 0, count53 = glyphsByClusterRangeKeys.length; i5 < count53; i5 += 1) {
|
|
729
|
+
if (glyphsByClusterRangeKeys[i5].start === range.start && glyphsByClusterRangeKeys[i5].end === range.end) {
|
|
730
|
+
glyphsByClusterRangeValues[i5].push(g);
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
glyphsByClusterRangeKeys.push(range);
|
|
735
|
+
glyphsByClusterRangeValues.push([g]);
|
|
736
|
+
};
|
|
737
|
+
for (let i6 = 0, count54 = shapingResults.length; i6 < count54; i6 += 1) {
|
|
738
|
+
const res3 = shapingResults[i6];
|
|
739
|
+
for (let r = 0, count55 = res3.glyphRuns.length; r < count55; r += 1) {
|
|
740
|
+
const run = res3.glyphRuns[r];
|
|
741
|
+
const seenRanges = new Array();
|
|
742
|
+
for (let g = 0, count57 = run.glyphs.length; g < count57; g += 1) {
|
|
743
|
+
const glyph = run.glyphs[g];
|
|
744
|
+
addGlyphToClusterRange(glyph.clusterRange, glyph);
|
|
745
|
+
let rangeSeen = false;
|
|
746
|
+
for (let sr = 0, count58 = seenRanges.length; sr < count58; sr += 1) {
|
|
747
|
+
if (seenRanges[sr].start === glyph.clusterRange.start && seenRanges[sr].end === glyph.clusterRange.end) {
|
|
748
|
+
rangeSeen = true;
|
|
749
|
+
break;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
if (!rangeSeen) {
|
|
753
|
+
seenRanges.push(glyph.clusterRange);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
for (let sr2 = 0, count56 = seenRanges.length; sr2 < count56; sr2 += 1) {
|
|
757
|
+
const range = seenRanges[sr2];
|
|
758
|
+
const featCopy = [];
|
|
759
|
+
for (let fi = 0; fi < run.openTypeFeatures.length; fi += 1) {
|
|
760
|
+
featCopy.push(run.openTypeFeatures[fi]);
|
|
761
|
+
}
|
|
762
|
+
let previousFeatures = null;
|
|
763
|
+
let featureLookupDone = false;
|
|
764
|
+
const featureKeyCount = openTypeFeatureKeys.length;
|
|
765
|
+
if (featureKeyCount > 0) {
|
|
766
|
+
const lastFeatureKey = openTypeFeatureKeys[featureKeyCount - 1];
|
|
767
|
+
if (lastFeatureKey.start === range.start && lastFeatureKey.end === range.end) {
|
|
768
|
+
previousFeatures = openTypeFeatureValues[featureKeyCount - 1];
|
|
769
|
+
featureLookupDone = true;
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
if (range.start > lastFeatureKey.start) {
|
|
773
|
+
featureLookupDone = true;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (!featureLookupDone) {
|
|
778
|
+
for (let pi = 0, count59 = openTypeFeatureKeys.length; pi < count59; pi += 1) {
|
|
779
|
+
if (openTypeFeatureKeys[pi].start === range.start && openTypeFeatureKeys[pi].end === range.end) {
|
|
780
|
+
previousFeatures = openTypeFeatureValues[pi];
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (previousFeatures !== null) {
|
|
786
|
+
let sameFeatures = previousFeatures.length === featCopy.length;
|
|
787
|
+
if (sameFeatures) {
|
|
788
|
+
for (let fi2 = 0, count60 = previousFeatures.length; fi2 < count60; fi2 += 1) {
|
|
789
|
+
if (previousFeatures[fi2] !== featCopy[fi2]) {
|
|
790
|
+
sameFeatures = false;
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
if (!sameFeatures) {
|
|
796
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: `Conflicting OpenType features for shaped cluster ${range.toString()}` });
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
openTypeFeatureKeys.push(range);
|
|
800
|
+
openTypeFeatureValues.push(featCopy);
|
|
801
|
+
openTypeFeaturesByClusterRangeBuilder.put(range, featCopy);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
for (let i7 = 0, count40 = glyphsByClusterRangeKeys.length; i7 < count40; i7 += 1) {
|
|
806
|
+
shapedGlyphsByClusterRangeBuilder.put(glyphsByClusterRangeKeys[i7], glyphsByClusterRangeValues[i7]);
|
|
807
|
+
}
|
|
808
|
+
const shapedGlyphsByClusterRange = shapedGlyphsByClusterRangeBuilder.build();
|
|
809
|
+
const openTypeFeaturesByClusterRange = openTypeFeaturesByClusterRangeBuilder.build();
|
|
810
|
+
ClusterRoleResolution.requireCoveredBy(rawNaturalClusters, annotation.fontDecisions);
|
|
811
|
+
const inlineObjectRanges = [];
|
|
812
|
+
for (let i8 = 0; i8 < input.inlineObjects.length; i8 += 1) {
|
|
813
|
+
inlineObjectRanges.push(input.inlineObjects[i8].range);
|
|
814
|
+
}
|
|
815
|
+
const narrowInlineBoxRanges = new Array();
|
|
816
|
+
for (let i9 = 0, count61 = input.inlineBoxes.length; i9 < count61; i9 += 1) {
|
|
817
|
+
const box = input.inlineBoxes[i9];
|
|
818
|
+
if (box.outerSpacing.kind === "Narrow") {
|
|
819
|
+
narrowInlineBoxRanges.push(box.range);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
const narrowInlineBoxLeadingClustersBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
823
|
+
const narrowInlineBoxTrailingClustersBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
824
|
+
for (let idx = 0, count41 = rawNaturalClusters.length; idx < count41; idx += 1) {
|
|
825
|
+
const cl = rawNaturalClusters[idx];
|
|
826
|
+
for (let j = 0, count62 = narrowInlineBoxRanges.length; j < count62; j += 1) {
|
|
827
|
+
if (narrowInlineBoxRanges[j].start === cl.range.start) {
|
|
828
|
+
narrowInlineBoxLeadingClustersBuilder.put(idx);
|
|
829
|
+
}
|
|
830
|
+
if (narrowInlineBoxRanges[j].end === cl.range.end) {
|
|
831
|
+
narrowInlineBoxTrailingClustersBuilder.put(idx);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
const narrowInlineBoxLeadingClusters = narrowInlineBoxLeadingClustersBuilder.build();
|
|
836
|
+
const narrowInlineBoxTrailingClusters = narrowInlineBoxTrailingClustersBuilder.build();
|
|
837
|
+
const resolvedSpacingEdges = new Array();
|
|
838
|
+
for (let index = 0, count63 = rawNaturalClusters.length; index < count63; index += 1) {
|
|
839
|
+
const cluster = rawNaturalClusters[index];
|
|
840
|
+
let isContained = false;
|
|
841
|
+
for (let j2 = 0, count64 = inlineObjectRanges.length; j2 < count64; j2 += 1) {
|
|
842
|
+
if (WidthIndependentAnnotationCacheFns.isContainedIn(cluster.range, inlineObjectRanges[j2])) {
|
|
843
|
+
isContained = true;
|
|
844
|
+
break;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
if (isContained || PunctuationGeometryStage.isAttachedAsciiPointMarkAt(rawNaturalClusters, index) && !narrowInlineBoxLeadingClusters.has(index)) {
|
|
848
|
+
resolvedSpacingEdges.push(new EastAsianSpacingEdges(EastAsianSpacingValue.Other, EastAsianSpacingValue.Other, false));
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
const resolved = UnicodeEastAsianSpacing.resolvedEdges(cluster.text, input.textStyle.locale);
|
|
852
|
+
const leadingVal = (narrowInlineBoxLeadingClusters.has(index) ? EastAsianSpacingValue.Narrow : resolved.leading);
|
|
853
|
+
const trailingVal = (narrowInlineBoxTrailingClusters.has(index) ? EastAsianSpacingValue.Narrow : resolved.trailing);
|
|
854
|
+
resolvedSpacingEdges.push(new EastAsianSpacingEdges(leadingVal, trailingVal, resolved.containsWide));
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
const verbatimRanges = input.content.autoSpaceSuppressedRanges;
|
|
858
|
+
const verbatimSuppressedBoundary = (offset) => {
|
|
859
|
+
for (let i10 = 0, count65 = verbatimRanges.length; i10 < count65; i10 += 1) {
|
|
860
|
+
const vr = verbatimRanges[i10];
|
|
861
|
+
if (vr.start < offset && offset < vr.end) {
|
|
862
|
+
return true;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return false;
|
|
866
|
+
};
|
|
867
|
+
let eastAsianSpacingEdges = resolvedSpacingEdges;
|
|
868
|
+
if (verbatimRanges.length > 0) {
|
|
869
|
+
const list = new Array();
|
|
870
|
+
for (let index2 = 0, count66 = resolvedSpacingEdges.length; index2 < count66; index2 += 1) {
|
|
871
|
+
const edges = resolvedSpacingEdges[index2];
|
|
872
|
+
const cluster2 = rawNaturalClusters[index2];
|
|
873
|
+
const leadingSuppressed = !narrowInlineBoxLeadingClusters.has(index2) && verbatimSuppressedBoundary(cluster2.range.start);
|
|
874
|
+
const trailingSuppressed = !narrowInlineBoxTrailingClusters.has(index2) && verbatimSuppressedBoundary(cluster2.range.end);
|
|
875
|
+
if (!leadingSuppressed && !trailingSuppressed) {
|
|
876
|
+
list.push(edges);
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
list.push(new EastAsianSpacingEdges((leadingSuppressed ? EastAsianSpacingValue.Other : edges.leading), (trailingSuppressed ? EastAsianSpacingValue.Other : edges.trailing), edges.containsWide));
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
eastAsianSpacingEdges = list;
|
|
883
|
+
}
|
|
884
|
+
const verbatimSuppressionDecisions = new Array();
|
|
885
|
+
if (verbatimRanges.length > 0) {
|
|
886
|
+
for (let index3 = 1, count67 = rawNaturalClusters.length; index3 < count67; index3 += 1) {
|
|
887
|
+
const offset = rawNaturalClusters[index3].range.start;
|
|
888
|
+
if (!verbatimSuppressedBoundary(offset)) {
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
const left = resolvedSpacingEdges[index3 - 1].trailing;
|
|
892
|
+
const right = resolvedSpacingEdges[index3].leading;
|
|
893
|
+
const wideNarrowPair = left.kind === "Wide" && right.kind === "Narrow" || left.kind === "Narrow" && right.kind === "Wide";
|
|
894
|
+
if (!wideNarrowPair) {
|
|
895
|
+
continue;
|
|
896
|
+
}
|
|
897
|
+
verbatimSuppressionDecisions.push(new AutoSpaceDecisionInfo(rawNaturalClusters[index3].range, "leading", "EastAsianSpacing.Wide", AutoSpaceMode.Disabled.kind, 0, 0.0, 0.0, "VerbatimRangeAutoSpace:east-asian-spacing-W-N-suppressed"));
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
const naturalInlineAttachments = [];
|
|
901
|
+
for (let i11 = 0; i11 < rawNaturalClusters.length; i11 += 1) {
|
|
902
|
+
naturalInlineAttachments.push(annotation.styleAt(rawNaturalClusters[i11].range.start).inlineAttachment);
|
|
903
|
+
}
|
|
904
|
+
const autoSpaceResult = PunctuationGeometryStage.applyAutoSpacePolicy(rawNaturalClusters, eastAsianSpacingEdges, naturalInlineAttachments, annotation.clreqProfile.autoSpace, fontSize, narrowInlineBoxLeadingClusters, narrowInlineBoxTrailingClusters);
|
|
905
|
+
const inlineBoxesCopy = [];
|
|
906
|
+
for (let i12 = 0; i12 < input.inlineBoxes.length; i12 += 1) {
|
|
907
|
+
inlineBoxesCopy.push(input.inlineBoxes[i12]);
|
|
908
|
+
}
|
|
909
|
+
const inlineBoxResult = PunctuationGeometryStage.applyInlineBoxSpans(autoSpaceResult.clusters, inlineBoxesCopy);
|
|
910
|
+
const naturalClusters = inlineBoxResult.clusters;
|
|
911
|
+
const inlineObjectByClusterIndexBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
912
|
+
const boundaryIndices = new Array();
|
|
913
|
+
const boundaryAdjustments = new Array();
|
|
914
|
+
const getRegisteredBoundary = (leftClusterIndex) => {
|
|
915
|
+
for (let i13 = 0, count68 = boundaryIndices.length; i13 < count68; i13 += 1) {
|
|
916
|
+
if (boundaryIndices[i13] === leftClusterIndex) {
|
|
917
|
+
return boundaryAdjustments[i13];
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return null;
|
|
921
|
+
};
|
|
922
|
+
const setRegisteredBoundary = (leftClusterIndex, boundary) => {
|
|
923
|
+
for (let i14 = 0, count69 = boundaryIndices.length; i14 < count69; i14 += 1) {
|
|
924
|
+
if (boundaryIndices[i14] === leftClusterIndex) {
|
|
925
|
+
boundaryAdjustments[i14] = boundary;
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
boundaryIndices.push(leftClusterIndex);
|
|
930
|
+
boundaryAdjustments.push(boundary);
|
|
931
|
+
};
|
|
932
|
+
const registerInlineObjectBoundary = (leftClusterIndex, boundary) => {
|
|
933
|
+
const previous = getRegisteredBoundary(leftClusterIndex);
|
|
934
|
+
if (previous === null) {
|
|
935
|
+
setRegisteredBoundary(leftClusterIndex, boundary);
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
const prevKind = (previous.preferredStretch !== null ? previous.preferredStretch.kind : null);
|
|
939
|
+
const boundKind = (boundary.preferredStretch !== null ? boundary.preferredStretch.kind : null);
|
|
940
|
+
if (prevKind !== null && boundKind !== null && prevKind !== boundKind) {
|
|
941
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: `Conflicting inline-object stretch classes at cluster boundary ${leftClusterIndex}` });
|
|
942
|
+
}
|
|
943
|
+
let preferred = null;
|
|
944
|
+
if (previous.preferredStretch !== null && boundary.preferredStretch !== null) {
|
|
945
|
+
preferred = (previous.preferredStretch.capacity >= boundary.preferredStretch.capacity ? previous.preferredStretch : boundary.preferredStretch);
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
if (previous.preferredStretch !== null) {
|
|
949
|
+
preferred = previous.preferredStretch;
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
preferred = boundary.preferredStretch;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
setRegisteredBoundary(leftClusterIndex, new InlineObjectBoundaryAdjustment(previous.participatesInUniformStretch || boundary.participatesInUniformStretch, preferred, Math.max(previous.shrinkCapacity, boundary.shrinkCapacity), Math.max(previous.lineEndDiscardableAdvance, boundary.lineEndDiscardableAdvance), previous.preventsLineBreak || boundary.preventsLineBreak));
|
|
956
|
+
};
|
|
957
|
+
for (let clusterIndex = 0, count42 = naturalClusters.length; clusterIndex < count42; clusterIndex += 1) {
|
|
958
|
+
const cluster3 = naturalClusters[clusterIndex];
|
|
959
|
+
const inlineObject = annotation.inlineObjectByRange.get(cluster3.range);
|
|
960
|
+
if (inlineObject !== null) {
|
|
961
|
+
inlineObjectByClusterIndexBuilder.put(clusterIndex, (inlineObject));
|
|
962
|
+
if (clusterIndex > 0 && !WidthIndependentAnnotationCacheFns.isFixedBoundary(inlineObject.leadingBoundary)) {
|
|
963
|
+
registerInlineObjectBoundary(clusterIndex - 1, inlineObject.leadingBoundary);
|
|
964
|
+
}
|
|
965
|
+
if (clusterIndex < count42 - 1 && !WidthIndependentAnnotationCacheFns.isFixedBoundary(inlineObject.trailingBoundary)) {
|
|
966
|
+
registerInlineObjectBoundary(clusterIndex, inlineObject.trailingBoundary);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
const inlineObjectByClusterIndex = inlineObjectByClusterIndexBuilder.build();
|
|
971
|
+
const uniformInlineObjectBoundaryBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
972
|
+
const preferredInlineObjectBoundaryBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
973
|
+
const inlineObjectBoundaryUnbreakableRanges = new Array();
|
|
974
|
+
for (let i15 = 0, count43 = boundaryIndices.length; i15 < count43; i15 += 1) {
|
|
975
|
+
const bIdx = boundaryIndices[i15];
|
|
976
|
+
const bAdj = boundaryAdjustments[i15];
|
|
977
|
+
if (bAdj.participatesInUniformStretch) {
|
|
978
|
+
uniformInlineObjectBoundaryBuilder.put(bIdx);
|
|
979
|
+
}
|
|
980
|
+
if (bAdj.preferredStretch !== null) {
|
|
981
|
+
preferredInlineObjectBoundaryBuilder.put(bIdx, (bAdj.preferredStretch));
|
|
982
|
+
}
|
|
983
|
+
if (bAdj.preventsLineBreak) {
|
|
984
|
+
inlineObjectBoundaryUnbreakableRanges.push(new IntRange(bIdx, bIdx + 1));
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
const uniformInlineObjectBoundaryAfterClusters = uniformInlineObjectBoundaryBuilder.build();
|
|
988
|
+
const preferredInlineObjectBoundaryAfterClusters = preferredInlineObjectBoundaryBuilder.build();
|
|
989
|
+
const autoSpaceDecisions = [];
|
|
990
|
+
for (let i16 = 0; i16 < autoSpaceResult.decisions.length; i16 += 1) {
|
|
991
|
+
autoSpaceDecisions.push(autoSpaceResult.decisions[i16]);
|
|
992
|
+
}
|
|
993
|
+
for (let i17 = 0, count44 = verbatimSuppressionDecisions.length; i17 < count44; i17 += 1) {
|
|
994
|
+
autoSpaceDecisions.push(verbatimSuppressionDecisions[i17]);
|
|
995
|
+
}
|
|
996
|
+
const clusterRolesDecisions = WidthIndependentAnnotationCacheFns.containingFontDecisions(naturalClusters, annotation.fontDecisions);
|
|
997
|
+
const count45 = clusterRolesDecisions.length;
|
|
998
|
+
const clusterRoles = [];
|
|
999
|
+
for (let i18 = 0; i18 < count45; i18 += 1) {
|
|
1000
|
+
const d2 = clusterRolesDecisions[i18];
|
|
1001
|
+
clusterRoles.push((d2 !== null ? d2.role : FontRole.Unknown));
|
|
1002
|
+
}
|
|
1003
|
+
const inlineObjectAttachedMarks = PunctuationGeometryStage.inlineObjectAttachedMarks(naturalClusters, clusterRoles, resolvedKinsoku.level, kinsokuRule);
|
|
1004
|
+
const inlineObjectSeparatorSpaceTrimsBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
1005
|
+
const inlineObjectAttachmentNoStretchBoundariesBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
1006
|
+
const inlineObjectPunctuationAttachmentDecisions = new Array();
|
|
1007
|
+
for (let a = 0, count46 = inlineObjectAttachedMarks.length; a < count46; a += 1) {
|
|
1008
|
+
const attachment = inlineObjectAttachedMarks[a];
|
|
1009
|
+
for (let s = 0, count70 = attachment.separatorClusterIndices.length; s < count70; s += 1) {
|
|
1010
|
+
const clusterIndex2 = attachment.separatorClusterIndices[s];
|
|
1011
|
+
inlineObjectSeparatorSpaceTrimsBuilder.put(clusterIndex2, naturalClusters[clusterIndex2].advance);
|
|
1012
|
+
}
|
|
1013
|
+
for (let idx2 = attachment.objectClusterIndex, count71 = attachment.markClusterIndex; idx2 < count71; idx2 += 1) {
|
|
1014
|
+
inlineObjectAttachmentNoStretchBoundariesBuilder.put(idx2);
|
|
1015
|
+
}
|
|
1016
|
+
if (attachment.separatorClusterIndices.length > 0) {
|
|
1017
|
+
const separatorFirst = naturalClusters[attachment.separatorClusterIndices[0]];
|
|
1018
|
+
const separatorLast = naturalClusters[attachment.separatorClusterIndices[attachment.separatorClusterIndices.length - 1]];
|
|
1019
|
+
const mark = naturalClusters[attachment.markClusterIndex];
|
|
1020
|
+
const collapsedTerms = [];
|
|
1021
|
+
for (let s2 = 0, count72 = attachment.separatorClusterIndices.length; s2 < count72; s2 += 1) {
|
|
1022
|
+
collapsedTerms.push(naturalClusters[attachment.separatorClusterIndices[s2]].advance);
|
|
1023
|
+
}
|
|
1024
|
+
const collapsedAdv = AccurateSum.of(collapsedTerms);
|
|
1025
|
+
inlineObjectPunctuationAttachmentDecisions.push(new InlineObjectPunctuationAttachmentDecisionInfo(naturalClusters[attachment.objectClusterIndex].range, new TextRange(separatorFirst.range.start, separatorLast.range.end), mark.range, mark.text, new TextRange(naturalClusters[attachment.objectClusterIndex].range.start, mark.range.end), collapsedAdv));
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
const inlineObjectSeparatorSpaceTrims = inlineObjectSeparatorSpaceTrimsBuilder.build();
|
|
1029
|
+
const inlineObjectAttachmentNoStretchBoundaries = inlineObjectAttachmentNoStretchBoundariesBuilder.build();
|
|
1030
|
+
const mandatoryBreakClustersBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
1031
|
+
const zeroWidthBreakClustersBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
1032
|
+
const mandatoryBreakDecisions = new Array();
|
|
1033
|
+
const zeroWidthBreakDecisions = new Array();
|
|
1034
|
+
for (let idx3 = 0, count73 = naturalClusters.length; idx3 < count73; idx3 += 1) {
|
|
1035
|
+
const cluster4 = naturalClusters[idx3];
|
|
1036
|
+
if (ParagraphShapingStage.isMandatoryBreakCluster(cluster4)) {
|
|
1037
|
+
mandatoryBreakClustersBuilder.put(idx3);
|
|
1038
|
+
mandatoryBreakDecisions.push(new MandatoryBreakDecisionInfo(cluster4.range, cluster4.text, idx3, "MandatoryBreakNoShape"));
|
|
1039
|
+
}
|
|
1040
|
+
if (ParagraphShapingStage.isZeroWidthSoftBreakCluster(cluster4)) {
|
|
1041
|
+
zeroWidthBreakClustersBuilder.put(idx3);
|
|
1042
|
+
zeroWidthBreakDecisions.push(new ZeroWidthBreakDecisionInfo(cluster4.range, cluster4.text, idx3));
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
const mandatoryBreakClusters = mandatoryBreakClustersBuilder.build();
|
|
1046
|
+
const zeroWidthBreakClusters = zeroWidthBreakClustersBuilder.build();
|
|
1047
|
+
const punctuationAtoms = new Array();
|
|
1048
|
+
for (let idx4 = 0, count74 = naturalClusters.length; idx4 < count74; idx4 += 1) {
|
|
1049
|
+
if (clusterRoles[idx4].kind === "LatinText") {
|
|
1050
|
+
continue;
|
|
1051
|
+
}
|
|
1052
|
+
const cluster5 = naturalClusters[idx4];
|
|
1053
|
+
const shapedGlyphs = (shapedGlyphsByClusterRange.has(cluster5.range) ? shapedGlyphsByClusterRange.get(cluster5.range) : []);
|
|
1054
|
+
const atoms = PunctuationGeometryStage.punctuationAtoms(cluster5, fontSize, engine.punctuationAtomBuilder, (shapedGlyphs), annotation.clreqProfile.gluePlacement, annotation.clreqProfile.punctuationWidth);
|
|
1055
|
+
for (let a2 = 0, count75 = atoms.length; a2 < count75; a2 += 1) {
|
|
1056
|
+
punctuationAtoms.push(atoms[a2]);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
const adjacentPunctuationSpacingPlan = engine.punctuationSpacingCompressor.compress(punctuationAtoms, fontSize);
|
|
1060
|
+
const cjkClosingBeforeAsciiPointMarkPlan = engine.punctuationSpacingCompressor.compressCjkClosingBeforeAsciiPointMark(punctuationAtoms, text, fontSize);
|
|
1061
|
+
const allAdjustments = [];
|
|
1062
|
+
for (let i19 = 0; i19 < adjacentPunctuationSpacingPlan.adjustments.length; i19 += 1) {
|
|
1063
|
+
allAdjustments.push(adjacentPunctuationSpacingPlan.adjustments[i19]);
|
|
1064
|
+
}
|
|
1065
|
+
for (let i20 = 0, count76 = cjkClosingBeforeAsciiPointMarkPlan.adjustments.length; i20 < count76; i20 += 1) {
|
|
1066
|
+
allAdjustments.push(cjkClosingBeforeAsciiPointMarkPlan.adjustments[i20]);
|
|
1067
|
+
}
|
|
1068
|
+
const spacingPlan = new PunctuationSpacingCompressionResult(allAdjustments);
|
|
1069
|
+
const rubySpread = WidthIndependentAnnotationCacheFns.computeRubySpread(naturalClusters, annotation.rubyFontSize, annotation.pinyinSpans, annotation.rubyFontGeometryBySpan);
|
|
1070
|
+
const bopomofoSpans = new Array();
|
|
1071
|
+
for (let i21 = 0, count77 = input.rubySpans.length; i21 < count77; i21 += 1) {
|
|
1072
|
+
const rs = input.rubySpans[i21];
|
|
1073
|
+
if (rs.kind.kind === "Bopomofo") {
|
|
1074
|
+
bopomofoSpans.push(rs);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
let rubyAndBopomofoSpread = rubySpread;
|
|
1078
|
+
if (bopomofoSpans.length > 0) {
|
|
1079
|
+
const mergedBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
1080
|
+
const mergedKeys = new Array();
|
|
1081
|
+
const mergedVals = new Array();
|
|
1082
|
+
for (let i22 = 0, count80 = rubySpread.size(); i22 < count80; i22 += 1) {
|
|
1083
|
+
mergedKeys.push(rubySpread.keyAt(i22));
|
|
1084
|
+
mergedVals.push(rubySpread.valueAt(i22));
|
|
1085
|
+
}
|
|
1086
|
+
for (let i23 = 0, count78 = bopomofoSpans.length; i23 < count78; i23 += 1) {
|
|
1087
|
+
const z = bopomofoSpans[i23];
|
|
1088
|
+
const r2 = PunctuationGeometryLedger.clusterIndexRangeFor(naturalClusters, z.baseRange);
|
|
1089
|
+
if (r2 === null) {
|
|
1090
|
+
continue;
|
|
1091
|
+
}
|
|
1092
|
+
const lastIdx = r2.end;
|
|
1093
|
+
let found = false;
|
|
1094
|
+
for (let j3 = 0, count81 = mergedKeys.length; j3 < count81; j3 += 1) {
|
|
1095
|
+
if (mergedKeys[j3] === lastIdx) {
|
|
1096
|
+
mergedVals[j3] = mergedVals[j3] + 0.5 * fontSize;
|
|
1097
|
+
found = true;
|
|
1098
|
+
break;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
if (!found) {
|
|
1102
|
+
mergedKeys.push(lastIdx);
|
|
1103
|
+
mergedVals.push(0.5 * fontSize);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
for (let i24 = 0, count79 = mergedKeys.length; i24 < count79; i24 += 1) {
|
|
1107
|
+
mergedBuilder.put(mergedKeys[i24], mergedVals[i24]);
|
|
1108
|
+
}
|
|
1109
|
+
rubyAndBopomofoSpread = mergedBuilder.build();
|
|
1110
|
+
}
|
|
1111
|
+
const adjustmentStyle = annotation.clreqProfile.adjustment;
|
|
1112
|
+
const punctuationBaseGeometry = PunctuationGeometryLedger.from(naturalClusters, punctuationAtoms, spacingPlan).withInlineBoxAdvances(inlineBoxResult.advanceByCluster).withRubySpread(rubyAndBopomofoSpread).withRawEdgeTrims(inlineObjectSeparatorSpaceTrims);
|
|
1113
|
+
const finalNaturalInlineAttachments = [];
|
|
1114
|
+
for (let i25 = 0; i25 < naturalClusters.length; i25 += 1) {
|
|
1115
|
+
finalNaturalInlineAttachments.push(annotation.styleAt(naturalClusters[i25].range.start).inlineAttachment);
|
|
1116
|
+
}
|
|
1117
|
+
const attachedPunctuationBoundary = punctuationBaseGeometry.resolveAttachedInlinePunctuationBoundaries(finalNaturalInlineAttachments, punctuationAtoms, fontSize);
|
|
1118
|
+
const baseGeometry = attachedPunctuationBoundary.geometry;
|
|
1119
|
+
const attachedPunctuationTrailingGlueByCluster = attachedPunctuationBoundary.trailingGlueByCluster;
|
|
1120
|
+
const clusters = baseGeometry.resolveClusters();
|
|
1121
|
+
const glueCaps = baseGeometry.glueCapacities();
|
|
1122
|
+
const gapClusterRanges = new Array();
|
|
1123
|
+
for (let i26 = 0, count47 = autoSpaceDecisions.length; i26 < count47; i26 += 1) {
|
|
1124
|
+
const d3 = autoSpaceDecisions[i26];
|
|
1125
|
+
if (d3.side === "gap") {
|
|
1126
|
+
gapClusterRanges.push(d3.clusterRange);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
const containedAtoms = WidthIndependentAnnotationCacheFns.firstContainedAtom(naturalClusters, punctuationAtoms);
|
|
1130
|
+
const atomClassByRangeBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
1131
|
+
for (let i27 = 0, count82 = naturalClusters.length; i27 < count82; i27 += 1) {
|
|
1132
|
+
const atom = containedAtoms[i27];
|
|
1133
|
+
if (atom !== null) {
|
|
1134
|
+
atomClassByRangeBuilder.put(naturalClusters[i27].range, atom.punctuationClass);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
const atomClassByRange = atomClassByRangeBuilder.build();
|
|
1138
|
+
const shrinkOpportunities = new Array();
|
|
1139
|
+
for (let idx5 = 0, count83 = naturalClusters.length; idx5 < count83; idx5 += 1) {
|
|
1140
|
+
const cluster6 = naturalClusters[idx5];
|
|
1141
|
+
if (glueCaps.has(idx5)) {
|
|
1142
|
+
const caps = glueCaps.get(idx5);
|
|
1143
|
+
const cls = (atomClassByRange.has(cluster6.range) ? atomClassByRange.get(cluster6.range) : null);
|
|
1144
|
+
if ((cls !== null && cls.kind === "Interpunct") || (cls !== null && cls.kind === "MiddleDot")) {
|
|
1145
|
+
WidthIndependentAnnotationCacheFns.addGeometryAwareOpportunity(shrinkOpportunities, (caps), idx5, 3, false);
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
if ((cls !== null && cls.kind === "Opening") || (cls !== null && cls.kind === "Closing")) {
|
|
1149
|
+
WidthIndependentAnnotationCacheFns.addGeometryAwareOpportunity(shrinkOpportunities, (caps), idx5, 4, false);
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
if ((cls !== null && cls.kind === "PauseOrStop")) {
|
|
1153
|
+
const firstChar = (cluster6.displayText.length > 0 ? (Number.isNaN(cluster6.displayText.charCodeAt(0)) ? null : cluster6.displayText.charCodeAt(0)) : 0);
|
|
1154
|
+
const isStop = WidthIndependentAnnotationCacheFns.isInlineStop((firstChar));
|
|
1155
|
+
const tier = (isStop ? 7 : 5);
|
|
1156
|
+
const lineEndOnly = isStop && !adjustmentStyle.allowInlineStopCompression;
|
|
1157
|
+
WidthIndependentAnnotationCacheFns.addGeometryAwareOpportunity(shrinkOpportunities, (caps), idx5, tier, lineEndOnly);
|
|
1158
|
+
}
|
|
1159
|
+
else {
|
|
1160
|
+
WidthIndependentAnnotationCacheFns.addGeometryAwareOpportunity(shrinkOpportunities, (caps), idx5, 5, false);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
if (PunctuationGeometryStage.isSpaceRun(cluster6) && !inlineObjectSeparatorSpaceTrims.has(idx5)) {
|
|
1167
|
+
let inGap = false;
|
|
1168
|
+
for (let g2 = 0, count84 = gapClusterRanges.length; g2 < count84; g2 += 1) {
|
|
1169
|
+
const gr = gapClusterRanges[g2];
|
|
1170
|
+
if (gr.start === cluster6.range.start && gr.end === cluster6.range.end) {
|
|
1171
|
+
inGap = true;
|
|
1172
|
+
break;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
if (inGap) {
|
|
1176
|
+
const cap = cluster6.advance - 0.125 * fontSize;
|
|
1177
|
+
if (adjustmentStyle.allowSinoWesternGapAdjustment && cap > 0.0) {
|
|
1178
|
+
shrinkOpportunities.push(new ShrinkOpportunity(idx5, 6, cap, ShrinkChannel.RawAdvance));
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
else {
|
|
1182
|
+
const cap2 = cluster6.advance - 0.25 * fontSize;
|
|
1183
|
+
if (cap2 > 0.0) {
|
|
1184
|
+
shrinkOpportunities.push(new ShrinkOpportunity(idx5, 2, cap2, ShrinkChannel.RawAdvance));
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
for (let i28 = 0, count85 = inlineObjectByClusterIndex.size(); i28 < count85; i28 += 1) {
|
|
1191
|
+
const idx6 = inlineObjectByClusterIndex.keyAt(i28);
|
|
1192
|
+
const inlineObject2 = inlineObjectByClusterIndex.valueAt(i28);
|
|
1193
|
+
const trailing = inlineObject2.trailingBoundary.shrinkCapacity;
|
|
1194
|
+
if (trailing > 0.0) {
|
|
1195
|
+
shrinkOpportunities.push(new ShrinkOpportunity(idx6, 8, trailing, ShrinkChannel.RawAdvance));
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
const shapingDecisionsList = new Array();
|
|
1199
|
+
for (let srIdx = 0, count86 = shapingStage.shapingResults.length; srIdx < count86; srIdx += 1) {
|
|
1200
|
+
const sr3 = shapingStage.shapingResults[srIdx];
|
|
1201
|
+
for (let dIdx = 0, count87 = sr3.decisions.length; dIdx < count87; dIdx += 1) {
|
|
1202
|
+
shapingDecisionsList.push(sr3.decisions[dIdx]);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return new ParagraphLayoutPrep(input, rejectedTechnicalTiersBySpan, text, fontSize, annotation.styleAt, annotation.fontSizeAt, annotation.bopomofoFontWeightAt, annotation.rubyFontSize, annotation.rubyStackGap, annotation.rubyFontWeight, annotation.pinyinSpans, annotation.clreqProfile, annotation.punctuationGlyphSubstitutor, measure, measureEm, gridBodyOffset, lineLengthGridDecision, annotation.quotePairs, annotation.roleOverrideInfos, annotation.fontDecisions, shapingStage.hyphenOffsets, shapingStage.hyphenAdvance, shapingStage.hyphenGlyphs, shapingStage.substitutionRollbacks, shapingStage.breakOpportunityDecisions, shapingStage.emergencyTrackingEligibilityDecisions, shapingStage.progressiveBreakOffsets, shapedGlyphsByClusterRange, openTypeFeaturesByClusterRange, shapingDecisionsList, eastAsianSpacingEdges, autoSpaceDecisions, inlineBoxResult, naturalClusters, inlineObjectByClusterIndex, uniformInlineObjectBoundaryAfterClusters, preferredInlineObjectBoundaryAfterClusters, inlineObjectBoundaryUnbreakableRanges, clusterRoles, resolvedKinsoku, kinsokuRule, inlineObjectAttachedMarks, inlineObjectSeparatorSpaceTrims, inlineObjectAttachmentNoStretchBoundaries, inlineObjectPunctuationAttachmentDecisions, mandatoryBreakClusters, zeroWidthBreakClusters, mandatoryBreakDecisions, zeroWidthBreakDecisions, punctuationAtoms, spacingPlan, annotation.rubyFontGeometryBySpan, rubyAndBopomofoSpread, finalNaturalInlineAttachments, attachedPunctuationBoundary, baseGeometry, attachedPunctuationTrailingGlueByCluster, clusters, adjustmentStyle, atomClassByRange, shrinkOpportunities);
|
|
1206
|
+
}
|
|
1207
|
+
}
|