@tiqian/engine 0.0.1 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
- package/dist/org/tiqian/clreq/BopomofoParser.d.ts +10 -0
- package/dist/org/tiqian/clreq/BopomofoParser.js +46 -0
- package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
- package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
- package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
- package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphSubstitution.d.ts +8 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphSubstitution.js +25 -0
- package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
- package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
- package/dist/org/tiqian/clreq/ClreqProfileResolver.d.ts +10 -0
- package/dist/org/tiqian/clreq/ClreqProfileResolver.js +13 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationAdvancePolicy.d.ts +7 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationAdvancePolicy.js +40 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationGlyphSubstitutor.d.ts +19 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationGlyphSubstitutor.js +93 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationPolicies.d.ts +26 -0
- package/dist/org/tiqian/clreq/ClreqPunctuationPolicies.js +137 -0
- package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
- package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
- package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
- package/dist/org/tiqian/clreq/GlueSide.js +17 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
- package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
- package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
- package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
- package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/NumberSymbolCohesion.d.ts +8 -0
- package/dist/org/tiqian/clreq/NumberSymbolCohesion.js +56 -0
- package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
- package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
- package/dist/org/tiqian/clreq/PunctuationPolicy.d.ts +10 -0
- package/dist/org/tiqian/clreq/PunctuationPolicy.js +18 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
- package/dist/org/tiqian/core/AccurateSum.d.ts +3 -0
- package/dist/org/tiqian/core/AccurateSum.js +9 -0
- package/dist/org/tiqian/core/AutoSpaceDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/AutoSpaceDecisionInfo.js +24 -0
- package/dist/org/tiqian/core/BopomofoDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/BopomofoDecisionInfo.js +32 -0
- package/dist/org/tiqian/core/BopomofoGlyphPlacement.d.ts +16 -0
- package/dist/org/tiqian/core/BopomofoGlyphPlacement.js +33 -0
- package/dist/org/tiqian/core/BopomofoGlyphRole.d.ts +16 -0
- package/dist/org/tiqian/core/BopomofoGlyphRole.js +17 -0
- package/dist/org/tiqian/core/BreakOpportunityDecisionInfo.d.ts +11 -0
- package/dist/org/tiqian/core/BreakOpportunityDecisionInfo.js +52 -0
- package/dist/org/tiqian/core/BuiltInLayoutProfiles.d.ts +4 -0
- package/dist/org/tiqian/core/BuiltInLayoutProfiles.js +5 -0
- package/dist/org/tiqian/core/Cluster.d.ts +13 -0
- package/dist/org/tiqian/core/Cluster.js +24 -0
- package/dist/org/tiqian/core/ClusterGeometryDecisionInfo.d.ts +21 -0
- package/dist/org/tiqian/core/ClusterGeometryDecisionInfo.js +40 -0
- package/dist/org/tiqian/core/ColorSpan.d.ts +8 -0
- package/dist/org/tiqian/core/ColorSpan.js +25 -0
- package/dist/org/tiqian/core/ContextualKinsokuDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/ContextualKinsokuDecisionInfo.js +47 -0
- package/dist/org/tiqian/core/DecorationDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/DecorationDecisionInfo.js +24 -0
- package/dist/org/tiqian/core/DecorationKind.d.ts +20 -0
- package/dist/org/tiqian/core/DecorationKind.js +20 -0
- package/dist/org/tiqian/core/DecorationSegmentInfo.d.ts +15 -0
- package/dist/org/tiqian/core/DecorationSegmentInfo.js +28 -0
- package/dist/org/tiqian/core/DecorationSpan.d.ts +10 -0
- package/dist/org/tiqian/core/DecorationSpan.js +36 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
- package/dist/org/tiqian/core/EmergencyTrackingEligibilityDecisionInfo.d.ts +9 -0
- package/dist/org/tiqian/core/EmergencyTrackingEligibilityDecisionInfo.js +29 -0
- package/dist/org/tiqian/core/FirstLineIndentDecisionInfo.d.ts +8 -0
- package/dist/org/tiqian/core/FirstLineIndentDecisionInfo.js +16 -0
- package/dist/org/tiqian/core/FittedLinePatternGeometry.d.ts +2 -0
- package/dist/org/tiqian/core/FittedLinePatternGeometry.js +84 -0
- package/dist/org/tiqian/core/FontDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/FontDecisionInfo.js +45 -0
- package/dist/org/tiqian/core/Glyph.d.ts +15 -0
- package/dist/org/tiqian/core/Glyph.js +30 -0
- package/dist/org/tiqian/core/GlyphRun.d.ts +11 -0
- package/dist/org/tiqian/core/GlyphRun.js +28 -0
- package/dist/org/tiqian/core/Ic.d.ts +7 -0
- package/dist/org/tiqian/core/Ic.js +17 -0
- package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
- package/dist/org/tiqian/core/IllegalStateException.js +8 -0
- package/dist/org/tiqian/core/InlineAttachment.d.ts +12 -0
- package/dist/org/tiqian/core/InlineAttachment.js +14 -0
- package/dist/org/tiqian/core/InlineBoxDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/InlineBoxDecisionInfo.js +22 -0
- package/dist/org/tiqian/core/InlineBoxOuterSpacing.d.ts +12 -0
- package/dist/org/tiqian/core/InlineBoxOuterSpacing.js +14 -0
- package/dist/org/tiqian/core/InlineBoxSpan.d.ts +10 -0
- package/dist/org/tiqian/core/InlineBoxSpan.js +17 -0
- package/dist/org/tiqian/core/InlineObjectBoundaryAdjustment.d.ts +12 -0
- package/dist/org/tiqian/core/InlineObjectBoundaryAdjustment.js +31 -0
- package/dist/org/tiqian/core/InlineObjectDecisionInfo.d.ts +28 -0
- package/dist/org/tiqian/core/InlineObjectDecisionInfo.js +54 -0
- package/dist/org/tiqian/core/InlineObjectLineHeightDecisionInfo.d.ts +16 -0
- package/dist/org/tiqian/core/InlineObjectLineHeightDecisionInfo.js +57 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretch.d.ts +11 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretch.js +30 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretchKind.d.ts +16 -0
- package/dist/org/tiqian/core/InlineObjectPreferredStretchKind.js +17 -0
- package/dist/org/tiqian/core/InlineObjectPunctuationAttachmentDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/InlineObjectPunctuationAttachmentDecisionInfo.js +22 -0
- package/dist/org/tiqian/core/InlineObjectSpan.d.ts +13 -0
- package/dist/org/tiqian/core/InlineObjectSpan.js +22 -0
- package/dist/org/tiqian/core/IntRange.d.ts +12 -0
- package/dist/org/tiqian/core/IntRange.js +30 -0
- package/dist/org/tiqian/core/IntRangeFns.d.ts +2 -0
- package/dist/org/tiqian/core/IntRangeFns.js +4 -0
- package/dist/org/tiqian/core/JustificationAllocationInfo.d.ts +10 -0
- package/dist/org/tiqian/core/JustificationAllocationInfo.js +18 -0
- package/dist/org/tiqian/core/JustificationDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/JustificationDecisionInfo.js +21 -0
- package/dist/org/tiqian/core/KinsokuDecisionInfo.d.ts +8 -0
- package/dist/org/tiqian/core/KinsokuDecisionInfo.js +16 -0
- package/dist/org/tiqian/core/LastLineAlignment.d.ts +16 -0
- package/dist/org/tiqian/core/LastLineAlignment.js +17 -0
- package/dist/org/tiqian/core/LayoutConstraints.d.ts +7 -0
- package/dist/org/tiqian/core/LayoutConstraints.js +24 -0
- package/dist/org/tiqian/core/LayoutDebugInfo.d.ts +70 -0
- package/dist/org/tiqian/core/LayoutDebugInfo.js +205 -0
- package/dist/org/tiqian/core/LayoutInput.d.ts +22 -0
- package/dist/org/tiqian/core/LayoutInput.js +56 -0
- package/dist/org/tiqian/core/LayoutPaintBounds.d.ts +18 -0
- package/dist/org/tiqian/core/LayoutPaintBounds.js +131 -0
- package/dist/org/tiqian/core/LayoutProfileId.d.ts +6 -0
- package/dist/org/tiqian/core/LayoutProfileId.js +17 -0
- package/dist/org/tiqian/core/LayoutQueries.d.ts +121 -0
- package/dist/org/tiqian/core/LayoutQueries.js +1297 -0
- package/dist/org/tiqian/core/LayoutQueryFns.d.ts +27 -0
- package/dist/org/tiqian/core/LayoutQueryFns.js +65 -0
- package/dist/org/tiqian/core/LayoutResult.d.ts +16 -0
- package/dist/org/tiqian/core/LayoutResult.js +36 -0
- package/dist/org/tiqian/core/LayoutResultFns.d.ts +3 -0
- package/dist/org/tiqian/core/LayoutResultFns.js +5 -0
- package/dist/org/tiqian/core/LayoutResultLineFns.d.ts +4 -0
- package/dist/org/tiqian/core/LayoutResultLineFns.js +5 -0
- package/dist/org/tiqian/core/LayoutResultReplayIndex.d.ts +37 -0
- package/dist/org/tiqian/core/LayoutResultReplayIndex.js +379 -0
- package/dist/org/tiqian/core/LineBox.d.ts +23 -0
- package/dist/org/tiqian/core/LineBox.js +43 -0
- package/dist/org/tiqian/core/LineBreakPolicy.d.ts +8 -0
- package/dist/org/tiqian/core/LineBreakPolicy.js +11 -0
- package/dist/org/tiqian/core/LineBreakSpan.d.ts +10 -0
- package/dist/org/tiqian/core/LineBreakSpan.js +30 -0
- package/dist/org/tiqian/core/LineDebugInfo.d.ts +7 -0
- package/dist/org/tiqian/core/LineDebugInfo.js +18 -0
- package/dist/org/tiqian/core/LineDecisionInfo.d.ts +14 -0
- package/dist/org/tiqian/core/LineDecisionInfo.js +32 -0
- package/dist/org/tiqian/core/LineEdgeTrimDecisionInfo.d.ts +12 -0
- package/dist/org/tiqian/core/LineEdgeTrimDecisionInfo.js +22 -0
- package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
- package/dist/org/tiqian/core/LineEndReason.js +17 -0
- package/dist/org/tiqian/core/LineLengthGrid.d.ts +7 -0
- package/dist/org/tiqian/core/LineLengthGrid.js +12 -0
- package/dist/org/tiqian/core/LineLengthGridDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/LineLengthGridDecisionInfo.js +26 -0
- package/dist/org/tiqian/core/LineRepairAllocationInfo.d.ts +8 -0
- package/dist/org/tiqian/core/LineRepairAllocationInfo.js +14 -0
- package/dist/org/tiqian/core/LineRepairCandidateInfo.d.ts +16 -0
- package/dist/org/tiqian/core/LineRepairCandidateInfo.js +30 -0
- package/dist/org/tiqian/core/LineRepairDecisionInfo.d.ts +15 -0
- package/dist/org/tiqian/core/LineRepairDecisionInfo.js +31 -0
- package/dist/org/tiqian/core/LineSpacingDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/LineSpacingDecisionInfo.js +20 -0
- package/dist/org/tiqian/core/LinkAddressDisplay.d.ts +3 -0
- package/dist/org/tiqian/core/LinkAddressDisplay.js +12 -0
- package/dist/org/tiqian/core/MandatoryBreakDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/MandatoryBreakDecisionInfo.js +33 -0
- package/dist/org/tiqian/core/MaxLinesDecisionInfo.d.ts +8 -0
- package/dist/org/tiqian/core/MaxLinesDecisionInfo.js +25 -0
- package/dist/org/tiqian/core/MeasureAdaptiveFirstLineIndent.d.ts +8 -0
- package/dist/org/tiqian/core/MeasureAdaptiveFirstLineIndent.js +17 -0
- package/dist/org/tiqian/core/MetricDecisionInfo.d.ts +19 -0
- package/dist/org/tiqian/core/MetricDecisionInfo.js +36 -0
- package/dist/org/tiqian/core/ParagraphStyle.d.ts +22 -0
- package/dist/org/tiqian/core/ParagraphStyle.js +36 -0
- package/dist/org/tiqian/core/PositionedCluster.d.ts +22 -0
- package/dist/org/tiqian/core/PositionedCluster.js +52 -0
- package/dist/org/tiqian/core/PunctuationDecisionInfo.d.ts +29 -0
- package/dist/org/tiqian/core/PunctuationDecisionInfo.js +54 -0
- package/dist/org/tiqian/core/Rect.d.ts +12 -0
- package/dist/org/tiqian/core/Rect.js +28 -0
- package/dist/org/tiqian/core/RichTextBackgroundDrawStyle.d.ts +15 -0
- package/dist/org/tiqian/core/RichTextBackgroundDrawStyle.js +25 -0
- package/dist/org/tiqian/core/RichTextBackgroundMetricPolicy.d.ts +16 -0
- package/dist/org/tiqian/core/RichTextBackgroundMetricPolicy.js +17 -0
- package/dist/org/tiqian/core/RichTextBackgroundPaint.d.ts +19 -0
- package/dist/org/tiqian/core/RichTextBackgroundPaint.js +51 -0
- package/dist/org/tiqian/core/RichTextCornerRadii.d.ts +12 -0
- package/dist/org/tiqian/core/RichTextCornerRadii.js +28 -0
- package/dist/org/tiqian/core/RichTextLayoutProjection.d.ts +6 -0
- package/dist/org/tiqian/core/RichTextLayoutProjection.js +62 -0
- package/dist/org/tiqian/core/RichTextLinePattern.d.ts +24 -0
- package/dist/org/tiqian/core/RichTextLinePattern.js +46 -0
- package/dist/org/tiqian/core/RichTextLineSegment.d.ts +25 -0
- package/dist/org/tiqian/core/RichTextLineSegment.js +55 -0
- package/dist/org/tiqian/core/RichTextPaint.d.ts +17 -0
- package/dist/org/tiqian/core/RichTextPaint.js +64 -0
- package/dist/org/tiqian/core/RichTextProjectionFns.d.ts +7 -0
- package/dist/org/tiqian/core/RichTextProjectionFns.js +102 -0
- package/dist/org/tiqian/core/RichTextRole.d.ts +35 -0
- package/dist/org/tiqian/core/RichTextRole.js +57 -0
- package/dist/org/tiqian/core/RichTextSpan.d.ts +11 -0
- package/dist/org/tiqian/core/RichTextSpan.js +34 -0
- package/dist/org/tiqian/core/RoleOverrideInfo.d.ts +12 -0
- package/dist/org/tiqian/core/RoleOverrideInfo.js +41 -0
- package/dist/org/tiqian/core/RubyDecisionInfo.d.ts +20 -0
- package/dist/org/tiqian/core/RubyDecisionInfo.js +46 -0
- package/dist/org/tiqian/core/RubyKind.d.ts +12 -0
- package/dist/org/tiqian/core/RubyKind.js +14 -0
- package/dist/org/tiqian/core/RubyLineHeightDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/RubyLineHeightDecisionInfo.js +36 -0
- package/dist/org/tiqian/core/RubyLineHeightMode.d.ts +12 -0
- package/dist/org/tiqian/core/RubyLineHeightMode.js +14 -0
- package/dist/org/tiqian/core/RubySpan.d.ts +13 -0
- package/dist/org/tiqian/core/RubySpan.js +60 -0
- package/dist/org/tiqian/core/ShapingDecisionInfo.d.ts +21 -0
- package/dist/org/tiqian/core/ShapingDecisionInfo.js +40 -0
- package/dist/org/tiqian/core/Size.d.ts +6 -0
- package/dist/org/tiqian/core/Size.js +12 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
- package/dist/org/tiqian/core/SpacingDecisionInfo.d.ts +13 -0
- package/dist/org/tiqian/core/SpacingDecisionInfo.js +24 -0
- package/dist/org/tiqian/core/TextRange.d.ts +11 -0
- package/dist/org/tiqian/core/TextRange.js +40 -0
- package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
- package/dist/org/tiqian/core/TextRangeError.js +2 -0
- package/dist/org/tiqian/core/TextSpan.d.ts +8 -0
- package/dist/org/tiqian/core/TextSpan.js +12 -0
- package/dist/org/tiqian/core/TextStyle.d.ts +12 -0
- package/dist/org/tiqian/core/TextStyle.js +28 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
- package/dist/org/tiqian/core/TiqianTextContent.d.ts +12 -0
- package/dist/org/tiqian/core/TiqianTextContent.js +38 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
- package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
- package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
- package/dist/org/tiqian/core/Units.d.ts +7 -0
- package/dist/org/tiqian/core/Units.js +11 -0
- package/dist/org/tiqian/core/WritingMode.d.ts +12 -0
- package/dist/org/tiqian/core/WritingMode.js +14 -0
- package/dist/org/tiqian/core/ZeroWidthBreakDecisionInfo.d.ts +10 -0
- package/dist/org/tiqian/core/ZeroWidthBreakDecisionInfo.js +33 -0
- package/dist/org/tiqian/font/BaselineClass.d.ts +24 -0
- package/dist/org/tiqian/font/BaselineClass.js +23 -0
- package/dist/org/tiqian/font/BaselinePolicy.d.ts +17 -0
- package/dist/org/tiqian/font/BaselinePolicy.js +18 -0
- package/dist/org/tiqian/font/CjkDashCapabilityPolicy.d.ts +4 -0
- package/dist/org/tiqian/font/CjkDashCapabilityPolicy.js +9 -0
- package/dist/org/tiqian/font/CjkFontRoleClassifier.d.ts +8 -0
- package/dist/org/tiqian/font/CjkFontRoleClassifier.js +43 -0
- package/dist/org/tiqian/font/FontMetricSource.d.ts +24 -0
- package/dist/org/tiqian/font/FontMetricSource.js +23 -0
- package/dist/org/tiqian/font/FontMetrics.d.ts +39 -0
- package/dist/org/tiqian/font/FontMetrics.js +106 -0
- package/dist/org/tiqian/font/FontMetricsPolicy.d.ts +21 -0
- package/dist/org/tiqian/font/FontMetricsPolicy.js +21 -0
- package/dist/org/tiqian/font/FontPolicy.d.ts +36 -0
- package/dist/org/tiqian/font/FontPolicy.js +157 -0
- package/dist/org/tiqian/font/FontRole.d.ts +29 -0
- package/dist/org/tiqian/font/FontRole.js +27 -0
- package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
- package/dist/org/tiqian/font/FontRoleContext.js +28 -0
- package/dist/org/tiqian/font/InlineShapingStylePolicy.d.ts +4 -0
- package/dist/org/tiqian/font/InlineShapingStylePolicy.js +18 -0
- package/dist/org/tiqian/font/LayoutFontMetrics.d.ts +18 -0
- package/dist/org/tiqian/font/LayoutFontMetrics.js +29 -0
- package/dist/org/tiqian/font/MetricBox.d.ts +20 -0
- package/dist/org/tiqian/font/MetricBox.js +20 -0
- package/dist/org/tiqian/font/PreferCjkForAmbiguousPunctuationResolver.d.ts +10 -0
- package/dist/org/tiqian/font/PreferCjkForAmbiguousPunctuationResolver.js +30 -0
- package/dist/org/tiqian/font/PunctuationFontPolicy.d.ts +21 -0
- package/dist/org/tiqian/font/PunctuationFontPolicy.js +21 -0
- package/dist/org/tiqian/font/RawFontMetrics.d.ts +11 -0
- package/dist/org/tiqian/font/RawFontMetrics.js +23 -0
- package/dist/org/tiqian/font/UnicodeEmojiData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeEmojiData.js +63 -0
- package/dist/org/tiqian/font/UnicodeEmojiPresentationData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeEmojiPresentationData.js +46 -0
- package/dist/org/tiqian/font/UnicodeEmojiStyleVariationData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeEmojiStyleVariationData.js +71 -0
- package/dist/org/tiqian/font/UnicodeSymbolData.d.ts +3 -0
- package/dist/org/tiqian/font/UnicodeSymbolData.js +88 -0
- package/dist/org/tiqian/layout/AnnotationGeometryStage.d.ts +57 -0
- package/dist/org/tiqian/layout/AnnotationGeometryStage.js +622 -0
- package/dist/org/tiqian/layout/AsciiPointMarkKinsokuTestSupport.d.ts +52 -0
- package/dist/org/tiqian/layout/AsciiPointMarkKinsokuTestSupport.js +209 -0
- package/dist/org/tiqian/layout/ClusterRoleResolution.d.ts +30 -0
- package/dist/org/tiqian/layout/ClusterRoleResolution.js +215 -0
- package/dist/org/tiqian/layout/ContextualDashEllipsisRoleResolver.d.ts +54 -0
- package/dist/org/tiqian/layout/ContextualDashEllipsisRoleResolver.js +326 -0
- package/dist/org/tiqian/layout/ContextualPunctuationDisplaySubstitution.d.ts +6 -0
- package/dist/org/tiqian/layout/ContextualPunctuationDisplaySubstitution.js +8 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
- package/dist/org/tiqian/layout/DefaultHyphenator.d.ts +4 -0
- package/dist/org/tiqian/layout/DefaultHyphenator.js +7 -0
- package/dist/org/tiqian/layout/Justifier.d.ts +64 -0
- package/dist/org/tiqian/layout/Justifier.js +474 -0
- package/dist/org/tiqian/layout/KinsokuRule.d.ts +15 -0
- package/dist/org/tiqian/layout/KinsokuRule.js +24 -0
- package/dist/org/tiqian/layout/LayoutDebugAssembly.d.ts +87 -0
- package/dist/org/tiqian/layout/LayoutDebugAssembly.js +371 -0
- package/dist/org/tiqian/layout/LineAdjustmentStage.d.ts +29 -0
- package/dist/org/tiqian/layout/LineAdjustmentStage.js +797 -0
- package/dist/org/tiqian/layout/LineBreakPlanningStage.d.ts +149 -0
- package/dist/org/tiqian/layout/LineBreakPlanningStage.js +769 -0
- package/dist/org/tiqian/layout/LineBreaker.d.ts +54 -0
- package/dist/org/tiqian/layout/LineBreaker.js +457 -0
- package/dist/org/tiqian/layout/LineGeometryStage.d.ts +63 -0
- package/dist/org/tiqian/layout/LineGeometryStage.js +344 -0
- package/dist/org/tiqian/layout/LineOptimization.d.ts +125 -0
- package/dist/org/tiqian/layout/LineOptimization.js +299 -0
- package/dist/org/tiqian/layout/LineRepair.d.ts +30 -0
- package/dist/org/tiqian/layout/LineRepair.js +471 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreaker.d.ts +80 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreaker.js +556 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreakerTestSupport.d.ts +23 -0
- package/dist/org/tiqian/layout/ParagraphDpLineBreakerTestSupport.js +135 -0
- package/dist/org/tiqian/layout/ParagraphLayoutEngine.d.ts +48 -0
- package/dist/org/tiqian/layout/ParagraphLayoutEngine.js +199 -0
- package/dist/org/tiqian/layout/ParagraphShapingStage.d.ts +63 -0
- package/dist/org/tiqian/layout/ParagraphShapingStage.js +1471 -0
- package/dist/org/tiqian/layout/PlanLowering.d.ts +10 -0
- package/dist/org/tiqian/layout/PlanLowering.js +329 -0
- package/dist/org/tiqian/layout/PreparedParagraph.d.ts +32 -0
- package/dist/org/tiqian/layout/PreparedParagraph.js +114 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
- package/dist/org/tiqian/layout/PunctuationGeometryLedger.d.ts +92 -0
- package/dist/org/tiqian/layout/PunctuationGeometryLedger.js +617 -0
- package/dist/org/tiqian/layout/PunctuationGeometryStage.d.ts +73 -0
- package/dist/org/tiqian/layout/PunctuationGeometryStage.js +631 -0
- package/dist/org/tiqian/layout/PunctuationModel.d.ts +181 -0
- package/dist/org/tiqian/layout/PunctuationModel.js +414 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
- package/dist/org/tiqian/layout/UnicodePunctuationBoundaryResolver.d.ts +88 -0
- package/dist/org/tiqian/layout/UnicodePunctuationBoundaryResolver.js +495 -0
- package/dist/org/tiqian/layout/WidthIndependentAnnotationCache.d.ts +102 -0
- package/dist/org/tiqian/layout/WidthIndependentAnnotationCache.js +1207 -0
- package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
- package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
- package/dist/org/tiqian/linebreak/BreakOpportunity.d.ts +19 -0
- package/dist/org/tiqian/linebreak/BreakOpportunity.js +64 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenation.d.ts +5 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenation.js +14 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenationPatterns.d.ts +4 -0
- package/dist/org/tiqian/linebreak/EnglishHyphenationPatterns.js +4294 -0
- package/dist/org/tiqian/linebreak/Hyphenator.d.ts +17 -0
- package/dist/org/tiqian/linebreak/Hyphenator.js +24 -0
- package/dist/org/tiqian/linebreak/LiangHyphenator.d.ts +10 -0
- package/dist/org/tiqian/linebreak/LiangHyphenator.js +67 -0
- package/dist/org/tiqian/linebreak/LineBreakAnalyzer.d.ts +9 -0
- package/dist/org/tiqian/linebreak/LineBreakAnalyzer.js +23 -0
- package/dist/org/tiqian/linebreak/LineBreakFns.d.ts +2 -0
- package/dist/org/tiqian/linebreak/LineBreakFns.js +7 -0
- package/dist/org/tiqian/linebreak/ParseTexHyphenationPatterns.d.ts +7 -0
- package/dist/org/tiqian/linebreak/ParseTexHyphenationPatterns.js +108 -0
- package/dist/org/tiqian/linebreak/ParsedTexHyphenation.d.ts +6 -0
- package/dist/org/tiqian/linebreak/ParsedTexHyphenation.js +9 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreak.d.ts +63 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreak.js +103 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreakData.d.ts +3 -0
- package/dist/org/tiqian/linebreak/UnicodePunctuationLineBreakData.js +164 -0
- package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
- package/dist/org/tiqian/protocol/NamedError.js +71 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
- package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
- package/dist/org/tiqian/protocol/Plan.js +10 -0
- package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
- package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
- package/dist/org/tiqian/protocol/PlanJson.d.ts +10 -0
- package/dist/org/tiqian/protocol/PlanJson.js +442 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
- package/dist/org/tiqian/protocol/PlanPacked.d.ts +34 -0
- package/dist/org/tiqian/protocol/PlanPacked.js +1166 -0
- package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
- package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
- package/dist/org/tiqian/shaping/ReplayableFontBackend.d.ts +48 -0
- package/dist/org/tiqian/shaping/ReplayableFontBackend.js +97 -0
- package/dist/org/tiqian/shaping/TextShaper.d.ts +71 -0
- package/dist/org/tiqian/shaping/TextShaper.js +176 -0
- package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
- package/dist/org/tiqian/test/TestHelpers.js +27 -0
- package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
- package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceField.js +10 -0
- package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
- package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
- package/dist/runtime.d.ts +96 -0
- package/dist/runtime.js +1612 -0
- package/dist/std/FsError.d.ts +48 -0
- package/dist/std/FsError.js +2 -0
- package/dist/std/FsException.d.ts +6 -0
- package/dist/std/FsException.js +45 -0
- package/dist/std/UStringException.d.ts +6 -0
- package/dist/std/UStringException.js +21 -0
- package/dist/std/UStringFault.d.ts +9 -0
- package/dist/std/UStringFault.js +2 -0
- package/package.json +22 -4
- package/README.md +0 -3
|
@@ -0,0 +1,1471 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { ClreqPunctuationPolicies } from "./../clreq/ClreqPunctuationPolicies.js";
|
|
3
|
+
import { AccurateSum } from "./../core/AccurateSum.js";
|
|
4
|
+
import { BreakOpportunityDecisionInfo } from "./../core/BreakOpportunityDecisionInfo.js";
|
|
5
|
+
import { Cluster } from "./../core/Cluster.js";
|
|
6
|
+
import { EmergencyTrackingEligibilityDecisionInfo } from "./../core/EmergencyTrackingEligibilityDecisionInfo.js";
|
|
7
|
+
import { Glyph } from "./../core/Glyph.js";
|
|
8
|
+
import { ShapingDecisionInfo } from "./../core/ShapingDecisionInfo.js";
|
|
9
|
+
import { SourceInteractionBoundaries } from "./../core/SourceInteractionBoundaries.js";
|
|
10
|
+
import { TextRange, compareTextRange } from "./../core/TextRange.js";
|
|
11
|
+
import { TextStyle } from "./../core/TextStyle.js";
|
|
12
|
+
import { UnicodeWordCharacterData } from "./../core/UnicodeWordCharacterData.js";
|
|
13
|
+
import { FontRequest } from "./../font/FontPolicy.js";
|
|
14
|
+
import { ContextualPunctuationDisplaySubstitutionFns } from "./ContextualPunctuationDisplaySubstitution.js";
|
|
15
|
+
import { ParagraphLayoutEngineFns } from "./ParagraphLayoutEngine.js";
|
|
16
|
+
import { ProgressiveBreakOpportunity, ProgressiveBreakTier } from "./ProgressiveBreakDecisions.js";
|
|
17
|
+
import { ProgressiveBreakTierPriority } from "./ProgressiveBreakTierPriority.js";
|
|
18
|
+
import { ShapingInput, ShapingIssue, ShapingResult } from "./../shaping/TextShaper.js";
|
|
19
|
+
import { SortedTable, readUnit } from "../../../runtime.js";
|
|
20
|
+
export class ParagraphShapingStageResult {
|
|
21
|
+
shapingResults;
|
|
22
|
+
hyphenOffsets;
|
|
23
|
+
hyphenAdvance;
|
|
24
|
+
hyphenGlyphs;
|
|
25
|
+
substitutionRollbacks;
|
|
26
|
+
breakOpportunityDecisions;
|
|
27
|
+
emergencyTrackingEligibilityDecisions;
|
|
28
|
+
progressiveBreakOffsets;
|
|
29
|
+
segmentShapingCache;
|
|
30
|
+
constructor(shapingResults, hyphenOffsets, hyphenAdvance, hyphenGlyphs, substitutionRollbacks, breakOpportunityDecisions, emergencyTrackingEligibilityDecisions, progressiveBreakOffsets, segmentShapingCache = null) {
|
|
31
|
+
this.shapingResults = shapingResults;
|
|
32
|
+
this.hyphenOffsets = hyphenOffsets;
|
|
33
|
+
this.hyphenAdvance = hyphenAdvance;
|
|
34
|
+
this.hyphenGlyphs = hyphenGlyphs;
|
|
35
|
+
this.substitutionRollbacks = substitutionRollbacks;
|
|
36
|
+
this.breakOpportunityDecisions = breakOpportunityDecisions;
|
|
37
|
+
this.emergencyTrackingEligibilityDecisions = emergencyTrackingEligibilityDecisions;
|
|
38
|
+
this.progressiveBreakOffsets = progressiveBreakOffsets;
|
|
39
|
+
this.segmentShapingCache = segmentShapingCache ?? SortedTable.mapBuilder(compareTextRange).build();
|
|
40
|
+
}
|
|
41
|
+
toString() {
|
|
42
|
+
return `ParagraphShapingStageResult(shapingResults=${(() => { let out = "["; const n = this.shapingResults.length; for (let i = 0; i < n; i += 1) {
|
|
43
|
+
if (i > 0) {
|
|
44
|
+
out += ", ";
|
|
45
|
+
}
|
|
46
|
+
out += this.shapingResults[i].toString();
|
|
47
|
+
} out += "]"; return out; })()}, hyphenOffsets=${(() => { let out = "["; const n = this.hyphenOffsets.size(); for (let i = 0; i < n; i += 1) {
|
|
48
|
+
if (i > 0) {
|
|
49
|
+
out += ", ";
|
|
50
|
+
}
|
|
51
|
+
out += this.hyphenOffsets.at(i);
|
|
52
|
+
} out += "]"; return out; })()}, hyphenAdvance=${this.hyphenAdvance}, hyphenGlyphs=${(() => { let out = "["; const n = this.hyphenGlyphs.length; for (let i = 0; i < n; i += 1) {
|
|
53
|
+
if (i > 0) {
|
|
54
|
+
out += ", ";
|
|
55
|
+
}
|
|
56
|
+
out += this.hyphenGlyphs[i].toString();
|
|
57
|
+
} out += "]"; return out; })()}, substitutionRollbacks=${(() => { let out = "{"; const n = this.substitutionRollbacks.size(); for (let i = 0; i < n; i += 1) {
|
|
58
|
+
if (i > 0) {
|
|
59
|
+
out += ", ";
|
|
60
|
+
}
|
|
61
|
+
out += this.substitutionRollbacks.keyAt(i).toString() + "=" + this.substitutionRollbacks.valueAt(i);
|
|
62
|
+
} out += "}"; return out; })()}, breakOpportunityDecisions=${(() => { let out = "["; const n = this.breakOpportunityDecisions.length; for (let i = 0; i < n; i += 1) {
|
|
63
|
+
if (i > 0) {
|
|
64
|
+
out += ", ";
|
|
65
|
+
}
|
|
66
|
+
out += this.breakOpportunityDecisions[i].toString();
|
|
67
|
+
} out += "]"; return out; })()}, emergencyTrackingEligibilityDecisions=${(() => { let out = "["; const n = this.emergencyTrackingEligibilityDecisions.length; for (let i = 0; i < n; i += 1) {
|
|
68
|
+
if (i > 0) {
|
|
69
|
+
out += ", ";
|
|
70
|
+
}
|
|
71
|
+
out += this.emergencyTrackingEligibilityDecisions[i].toString();
|
|
72
|
+
} out += "]"; return out; })()}, progressiveBreakOffsets=${(() => { let out = "{"; const n = this.progressiveBreakOffsets.size(); for (let i = 0; i < n; i += 1) {
|
|
73
|
+
if (i > 0) {
|
|
74
|
+
out += ", ";
|
|
75
|
+
}
|
|
76
|
+
out += this.progressiveBreakOffsets.keyAt(i) + "=" + this.progressiveBreakOffsets.valueAt(i).toString();
|
|
77
|
+
} out += "}"; return out; })()}, segmentShapingCache=${(() => { let out = "{"; const n = this.segmentShapingCache.size(); for (let i = 0; i < n; i += 1) {
|
|
78
|
+
if (i > 0) {
|
|
79
|
+
out += ", ";
|
|
80
|
+
}
|
|
81
|
+
out += this.segmentShapingCache.keyAt(i).toString() + "=" + this.segmentShapingCache.valueAt(i).toString();
|
|
82
|
+
} out += "}"; return out; })()})`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export class ParagraphShapingStage {
|
|
86
|
+
static isDigit(c) {
|
|
87
|
+
return c >= 48 && c <= 57;
|
|
88
|
+
}
|
|
89
|
+
static isLetter(c) {
|
|
90
|
+
return c >= 65 && c <= 90 || c >= 97 && c <= 122 || UnicodeWordCharacterData.contains(c) && !ParagraphShapingStage.isDigit(c);
|
|
91
|
+
}
|
|
92
|
+
static isLetterOrDigit(c) {
|
|
93
|
+
return c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || UnicodeWordCharacterData.contains(c);
|
|
94
|
+
}
|
|
95
|
+
static isUpperCase(c) {
|
|
96
|
+
return c >= 65 && c <= 90;
|
|
97
|
+
}
|
|
98
|
+
static isLowerCase(c) {
|
|
99
|
+
return c >= 97 && c <= 122;
|
|
100
|
+
}
|
|
101
|
+
static isWhitespace(c) {
|
|
102
|
+
return c >= 9 && c <= 13 || c === 32 || c === 160 || c === 5760 || c >= 8192 && c <= 8202 || c === 8232 || c === 8233 || c === 8239 || c === 8287 || c === 12288;
|
|
103
|
+
}
|
|
104
|
+
static isAllDigits(s) {
|
|
105
|
+
const count = s.length;
|
|
106
|
+
if (count === 0) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
for (let i = 0; i < count; i += 1) {
|
|
110
|
+
const c = (Number.isNaN(s.charCodeAt(i)) ? null : s.charCodeAt(i));
|
|
111
|
+
if (c < 48 || c > 57) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
static isSharedCurlyQuote(c) {
|
|
118
|
+
return c === 8216 || c === 8217 || c === 8220 || c === 8221;
|
|
119
|
+
}
|
|
120
|
+
static isProgressiveTechnicalBreakAfterChar(c) {
|
|
121
|
+
return c === 47 || c === 92 || c === 46 || c === 45 || c === 95 || c === 58 || c === 59 || c === 44 || c === 63 || c === 38 || c === 61 || c === 35 || c === 37 || c === 126 || c === 43 || c === 42 || c === 124 || c === 41 || c === 93 || c === 125;
|
|
122
|
+
}
|
|
123
|
+
static sortInts(arr) {
|
|
124
|
+
let i = 1;
|
|
125
|
+
while (i < arr.length) {
|
|
126
|
+
const current = arr[i];
|
|
127
|
+
let j = i - 1;
|
|
128
|
+
while (j >= 0 && arr[j] > current) {
|
|
129
|
+
arr[j + 1] = arr[j];
|
|
130
|
+
j--;
|
|
131
|
+
}
|
|
132
|
+
arr[j + 1] = current;
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
static tierName(tier) {
|
|
137
|
+
if (tier.kind === "Whitespace") {
|
|
138
|
+
return "Whitespace";
|
|
139
|
+
}
|
|
140
|
+
if (tier.kind === "Structural") {
|
|
141
|
+
return "Structural";
|
|
142
|
+
}
|
|
143
|
+
if (tier.kind === "Syllable") {
|
|
144
|
+
return "Syllable";
|
|
145
|
+
}
|
|
146
|
+
if (tier.kind === "WholeToken") {
|
|
147
|
+
return "WholeToken";
|
|
148
|
+
}
|
|
149
|
+
if (tier.kind === "Emergency") {
|
|
150
|
+
return "Emergency";
|
|
151
|
+
}
|
|
152
|
+
return "Unknown";
|
|
153
|
+
}
|
|
154
|
+
static cjkPunctuationFullWidthFeatures(role, displayText) {
|
|
155
|
+
if (role.kind === "CjkPunctuation") {
|
|
156
|
+
for (let i = 0, count2 = displayText.length; i < count2; i += 1) {
|
|
157
|
+
const c = (Number.isNaN(displayText.charCodeAt(i)) ? null : displayText.charCodeAt(i));
|
|
158
|
+
if (ParagraphShapingStage.isSharedCurlyQuote((c))) {
|
|
159
|
+
return ["fwid=1"];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
static isUrlLikeLatinToken(token) {
|
|
166
|
+
const lower = token.toLowerCase();
|
|
167
|
+
return token.indexOf("://") >= 0 || lower.startsWith("www.") || ParagraphShapingStage.hasDomainLikeDot(token);
|
|
168
|
+
}
|
|
169
|
+
static hasDomainLikeDot(token) {
|
|
170
|
+
for (let i = 0, count3 = token.length; i < count3; i += 1) {
|
|
171
|
+
if ((Number.isNaN(token.charCodeAt(i)) ? null : token.charCodeAt(i)) !== 46 || i === 0 || i + 2 >= count3) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (!ParagraphShapingStage.isLetterOrDigit(readUnit(token, i - 1)) || !ParagraphShapingStage.isLetterOrDigit(readUnit(token, i + 1))) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
let tld = 0;
|
|
178
|
+
let j = i + 1;
|
|
179
|
+
while (j < count3 && ParagraphShapingStage.isLetter((Number.isNaN(token.charCodeAt(j)) ? null : token.charCodeAt(j)))) {
|
|
180
|
+
tld += 1;
|
|
181
|
+
j += 1;
|
|
182
|
+
}
|
|
183
|
+
if (tld >= 2) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
static isLatinTokenBreakAfter(token, index, keepUrlScheme) {
|
|
190
|
+
if (index < 0 || index >= token.length - 1) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
const c = (Number.isNaN(token.charCodeAt(index)) ? null : token.charCodeAt(index));
|
|
194
|
+
if (c === 47) {
|
|
195
|
+
return !keepUrlScheme || index === 0 || readUnit(token, index - 1) !== 58;
|
|
196
|
+
}
|
|
197
|
+
if (c === 46 || c === 45 || c === 95 || c === 63 || c === 38 || c === 61 || c === 35 || c === 37 || c === 126) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
static bibliographicNumericLocatorBreakOffsets(token) {
|
|
203
|
+
const open = token.indexOf("(");
|
|
204
|
+
if (open <= 0 || !ParagraphShapingStage.isDigit((Number.isNaN(token.charCodeAt(0)) ? null : token.charCodeAt(0)))) {
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
const close = token.indexOf(")", open + 1);
|
|
208
|
+
if (close <= open + 1) {
|
|
209
|
+
return [];
|
|
210
|
+
}
|
|
211
|
+
const colon = token.indexOf(":", close + 1);
|
|
212
|
+
if (colon !== close + 1 || colon >= token.length - 1) {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
const volume = token.substring(0, open);
|
|
216
|
+
const issue = token.substring(open + 1, close);
|
|
217
|
+
let pages = token.substring(colon + 1);
|
|
218
|
+
if (pages.endsWith(".")) {
|
|
219
|
+
pages = pages.substring(0, pages.length - 1);
|
|
220
|
+
}
|
|
221
|
+
const count4 = pages.length;
|
|
222
|
+
if (volume.length === 0 || issue.length === 0 || count4 === 0) {
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
if (!ParagraphShapingStage.isAllDigits(volume) || !ParagraphShapingStage.isAllDigits(issue)) {
|
|
226
|
+
return [];
|
|
227
|
+
}
|
|
228
|
+
let rangeSeparator = -1;
|
|
229
|
+
for (let i = 0; i < count4; i += 1) {
|
|
230
|
+
const c = (Number.isNaN(pages.charCodeAt(i)) ? null : pages.charCodeAt(i));
|
|
231
|
+
if (c === 45 || c === 8211 || c === 8212) {
|
|
232
|
+
rangeSeparator = i;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const pagesAreNumeric = (rangeSeparator < 0 ? ParagraphShapingStage.isAllDigits(pages) : rangeSeparator > 0 && rangeSeparator < pages.length - 1 && ParagraphShapingStage.isAllDigits(pages.substring(0, rangeSeparator)) && ParagraphShapingStage.isAllDigits(pages.substring(rangeSeparator + 1)));
|
|
237
|
+
if (!pagesAreNumeric) {
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
return [open, colon + 1];
|
|
241
|
+
}
|
|
242
|
+
static hasBreakableLatinSolidus(token) {
|
|
243
|
+
for (let i = 1, count5 = token.length - 1; i < count5; i += 1) {
|
|
244
|
+
if ((Number.isNaN(token.charCodeAt(i)) ? null : token.charCodeAt(i)) === 47 && ParagraphShapingStage.isLetterOrDigit(readUnit(token, i - 1)) && ParagraphShapingStage.isLetterOrDigit(readUnit(token, i + 1))) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
static existingHyphenCuts(text, wordRange) {
|
|
251
|
+
const w = text.substring(wordRange.start, wordRange.end);
|
|
252
|
+
const cuts = new Array();
|
|
253
|
+
for (let i = 0, count6 = w.length; i < count6; i += 1) {
|
|
254
|
+
if ((Number.isNaN(w.charCodeAt(i)) ? null : w.charCodeAt(i)) !== 45) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
let before = 0;
|
|
258
|
+
let j = i - 1;
|
|
259
|
+
while (j >= 0 && ParagraphShapingStage.isLetter((Number.isNaN(w.charCodeAt(j)) ? null : w.charCodeAt(j)))) {
|
|
260
|
+
before += 1;
|
|
261
|
+
j -= 1;
|
|
262
|
+
}
|
|
263
|
+
let after = 0;
|
|
264
|
+
let k = i + 1;
|
|
265
|
+
while (k < count6 && ParagraphShapingStage.isLetter((Number.isNaN(w.charCodeAt(k)) ? null : w.charCodeAt(k)))) {
|
|
266
|
+
after += 1;
|
|
267
|
+
k += 1;
|
|
268
|
+
}
|
|
269
|
+
if (before >= 2 && after >= 2) {
|
|
270
|
+
cuts.push(wordRange.start + i + 1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return cuts;
|
|
274
|
+
}
|
|
275
|
+
static camelCaseCuts(text, wordRange) {
|
|
276
|
+
const w = text.substring(wordRange.start, wordRange.end);
|
|
277
|
+
const humps = new Array();
|
|
278
|
+
for (let i = 1, count7 = w.length; i < count7; i += 1) {
|
|
279
|
+
const c = (Number.isNaN(w.charCodeAt(i)) ? null : w.charCodeAt(i));
|
|
280
|
+
const prev = readUnit(w, i - 1);
|
|
281
|
+
if (ParagraphShapingStage.isUpperCase((c)) && (ParagraphShapingStage.isLowerCase((prev)) || ParagraphShapingStage.isUpperCase((prev)) && i + 1 < count7 && ParagraphShapingStage.isLowerCase(readUnit(w, i + 1)))) {
|
|
282
|
+
humps.push(i);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const bounds = [0];
|
|
286
|
+
for (let h = 0, count8 = humps.length; h < count8; h += 1) {
|
|
287
|
+
bounds.push(humps[h]);
|
|
288
|
+
}
|
|
289
|
+
bounds.push(w.length);
|
|
290
|
+
const result = new Array();
|
|
291
|
+
for (let idx = 0, count9 = humps.length; idx < count9; idx += 1) {
|
|
292
|
+
const h2 = humps[idx];
|
|
293
|
+
let lastBefore = 0;
|
|
294
|
+
for (let b = 0, count10 = bounds.length; b < count10; b += 1) {
|
|
295
|
+
if (bounds[b] < h2) {
|
|
296
|
+
lastBefore = bounds[b];
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
let firstAfter = w.length;
|
|
300
|
+
for (let b2 = 0, count11 = bounds.length; b2 < count11; b2 += 1) {
|
|
301
|
+
if (bounds[b2] > h2) {
|
|
302
|
+
firstAfter = bounds[b2];
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (h2 - lastBefore >= 2 && firstAfter - h2 >= 2) {
|
|
307
|
+
result.push(wordRange.start + h2);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
static alphaNumericTransitionCuts(text, wordRange) {
|
|
313
|
+
const w = text.substring(wordRange.start, wordRange.end);
|
|
314
|
+
const cuts = new Array();
|
|
315
|
+
for (let index = 1, count12 = w.length; index < count12; index += 1) {
|
|
316
|
+
const left = readUnit(w, index - 1);
|
|
317
|
+
const right = (Number.isNaN(w.charCodeAt(index)) ? null : w.charCodeAt(index));
|
|
318
|
+
if (ParagraphShapingStage.isLetter((left)) && ParagraphShapingStage.isDigit((right)) || ParagraphShapingStage.isDigit((left)) && ParagraphShapingStage.isLetter((right))) {
|
|
319
|
+
cuts.push(wordRange.start + index);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return cuts;
|
|
323
|
+
}
|
|
324
|
+
static strongNonLexicalReason(w) {
|
|
325
|
+
const count13 = w.length;
|
|
326
|
+
if (count13 < 12) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
let allLetters = true;
|
|
330
|
+
const firstCharLower = w.charAt(0).toLowerCase();
|
|
331
|
+
let allSameLetter = true;
|
|
332
|
+
for (let i = 0; i < count13; i += 1) {
|
|
333
|
+
const c = (Number.isNaN(w.charCodeAt(i)) ? null : w.charCodeAt(i));
|
|
334
|
+
if (!ParagraphShapingStage.isLetter((c))) {
|
|
335
|
+
allLetters = false;
|
|
336
|
+
allSameLetter = false;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
if (w.charAt(i).toLowerCase() !== firstCharLower) {
|
|
340
|
+
allSameLetter = false;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (allLetters && allSameLetter) {
|
|
345
|
+
return "LongRepeatedLetterRun";
|
|
346
|
+
}
|
|
347
|
+
let anyLetter = false;
|
|
348
|
+
let allHexOrDigit = true;
|
|
349
|
+
for (let i2 = 0, count14 = w.length; i2 < count14; i2 += 1) {
|
|
350
|
+
const c2 = (Number.isNaN(w.charCodeAt(i2)) ? null : w.charCodeAt(i2));
|
|
351
|
+
if (ParagraphShapingStage.isLetter((c2))) {
|
|
352
|
+
anyLetter = true;
|
|
353
|
+
}
|
|
354
|
+
const isHexDigit = ParagraphShapingStage.isDigit((c2)) || c2 >= 65 && c2 <= 70 || c2 >= 97 && c2 <= 102;
|
|
355
|
+
if (!isHexDigit) {
|
|
356
|
+
allHexOrDigit = false;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (anyLetter && allHexOrDigit) {
|
|
360
|
+
return "LongHexIdentityRun";
|
|
361
|
+
}
|
|
362
|
+
let anyDigit = false;
|
|
363
|
+
for (let i3 = 0, count15 = w.length; i3 < count15; i3 += 1) {
|
|
364
|
+
if (ParagraphShapingStage.isDigit((Number.isNaN(w.charCodeAt(i3)) ? null : w.charCodeAt(i3)))) {
|
|
365
|
+
anyDigit = true;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (anyLetter && anyDigit) {
|
|
370
|
+
let transitions = 0;
|
|
371
|
+
for (let i4 = 0, count16 = w.length - 1; i4 < count16; i4 += 1) {
|
|
372
|
+
const left = (Number.isNaN(w.charCodeAt(i4)) ? null : w.charCodeAt(i4));
|
|
373
|
+
const right = readUnit(w, i4 + 1);
|
|
374
|
+
if (ParagraphShapingStage.isLetter((left)) && ParagraphShapingStage.isDigit((right)) || ParagraphShapingStage.isDigit((left)) && ParagraphShapingStage.isLetter((right))) {
|
|
375
|
+
transitions++;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (transitions >= 2) {
|
|
379
|
+
return "LongMixedAlphaNumericIdentifier";
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
static mandatoryBreakShapingResult(text, range) {
|
|
385
|
+
const sourceText = text.substring(range.start, range.end);
|
|
386
|
+
const cluster = new Cluster(range, sourceText, ParagraphLayoutEngineFns.MANDATORY_BREAK_FONT_KEY, 0.0, "");
|
|
387
|
+
return new ShapingResult([cluster], [], []);
|
|
388
|
+
}
|
|
389
|
+
static zeroWidthSoftBreakShapingResult(text, range) {
|
|
390
|
+
const sourceText = text.substring(range.start, range.end);
|
|
391
|
+
const cluster = new Cluster(range, sourceText, "zero-width-space", 0.0, "");
|
|
392
|
+
const decision = new ShapingDecisionInfo(range, sourceText, "", "zero-width-space", 0, 0.0, "StructuralControl", "ZeroWidthSpaceSoftBreakNoShape");
|
|
393
|
+
return new ShapingResult([cluster], [], [decision]);
|
|
394
|
+
}
|
|
395
|
+
static inlineObjectShapingResult(text, inlineObject) {
|
|
396
|
+
const sourceText = text.substring(inlineObject.range.start, inlineObject.range.end);
|
|
397
|
+
const cluster = new Cluster(inlineObject.range, sourceText, "inline-object", inlineObject.advance, "");
|
|
398
|
+
const decision = new ShapingDecisionInfo(inlineObject.range, sourceText, "", "inline-object", 0, inlineObject.advance, "InlineObject", "MeasurableOpaqueInlineObject:no-font-shaping");
|
|
399
|
+
return new ShapingResult([cluster], [], [decision]);
|
|
400
|
+
}
|
|
401
|
+
static mapToClusterRange(glyphs, cluster) {
|
|
402
|
+
const sourceTerms = [];
|
|
403
|
+
for (let i = 0, count17 = glyphs.length; i < count17; i += 1) {
|
|
404
|
+
sourceTerms.push(glyphs[i].advance);
|
|
405
|
+
}
|
|
406
|
+
const sourceAdvance = AccurateSum.of(sourceTerms);
|
|
407
|
+
if (sourceAdvance <= 0.0) {
|
|
408
|
+
const count18 = glyphs.length;
|
|
409
|
+
const count = (count18 > 1 ? count18 : 1);
|
|
410
|
+
const fallbackAdvance = cluster.advance / count;
|
|
411
|
+
const result = [];
|
|
412
|
+
for (let i2 = 0; i2 < count18; i2 += 1) {
|
|
413
|
+
const g = glyphs[i2];
|
|
414
|
+
result.push(new Glyph(g.id, cluster.range, fallbackAdvance, g.x, g.y, g.renderFontKey, g.bounds, g.haltAdvance, g.haltPlacementX));
|
|
415
|
+
}
|
|
416
|
+
return result;
|
|
417
|
+
}
|
|
418
|
+
const result2 = [];
|
|
419
|
+
for (let i3 = 0; i3 < glyphs.length; i3 += 1) {
|
|
420
|
+
const g2 = glyphs[i3];
|
|
421
|
+
result2.push(new Glyph(g2.id, cluster.range, g2.advance, g2.x, g2.y, g2.renderFontKey, g2.bounds, g2.haltAdvance, g2.haltPlacementX));
|
|
422
|
+
}
|
|
423
|
+
return result2;
|
|
424
|
+
}
|
|
425
|
+
static isMandatoryBreakCluster(cluster) {
|
|
426
|
+
return cluster.fontKey === ParagraphLayoutEngineFns.MANDATORY_BREAK_FONT_KEY && cluster.displayText.length === 0;
|
|
427
|
+
}
|
|
428
|
+
static isZeroWidthSoftBreakCluster(cluster) {
|
|
429
|
+
return cluster.fontKey === "zero-width-space" && cluster.displayText.length === 0;
|
|
430
|
+
}
|
|
431
|
+
static isInlineObjectCluster(cluster) {
|
|
432
|
+
return cluster.fontKey === "inline-object";
|
|
433
|
+
}
|
|
434
|
+
static shapingSegments(decision, text) {
|
|
435
|
+
if (decision.role.kind !== "LatinText") {
|
|
436
|
+
return [decision.range];
|
|
437
|
+
}
|
|
438
|
+
const segments = new Array();
|
|
439
|
+
let segStart = decision.range.start;
|
|
440
|
+
let inSpace = (Number.isNaN(text.charCodeAt(decision.range.start)) ? null : text.charCodeAt(decision.range.start)) === 32;
|
|
441
|
+
let i = decision.range.start + 1;
|
|
442
|
+
while (i < decision.range.end) {
|
|
443
|
+
const isSpace = (Number.isNaN(text.charCodeAt(i)) ? null : text.charCodeAt(i)) === 32;
|
|
444
|
+
if (isSpace !== inSpace) {
|
|
445
|
+
segments.push(new TextRange(segStart, i));
|
|
446
|
+
segStart = i;
|
|
447
|
+
inSpace = isSpace;
|
|
448
|
+
}
|
|
449
|
+
i++;
|
|
450
|
+
}
|
|
451
|
+
segments.push(new TextRange(segStart, decision.range.end));
|
|
452
|
+
return segments;
|
|
453
|
+
}
|
|
454
|
+
static copyFontFamilies(families) {
|
|
455
|
+
const count19 = families.length;
|
|
456
|
+
const result = [];
|
|
457
|
+
for (let i = 0; i < count19; i += 1) {
|
|
458
|
+
result.push(families[i]);
|
|
459
|
+
}
|
|
460
|
+
return result;
|
|
461
|
+
}
|
|
462
|
+
static copyInts(arr) {
|
|
463
|
+
const count20 = arr.length;
|
|
464
|
+
const result = [];
|
|
465
|
+
for (let i = 0; i < count20; i += 1) {
|
|
466
|
+
result.push(arr[i]);
|
|
467
|
+
}
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
static shapeParagraph(engine, input, text, fontSize, measure, clusterRanges, fontDecisionByRange, inlineObjectByRange, punctuationGlyphSubstitutor, styleAt, emphasisItalicAt, rejectedTechnicalTiersBySpan, cachedSegmentShaping, cachedSubstitutionRollbacks) {
|
|
471
|
+
cachedSegmentShaping = cachedSegmentShaping ?? null;
|
|
472
|
+
cachedSubstitutionRollbacks = cachedSubstitutionRollbacks ?? null;
|
|
473
|
+
const segmentShapingCacheKeys = new Array();
|
|
474
|
+
const segmentShapingCacheValues = new Array();
|
|
475
|
+
if (cachedSegmentShaping !== null) {
|
|
476
|
+
for (let i = 0, count26 = cachedSegmentShaping.size(); i < count26; i += 1) {
|
|
477
|
+
segmentShapingCacheKeys.push(cachedSegmentShaping.keyAt(i));
|
|
478
|
+
segmentShapingCacheValues.push(cachedSegmentShaping.valueAt(i));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
const substitutionRollbackKeys = new Array();
|
|
482
|
+
const substitutionRollbackValues = new Array();
|
|
483
|
+
if (cachedSubstitutionRollbacks !== null) {
|
|
484
|
+
for (let i2 = 0, count27 = cachedSubstitutionRollbacks.size(); i2 < count27; i2 += 1) {
|
|
485
|
+
substitutionRollbackKeys.push(cachedSubstitutionRollbacks.keyAt(i2));
|
|
486
|
+
substitutionRollbackValues.push(cachedSubstitutionRollbacks.valueAt(i2));
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const getCachedSegmentShaping = (r) => {
|
|
490
|
+
const count28 = segmentShapingCacheKeys.length;
|
|
491
|
+
const keyCount = count28;
|
|
492
|
+
if (keyCount > 0) {
|
|
493
|
+
const lastKey = segmentShapingCacheKeys[keyCount - 1];
|
|
494
|
+
if (lastKey.start === r.start && lastKey.end === r.end) {
|
|
495
|
+
return segmentShapingCacheValues[keyCount - 1];
|
|
496
|
+
}
|
|
497
|
+
if (r.start > lastKey.start) {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
for (let i3 = 0; i3 < count28; i3 += 1) {
|
|
502
|
+
const k = segmentShapingCacheKeys[i3];
|
|
503
|
+
if (k.start === r.start && k.end === r.end) {
|
|
504
|
+
return segmentShapingCacheValues[i3];
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return null;
|
|
508
|
+
};
|
|
509
|
+
const putCachedSegmentShaping = (r, v) => {
|
|
510
|
+
const keyCount2 = segmentShapingCacheKeys.length;
|
|
511
|
+
if (keyCount2 > 0) {
|
|
512
|
+
const lastKey2 = segmentShapingCacheKeys[keyCount2 - 1];
|
|
513
|
+
if (lastKey2.start === r.start && lastKey2.end === r.end) {
|
|
514
|
+
segmentShapingCacheValues[keyCount2 - 1] = v;
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
if (r.start > lastKey2.start) {
|
|
518
|
+
segmentShapingCacheKeys.push(r);
|
|
519
|
+
segmentShapingCacheValues.push(v);
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
for (let i4 = 0, count29 = segmentShapingCacheKeys.length; i4 < count29; i4 += 1) {
|
|
524
|
+
const k2 = segmentShapingCacheKeys[i4];
|
|
525
|
+
if (k2.start === r.start && k2.end === r.end) {
|
|
526
|
+
segmentShapingCacheValues[i4] = v;
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
segmentShapingCacheKeys.push(r);
|
|
531
|
+
segmentShapingCacheValues.push(v);
|
|
532
|
+
};
|
|
533
|
+
const putSubstitutionRollback = (r, v) => {
|
|
534
|
+
const keyCount3 = substitutionRollbackKeys.length;
|
|
535
|
+
if (keyCount3 > 0) {
|
|
536
|
+
const lastKey3 = substitutionRollbackKeys[keyCount3 - 1];
|
|
537
|
+
if (lastKey3.start === r.start && lastKey3.end === r.end) {
|
|
538
|
+
substitutionRollbackValues[keyCount3 - 1] = v;
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
if (r.start > lastKey3.start) {
|
|
542
|
+
substitutionRollbackKeys.push(r);
|
|
543
|
+
substitutionRollbackValues.push(v);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
for (let i5 = 0, count30 = substitutionRollbackKeys.length; i5 < count30; i5 += 1) {
|
|
548
|
+
const k3 = substitutionRollbackKeys[i5];
|
|
549
|
+
if (k3.start === r.start && k3.end === r.end) {
|
|
550
|
+
substitutionRollbackValues[i5] = v;
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
substitutionRollbackKeys.push(r);
|
|
555
|
+
substitutionRollbackValues.push(v);
|
|
556
|
+
};
|
|
557
|
+
const dashInkCoverageDeficient = (shaped, displayText, segmentFontSize) => {
|
|
558
|
+
if (displayText.indexOf("⸺") < 0) {
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
let totalGlyphs = 0;
|
|
562
|
+
let singleGlyph = null;
|
|
563
|
+
for (let i6 = 0, count31 = shaped.glyphRuns.length; i6 < count31; i6 += 1) {
|
|
564
|
+
const r = shaped.glyphRuns[i6];
|
|
565
|
+
for (let j = 0, count32 = r.glyphs.length; j < count32; j += 1) {
|
|
566
|
+
totalGlyphs++;
|
|
567
|
+
singleGlyph = r.glyphs[j];
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (totalGlyphs !== 1 || singleGlyph === null) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
const ink = singleGlyph.bounds;
|
|
574
|
+
if (ink === null) {
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
const targetAdvance = 2.0 * segmentFontSize;
|
|
578
|
+
return ink.right - ink.left < targetAdvance * 0.85;
|
|
579
|
+
};
|
|
580
|
+
const shapeSegment = (decision, segmentRange) => {
|
|
581
|
+
const cached = getCachedSegmentShaping(segmentRange);
|
|
582
|
+
if (cached !== null) {
|
|
583
|
+
return cached;
|
|
584
|
+
}
|
|
585
|
+
const sourceText = text.substring(segmentRange.start, segmentRange.end);
|
|
586
|
+
const substitution = ContextualPunctuationDisplaySubstitutionFns.substituteForRole(punctuationGlyphSubstitutor, sourceText, decision.role);
|
|
587
|
+
const baseSegmentStyle = styleAt(segmentRange.start);
|
|
588
|
+
let segmentStyle = baseSegmentStyle;
|
|
589
|
+
if (decision.role.kind === "LatinText" && emphasisItalicAt(segmentRange.start)) {
|
|
590
|
+
segmentStyle = new TextStyle(ParagraphShapingStage.copyFontFamilies(baseSegmentStyle.fontFamilies), baseSegmentStyle.fontSize, baseSegmentStyle.locale, baseSegmentStyle.fontWeight, true, baseSegmentStyle.baselineShift, baseSegmentStyle.inlineAttachment);
|
|
591
|
+
}
|
|
592
|
+
const shaped = engine.textShaper.shape(new ShapingInput(text, segmentRange, segmentStyle, decision, substitution.displayText, ParagraphShapingStage.cjkPunctuationFullWidthFeatures(decision.role, substitution.displayText)));
|
|
593
|
+
let rollbackCause = null;
|
|
594
|
+
if (substitution.displayText !== sourceText) {
|
|
595
|
+
let hasUnverified = false;
|
|
596
|
+
let hasMissing = false;
|
|
597
|
+
for (let i7 = 0, count33 = shaped.decisions.length; i7 < count33; i7 += 1) {
|
|
598
|
+
const d = shaped.decisions[i7];
|
|
599
|
+
if (d.capabilityIssue === ShapingIssue.UNVERIFIED_DISPLAY_SUBSTITUTION_COVERAGE_ISSUE) {
|
|
600
|
+
hasUnverified = true;
|
|
601
|
+
}
|
|
602
|
+
if (d.missingGlyphs > 0) {
|
|
603
|
+
hasMissing = true;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (hasUnverified) {
|
|
607
|
+
rollbackCause = "SubstitutionRollbackOnUnverifiedGlyphCoverage";
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
if (hasMissing) {
|
|
611
|
+
rollbackCause = "SubstitutionRollbackOnMissingGlyph";
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
if (dashInkCoverageDeficient(shaped, substitution.displayText, segmentStyle.fontSize)) {
|
|
615
|
+
rollbackCause = "DashSubstitutionInkCoverageRollback";
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
let result = shaped;
|
|
621
|
+
if (rollbackCause !== null) {
|
|
622
|
+
putSubstitutionRollback(segmentRange, (rollbackCause));
|
|
623
|
+
result = engine.textShaper.shape(new ShapingInput(text, segmentRange, segmentStyle, decision, sourceText, ParagraphShapingStage.cjkPunctuationFullWidthFeatures(decision.role, sourceText)));
|
|
624
|
+
}
|
|
625
|
+
putCachedSegmentShaping(segmentRange, result);
|
|
626
|
+
return result;
|
|
627
|
+
};
|
|
628
|
+
const shapeSegmentWithPointMarkPrefix = (decision, segmentRange) => {
|
|
629
|
+
let prefixEnd = segmentRange.start;
|
|
630
|
+
while (prefixEnd < segmentRange.end && ClreqPunctuationPolicies.isAsciiPointMark(text.charAt(prefixEnd))) {
|
|
631
|
+
prefixEnd += 1;
|
|
632
|
+
}
|
|
633
|
+
if (prefixEnd > segmentRange.start && prefixEnd < segmentRange.end) {
|
|
634
|
+
return [shapeSegment(decision, new TextRange(segmentRange.start, prefixEnd)), shapeSegment(decision, new TextRange(prefixEnd, segmentRange.end))];
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
return [shapeSegment(decision, segmentRange)];
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
const hyphenOffsets = new Array();
|
|
641
|
+
let hyphenAdvanceOrNull = null;
|
|
642
|
+
let hyphenGlyphs = new Array();
|
|
643
|
+
const latinWordCuts = (decision, wordRange, syllable) => {
|
|
644
|
+
const count34 = syllable.length;
|
|
645
|
+
const cuts = [];
|
|
646
|
+
for (let i8 = 0; i8 < count34; i8 += 1) {
|
|
647
|
+
cuts.push(wordRange.start + syllable[i8]);
|
|
648
|
+
}
|
|
649
|
+
const relBounds = [0];
|
|
650
|
+
for (let sIdx = 0, count36 = syllable.length; sIdx < count36; sIdx += 1) {
|
|
651
|
+
const s = syllable[sIdx];
|
|
652
|
+
let exists = false;
|
|
653
|
+
for (let j2 = 0, count37 = relBounds.length; j2 < count37; j2 += 1) {
|
|
654
|
+
if (relBounds[j2] === s) {
|
|
655
|
+
exists = true;
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (!exists) {
|
|
660
|
+
relBounds.push(s);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
let lenExists = false;
|
|
664
|
+
for (let j3 = 0, count35 = relBounds.length; j3 < count35; j3 += 1) {
|
|
665
|
+
if (relBounds[j3] === wordRange.length) {
|
|
666
|
+
lenExists = true;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (!lenExists) {
|
|
671
|
+
relBounds.push(wordRange.length);
|
|
672
|
+
}
|
|
673
|
+
ParagraphShapingStage.sortInts(relBounds);
|
|
674
|
+
for (let i9 = 0, count38 = relBounds.length - 1; i9 < count38; i9 += 1) {
|
|
675
|
+
const a = relBounds[i9];
|
|
676
|
+
const b = relBounds[i9 + 1];
|
|
677
|
+
const pieceShaped = shapeSegment(decision, new TextRange(wordRange.start + a, wordRange.start + b));
|
|
678
|
+
const pieceAdvance = (pieceShaped.clusters.length === 1 ? pieceShaped.clusters[0].advance : 0.0);
|
|
679
|
+
if (pieceAdvance <= measure) {
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
const lo = a + 2;
|
|
683
|
+
const hi = b - 3;
|
|
684
|
+
let off = (lo <= hi ? lo : a + 1);
|
|
685
|
+
const endOff = (lo <= hi ? hi + 1 : b);
|
|
686
|
+
while (off < endOff) {
|
|
687
|
+
const c = wordRange.start + off;
|
|
688
|
+
let exists2 = false;
|
|
689
|
+
for (let k4 = 0, count39 = cuts.length; k4 < count39; k4 += 1) {
|
|
690
|
+
if (cuts[k4] === c) {
|
|
691
|
+
exists2 = true;
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
if (!exists2) {
|
|
696
|
+
cuts.push(c);
|
|
697
|
+
}
|
|
698
|
+
off++;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
ParagraphShapingStage.sortInts(cuts);
|
|
702
|
+
return cuts;
|
|
703
|
+
};
|
|
704
|
+
const breakOpportunityDecisions = new Array();
|
|
705
|
+
const emergencyTrackingEligibilityDecisions = new Array();
|
|
706
|
+
const registerEmergencyTrackingEligibility = (range, reason) => {
|
|
707
|
+
for (let i10 = 0, count40 = emergencyTrackingEligibilityDecisions.length; i10 < count40; i10 += 1) {
|
|
708
|
+
const d2 = emergencyTrackingEligibilityDecisions[i10];
|
|
709
|
+
if (d2.range.start === range.start && d2.range.end === range.end && d2.reason === reason) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
emergencyTrackingEligibilityDecisions.push(new EmergencyTrackingEligibilityDecisionInfo(range, text.substring(range.start, range.end), reason));
|
|
714
|
+
};
|
|
715
|
+
const progBreakKeys = new Array();
|
|
716
|
+
const progBreakValues = new Array();
|
|
717
|
+
const putProgressiveBreak = (offset, opp) => {
|
|
718
|
+
for (let i11 = 0, count41 = progBreakKeys.length; i11 < count41; i11 += 1) {
|
|
719
|
+
if (progBreakKeys[i11] === offset) {
|
|
720
|
+
const current = progBreakValues[i11];
|
|
721
|
+
if (ProgressiveBreakTierPriority.priority(opp.tier) < ProgressiveBreakTierPriority.priority(current.tier)) {
|
|
722
|
+
progBreakValues[i11] = opp;
|
|
723
|
+
}
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
progBreakKeys.push(offset);
|
|
728
|
+
progBreakValues.push(opp);
|
|
729
|
+
};
|
|
730
|
+
const latinSeparatorCuts = (tokenRange, tokenAdvance, forceOpaqueBreaks) => {
|
|
731
|
+
const token = text.substring(tokenRange.start, tokenRange.end);
|
|
732
|
+
const urlLike = ParagraphShapingStage.isUrlLikeLatinToken(token);
|
|
733
|
+
let opaque = false;
|
|
734
|
+
for (let i12 = 0, count42 = token.length; i12 < count42; i12 += 1) {
|
|
735
|
+
if (!ParagraphShapingStage.isLetter((Number.isNaN(token.charCodeAt(i12)) ? null : token.charCodeAt(i12)))) {
|
|
736
|
+
opaque = true;
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
const structuralSolidus = ParagraphShapingStage.hasBreakableLatinSolidus(token);
|
|
741
|
+
const bibliographicLocatorCuts = ParagraphShapingStage.bibliographicNumericLocatorBreakOffsets(token);
|
|
742
|
+
const opaqueSeparatorMode = urlLike || opaque && (tokenAdvance > measure || forceOpaqueBreaks);
|
|
743
|
+
const count43 = bibliographicLocatorCuts.length;
|
|
744
|
+
if (!structuralSolidus && !opaqueSeparatorMode && count43 === 0) {
|
|
745
|
+
return [];
|
|
746
|
+
}
|
|
747
|
+
const cuts2 = [];
|
|
748
|
+
for (let i13 = 0; i13 < count43; i13 += 1) {
|
|
749
|
+
cuts2.push(tokenRange.start + bibliographicLocatorCuts[i13]);
|
|
750
|
+
}
|
|
751
|
+
if (bibliographicLocatorCuts.length > 0) {
|
|
752
|
+
breakOpportunityDecisions.push(new BreakOpportunityDecisionInfo(tokenRange, token, ParagraphShapingStage.copyInts(cuts2), "BibliographicNumericLocatorBreak"));
|
|
753
|
+
}
|
|
754
|
+
for (let i14 = 0, count44 = token.length - 1; i14 < count44; i14 += 1) {
|
|
755
|
+
const breakAfter = structuralSolidus && !urlLike && (Number.isNaN(token.charCodeAt(i14)) ? null : token.charCodeAt(i14)) === 47 || opaqueSeparatorMode && ParagraphShapingStage.isLatinTokenBreakAfter(token, i14, tokenAdvance <= measure);
|
|
756
|
+
if (breakAfter) {
|
|
757
|
+
cuts2.push(tokenRange.start + i14 + 1);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return cuts2;
|
|
761
|
+
};
|
|
762
|
+
const latinOpaqueHardCuts = (decision, tokenRange, cleanCuts, forceOpaqueBreaks) => {
|
|
763
|
+
const relBounds2 = [0];
|
|
764
|
+
for (let i15 = 0, count45 = cleanCuts.length; i15 < count45; i15 += 1) {
|
|
765
|
+
const rel = cleanCuts[i15] - tokenRange.start;
|
|
766
|
+
let exists3 = false;
|
|
767
|
+
for (let j4 = 0, count47 = relBounds2.length; j4 < count47; j4 += 1) {
|
|
768
|
+
if (relBounds2[j4] === rel) {
|
|
769
|
+
exists3 = true;
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (!exists3) {
|
|
774
|
+
relBounds2.push(rel);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
let lenExists2 = false;
|
|
778
|
+
for (let j5 = 0, count46 = relBounds2.length; j5 < count46; j5 += 1) {
|
|
779
|
+
if (relBounds2[j5] === tokenRange.length) {
|
|
780
|
+
lenExists2 = true;
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
if (!lenExists2) {
|
|
785
|
+
relBounds2.push(tokenRange.length);
|
|
786
|
+
}
|
|
787
|
+
ParagraphShapingStage.sortInts(relBounds2);
|
|
788
|
+
const cuts3 = new Array();
|
|
789
|
+
for (let i16 = 0, count48 = relBounds2.length - 1; i16 < count48; i16 += 1) {
|
|
790
|
+
const a2 = relBounds2[i16];
|
|
791
|
+
const b2 = relBounds2[i16 + 1];
|
|
792
|
+
if (b2 - a2 <= 1) {
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
const pieceRange = new TextRange(tokenRange.start + a2, tokenRange.start + b2);
|
|
796
|
+
const pieceShaped2 = shapeSegment(decision, pieceRange);
|
|
797
|
+
const pieceAdvance2 = (pieceShaped2.clusters.length === 1 ? pieceShaped2.clusters[0].advance : 0.0);
|
|
798
|
+
if (pieceAdvance2 <= measure && !(forceOpaqueBreaks && b2 - a2 >= 24)) {
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
const graphemes = SourceInteractionBoundaries.sourceGraphemeBoundaries(text, pieceRange);
|
|
802
|
+
for (let g = 0, count49 = graphemes.length; g < count49; g += 1) {
|
|
803
|
+
const pos = graphemes[g];
|
|
804
|
+
if (pos > pieceRange.start && pos < pieceRange.end) {
|
|
805
|
+
let exists4 = false;
|
|
806
|
+
for (let k5 = 0, count50 = cuts3.length; k5 < count50; k5 += 1) {
|
|
807
|
+
if (cuts3[k5] === pos) {
|
|
808
|
+
exists4 = true;
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (!exists4) {
|
|
813
|
+
cuts3.push(pos);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
ParagraphShapingStage.sortInts(cuts3);
|
|
819
|
+
return cuts3;
|
|
820
|
+
};
|
|
821
|
+
const getInlineObject = (range) => {
|
|
822
|
+
if (inlineObjectByRange === null) {
|
|
823
|
+
return null;
|
|
824
|
+
}
|
|
825
|
+
for (let i17 = 0, count51 = inlineObjectByRange.size(); i17 < count51; i17 += 1) {
|
|
826
|
+
const k6 = inlineObjectByRange.keyAt(i17);
|
|
827
|
+
if (k6.start === range.start && k6.end === range.end) {
|
|
828
|
+
return inlineObjectByRange.valueAt(i17);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return null;
|
|
832
|
+
};
|
|
833
|
+
const getFontDecision = (range) => {
|
|
834
|
+
if (fontDecisionByRange === null) {
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
for (let i18 = 0, count52 = fontDecisionByRange.size(); i18 < count52; i18 += 1) {
|
|
838
|
+
const k7 = fontDecisionByRange.keyAt(i18);
|
|
839
|
+
if (k7.start === range.start && k7.end === range.end) {
|
|
840
|
+
return fontDecisionByRange.valueAt(i18);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
return null;
|
|
844
|
+
};
|
|
845
|
+
const getRejectedTiers = (range) => {
|
|
846
|
+
if (rejectedTechnicalTiersBySpan === null) {
|
|
847
|
+
return null;
|
|
848
|
+
}
|
|
849
|
+
for (let i19 = 0, count53 = rejectedTechnicalTiersBySpan.size(); i19 < count53; i19 += 1) {
|
|
850
|
+
const k8 = rejectedTechnicalTiersBySpan.keyAt(i19);
|
|
851
|
+
if (k8.start === range.start && k8.end === range.end) {
|
|
852
|
+
return rejectedTechnicalTiersBySpan.valueAt(i19);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return null;
|
|
856
|
+
};
|
|
857
|
+
const spanAdvanceCacheKeys = new Array();
|
|
858
|
+
const spanAdvanceCacheValues = new Array();
|
|
859
|
+
const progressiveSpanAdvance = (spanRange) => {
|
|
860
|
+
for (let i20 = 0, count54 = spanAdvanceCacheKeys.length; i20 < count54; i20 += 1) {
|
|
861
|
+
const k9 = spanAdvanceCacheKeys[i20];
|
|
862
|
+
if (k9.start === spanRange.start && k9.end === spanRange.end) {
|
|
863
|
+
return spanAdvanceCacheValues[i20];
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const advanceTerms = [];
|
|
867
|
+
for (let crIdx = 0, count55 = clusterRanges.length; crIdx < count55; crIdx += 1) {
|
|
868
|
+
const resolvedRange = clusterRanges[crIdx];
|
|
869
|
+
if (resolvedRange.mandatoryBreak || resolvedRange.zeroWidthSoftBreak || getInlineObject(resolvedRange.range) !== null) {
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
872
|
+
const decision = getFontDecision(resolvedRange.range);
|
|
873
|
+
if (decision === null) {
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
const candidates = ParagraphShapingStage.shapingSegments((decision), text);
|
|
877
|
+
for (let cIdx = 0, count56 = candidates.length; cIdx < count56; cIdx += 1) {
|
|
878
|
+
const candidate = candidates[cIdx];
|
|
879
|
+
const start = (candidate.start > spanRange.start ? candidate.start : spanRange.start);
|
|
880
|
+
const end = (candidate.end < spanRange.end ? candidate.end : spanRange.end);
|
|
881
|
+
if (start < end) {
|
|
882
|
+
const pieceShaped3 = shapeSegment((decision), new TextRange(start, end));
|
|
883
|
+
for (let clIdx = 0, count57 = pieceShaped3.clusters.length; clIdx < count57; clIdx += 1) {
|
|
884
|
+
advanceTerms.push(pieceShaped3.clusters[clIdx].advance);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
const totalAdvance = AccurateSum.of(advanceTerms);
|
|
890
|
+
spanAdvanceCacheKeys.push(spanRange);
|
|
891
|
+
spanAdvanceCacheValues.push(totalAdvance);
|
|
892
|
+
return totalAdvance;
|
|
893
|
+
};
|
|
894
|
+
const shapingResults = new Array();
|
|
895
|
+
for (let crIdx2 = 0, count21 = clusterRanges.length; crIdx2 < count21; crIdx2 += 1) {
|
|
896
|
+
const resolvedRange2 = clusterRanges[crIdx2];
|
|
897
|
+
const inlineObj = getInlineObject(resolvedRange2.range);
|
|
898
|
+
if (inlineObj !== null) {
|
|
899
|
+
shapingResults.push(ParagraphShapingStage.inlineObjectShapingResult(text, (inlineObj)));
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
if (resolvedRange2.mandatoryBreak) {
|
|
903
|
+
shapingResults.push(ParagraphShapingStage.mandatoryBreakShapingResult(text, resolvedRange2.range));
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
if (resolvedRange2.zeroWidthSoftBreak) {
|
|
907
|
+
shapingResults.push(ParagraphShapingStage.zeroWidthSoftBreakShapingResult(text, resolvedRange2.range));
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
let decision2 = getFontDecision(resolvedRange2.range);
|
|
911
|
+
if (decision2 === null) {
|
|
912
|
+
decision2 = engine.fallbackResolver.resolve(text, resolvedRange2.range, new FontRequest(input.textStyle.fontFamilies, input.textStyle.locale, resolvedRange2.role));
|
|
913
|
+
}
|
|
914
|
+
const segments = ParagraphShapingStage.shapingSegments((decision2), text);
|
|
915
|
+
for (let segIdx = 0, count58 = segments.length; segIdx < count58; segIdx += 1) {
|
|
916
|
+
const segmentRange = segments[segIdx];
|
|
917
|
+
const shaped2 = shapeSegment((decision2), segmentRange);
|
|
918
|
+
const isLatin = decision2.role.kind === "LatinText" && segmentRange.length > 0;
|
|
919
|
+
const w = (isLatin ? text.substring(segmentRange.start, segmentRange.end) : "");
|
|
920
|
+
let progressiveSpan = null;
|
|
921
|
+
for (let sIdx2 = 0, count64 = input.content.lineBreakSpans.length; sIdx2 < count64; sIdx2 += 1) {
|
|
922
|
+
const s2 = input.content.lineBreakSpans[sIdx2];
|
|
923
|
+
if (s2.policy.kind === "ProgressiveTechnical" && segmentRange.start >= s2.range.start && segmentRange.end <= s2.range.end) {
|
|
924
|
+
progressiveSpan = s2;
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
let allLetters = isLatin && w.length > 0;
|
|
929
|
+
if (isLatin) {
|
|
930
|
+
for (let cIdx2 = 0, count65 = w.length; cIdx2 < count65; cIdx2 += 1) {
|
|
931
|
+
if (!ParagraphShapingStage.isLetter((Number.isNaN(w.charCodeAt(cIdx2)) ? null : w.charCodeAt(cIdx2)))) {
|
|
932
|
+
allLetters = false;
|
|
933
|
+
break;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
let isAllCaps = allLetters && w.length >= 2;
|
|
938
|
+
if (isAllCaps) {
|
|
939
|
+
for (let cIdx3 = 0, count66 = w.length; cIdx3 < count66; cIdx3 += 1) {
|
|
940
|
+
if (ParagraphShapingStage.isLowerCase((Number.isNaN(w.charCodeAt(cIdx3)) ? null : w.charCodeAt(cIdx3)))) {
|
|
941
|
+
isAllCaps = false;
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
const isAbbreviation = isAllCaps && w.length < 24;
|
|
947
|
+
let hasInternalUpper = false;
|
|
948
|
+
if (allLetters && !isAllCaps && !isAbbreviation) {
|
|
949
|
+
for (let cIdx4 = 1, count67 = w.length; cIdx4 < count67; cIdx4 += 1) {
|
|
950
|
+
if (ParagraphShapingStage.isUpperCase((Number.isNaN(w.charCodeAt(cIdx4)) ? null : w.charCodeAt(cIdx4)))) {
|
|
951
|
+
hasInternalUpper = true;
|
|
952
|
+
break;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
const isCamelCase = allLetters && !isAllCaps && !isAbbreviation && hasInternalUpper;
|
|
957
|
+
const tokenTerms = [];
|
|
958
|
+
for (let clIdx2 = 0, count68 = shaped2.clusters.length; clIdx2 < count68; clIdx2 += 1) {
|
|
959
|
+
tokenTerms.push(shaped2.clusters[clIdx2].advance);
|
|
960
|
+
}
|
|
961
|
+
const tokenAdvance = AccurateSum.of(tokenTerms);
|
|
962
|
+
const strongReason = (isLatin ? ParagraphShapingStage.strongNonLexicalReason(w) : null);
|
|
963
|
+
let syllableCuts = new Array();
|
|
964
|
+
if (allLetters && !isAbbreviation && !isCamelCase && w.indexOf("-") < 0 && strongReason === null) {
|
|
965
|
+
const hyphenPoints = engine.hyphenator.hyphenate(w);
|
|
966
|
+
const uniquePoints = new Array();
|
|
967
|
+
for (let p = 0, count69 = hyphenPoints.length; p < count69; p += 1) {
|
|
968
|
+
const pt = hyphenPoints[p];
|
|
969
|
+
let exists5 = false;
|
|
970
|
+
for (let q = 0, count70 = uniquePoints.length; q < count70; q += 1) {
|
|
971
|
+
if (uniquePoints[q] === pt) {
|
|
972
|
+
exists5 = true;
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
if (!exists5) {
|
|
977
|
+
uniquePoints.push(pt);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
ParagraphShapingStage.sortInts(uniquePoints);
|
|
981
|
+
syllableCuts = uniquePoints;
|
|
982
|
+
}
|
|
983
|
+
let longestUnhyphenatedLetterPiece = 0;
|
|
984
|
+
if (allLetters) {
|
|
985
|
+
const bounds = [0];
|
|
986
|
+
for (let p2 = 0, count71 = syllableCuts.length; p2 < count71; p2 += 1) {
|
|
987
|
+
bounds.push(syllableCuts[p2]);
|
|
988
|
+
}
|
|
989
|
+
bounds.push(w.length);
|
|
990
|
+
let maxLen = 0;
|
|
991
|
+
for (let p3 = 0, count72 = bounds.length - 1; p3 < count72; p3 += 1) {
|
|
992
|
+
const diff = bounds[p3 + 1] - bounds[p3];
|
|
993
|
+
if (diff > maxLen) {
|
|
994
|
+
maxLen = diff;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
longestUnhyphenatedLetterPiece = maxLen;
|
|
998
|
+
}
|
|
999
|
+
const isLongUnhyphenatedLetterToken = allLetters && !isAbbreviation && !isCamelCase && longestUnhyphenatedLetterPiece >= 24;
|
|
1000
|
+
const isLongOpaqueLatinToken = strongReason !== null || isLongUnhyphenatedLetterToken || isLatin && !allLetters && w.length >= 24;
|
|
1001
|
+
let technicalStructuralCuts = new Array();
|
|
1002
|
+
if (progressiveSpan !== null && isLatin) {
|
|
1003
|
+
const cutsSet = new Array();
|
|
1004
|
+
const cc = ParagraphShapingStage.camelCaseCuts(text, segmentRange);
|
|
1005
|
+
for (let c2 = 0, count73 = cc.length; c2 < count73; c2 += 1) {
|
|
1006
|
+
cutsSet.push(cc[c2]);
|
|
1007
|
+
}
|
|
1008
|
+
const at = ParagraphShapingStage.alphaNumericTransitionCuts(text, segmentRange);
|
|
1009
|
+
for (let c3 = 0, count74 = at.length; c3 < count74; c3 += 1) {
|
|
1010
|
+
const v = at[c3];
|
|
1011
|
+
let exists6 = false;
|
|
1012
|
+
for (let q2 = 0, count75 = cutsSet.length; q2 < count75; q2 += 1) {
|
|
1013
|
+
if (cutsSet[q2] === v) {
|
|
1014
|
+
exists6 = true;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
if (!exists6) {
|
|
1019
|
+
cutsSet.push(v);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
for (let i21 = 0, count76 = w.length - 1; i21 < count76; i21 += 1) {
|
|
1023
|
+
if (ParagraphShapingStage.isProgressiveTechnicalBreakAfterChar((Number.isNaN(w.charCodeAt(i21)) ? null : w.charCodeAt(i21)))) {
|
|
1024
|
+
const v2 = segmentRange.start + i21 + 1;
|
|
1025
|
+
let exists7 = false;
|
|
1026
|
+
for (let q3 = 0, count77 = cutsSet.length; q3 < count77; q3 += 1) {
|
|
1027
|
+
if (cutsSet[q3] === v2) {
|
|
1028
|
+
exists7 = true;
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
if (!exists7) {
|
|
1033
|
+
cutsSet.push(v2);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
ParagraphShapingStage.sortInts(cutsSet);
|
|
1038
|
+
technicalStructuralCuts = cutsSet;
|
|
1039
|
+
}
|
|
1040
|
+
let rawTechnicalSyllableCuts = new Array();
|
|
1041
|
+
if (progressiveSpan !== null && isLatin) {
|
|
1042
|
+
const preferredBounds = [segmentRange.start];
|
|
1043
|
+
for (let c4 = 0, count78 = technicalStructuralCuts.length; c4 < count78; c4 += 1) {
|
|
1044
|
+
preferredBounds.push(technicalStructuralCuts[c4]);
|
|
1045
|
+
}
|
|
1046
|
+
preferredBounds.push(segmentRange.end);
|
|
1047
|
+
const uniqueBounds = new Array();
|
|
1048
|
+
for (let p4 = 0, count79 = preferredBounds.length; p4 < count79; p4 += 1) {
|
|
1049
|
+
const pt2 = preferredBounds[p4];
|
|
1050
|
+
let exists8 = false;
|
|
1051
|
+
for (let q4 = 0, count81 = uniqueBounds.length; q4 < count81; q4 += 1) {
|
|
1052
|
+
if (uniqueBounds[q4] === pt2) {
|
|
1053
|
+
exists8 = true;
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
if (!exists8) {
|
|
1058
|
+
uniqueBounds.push(pt2);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
ParagraphShapingStage.sortInts(uniqueBounds);
|
|
1062
|
+
const cutsList = new Array();
|
|
1063
|
+
for (let p5 = 0, count82 = uniqueBounds.length - 1; p5 < count82; p5 += 1) {
|
|
1064
|
+
const pieceStart = uniqueBounds[p5];
|
|
1065
|
+
const pieceEnd = uniqueBounds[p5 + 1];
|
|
1066
|
+
const piece = text.substring(pieceStart, pieceEnd);
|
|
1067
|
+
if (ParagraphShapingStage.strongNonLexicalReason(piece) !== null) {
|
|
1068
|
+
continue;
|
|
1069
|
+
}
|
|
1070
|
+
let runStart = pieceStart;
|
|
1071
|
+
while (runStart < pieceEnd) {
|
|
1072
|
+
while (runStart < pieceEnd && !ParagraphShapingStage.isLetter((Number.isNaN(text.charCodeAt(runStart)) ? null : text.charCodeAt(runStart)))) {
|
|
1073
|
+
runStart++;
|
|
1074
|
+
}
|
|
1075
|
+
let runEnd = runStart;
|
|
1076
|
+
while (runEnd < pieceEnd && ParagraphShapingStage.isLetter((Number.isNaN(text.charCodeAt(runEnd)) ? null : text.charCodeAt(runEnd)))) {
|
|
1077
|
+
runEnd++;
|
|
1078
|
+
}
|
|
1079
|
+
if (runEnd > runStart) {
|
|
1080
|
+
const word = text.substring(runStart, runEnd);
|
|
1081
|
+
const wordHyphs = engine.hyphenator.hyphenate(word);
|
|
1082
|
+
for (let h = 0, count83 = wordHyphs.length; h < count83; h += 1) {
|
|
1083
|
+
const off2 = wordHyphs[h];
|
|
1084
|
+
if (off2 >= 1 && off2 < word.length) {
|
|
1085
|
+
cutsList.push(runStart + off2);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
runStart = (runEnd > runStart ? runEnd : runStart + 1);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
const uniqueCuts = new Array();
|
|
1093
|
+
for (let p6 = 0, count80 = cutsList.length; p6 < count80; p6 += 1) {
|
|
1094
|
+
const pt3 = cutsList[p6];
|
|
1095
|
+
let exists9 = false;
|
|
1096
|
+
for (let q5 = 0, count84 = uniqueCuts.length; q5 < count84; q5 += 1) {
|
|
1097
|
+
if (uniqueCuts[q5] === pt3) {
|
|
1098
|
+
exists9 = true;
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
if (!exists9) {
|
|
1103
|
+
uniqueCuts.push(pt3);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
ParagraphShapingStage.sortInts(uniqueCuts);
|
|
1107
|
+
rawTechnicalSyllableCuts = uniqueCuts;
|
|
1108
|
+
}
|
|
1109
|
+
const technicalSyllableCuts = new Array();
|
|
1110
|
+
for (let i22 = 0, count59 = rawTechnicalSyllableCuts.length; i22 < count59; i22 += 1) {
|
|
1111
|
+
const cut = rawTechnicalSyllableCuts[i22];
|
|
1112
|
+
let inStructural = false;
|
|
1113
|
+
for (let j6 = 0, count85 = technicalStructuralCuts.length; j6 < count85; j6 += 1) {
|
|
1114
|
+
if (technicalStructuralCuts[j6] === cut) {
|
|
1115
|
+
inStructural = true;
|
|
1116
|
+
break;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
if (!inStructural) {
|
|
1120
|
+
technicalSyllableCuts.push(cut);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
let technicalEmergencyCuts = new Array();
|
|
1124
|
+
if (progressiveSpan !== null && isLatin) {
|
|
1125
|
+
const rejectedTiers = getRejectedTiers(progressiveSpan.range);
|
|
1126
|
+
const exposedForCurrentLine = rejectedTiers !== null && rejectedTiers.size() > 0;
|
|
1127
|
+
const preferredBounds2 = [segmentRange.start];
|
|
1128
|
+
for (let c5 = 0, count86 = technicalStructuralCuts.length; c5 < count86; c5 += 1) {
|
|
1129
|
+
preferredBounds2.push(technicalStructuralCuts[c5]);
|
|
1130
|
+
}
|
|
1131
|
+
for (let c6 = 0, count87 = technicalSyllableCuts.length; c6 < count87; c6 += 1) {
|
|
1132
|
+
preferredBounds2.push(technicalSyllableCuts[c6]);
|
|
1133
|
+
}
|
|
1134
|
+
preferredBounds2.push(segmentRange.end);
|
|
1135
|
+
const uniqueBounds2 = new Array();
|
|
1136
|
+
for (let p7 = 0, count88 = preferredBounds2.length; p7 < count88; p7 += 1) {
|
|
1137
|
+
const pt4 = preferredBounds2[p7];
|
|
1138
|
+
let exists10 = false;
|
|
1139
|
+
for (let q6 = 0, count92 = uniqueBounds2.length; q6 < count92; q6 += 1) {
|
|
1140
|
+
if (uniqueBounds2[q6] === pt4) {
|
|
1141
|
+
exists10 = true;
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
if (!exists10) {
|
|
1146
|
+
uniqueBounds2.push(pt4);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
ParagraphShapingStage.sortInts(uniqueBounds2);
|
|
1150
|
+
const interiorEmergencyCuts = new Array();
|
|
1151
|
+
for (let p8 = 0, count93 = uniqueBounds2.length - 1; p8 < count93; p8 += 1) {
|
|
1152
|
+
const pStart = uniqueBounds2[p8];
|
|
1153
|
+
const pEnd = uniqueBounds2[p8 + 1];
|
|
1154
|
+
const pieceRange2 = new TextRange(pStart, pEnd);
|
|
1155
|
+
const pieceShaped4 = shapeSegment((decision2), pieceRange2);
|
|
1156
|
+
const pieceTerms = [];
|
|
1157
|
+
for (let clIdx3 = 0, count94 = pieceShaped4.clusters.length; clIdx3 < count94; clIdx3 += 1) {
|
|
1158
|
+
pieceTerms.push(pieceShaped4.clusters[clIdx3].advance);
|
|
1159
|
+
}
|
|
1160
|
+
const pieceAdvance3 = AccurateSum.of(pieceTerms);
|
|
1161
|
+
if (!exposedForCurrentLine && pieceAdvance3 <= measure && progressiveSpanAdvance(progressiveSpan.range) <= measure) {
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
const graphemes2 = SourceInteractionBoundaries.sourceGraphemeBoundaries(text, pieceRange2);
|
|
1165
|
+
for (let g2 = 0, count95 = graphemes2.length; g2 < count95; g2 += 1) {
|
|
1166
|
+
const pt5 = graphemes2[g2];
|
|
1167
|
+
if (pt5 > pStart && pt5 < pEnd) {
|
|
1168
|
+
interiorEmergencyCuts.push(pt5);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
const rejectedCleanBoundaries = new Array();
|
|
1174
|
+
if (rejectedTiers !== null) {
|
|
1175
|
+
if (rejectedTiers.has(ProgressiveBreakTierPriority.priority(ProgressiveBreakTier.Structural))) {
|
|
1176
|
+
for (let c7 = 0, count96 = technicalStructuralCuts.length; c7 < count96; c7 += 1) {
|
|
1177
|
+
rejectedCleanBoundaries.push(technicalStructuralCuts[c7]);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
if (rejectedTiers.has(ProgressiveBreakTierPriority.priority(ProgressiveBreakTier.Syllable))) {
|
|
1181
|
+
for (let c8 = 0, count97 = technicalSyllableCuts.length; c8 < count97; c8 += 1) {
|
|
1182
|
+
rejectedCleanBoundaries.push(technicalSyllableCuts[c8]);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
const count89 = interiorEmergencyCuts.length;
|
|
1187
|
+
const combined = [];
|
|
1188
|
+
for (let c9 = 0; c9 < count89; c9 += 1) {
|
|
1189
|
+
combined.push(interiorEmergencyCuts[c9]);
|
|
1190
|
+
}
|
|
1191
|
+
for (let c10 = 0, count90 = rejectedCleanBoundaries.length; c10 < count90; c10 += 1) {
|
|
1192
|
+
combined.push(rejectedCleanBoundaries[c10]);
|
|
1193
|
+
}
|
|
1194
|
+
const uniqueCombined = new Array();
|
|
1195
|
+
for (let p9 = 0, count91 = combined.length; p9 < count91; p9 += 1) {
|
|
1196
|
+
const pt6 = combined[p9];
|
|
1197
|
+
let exists11 = false;
|
|
1198
|
+
for (let q7 = 0, count98 = uniqueCombined.length; q7 < count98; q7 += 1) {
|
|
1199
|
+
if (uniqueCombined[q7] === pt6) {
|
|
1200
|
+
exists11 = true;
|
|
1201
|
+
break;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
if (!exists11) {
|
|
1205
|
+
uniqueCombined.push(pt6);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
ParagraphShapingStage.sortInts(uniqueCombined);
|
|
1209
|
+
technicalEmergencyCuts = uniqueCombined;
|
|
1210
|
+
}
|
|
1211
|
+
if (progressiveSpan !== null) {
|
|
1212
|
+
if (technicalEmergencyCuts.length > 0) {
|
|
1213
|
+
const rej = getRejectedTiers(progressiveSpan.range);
|
|
1214
|
+
let reason = "ProgressiveTechnicalSpan";
|
|
1215
|
+
if (rej !== null && rej.size() > 0) {
|
|
1216
|
+
const tiers = [];
|
|
1217
|
+
for (let i23 = 0; i23 < rej.size(); i23 += 1) {
|
|
1218
|
+
tiers.push(rej.at(i23));
|
|
1219
|
+
}
|
|
1220
|
+
let tIdx = 1;
|
|
1221
|
+
while (tIdx < tiers.length) {
|
|
1222
|
+
const curr = tiers[tIdx];
|
|
1223
|
+
let j7 = tIdx - 1;
|
|
1224
|
+
while (j7 >= 0 && tiers[j7] > curr) {
|
|
1225
|
+
tiers[j7 + 1] = tiers[j7];
|
|
1226
|
+
j7--;
|
|
1227
|
+
}
|
|
1228
|
+
tiers[j7 + 1] = curr;
|
|
1229
|
+
tIdx++;
|
|
1230
|
+
}
|
|
1231
|
+
let joined = "";
|
|
1232
|
+
for (let i24 = 0, count99 = tiers.length; i24 < count99; i24 += 1) {
|
|
1233
|
+
if (i24 > 0) {
|
|
1234
|
+
joined += "+";
|
|
1235
|
+
}
|
|
1236
|
+
joined += ParagraphShapingStage.tierName(ProgressiveBreakTierPriority.fromPriority(tiers[i24]));
|
|
1237
|
+
}
|
|
1238
|
+
reason = `CurrentLineTechnicalTierRejection:${joined}`;
|
|
1239
|
+
}
|
|
1240
|
+
registerEmergencyTrackingEligibility(progressiveSpan.range, reason);
|
|
1241
|
+
}
|
|
1242
|
+
const tierArrays = [technicalStructuralCuts, technicalSyllableCuts, technicalEmergencyCuts];
|
|
1243
|
+
const tierTypes = [ProgressiveBreakTier.Structural, ProgressiveBreakTier.Syllable, ProgressiveBreakTier.Emergency];
|
|
1244
|
+
for (let tIdx2 = 0; tIdx2 < 3; tIdx2 += 1) {
|
|
1245
|
+
const tier = tierTypes[tIdx2];
|
|
1246
|
+
const offsets = tierArrays[tIdx2];
|
|
1247
|
+
const rej2 = getRejectedTiers(progressiveSpan.range);
|
|
1248
|
+
if (rej2 !== null && rej2.has(ProgressiveBreakTierPriority.priority(tier))) {
|
|
1249
|
+
continue;
|
|
1250
|
+
}
|
|
1251
|
+
const uniqueOffsets = new Array();
|
|
1252
|
+
for (let p10 = 0, count100 = offsets.length; p10 < count100; p10 += 1) {
|
|
1253
|
+
const pt7 = offsets[p10];
|
|
1254
|
+
let exists12 = false;
|
|
1255
|
+
for (let q8 = 0, count102 = uniqueOffsets.length; q8 < count102; q8 += 1) {
|
|
1256
|
+
if (uniqueOffsets[q8] === pt7) {
|
|
1257
|
+
exists12 = true;
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if (!exists12) {
|
|
1262
|
+
uniqueOffsets.push(pt7);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
ParagraphShapingStage.sortInts(uniqueOffsets);
|
|
1266
|
+
const count101 = uniqueOffsets.length;
|
|
1267
|
+
if (count101 > 0) {
|
|
1268
|
+
const rejNotEmpty = rej2 !== null && rej2.size() > 0;
|
|
1269
|
+
const breakReason = (tier.kind === "Emergency" && rejNotEmpty ? "CurrentLineTechnicalEmergencyBreak" : "ProgressiveTechnicalBreak");
|
|
1270
|
+
breakOpportunityDecisions.push(new BreakOpportunityDecisionInfo(segmentRange, w, ParagraphShapingStage.copyInts(uniqueOffsets), breakReason, ParagraphShapingStage.tierName(tier)));
|
|
1271
|
+
}
|
|
1272
|
+
for (let oIdx = 0; oIdx < count101; oIdx += 1) {
|
|
1273
|
+
const offset = uniqueOffsets[oIdx];
|
|
1274
|
+
putProgressiveBreak(offset, new ProgressiveBreakOpportunity(tier, progressiveSpan.range));
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
let boundaryTier = ProgressiveBreakTier.WholeToken;
|
|
1278
|
+
if (segmentRange.start > progressiveSpan.range.start && ParagraphShapingStage.isWhitespace(readUnit(text, segmentRange.start - 1))) {
|
|
1279
|
+
boundaryTier = ProgressiveBreakTier.Whitespace;
|
|
1280
|
+
}
|
|
1281
|
+
const rej3 = getRejectedTiers(progressiveSpan.range);
|
|
1282
|
+
if (rej3 === null || !rej3.has(ProgressiveBreakTierPriority.priority(boundaryTier))) {
|
|
1283
|
+
const wholeToken = new ProgressiveBreakOpportunity(boundaryTier, progressiveSpan.range);
|
|
1284
|
+
putProgressiveBreak(segmentRange.start, wholeToken);
|
|
1285
|
+
const wrapReason = (boundaryTier.kind === "Whitespace" ? "ProgressiveTechnicalWhitespaceBreak" : "ProgressiveTechnicalWholeTokenWrap");
|
|
1286
|
+
breakOpportunityDecisions.push(new BreakOpportunityDecisionInfo(segmentRange, w, [segmentRange.start], wrapReason, ParagraphShapingStage.tierName(boundaryTier)));
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
let cleanCuts = new Array();
|
|
1290
|
+
if (progressiveSpan !== null) {
|
|
1291
|
+
for (let c11 = 0, count103 = technicalStructuralCuts.length; c11 < count103; c11 += 1) {
|
|
1292
|
+
cleanCuts.push(technicalStructuralCuts[c11]);
|
|
1293
|
+
}
|
|
1294
|
+
for (let c12 = 0, count104 = technicalSyllableCuts.length; c12 < count104; c12 += 1) {
|
|
1295
|
+
cleanCuts.push(technicalSyllableCuts[c12]);
|
|
1296
|
+
}
|
|
1297
|
+
for (let c13 = 0, count105 = technicalEmergencyCuts.length; c13 < count105; c13 += 1) {
|
|
1298
|
+
cleanCuts.push(technicalEmergencyCuts[c13]);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
if (!isLatin) {
|
|
1303
|
+
}
|
|
1304
|
+
else {
|
|
1305
|
+
if (w.indexOf("-") >= 0) {
|
|
1306
|
+
const existing = ParagraphShapingStage.existingHyphenCuts(text, segmentRange);
|
|
1307
|
+
for (let c14 = 0, count106 = existing.length; c14 < count106; c14 += 1) {
|
|
1308
|
+
cleanCuts.push(existing[c14]);
|
|
1309
|
+
}
|
|
1310
|
+
const sep = latinSeparatorCuts(segmentRange, tokenAdvance, isLongOpaqueLatinToken);
|
|
1311
|
+
for (let c15 = 0, count107 = sep.length; c15 < count107; c15 += 1) {
|
|
1312
|
+
cleanCuts.push(sep[c15]);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
else {
|
|
1316
|
+
if (isCamelCase) {
|
|
1317
|
+
cleanCuts = ParagraphShapingStage.camelCaseCuts(text, segmentRange);
|
|
1318
|
+
}
|
|
1319
|
+
else {
|
|
1320
|
+
if (!allLetters) {
|
|
1321
|
+
cleanCuts = latinSeparatorCuts(segmentRange, tokenAdvance, isLongOpaqueLatinToken);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
let hyphenCuts = new Array();
|
|
1328
|
+
const count60 = cleanCuts.length;
|
|
1329
|
+
if (progressiveSpan === null && allLetters && !isAbbreviation && !isCamelCase && !isLongUnhyphenatedLetterToken && w.indexOf("-") < 0 && count60 === 0) {
|
|
1330
|
+
hyphenCuts = latinWordCuts((decision2), segmentRange, syllableCuts);
|
|
1331
|
+
}
|
|
1332
|
+
let opaqueHardCuts = new Array();
|
|
1333
|
+
if (progressiveSpan === null && isLatin && (!allLetters || isLongUnhyphenatedLetterToken) && (tokenAdvance > measure || isLongOpaqueLatinToken)) {
|
|
1334
|
+
opaqueHardCuts = latinOpaqueHardCuts((decision2), segmentRange, cleanCuts, isLongOpaqueLatinToken);
|
|
1335
|
+
}
|
|
1336
|
+
const count62 = opaqueHardCuts.length;
|
|
1337
|
+
if (progressiveSpan === null && count62 > 0) {
|
|
1338
|
+
const cleanBounds = [segmentRange.start];
|
|
1339
|
+
for (let c16 = 0, count108 = cleanCuts.length; c16 < count108; c16 += 1) {
|
|
1340
|
+
cleanBounds.push(cleanCuts[c16]);
|
|
1341
|
+
}
|
|
1342
|
+
cleanBounds.push(segmentRange.end);
|
|
1343
|
+
const uniqueBounds3 = new Array();
|
|
1344
|
+
for (let p11 = 0, count109 = cleanBounds.length; p11 < count109; p11 += 1) {
|
|
1345
|
+
const pt8 = cleanBounds[p11];
|
|
1346
|
+
let exists13 = false;
|
|
1347
|
+
for (let q9 = 0, count110 = uniqueBounds3.length; q9 < count110; q9 += 1) {
|
|
1348
|
+
if (uniqueBounds3[q9] === pt8) {
|
|
1349
|
+
exists13 = true;
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
if (!exists13) {
|
|
1354
|
+
uniqueBounds3.push(pt8);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
ParagraphShapingStage.sortInts(uniqueBounds3);
|
|
1358
|
+
for (let p12 = 0, count111 = uniqueBounds3.length - 1; p12 < count111; p12 += 1) {
|
|
1359
|
+
const pieceStart2 = uniqueBounds3[p12];
|
|
1360
|
+
const pieceEnd2 = uniqueBounds3[p12 + 1];
|
|
1361
|
+
let hasPieceHardCuts = false;
|
|
1362
|
+
for (let k10 = 0, count112 = opaqueHardCuts.length; k10 < count112; k10 += 1) {
|
|
1363
|
+
const cut2 = opaqueHardCuts[k10];
|
|
1364
|
+
if (cut2 > pieceStart2 && cut2 < pieceEnd2) {
|
|
1365
|
+
hasPieceHardCuts = true;
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
if (!hasPieceHardCuts) {
|
|
1370
|
+
continue;
|
|
1371
|
+
}
|
|
1372
|
+
const pieceRange3 = new TextRange(pieceStart2, pieceEnd2);
|
|
1373
|
+
const pieceReason = ParagraphShapingStage.strongNonLexicalReason(text.substring(pieceStart2, pieceEnd2));
|
|
1374
|
+
if (pieceReason !== null) {
|
|
1375
|
+
registerEmergencyTrackingEligibility(pieceRange3, (pieceReason));
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
const allCutsCombined = [];
|
|
1380
|
+
for (let c17 = 0; c17 < count60; c17 += 1) {
|
|
1381
|
+
allCutsCombined.push(cleanCuts[c17]);
|
|
1382
|
+
}
|
|
1383
|
+
for (let c18 = 0, count61 = hyphenCuts.length; c18 < count61; c18 += 1) {
|
|
1384
|
+
allCutsCombined.push(hyphenCuts[c18]);
|
|
1385
|
+
}
|
|
1386
|
+
for (let c19 = 0, count113 = opaqueHardCuts.length; c19 < count113; c19 += 1) {
|
|
1387
|
+
allCutsCombined.push(opaqueHardCuts[c19]);
|
|
1388
|
+
}
|
|
1389
|
+
const allCuts = new Array();
|
|
1390
|
+
for (let p13 = 0, count63 = allCutsCombined.length; p13 < count63; p13 += 1) {
|
|
1391
|
+
const pt9 = allCutsCombined[p13];
|
|
1392
|
+
let exists14 = false;
|
|
1393
|
+
for (let q10 = 0, count114 = allCuts.length; q10 < count114; q10 += 1) {
|
|
1394
|
+
if (allCuts[q10] === pt9) {
|
|
1395
|
+
exists14 = true;
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
if (!exists14) {
|
|
1400
|
+
allCuts.push(pt9);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
ParagraphShapingStage.sortInts(allCuts);
|
|
1404
|
+
if (allCuts.length === 0) {
|
|
1405
|
+
shapingResults.push(shaped2);
|
|
1406
|
+
}
|
|
1407
|
+
else {
|
|
1408
|
+
if (hyphenCuts.length > 0) {
|
|
1409
|
+
for (let c20 = 0, count116 = hyphenCuts.length; c20 < count116; c20 += 1) {
|
|
1410
|
+
const cut3 = hyphenCuts[c20];
|
|
1411
|
+
let exists15 = false;
|
|
1412
|
+
for (let q11 = 0, count117 = hyphenOffsets.length; q11 < count117; q11 += 1) {
|
|
1413
|
+
if (hyphenOffsets[q11] === cut3) {
|
|
1414
|
+
exists15 = true;
|
|
1415
|
+
break;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
if (!exists15) {
|
|
1419
|
+
hyphenOffsets.push(cut3);
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
if (hyphenAdvanceOrNull === null) {
|
|
1423
|
+
const hyphenShaped = engine.textShaper.shape(new ShapingInput("-", new TextRange(0, 1), input.textStyle, (decision2), "-", []));
|
|
1424
|
+
hyphenAdvanceOrNull = (hyphenShaped.clusters.length === 1 ? hyphenShaped.clusters[0].advance : 0.5 * fontSize);
|
|
1425
|
+
hyphenGlyphs = new Array();
|
|
1426
|
+
for (let r2 = 0, count118 = hyphenShaped.glyphRuns.length; r2 < count118; r2 += 1) {
|
|
1427
|
+
const run = hyphenShaped.glyphRuns[r2];
|
|
1428
|
+
for (let g3 = 0, count119 = run.glyphs.length; g3 < count119; g3 += 1) {
|
|
1429
|
+
hyphenGlyphs.push(run.glyphs[g3]);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
const bounds2 = [segmentRange.start];
|
|
1435
|
+
for (let c21 = 0, count115 = allCuts.length; c21 < count115; c21 += 1) {
|
|
1436
|
+
bounds2.push(allCuts[c21]);
|
|
1437
|
+
}
|
|
1438
|
+
bounds2.push(segmentRange.end);
|
|
1439
|
+
for (let k11 = 0, count120 = bounds2.length - 1; k11 < count120; k11 += 1) {
|
|
1440
|
+
const pieces = shapeSegmentWithPointMarkPrefix((decision2), new TextRange(bounds2[k11], bounds2[k11 + 1]));
|
|
1441
|
+
for (let p14 = 0, count121 = pieces.length; p14 < count121; p14 += 1) {
|
|
1442
|
+
shapingResults.push(pieces[p14]);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
const hyphenAdvance = (hyphenAdvanceOrNull !== null ? hyphenAdvanceOrNull : 0.0);
|
|
1449
|
+
const hyphenOffsetsBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
1450
|
+
for (let i25 = 0, count22 = hyphenOffsets.length; i25 < count22; i25 += 1) {
|
|
1451
|
+
hyphenOffsetsBuilder.put(hyphenOffsets[i25]);
|
|
1452
|
+
}
|
|
1453
|
+
const hyphenOffsetsSet = hyphenOffsetsBuilder.build();
|
|
1454
|
+
const rollbacksBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
1455
|
+
for (let i26 = 0, count23 = substitutionRollbackKeys.length; i26 < count23; i26 += 1) {
|
|
1456
|
+
rollbacksBuilder.put(substitutionRollbackKeys[i26], substitutionRollbackValues[i26]);
|
|
1457
|
+
}
|
|
1458
|
+
const rollbacksMap = rollbacksBuilder.build();
|
|
1459
|
+
const progOffsetsBuilder = SortedTable.mapBuilder(SortedTable.compareInts);
|
|
1460
|
+
for (let i27 = 0, count24 = progBreakKeys.length; i27 < count24; i27 += 1) {
|
|
1461
|
+
progOffsetsBuilder.put(progBreakKeys[i27], progBreakValues[i27]);
|
|
1462
|
+
}
|
|
1463
|
+
const progOffsetsMap = progOffsetsBuilder.build();
|
|
1464
|
+
const segmentCacheBuilder = SortedTable.mapBuilder(compareTextRange);
|
|
1465
|
+
for (let i28 = 0, count25 = segmentShapingCacheKeys.length; i28 < count25; i28 += 1) {
|
|
1466
|
+
segmentCacheBuilder.put(segmentShapingCacheKeys[i28], segmentShapingCacheValues[i28]);
|
|
1467
|
+
}
|
|
1468
|
+
const segmentCacheMap = segmentCacheBuilder.build();
|
|
1469
|
+
return new ParagraphShapingStageResult(shapingResults, hyphenOffsetsSet, (hyphenAdvance), hyphenGlyphs, rollbacksMap, breakOpportunityDecisions, emergencyTrackingEligibilityDecisions, progOffsetsMap, segmentCacheMap);
|
|
1470
|
+
}
|
|
1471
|
+
}
|