postext 1.15.1 → 1.16.1
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/__tests__/arabic/harakatProfile.test.d.ts +2 -0
- package/dist/__tests__/arabic/harakatProfile.test.d.ts.map +1 -0
- package/dist/__tests__/arabic/harakatProfile.test.js +105 -0
- package/dist/__tests__/arabic/harakatProfile.test.js.map +1 -0
- package/dist/__tests__/bundleLocaleAndBytes.test.js +9 -9
- package/dist/__tests__/bundleLocaleAndBytes.test.js.map +1 -1
- package/dist/__tests__/chineseLocale.test.js +10 -5
- package/dist/__tests__/chineseLocale.test.js.map +1 -1
- package/dist/__tests__/cjk/annotationsRender.test.js +5 -2
- package/dist/__tests__/cjk/annotationsRender.test.js.map +1 -1
- package/dist/__tests__/cjk/chipLatinSpacing.test.d.ts +2 -0
- package/dist/__tests__/cjk/chipLatinSpacing.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/chipLatinSpacing.test.js +137 -0
- package/dist/__tests__/cjk/chipLatinSpacing.test.js.map +1 -0
- package/dist/__tests__/cjk/chipTracking.test.d.ts +2 -0
- package/dist/__tests__/cjk/chipTracking.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/chipTracking.test.js +56 -0
- package/dist/__tests__/cjk/chipTracking.test.js.map +1 -0
- package/dist/__tests__/cjk/japaneseHtml.test.d.ts +2 -0
- package/dist/__tests__/cjk/japaneseHtml.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/japaneseHtml.test.js +163 -0
- package/dist/__tests__/cjk/japaneseHtml.test.js.map +1 -0
- package/dist/__tests__/cjk/japaneseMarks.test.d.ts +2 -0
- package/dist/__tests__/cjk/japaneseMarks.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/japaneseMarks.test.js +289 -0
- package/dist/__tests__/cjk/japaneseMarks.test.js.map +1 -0
- package/dist/__tests__/cjk/japaneseMarksRender.test.d.ts +2 -0
- package/dist/__tests__/cjk/japaneseMarksRender.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/japaneseMarksRender.test.js +161 -0
- package/dist/__tests__/cjk/japaneseMarksRender.test.js.map +1 -0
- package/dist/__tests__/cjk/japaneseRuby.test.d.ts +2 -0
- package/dist/__tests__/cjk/japaneseRuby.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/japaneseRuby.test.js +457 -0
- package/dist/__tests__/cjk/japaneseRuby.test.js.map +1 -0
- package/dist/__tests__/cjk/japaneseSegmentLanguage.test.d.ts +2 -0
- package/dist/__tests__/cjk/japaneseSegmentLanguage.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/japaneseSegmentLanguage.test.js +50 -0
- package/dist/__tests__/cjk/japaneseSegmentLanguage.test.js.map +1 -0
- package/dist/__tests__/cjk/japaneseSpacing.test.d.ts +2 -0
- package/dist/__tests__/cjk/japaneseSpacing.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/japaneseSpacing.test.js +417 -0
- package/dist/__tests__/cjk/japaneseSpacing.test.js.map +1 -0
- package/dist/__tests__/cjk/kanbunKunten.test.d.ts +2 -0
- package/dist/__tests__/cjk/kanbunKunten.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/kanbunKunten.test.js +230 -0
- package/dist/__tests__/cjk/kanbunKunten.test.js.map +1 -0
- package/dist/__tests__/cjk/kanbunKuntenRender.test.d.ts +2 -0
- package/dist/__tests__/cjk/kanbunKuntenRender.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/kanbunKuntenRender.test.js +127 -0
- package/dist/__tests__/cjk/kanbunKuntenRender.test.js.map +1 -0
- package/dist/__tests__/cjk/keepAll.test.d.ts +2 -0
- package/dist/__tests__/cjk/keepAll.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/keepAll.test.js +146 -0
- package/dist/__tests__/cjk/keepAll.test.js.map +1 -0
- package/dist/__tests__/cjk/kinsokuJa.test.d.ts +2 -0
- package/dist/__tests__/cjk/kinsokuJa.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/kinsokuJa.test.js +388 -0
- package/dist/__tests__/cjk/kinsokuJa.test.js.map +1 -0
- package/dist/__tests__/cjk/kinsokuJaBuild.test.d.ts +2 -0
- package/dist/__tests__/cjk/kinsokuJaBuild.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/kinsokuJaBuild.test.js +38 -0
- package/dist/__tests__/cjk/kinsokuJaBuild.test.js.map +1 -0
- package/dist/__tests__/cjk/resourceAnnotations.test.d.ts +2 -0
- package/dist/__tests__/cjk/resourceAnnotations.test.d.ts.map +1 -0
- package/dist/__tests__/cjk/resourceAnnotations.test.js +223 -0
- package/dist/__tests__/cjk/resourceAnnotations.test.js.map +1 -0
- package/dist/__tests__/defaults/cjk.test.js +10 -2
- package/dist/__tests__/defaults/cjk.test.js.map +1 -1
- package/dist/__tests__/exports.test.js +37 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/headingLetterSpacing.test.js +2 -1
- package/dist/__tests__/headingLetterSpacing.test.js.map +1 -1
- package/dist/__tests__/indexChinese.test.js +1 -1
- package/dist/__tests__/indexJapanese.test.d.ts +2 -0
- package/dist/__tests__/indexJapanese.test.d.ts.map +1 -0
- package/dist/__tests__/indexJapanese.test.js +242 -0
- package/dist/__tests__/indexJapanese.test.js.map +1 -0
- package/dist/__tests__/japaneseCaptions.test.d.ts +2 -0
- package/dist/__tests__/japaneseCaptions.test.d.ts.map +1 -0
- package/dist/__tests__/japaneseCaptions.test.js +79 -0
- package/dist/__tests__/japaneseCaptions.test.js.map +1 -0
- package/dist/__tests__/japaneseHeadings.test.d.ts +2 -0
- package/dist/__tests__/japaneseHeadings.test.d.ts.map +1 -0
- package/dist/__tests__/japaneseHeadings.test.js +364 -0
- package/dist/__tests__/japaneseHeadings.test.js.map +1 -0
- package/dist/__tests__/japaneseLocale.test.d.ts +2 -0
- package/dist/__tests__/japaneseLocale.test.d.ts.map +1 -0
- package/dist/__tests__/japaneseLocale.test.js +201 -0
- package/dist/__tests__/japaneseLocale.test.js.map +1 -0
- package/dist/__tests__/japaneseNotes.test.d.ts +2 -0
- package/dist/__tests__/japaneseNotes.test.d.ts.map +1 -0
- package/dist/__tests__/japaneseNotes.test.js +336 -0
- package/dist/__tests__/japaneseNotes.test.js.map +1 -0
- package/dist/__tests__/japaneseNumbering.test.d.ts +2 -0
- package/dist/__tests__/japaneseNumbering.test.d.ts.map +1 -0
- package/dist/__tests__/japaneseNumbering.test.js +292 -0
- package/dist/__tests__/japaneseNumbering.test.js.map +1 -0
- package/dist/__tests__/parse/listNesting.test.d.ts +2 -0
- package/dist/__tests__/parse/listNesting.test.d.ts.map +1 -0
- package/dist/__tests__/parse/listNesting.test.js +142 -0
- package/dist/__tests__/parse/listNesting.test.js.map +1 -0
- package/dist/__tests__/pipeline/citationsJapanese.test.d.ts +2 -0
- package/dist/__tests__/pipeline/citationsJapanese.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/citationsJapanese.test.js +110 -0
- package/dist/__tests__/pipeline/citationsJapanese.test.js.map +1 -0
- package/dist/__tests__/pipeline/listNestingLayout.test.d.ts +2 -0
- package/dist/__tests__/pipeline/listNestingLayout.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/listNestingLayout.test.js +90 -0
- package/dist/__tests__/pipeline/listNestingLayout.test.js.map +1 -0
- package/dist/__tests__/pipeline/paragraphStyleFaces.test.js +2 -2
- package/dist/__tests__/pipeline/paragraphStyleFaces.test.js.map +1 -1
- package/dist/__tests__/pipeline/safeArea.test.d.ts +2 -0
- package/dist/__tests__/pipeline/safeArea.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/safeArea.test.js +207 -0
- package/dist/__tests__/pipeline/safeArea.test.js.map +1 -0
- package/dist/__tests__/vertical/compositionPaint.test.js +6 -5
- package/dist/__tests__/vertical/compositionPaint.test.js.map +1 -1
- package/dist/__tests__/vertical/japaneseVertical.test.d.ts +2 -0
- package/dist/__tests__/vertical/japaneseVertical.test.d.ts.map +1 -0
- package/dist/__tests__/vertical/japaneseVertical.test.js +247 -0
- package/dist/__tests__/vertical/japaneseVertical.test.js.map +1 -0
- package/dist/__tests__/vertical/verticalSpans.d.ts +2 -1
- package/dist/__tests__/vertical/verticalSpans.d.ts.map +1 -1
- package/dist/__tests__/vertical/verticalSpans.js +3 -2
- package/dist/__tests__/vertical/verticalSpans.js.map +1 -1
- package/dist/__tests__/video.test.d.ts +2 -0
- package/dist/__tests__/video.test.d.ts.map +1 -0
- package/dist/__tests__/video.test.js +305 -0
- package/dist/__tests__/video.test.js.map +1 -0
- package/dist/arabicMarks.d.ts +11 -1
- package/dist/arabicMarks.d.ts.map +1 -1
- package/dist/arabicMarks.js +72 -5
- package/dist/arabicMarks.js.map +1 -1
- package/dist/bundle/adapters.d.ts +6 -0
- package/dist/bundle/adapters.d.ts.map +1 -1
- package/dist/bundle/adapters.js +30 -0
- package/dist/bundle/adapters.js.map +1 -1
- package/dist/bundle/codec.d.ts.map +1 -1
- package/dist/bundle/codec.js +67 -3
- package/dist/bundle/codec.js.map +1 -1
- package/dist/bundle/index.d.ts +2 -2
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +2 -2
- package/dist/bundle/index.js.map +1 -1
- package/dist/bundle/manifest.d.ts +8 -0
- package/dist/bundle/manifest.d.ts.map +1 -1
- package/dist/bundle/manifest.js +48 -1
- package/dist/bundle/manifest.js.map +1 -1
- package/dist/bundle/types.d.ts +5 -0
- package/dist/bundle/types.d.ts.map +1 -1
- package/dist/bundle/zip.js +1 -1
- package/dist/bundle/zip.js.map +1 -1
- package/dist/canvas-backend/annotations.d.ts +20 -5
- package/dist/canvas-backend/annotations.d.ts.map +1 -1
- package/dist/canvas-backend/annotations.js +59 -6
- package/dist/canvas-backend/annotations.js.map +1 -1
- package/dist/canvas-backend/blockRender.d.ts.map +1 -1
- package/dist/canvas-backend/blockRender.js +29 -3
- package/dist/canvas-backend/blockRender.js.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.d.ts +6 -1
- package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.js +124 -5
- package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
- package/dist/canvas-backend/verticalText.d.ts +9 -4
- package/dist/canvas-backend/verticalText.d.ts.map +1 -1
- package/dist/canvas-backend/verticalText.js +20 -9
- package/dist/canvas-backend/verticalText.js.map +1 -1
- package/dist/chineseNumerals.d.ts +3 -2
- package/dist/chineseNumerals.d.ts.map +1 -1
- package/dist/chineseNumerals.js +11 -8
- package/dist/chineseNumerals.js.map +1 -1
- package/dist/citations/bibtex.d.ts.map +1 -1
- package/dist/citations/bibtex.js +4 -0
- package/dist/citations/bibtex.js.map +1 -1
- package/dist/citations/data.d.ts.map +1 -1
- package/dist/citations/data.js +6 -1
- package/dist/citations/data.js.map +1 -1
- package/dist/citations/types.d.ts +8 -0
- package/dist/citations/types.d.ts.map +1 -1
- package/dist/cjkMarks.d.ts +23 -14
- package/dist/cjkMarks.d.ts.map +1 -1
- package/dist/cjkMarks.js +251 -49
- package/dist/cjkMarks.js.map +1 -1
- package/dist/configWarnings.js +10 -4
- package/dist/configWarnings.js.map +1 -1
- package/dist/defaults/captionStyle.d.ts +19 -4
- package/dist/defaults/captionStyle.d.ts.map +1 -1
- package/dist/defaults/captionStyle.js +27 -8
- package/dist/defaults/captionStyle.js.map +1 -1
- package/dist/defaults/cjk.d.ts +64 -14
- package/dist/defaults/cjk.d.ts.map +1 -1
- package/dist/defaults/cjk.js +209 -29
- package/dist/defaults/cjk.js.map +1 -1
- package/dist/defaults/footnotes.d.ts +27 -4
- package/dist/defaults/footnotes.d.ts.map +1 -1
- package/dist/defaults/footnotes.js +95 -36
- package/dist/defaults/footnotes.js.map +1 -1
- package/dist/defaults/headings.d.ts +5 -0
- package/dist/defaults/headings.d.ts.map +1 -1
- package/dist/defaults/headings.js +46 -1
- package/dist/defaults/headings.js.map +1 -1
- package/dist/defaults/index.d.ts +4 -3
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +14 -5
- package/dist/defaults/index.js.map +1 -1
- package/dist/defaults/indexConfig.d.ts.map +1 -1
- package/dist/defaults/indexConfig.js +7 -4
- package/dist/defaults/indexConfig.js.map +1 -1
- package/dist/defaults/paragraphStyles.d.ts.map +1 -1
- package/dist/defaults/paragraphStyles.js +8 -0
- package/dist/defaults/paragraphStyles.js.map +1 -1
- package/dist/defaults/resourceTypes.d.ts +16 -3
- package/dist/defaults/resourceTypes.d.ts.map +1 -1
- package/dist/defaults/resourceTypes.js +56 -8
- package/dist/defaults/resourceTypes.js.map +1 -1
- package/dist/defaults/shared.d.ts.map +1 -1
- package/dist/defaults/shared.js +21 -0
- package/dist/defaults/shared.js.map +1 -1
- package/dist/defaults/tableStyle.d.ts.map +1 -1
- package/dist/defaults/tableStyle.js +4 -1
- package/dist/defaults/tableStyle.js.map +1 -1
- package/dist/defaults/videoStyle.d.ts +9 -0
- package/dist/defaults/videoStyle.d.ts.map +1 -0
- package/dist/defaults/videoStyle.js +130 -0
- package/dist/defaults/videoStyle.js.map +1 -0
- package/dist/design/placeholders.d.ts.map +1 -1
- package/dist/design/placeholders.js +5 -3
- package/dist/design/placeholders.js.map +1 -1
- package/dist/html-backend.d.ts +13 -0
- package/dist/html-backend.d.ts.map +1 -1
- package/dist/html-backend.js +233 -26
- package/dist/html-backend.js.map +1 -1
- package/dist/htmlAnnotations.d.ts +47 -9
- package/dist/htmlAnnotations.d.ts.map +1 -1
- package/dist/htmlAnnotations.js +89 -17
- package/dist/htmlAnnotations.js.map +1 -1
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/japaneseNumerals.d.ts +44 -0
- package/dist/japaneseNumerals.d.ts.map +1 -0
- package/dist/japaneseNumerals.js +100 -0
- package/dist/japaneseNumerals.js.map +1 -0
- package/dist/knuthPlass/richAdapter.d.ts +5 -1
- package/dist/knuthPlass/richAdapter.d.ts.map +1 -1
- package/dist/knuthPlass/richAdapter.js +2 -0
- package/dist/knuthPlass/richAdapter.js.map +1 -1
- package/dist/locale.d.ts +19 -12
- package/dist/locale.d.ts.map +1 -1
- package/dist/locale.js +24 -12
- package/dist/locale.js.map +1 -1
- package/dist/measure/cache.d.ts.map +1 -1
- package/dist/measure/cache.js +20 -9
- package/dist/measure/cache.js.map +1 -1
- package/dist/measure/canvas.d.ts +21 -0
- package/dist/measure/canvas.d.ts.map +1 -1
- package/dist/measure/canvas.js +82 -0
- package/dist/measure/canvas.js.map +1 -1
- package/dist/measure/cjk.d.ts +3 -1
- package/dist/measure/cjk.d.ts.map +1 -1
- package/dist/measure/cjk.js +4 -2
- package/dist/measure/cjk.js.map +1 -1
- package/dist/measure/cjkAnnotate.d.ts +62 -3
- package/dist/measure/cjkAnnotate.d.ts.map +1 -1
- package/dist/measure/cjkAnnotate.js +99 -2
- package/dist/measure/cjkAnnotate.js.map +1 -1
- package/dist/measure/cjkClasses.d.ts +93 -13
- package/dist/measure/cjkClasses.d.ts.map +1 -1
- package/dist/measure/cjkClasses.js +204 -14
- package/dist/measure/cjkClasses.js.map +1 -1
- package/dist/measure/cjkCompose.d.ts +10 -4
- package/dist/measure/cjkCompose.d.ts.map +1 -1
- package/dist/measure/cjkCompose.js +834 -85
- package/dist/measure/cjkCompose.js.map +1 -1
- package/dist/measure/cjkPunctuation.d.ts +73 -14
- package/dist/measure/cjkPunctuation.d.ts.map +1 -1
- package/dist/measure/cjkPunctuation.js +97 -21
- package/dist/measure/cjkPunctuation.js.map +1 -1
- package/dist/measure/plain.js +2 -2
- package/dist/measure/plain.js.map +1 -1
- package/dist/measure/rich.d.ts +12 -2
- package/dist/measure/rich.d.ts.map +1 -1
- package/dist/measure/rich.js +46 -8
- package/dist/measure/rich.js.map +1 -1
- package/dist/measure/rubyJis.d.ts +96 -0
- package/dist/measure/rubyJis.d.ts.map +1 -0
- package/dist/measure/rubyJis.js +245 -0
- package/dist/measure/rubyJis.js.map +1 -0
- package/dist/measure/types.d.ts +6 -1
- package/dist/measure/types.d.ts.map +1 -1
- package/dist/measure/types.js.map +1 -1
- package/dist/measure/vertical.d.ts +13 -5
- package/dist/measure/vertical.d.ts.map +1 -1
- package/dist/measure/vertical.js +16 -6
- package/dist/measure/vertical.js.map +1 -1
- package/dist/numberWords.d.ts +4 -3
- package/dist/numberWords.d.ts.map +1 -1
- package/dist/numberWords.js +15 -5
- package/dist/numberWords.js.map +1 -1
- package/dist/numbering.d.ts +24 -12
- package/dist/numbering.d.ts.map +1 -1
- package/dist/numbering.js +57 -11
- package/dist/numbering.js.map +1 -1
- package/dist/parse/annotations.d.ts +21 -18
- package/dist/parse/annotations.d.ts.map +1 -1
- package/dist/parse/annotations.js +140 -51
- package/dist/parse/annotations.js.map +1 -1
- package/dist/parse/blockParser.d.ts.map +1 -1
- package/dist/parse/blockParser.js +12 -1
- package/dist/parse/blockParser.js.map +1 -1
- package/dist/parse/index.d.ts +1 -1
- package/dist/parse/index.d.ts.map +1 -1
- package/dist/parse/index.js.map +1 -1
- package/dist/parse/indexMarks.d.ts.map +1 -1
- package/dist/parse/indexMarks.js +42 -0
- package/dist/parse/indexMarks.js.map +1 -1
- package/dist/parse/inlineFormatting.d.ts +4 -3
- package/dist/parse/inlineFormatting.d.ts.map +1 -1
- package/dist/parse/inlineFormatting.js +9 -8
- package/dist/parse/inlineFormatting.js.map +1 -1
- package/dist/parse/listNesting.d.ts +47 -0
- package/dist/parse/listNesting.d.ts.map +1 -0
- package/dist/parse/listNesting.js +65 -0
- package/dist/parse/listNesting.js.map +1 -0
- package/dist/parse/types.d.ts +93 -5
- package/dist/parse/types.d.ts.map +1 -1
- package/dist/pipeline/annotations.d.ts +25 -15
- package/dist/pipeline/annotations.d.ts.map +1 -1
- package/dist/pipeline/annotations.js +102 -16
- package/dist/pipeline/annotations.js.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +284 -31
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/buildBlockKind.d.ts +7 -0
- package/dist/pipeline/buildBlockKind.d.ts.map +1 -1
- package/dist/pipeline/buildBlockKind.js +25 -2
- package/dist/pipeline/buildBlockKind.js.map +1 -1
- package/dist/pipeline/buildHelpers.d.ts +2 -0
- package/dist/pipeline/buildHelpers.d.ts.map +1 -1
- package/dist/pipeline/buildHelpers.js +17 -0
- package/dist/pipeline/buildHelpers.js.map +1 -1
- package/dist/pipeline/buildMeasurement.d.ts +3 -0
- package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
- package/dist/pipeline/buildMeasurement.js +1 -0
- package/dist/pipeline/buildMeasurement.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts +2 -0
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +5 -5
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/citations.d.ts +1 -1
- package/dist/pipeline/citations.d.ts.map +1 -1
- package/dist/pipeline/citations.js +15 -7
- package/dist/pipeline/citations.js.map +1 -1
- package/dist/pipeline/columnBalancing.d.ts +22 -0
- package/dist/pipeline/columnBalancing.d.ts.map +1 -1
- package/dist/pipeline/columnBalancing.js +80 -3
- package/dist/pipeline/columnBalancing.js.map +1 -1
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js +4 -3
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +19 -0
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/continuation.d.ts.map +1 -1
- package/dist/pipeline/continuation.js +3 -3
- package/dist/pipeline/continuation.js.map +1 -1
- package/dist/pipeline/crossRefs.d.ts.map +1 -1
- package/dist/pipeline/crossRefs.js +3 -0
- package/dist/pipeline/crossRefs.js.map +1 -1
- package/dist/pipeline/footnotes.d.ts +20 -12
- package/dist/pipeline/footnotes.d.ts.map +1 -1
- package/dist/pipeline/footnotes.js +62 -16
- package/dist/pipeline/footnotes.js.map +1 -1
- package/dist/pipeline/headingStyles.js +1 -1
- package/dist/pipeline/headingStyles.js.map +1 -1
- package/dist/pipeline/indexDirective.d.ts.map +1 -1
- package/dist/pipeline/indexDirective.js +89 -12
- package/dist/pipeline/indexDirective.js.map +1 -1
- package/dist/pipeline/indexGroups.d.ts +5 -3
- package/dist/pipeline/indexGroups.d.ts.map +1 -1
- package/dist/pipeline/indexGroups.js +9 -4
- package/dist/pipeline/indexGroups.js.map +1 -1
- package/dist/pipeline/indexJapanese.d.ts +75 -0
- package/dist/pipeline/indexJapanese.d.ts.map +1 -0
- package/dist/pipeline/indexJapanese.js +264 -0
- package/dist/pipeline/indexJapanese.js.map +1 -0
- package/dist/pipeline/lineSpan.d.ts +36 -0
- package/dist/pipeline/lineSpan.d.ts.map +1 -0
- package/dist/pipeline/lineSpan.js +36 -0
- package/dist/pipeline/lineSpan.js.map +1 -0
- package/dist/pipeline/lists.js +2 -2
- package/dist/pipeline/lists.js.map +1 -1
- package/dist/pipeline/measureContentBlock.d.ts +4 -0
- package/dist/pipeline/measureContentBlock.d.ts.map +1 -1
- package/dist/pipeline/measureContentBlock.js +57 -5
- package/dist/pipeline/measureContentBlock.js.map +1 -1
- package/dist/pipeline/outline.d.ts.map +1 -1
- package/dist/pipeline/outline.js +3 -1
- package/dist/pipeline/outline.js.map +1 -1
- package/dist/pipeline/paragraphContainers.d.ts +25 -2
- package/dist/pipeline/paragraphContainers.d.ts.map +1 -1
- package/dist/pipeline/paragraphContainers.js +82 -2
- package/dist/pipeline/paragraphContainers.js.map +1 -1
- package/dist/pipeline/parts.d.ts +2 -2
- package/dist/pipeline/parts.js +3 -3
- package/dist/pipeline/parts.js.map +1 -1
- package/dist/pipeline/placement.d.ts.map +1 -1
- package/dist/pipeline/placement.js +2 -2
- package/dist/pipeline/placement.js.map +1 -1
- package/dist/pipeline/resourceLayout.d.ts +6 -0
- package/dist/pipeline/resourceLayout.d.ts.map +1 -1
- package/dist/pipeline/resourceLayout.js +93 -17
- package/dist/pipeline/resourceLayout.js.map +1 -1
- package/dist/pipeline/resourceNumbering.d.ts +5 -2
- package/dist/pipeline/resourceNumbering.d.ts.map +1 -1
- package/dist/pipeline/resourceNumbering.js +12 -7
- package/dist/pipeline/resourceNumbering.js.map +1 -1
- package/dist/pipeline/safeArea.d.ts +29 -0
- package/dist/pipeline/safeArea.d.ts.map +1 -0
- package/dist/pipeline/safeArea.js +89 -0
- package/dist/pipeline/safeArea.js.map +1 -0
- package/dist/pipeline/styles.d.ts +16 -1
- package/dist/pipeline/styles.d.ts.map +1 -1
- package/dist/pipeline/styles.js +8 -1
- package/dist/pipeline/styles.js.map +1 -1
- package/dist/pipeline/verse.d.ts +3 -0
- package/dist/pipeline/verse.d.ts.map +1 -1
- package/dist/pipeline/verse.js +1 -1
- package/dist/pipeline/verse.js.map +1 -1
- package/dist/pipeline/verticalMetrics.d.ts.map +1 -1
- package/dist/pipeline/verticalMetrics.js +4 -0
- package/dist/pipeline/verticalMetrics.js.map +1 -1
- package/dist/pipeline/videoOverlay.d.ts +24 -0
- package/dist/pipeline/videoOverlay.d.ts.map +1 -0
- package/dist/pipeline/videoOverlay.js +134 -0
- package/dist/pipeline/videoOverlay.js.map +1 -0
- package/dist/types.d.ts +594 -50
- package/dist/types.d.ts.map +1 -1
- package/dist/uprightArabic.js +1 -1
- package/dist/uprightArabic.js.map +1 -1
- package/dist/vdt.d.ts +221 -17
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/dist/video/qr.d.ts +21 -0
- package/dist/video/qr.d.ts.map +1 -0
- package/dist/video/qr.js +326 -0
- package/dist/video/qr.js.map +1 -0
- package/dist/video/url.d.ts +62 -0
- package/dist/video/url.d.ts.map +1 -0
- package/dist/video/url.js +206 -0
- package/dist/video/url.js.map +1 -0
- package/dist/writingMode.d.ts +74 -20
- package/dist/writingMode.d.ts.map +1 -1
- package/dist/writingMode.js +146 -27
- package/dist/writingMode.js.map +1 -1
- package/package.json +1 -1
|
@@ -103,6 +103,14 @@ export interface CitationProcessor {
|
|
|
103
103
|
readonly kind: 'in-text' | 'note';
|
|
104
104
|
/** `true` for a numbered style (IEEE, Vancouver, GB/T 7714 numeric). */
|
|
105
105
|
readonly numeric: boolean;
|
|
106
|
+
/** The locale's words for a sentence that names two authors or more
|
|
107
|
+
* (the CSL terms `and` and `et-al`: と and ほか in ja-JP). A Japanese
|
|
108
|
+
* narrative citation the engine writes itself takes them (#426);
|
|
109
|
+
* without them it keeps 、 and 等. */
|
|
110
|
+
readonly terms?: {
|
|
111
|
+
readonly and: string;
|
|
112
|
+
readonly etAl: string;
|
|
113
|
+
};
|
|
106
114
|
/** Format every citation of the book, in reading order: disambiguation,
|
|
107
115
|
* numbering and *ibid.* see all of them. */
|
|
108
116
|
cite(clusters: readonly CitationClusterInput[]): FormattedCitation[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/citations/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,WAAW,OAAO;IACtB,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;gCAEgC;AAChC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,M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-1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Chinese interlinear marks of a laid-out document (#193
|
|
3
|
-
* (
|
|
4
|
-
* (书名号甲式)
|
|
5
|
-
*
|
|
2
|
+
* The Chinese and Japanese interlinear marks of a laid-out document (#193,
|
|
3
|
+
* #421): emphasis dots (着重号, 傍点), the proper-name line (专名号), the
|
|
4
|
+
* wavy book-title line (书名号甲式) and side lines (傍線), as
|
|
5
|
+
* `VDTLine.marks` — primitives the renderers draw as they are — and the
|
|
6
|
+
* leading checks of marks, ruby (#194) and kanbun marks (#430).
|
|
6
7
|
*
|
|
7
8
|
* The measurer flags the segments (`VDTLineSegment.cjkMarks`); the marks are
|
|
8
9
|
* placed once the document is laid out, where the renderers paint each
|
|
@@ -10,11 +11,13 @@
|
|
|
10
11
|
* spaces of a line included), in the flow frame of the line. Dots are
|
|
11
12
|
* centred on each character, spacing after it left out, and skip
|
|
12
13
|
* punctuation and spaces; a line spans its run's characters, and where two
|
|
13
|
-
* runs meet each end gives up an eighth of an em (clreq §5.6.1).
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* runs meet each end gives up an eighth of an em (clreq §5.6.1). A side
|
|
15
|
+
* line runs on across every character of its run, punctuation and spaces
|
|
16
|
+
* included. Marks sit against the characters' em box, centred on the
|
|
17
|
+
* font's central axis, on the side they were given (`over`: above
|
|
18
|
+
* horizontal text, right of vertical text): when dots and a line mark the
|
|
19
|
+
* same text on one side, the line is nearer the text, and dots on the side
|
|
20
|
+
* of a ruby reading go outside it (as CSS Text Decoration 3 sets them).
|
|
18
21
|
*/
|
|
19
22
|
import type { ContentWarning, VDTBlock, VDTDocument, VDTLine, VDTLineMark, VDTLineSegment } from './vdt';
|
|
20
23
|
import type { CjkRegion, ResolvedCjkConfig } from './types';
|
|
@@ -45,16 +48,22 @@ export declare function lineMarks(line: VDTLine, block: BlockLike, color?: strin
|
|
|
45
48
|
/**
|
|
46
49
|
* Set `VDTLine.marks` on every line of the document that holds Chinese
|
|
47
50
|
* marks, and report the paragraphs whose line gap is narrower than their
|
|
48
|
-
* marks or
|
|
49
|
-
* once per paragraph. `cjk`
|
|
50
|
-
* `annotationColor`).
|
|
51
|
+
* marks, readings or kanbun marks need (`cjkMarksExceedLeading`,
|
|
52
|
+
* `rubyExceedsLeading`, `kuntenExceedsLeading`), once per paragraph. `cjk`
|
|
53
|
+
* is the resolved configuration (its `annotationColor`).
|
|
51
54
|
*
|
|
52
55
|
* The gap between two lines of a column is shared: what the upper line
|
|
53
56
|
* sets under it and the lower one over it (dots under one line and the
|
|
54
57
|
* readings over the next, in one paragraph or across two) must fit in it
|
|
55
58
|
* together. Where they do not, the lower line's paragraph is reported
|
|
56
|
-
* (`rubyExceedsLeading` when readings take part,
|
|
57
|
-
* `cjkMarksExceedLeading`).
|
|
59
|
+
* (`rubyExceedsLeading` when readings take part, `kuntenExceedsLeading`
|
|
60
|
+
* when kanbun marks do, else `cjkMarksExceedLeading`).
|
|
61
|
+
*
|
|
62
|
+
* The cells, captions and notes of resource blocks (#429) are texts of
|
|
63
|
+
* their own: their marks are set and their leading checked the same way,
|
|
64
|
+
* each text's lines sharing their gaps only with one another (a table's
|
|
65
|
+
* cells sit apart, a caption under its figure). A resource's text is set
|
|
66
|
+
* horizontally on every page, a vertical one turning the whole block.
|
|
58
67
|
*/
|
|
59
68
|
export declare function annotateDocument(doc: VDTDocument, cjk: ResolvedCjkConfig | undefined): ContentWarning[];
|
|
60
69
|
export {};
|
package/dist/cjkMarks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cjkMarks.d.ts","sourceRoot":"","sources":["../src/cjkMarks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cjkMarks.d.ts","sourceRoot":"","sources":["../src/cjkMarks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAA4B,MAAM,OAAO,CAAC;AACnI,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAU5D,uDAAuD;AACvD,KAAK,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,YAAY,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC,CAAC;AAExJ;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCpG;AAED,wCAAwC;AACxC,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAMzE;AAsED,kEAAkE;AAClE,UAAU,aAAa;IACrB,MAAM,EAAE,SAAS,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;4CAE4C;AAC5C,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,WAAW,EAAE,CAgIlH;AAyOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,iBAAiB,GAAG,SAAS,GAAG,cAAc,EAAE,CA0GvG"}
|
package/dist/cjkMarks.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Chinese interlinear marks of a laid-out document (#193
|
|
3
|
-
* (
|
|
4
|
-
* (书名号甲式)
|
|
5
|
-
*
|
|
2
|
+
* The Chinese and Japanese interlinear marks of a laid-out document (#193,
|
|
3
|
+
* #421): emphasis dots (着重号, 傍点), the proper-name line (专名号), the
|
|
4
|
+
* wavy book-title line (书名号甲式) and side lines (傍線), as
|
|
5
|
+
* `VDTLine.marks` — primitives the renderers draw as they are — and the
|
|
6
|
+
* leading checks of marks, ruby (#194) and kanbun marks (#430).
|
|
6
7
|
*
|
|
7
8
|
* The measurer flags the segments (`VDTLineSegment.cjkMarks`); the marks are
|
|
8
9
|
* placed once the document is laid out, where the renderers paint each
|
|
@@ -10,11 +11,13 @@
|
|
|
10
11
|
* spaces of a line included), in the flow frame of the line. Dots are
|
|
11
12
|
* centred on each character, spacing after it left out, and skip
|
|
12
13
|
* punctuation and spaces; a line spans its run's characters, and where two
|
|
13
|
-
* runs meet each end gives up an eighth of an em (clreq §5.6.1).
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* runs meet each end gives up an eighth of an em (clreq §5.6.1). A side
|
|
15
|
+
* line runs on across every character of its run, punctuation and spaces
|
|
16
|
+
* included. Marks sit against the characters' em box, centred on the
|
|
17
|
+
* font's central axis, on the side they were given (`over`: above
|
|
18
|
+
* horizontal text, right of vertical text): when dots and a line mark the
|
|
19
|
+
* same text on one side, the line is nearer the text, and dots on the side
|
|
20
|
+
* of a ruby reading go outside it (as CSS Text Decoration 3 sets them).
|
|
18
21
|
*/
|
|
19
22
|
import { lineInkExtent, lineTrailingTracking } from './lineInk';
|
|
20
23
|
import { measureTextWidth } from './measure/canvas';
|
|
@@ -93,6 +96,11 @@ const LINE_AT = 0.08;
|
|
|
93
96
|
const WAVE_AT = 0.1;
|
|
94
97
|
const WAVE_HEIGHT = 0.08;
|
|
95
98
|
const WAVE_LENGTH = 0.25;
|
|
99
|
+
/** A double side line: its two rules' centres this far apart. */
|
|
100
|
+
const DOUBLE_GAP = 0.08;
|
|
101
|
+
/** A dotted side line: its dots' diameter and the pitch they come near. */
|
|
102
|
+
const DOTTED_SIZE = 0.08;
|
|
103
|
+
const DOTTED_PITCH = 0.16;
|
|
96
104
|
/** How far dots move out when a line marks the same text on their side. */
|
|
97
105
|
const PAST_LINE = 0.16;
|
|
98
106
|
/** Where each grapheme of a segment starts and how far it advances, px
|
|
@@ -157,21 +165,26 @@ export function lineMarks(line, block, color, vertical) {
|
|
|
157
165
|
const paint = color !== undefined ? { color } : {};
|
|
158
166
|
const runs = [];
|
|
159
167
|
const lined = new Set();
|
|
160
|
-
|
|
168
|
+
const linedOver = new Set();
|
|
169
|
+
const idOf = (kind, seg) => kind === 'line' ? seg?.cjkMarks?.properName : kind === 'wavy' ? seg?.cjkMarks?.bookTitle : seg?.cjkMarks?.sideline?.id;
|
|
170
|
+
for (const kind of ['line', 'wavy', 'side']) {
|
|
161
171
|
let open;
|
|
162
172
|
for (let i = 0; i < segments.length; i++) {
|
|
163
173
|
const seg = segments[i];
|
|
164
|
-
const id = kind
|
|
165
|
-
|
|
166
|
-
|
|
174
|
+
const id = idOf(kind, seg);
|
|
175
|
+
// A space inside a run (for a side line, anything the layout added
|
|
176
|
+
// there too: a Han–Latin space, a bracket): the line goes on when
|
|
177
|
+
// the run does.
|
|
178
|
+
const bridges = (s) => s.kind === 'space' || (kind === 'side' && !!s.inserted && !s.warichu);
|
|
179
|
+
if (id === undefined && open && bridges(seg)) {
|
|
167
180
|
let j = i + 1;
|
|
168
|
-
while (j < segments.length && segments[j]
|
|
181
|
+
while (j < segments.length && bridges(segments[j]))
|
|
169
182
|
j++;
|
|
170
|
-
const nextId = kind
|
|
183
|
+
const nextId = idOf(kind, segments[j]);
|
|
171
184
|
if (nextId !== undefined && `${kind}:${nextId}` === open.key)
|
|
172
185
|
continue;
|
|
173
186
|
}
|
|
174
|
-
if (id === undefined || seg.warichu || seg.inserted) {
|
|
187
|
+
if (id === undefined || seg.warichu || (seg.inserted && kind !== 'side')) {
|
|
175
188
|
open = undefined;
|
|
176
189
|
continue;
|
|
177
190
|
}
|
|
@@ -179,15 +192,26 @@ export function lineMarks(line, block, color, vertical) {
|
|
|
179
192
|
const font = segmentFont(seg, block);
|
|
180
193
|
const em = fontEm(font);
|
|
181
194
|
const end = xs[i] + widths[i] - (seg.kind === 'text' ? tracking + (seg.tracking ?? 0) : 0);
|
|
195
|
+
const over = kind === 'side' && seg.cjkMarks.sideline.position === 'over';
|
|
182
196
|
if (open && open.key === key) {
|
|
183
197
|
open.to = Math.max(open.to, end);
|
|
184
198
|
open.endSeg = i;
|
|
185
|
-
lined.add(i);
|
|
199
|
+
(over ? linedOver : lined).add(i);
|
|
186
200
|
continue;
|
|
187
201
|
}
|
|
188
|
-
open = {
|
|
202
|
+
open = {
|
|
203
|
+
kind,
|
|
204
|
+
key,
|
|
205
|
+
from: xs[i],
|
|
206
|
+
to: end,
|
|
207
|
+
em,
|
|
208
|
+
axis: -CENTRAL * em + (seg.baselineShift ?? 0),
|
|
209
|
+
startSeg: i,
|
|
210
|
+
endSeg: i,
|
|
211
|
+
...(kind === 'side' ? { side: seg.cjkMarks.sideline } : {}),
|
|
212
|
+
};
|
|
189
213
|
runs.push(open);
|
|
190
|
-
lined.add(i);
|
|
214
|
+
(over ? linedOver : lined).add(i);
|
|
191
215
|
}
|
|
192
216
|
}
|
|
193
217
|
// Two runs that meet each give up an eighth of an em.
|
|
@@ -195,6 +219,8 @@ export function lineMarks(line, block, color, vertical) {
|
|
|
195
219
|
for (const b of runs) {
|
|
196
220
|
if (a === b || a.kind !== b.kind || b.startSeg !== a.endSeg + 1)
|
|
197
221
|
continue;
|
|
222
|
+
if (a.side && a.side.position !== b.side?.position)
|
|
223
|
+
continue;
|
|
198
224
|
a.to -= a.em / 8;
|
|
199
225
|
b.from += b.em / 8;
|
|
200
226
|
}
|
|
@@ -203,6 +229,10 @@ export function lineMarks(line, block, color, vertical) {
|
|
|
203
229
|
const length = r.to - r.from;
|
|
204
230
|
if (length <= 0)
|
|
205
231
|
continue;
|
|
232
|
+
if (r.side) {
|
|
233
|
+
out.push(sidelineMark(r.side, r.from - x0, length, r.axis, r.em, paint));
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
206
236
|
const edge = r.axis + r.em / 2;
|
|
207
237
|
if (r.kind === 'line') {
|
|
208
238
|
out.push({ kind: 'line', x: r.from - x0, y: edge + LINE_AT * r.em, length, thickness: Math.max(0.5, STROKE * r.em), ...paint });
|
|
@@ -230,8 +260,12 @@ export function lineMarks(line, block, color, vertical) {
|
|
|
230
260
|
const axis = -CENTRAL * em + (seg.baselineShift ?? 0);
|
|
231
261
|
const size = DOT[dots.style] * em;
|
|
232
262
|
const under = dots.position === 'under';
|
|
233
|
-
const past = under
|
|
234
|
-
|
|
263
|
+
const past = (under ? lined : linedOver).has(i) ? PAST_LINE * em : 0;
|
|
264
|
+
let y = under ? axis + em / 2 + GAP * em + past + size / 2 : axis - em / 2 - GAP * em - past - size / 2;
|
|
265
|
+
// A reading on the same side: the dots go outside it.
|
|
266
|
+
const reading = seg.ruby && seg.ruby.position === dots.position ? rubyExtent(seg.ruby) : undefined;
|
|
267
|
+
if (reading)
|
|
268
|
+
y = under ? Math.max(y, reading.foot + GAP * em + size / 2) : Math.min(y, reading.head - GAP * em - size / 2);
|
|
235
269
|
const t = tracking + (seg.tracking ?? 0);
|
|
236
270
|
const inset = seg.ruby ? seg.inkOffset ?? 0 : 0;
|
|
237
271
|
const box = seg.ruby ? Math.max(0, widths[i] - 2 * inset) : widths[i];
|
|
@@ -251,6 +285,51 @@ export function lineMarks(line, block, color, vertical) {
|
|
|
251
285
|
});
|
|
252
286
|
return out;
|
|
253
287
|
}
|
|
288
|
+
/** How far a reading reaches across its line, px from the baseline: its
|
|
289
|
+
* runs' em boxes (`head` the least, `foot` the most). */
|
|
290
|
+
function rubyExtent(ruby) {
|
|
291
|
+
let head = Infinity;
|
|
292
|
+
let foot = -Infinity;
|
|
293
|
+
for (const run of ruby.runs) {
|
|
294
|
+
const runEm = fontEm(run.fontString);
|
|
295
|
+
head = Math.min(head, run.dy - (CENTRAL + 0.5) * runEm);
|
|
296
|
+
foot = Math.max(foot, run.dy + (0.5 - CENTRAL) * runEm);
|
|
297
|
+
}
|
|
298
|
+
return head <= foot ? { head, foot } : undefined;
|
|
299
|
+
}
|
|
300
|
+
/** The mark of a side line (傍線) `length` px long from `x`, against the
|
|
301
|
+
* em box of text `em` px high whose central axis is `axis`: a rule, two
|
|
302
|
+
* rules, a wave or a row of dots, on the side it was given. */
|
|
303
|
+
function sidelineMark(line, x, length, axis, em, paint) {
|
|
304
|
+
const sign = line.position === 'over' ? -1 : 1;
|
|
305
|
+
const edge = axis + sign * (em / 2);
|
|
306
|
+
switch (line.style) {
|
|
307
|
+
case 'double': {
|
|
308
|
+
const gap = DOUBLE_GAP * em;
|
|
309
|
+
return { kind: 'double', x, y: edge + sign * (LINE_AT * em + gap / 2), length, gap, thickness: Math.max(0.4, OUTLINE * em), ...paint };
|
|
310
|
+
}
|
|
311
|
+
case 'wavy':
|
|
312
|
+
return {
|
|
313
|
+
kind: 'wavy',
|
|
314
|
+
x,
|
|
315
|
+
y: edge + sign * WAVE_AT * em,
|
|
316
|
+
length,
|
|
317
|
+
thickness: Math.max(0.5, STROKE * em * 0.9),
|
|
318
|
+
amplitude: WAVE_HEIGHT * em,
|
|
319
|
+
wavelength: WAVE_LENGTH * em,
|
|
320
|
+
...paint,
|
|
321
|
+
};
|
|
322
|
+
case 'dotted': {
|
|
323
|
+
const size = DOTTED_SIZE * em;
|
|
324
|
+
// The pitch that sets the dots evenly from one end to the other.
|
|
325
|
+
const span = Math.max(0, length - size);
|
|
326
|
+
const count = Math.max(1, Math.round(span / (DOTTED_PITCH * em)));
|
|
327
|
+
return { kind: 'dotted', x, y: edge + sign * LINE_AT * em, length, size, gap: span / count, thickness: size, ...paint };
|
|
328
|
+
}
|
|
329
|
+
default:
|
|
330
|
+
return { kind: 'line', x, y: edge + sign * LINE_AT * em, length, thickness: Math.max(0.5, STROKE * em), ...paint };
|
|
331
|
+
}
|
|
332
|
+
}
|
|
254
333
|
/** How much line gap (em of the text) a line's marks need: half an em on
|
|
255
334
|
* one side, five eighths on both (clreq §5.6.1). 0 when it has none. */
|
|
256
335
|
function marksNeed(line) {
|
|
@@ -263,6 +342,8 @@ function marksNeed(line) {
|
|
|
263
342
|
sides.add(m.dots.position);
|
|
264
343
|
if (m.properName !== undefined || m.bookTitle !== undefined)
|
|
265
344
|
sides.add('under');
|
|
345
|
+
if (m.sideline)
|
|
346
|
+
sides.add(m.sideline.position);
|
|
266
347
|
}
|
|
267
348
|
return sides.size === 0 ? 0 : sides.size > 1 ? 0.625 : 0.5;
|
|
268
349
|
}
|
|
@@ -272,6 +353,10 @@ function marksNeed(line) {
|
|
|
272
353
|
function rubyNeed(line, em) {
|
|
273
354
|
let need = 0;
|
|
274
355
|
for (const seg of line.segments ?? []) {
|
|
356
|
+
// A footnote marker in the line gap (JLReq §4.2.3) needs its size, as
|
|
357
|
+
// a reading does.
|
|
358
|
+
for (const run of seg.sideMarker?.runs ?? [])
|
|
359
|
+
need = Math.max(need, fontEm(run.fontString) / em);
|
|
275
360
|
const r = seg.ruby;
|
|
276
361
|
if (!r || r.position === 'right')
|
|
277
362
|
continue;
|
|
@@ -283,6 +368,21 @@ function rubyNeed(line, em) {
|
|
|
283
368
|
}
|
|
284
369
|
return need;
|
|
285
370
|
}
|
|
371
|
+
/** How far a line's kanbun marks (#430) reach out of its em box, in em
|
|
372
|
+
* of the text: the 送り仮名 beside it, 返り点 set in the line gap. */
|
|
373
|
+
function kuntenNeed(line, em) {
|
|
374
|
+
const top = -(CENTRAL + 0.5) * em;
|
|
375
|
+
const bottom = (0.5 - CENTRAL) * em;
|
|
376
|
+
let need = 0;
|
|
377
|
+
for (const seg of line.segments ?? []) {
|
|
378
|
+
for (const run of seg.kunten?.runs ?? []) {
|
|
379
|
+
const runEm = fontEm(run.fontString);
|
|
380
|
+
const centre = run.dy - CENTRAL * runEm;
|
|
381
|
+
need = Math.max(need, top - (centre - runEm / 2), centre + runEm / 2 - bottom);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return need / em;
|
|
385
|
+
}
|
|
286
386
|
/** The {@link LineReach} of a line whose text is `em` px (its em box
|
|
287
387
|
* centred on the central axis): marks by their drawn extent, readings by
|
|
288
388
|
* their em box (an upright tone mark by its advance across the line). */
|
|
@@ -305,10 +405,17 @@ function lineReach(line, em) {
|
|
|
305
405
|
reach.footRuby = true;
|
|
306
406
|
};
|
|
307
407
|
for (const m of line.marks ?? []) {
|
|
308
|
-
const half = m.kind === 'line' ? m.thickness / 2
|
|
408
|
+
const half = m.kind === 'line' ? m.thickness / 2
|
|
409
|
+
: m.kind === 'wavy' ? (m.amplitude ?? 0) / 2 + m.thickness / 2
|
|
410
|
+
: m.kind === 'double' ? (m.gap ?? 0) / 2 + m.thickness / 2
|
|
411
|
+
: (m.size ?? 0) / 2;
|
|
309
412
|
extend(m.y - half, m.y + half, false);
|
|
310
413
|
}
|
|
311
414
|
for (const seg of line.segments ?? []) {
|
|
415
|
+
for (const run of seg.sideMarker?.runs ?? []) {
|
|
416
|
+
const runEm = fontEm(run.fontString);
|
|
417
|
+
extend(run.dy - (CENTRAL + 0.5) * runEm, run.dy + (0.5 - CENTRAL) * runEm, true);
|
|
418
|
+
}
|
|
312
419
|
const r = seg.ruby;
|
|
313
420
|
if (!r || r.position === 'right')
|
|
314
421
|
continue;
|
|
@@ -326,89 +433,183 @@ function lineReach(line, em) {
|
|
|
326
433
|
}
|
|
327
434
|
}
|
|
328
435
|
}
|
|
436
|
+
// Kanbun marks, by their em box: the side they reach furthest out on is
|
|
437
|
+
// theirs when nothing else reaches as far.
|
|
438
|
+
for (const seg of line.segments ?? []) {
|
|
439
|
+
for (const run of seg.kunten?.runs ?? []) {
|
|
440
|
+
const runEm = fontEm(run.fontString);
|
|
441
|
+
const lo = run.dy - (CENTRAL + 0.5) * runEm;
|
|
442
|
+
const hi = run.dy + (0.5 - CENTRAL) * runEm;
|
|
443
|
+
if (top - lo > reach.head + 1e-9) {
|
|
444
|
+
reach.head = top - lo;
|
|
445
|
+
reach.headRuby = false;
|
|
446
|
+
reach.headKunten = true;
|
|
447
|
+
}
|
|
448
|
+
if (hi - bottom > reach.foot + 1e-9) {
|
|
449
|
+
reach.foot = hi - bottom;
|
|
450
|
+
reach.footRuby = false;
|
|
451
|
+
reach.footKunten = true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
329
455
|
return reach;
|
|
330
456
|
}
|
|
457
|
+
/** A resource block's texts (#429): each table cell, the caption and the
|
|
458
|
+
* note, painted from their own fonts. Their lines carry their alignment
|
|
459
|
+
* (the measurer pushed a centred or right-aligned line over by its
|
|
460
|
+
* slack), so they are read flush from their start. The "continued"
|
|
461
|
+
* marker of a table slice holds no annotations. */
|
|
462
|
+
function resourceTextGroups(block, at) {
|
|
463
|
+
const rb = block.resourceBlock;
|
|
464
|
+
if (!rb)
|
|
465
|
+
return [];
|
|
466
|
+
const groups = [];
|
|
467
|
+
const add = (lines, fonts, key) => {
|
|
468
|
+
const first = lines[0];
|
|
469
|
+
if (!first || !lines.some((l) => l.segments?.some((s) => s.cjkMarks || s.ruby)))
|
|
470
|
+
return;
|
|
471
|
+
groups.push({
|
|
472
|
+
lines,
|
|
473
|
+
like: { bbox: first.bbox, textAlign: 'left', ...fonts },
|
|
474
|
+
pageIndex: block.pageIndex,
|
|
475
|
+
where: `${block.id}:${key}`,
|
|
476
|
+
at,
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
const t = rb.table;
|
|
480
|
+
if (t) {
|
|
481
|
+
t.cells.forEach((cell, i) => add(cell.lines, cell.isHeader
|
|
482
|
+
? { fontString: t.headerFontString, boldFontString: t.headerBoldFontString, italicFontString: t.headerItalicFontString, boldItalicFontString: t.headerBoldItalicFontString }
|
|
483
|
+
: { fontString: t.fontString, boldFontString: t.boldFontString, italicFontString: t.italicFontString, boldItalicFontString: t.boldItalicFontString }, `c${i}`));
|
|
484
|
+
}
|
|
485
|
+
add(rb.captionLines, { fontString: rb.captionFontString, boldFontString: rb.captionBoldFontString, italicFontString: rb.captionItalicFontString, boldItalicFontString: rb.captionBoldItalicFontString }, 'caption');
|
|
486
|
+
add(rb.noteLines, { fontString: rb.noteFontString, boldFontString: rb.noteBoldFontString, italicFontString: rb.noteItalicFontString, boldItalicFontString: rb.noteBoldItalicFontString }, 'note');
|
|
487
|
+
return groups;
|
|
488
|
+
}
|
|
489
|
+
/** The blocks of a document that hold a resource: in the flow and floated
|
|
490
|
+
* (`VDTPage.floats`), each once. */
|
|
491
|
+
function resourceBlocksOf(doc) {
|
|
492
|
+
const seen = new Set();
|
|
493
|
+
for (const block of doc.blocks)
|
|
494
|
+
if (block.resourceBlock)
|
|
495
|
+
seen.add(block);
|
|
496
|
+
for (const page of doc.pages)
|
|
497
|
+
for (const block of page.floats ?? [])
|
|
498
|
+
if (block.resourceBlock)
|
|
499
|
+
seen.add(block);
|
|
500
|
+
return [...seen];
|
|
501
|
+
}
|
|
331
502
|
/**
|
|
332
503
|
* Set `VDTLine.marks` on every line of the document that holds Chinese
|
|
333
504
|
* marks, and report the paragraphs whose line gap is narrower than their
|
|
334
|
-
* marks or
|
|
335
|
-
* once per paragraph. `cjk`
|
|
336
|
-
* `annotationColor`).
|
|
505
|
+
* marks, readings or kanbun marks need (`cjkMarksExceedLeading`,
|
|
506
|
+
* `rubyExceedsLeading`, `kuntenExceedsLeading`), once per paragraph. `cjk`
|
|
507
|
+
* is the resolved configuration (its `annotationColor`).
|
|
337
508
|
*
|
|
338
509
|
* The gap between two lines of a column is shared: what the upper line
|
|
339
510
|
* sets under it and the lower one over it (dots under one line and the
|
|
340
511
|
* readings over the next, in one paragraph or across two) must fit in it
|
|
341
512
|
* together. Where they do not, the lower line's paragraph is reported
|
|
342
|
-
* (`rubyExceedsLeading` when readings take part,
|
|
343
|
-
* `cjkMarksExceedLeading`).
|
|
513
|
+
* (`rubyExceedsLeading` when readings take part, `kuntenExceedsLeading`
|
|
514
|
+
* when kanbun marks do, else `cjkMarksExceedLeading`).
|
|
515
|
+
*
|
|
516
|
+
* The cells, captions and notes of resource blocks (#429) are texts of
|
|
517
|
+
* their own: their marks are set and their leading checked the same way,
|
|
518
|
+
* each text's lines sharing their gaps only with one another (a table's
|
|
519
|
+
* cells sit apart, a caption under its figure). A resource's text is set
|
|
520
|
+
* horizontally on every page, a vertical one turning the whole block.
|
|
344
521
|
*/
|
|
345
522
|
export function annotateDocument(doc, cjk) {
|
|
346
523
|
const warnings = [];
|
|
347
524
|
const color = cjk?.annotationColor?.hex;
|
|
348
525
|
const reported = new Set();
|
|
349
|
-
const whereOf = (block) => `${block.sourceStart ?? block.lines[0]?.sourceStart ?? block.id}`;
|
|
350
526
|
const atOf = (block) => ({
|
|
351
527
|
...(block.sourceStart !== undefined ? { sourceStart: block.sourceStart } : block.lines[0]?.sourceStart !== undefined ? { sourceStart: block.lines[0].sourceStart } : {}),
|
|
352
528
|
...(block.sourceEnd !== undefined ? { sourceEnd: block.sourceEnd } : {}),
|
|
353
529
|
...(block.pageIndex >= 0 ? { pageIndex: block.pageIndex } : {}),
|
|
354
530
|
});
|
|
355
|
-
|
|
356
|
-
* their reach. */
|
|
357
|
-
const columns = new Map();
|
|
531
|
+
const groups = [];
|
|
358
532
|
for (const block of doc.blocks) {
|
|
359
533
|
if (block.type === 'resource' || block.designOverlay)
|
|
360
534
|
continue;
|
|
535
|
+
groups.push({
|
|
536
|
+
lines: block.lines,
|
|
537
|
+
like: block,
|
|
538
|
+
pageIndex: block.pageIndex,
|
|
539
|
+
columnKey: `${block.pageIndex}:${block.columnIndex}`,
|
|
540
|
+
where: `${block.sourceStart ?? block.lines[0]?.sourceStart ?? block.id}`,
|
|
541
|
+
at: atOf(block),
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
for (const block of resourceBlocksOf(doc))
|
|
545
|
+
groups.push(...resourceTextGroups(block, atOf(block)));
|
|
546
|
+
/** The lines of each column's annotated paragraphs (of each resource
|
|
547
|
+
* text), in order, with their reach. */
|
|
548
|
+
const columns = new Map();
|
|
549
|
+
for (const group of groups) {
|
|
361
550
|
let marked = false;
|
|
362
551
|
let ruby = false;
|
|
363
|
-
|
|
552
|
+
let kunten = false;
|
|
553
|
+
for (const line of group.lines) {
|
|
364
554
|
const segs = line.segments;
|
|
365
555
|
if (!segs)
|
|
366
556
|
continue;
|
|
367
557
|
if (segs.some((s) => s.cjkMarks)) {
|
|
368
558
|
marked = true;
|
|
369
|
-
const flow =
|
|
559
|
+
const flow = group.columnKey !== undefined && group.pageIndex >= 0 ? doc.pages[group.pageIndex]?.flow : undefined;
|
|
370
560
|
const vertical = flow?.writingMode === 'vertical-rl' ? { region: cjk?.region ?? 'mainland', uprightDigits: cjk?.uprightDigits ?? 2 } : undefined;
|
|
371
|
-
const marks = lineMarks(line,
|
|
561
|
+
const marks = lineMarks(line, group.like, color, vertical);
|
|
372
562
|
if (marks.length > 0)
|
|
373
563
|
line.marks = marks;
|
|
374
564
|
}
|
|
375
|
-
// Only the CJK composer sets ruby (#194).
|
|
565
|
+
// Only the CJK composer sets ruby (#194). A footnote marker in the
|
|
566
|
+
// line gap is checked as a reading is, in any line.
|
|
376
567
|
if (line.cjkComposed && segs.some((s) => s.ruby && s.ruby.position !== 'right'))
|
|
377
568
|
ruby = true;
|
|
569
|
+
if (segs.some((s) => s.sideMarker))
|
|
570
|
+
ruby = true;
|
|
571
|
+
if (line.cjkComposed && segs.some((s) => s.kunten))
|
|
572
|
+
kunten = true;
|
|
378
573
|
}
|
|
379
|
-
if (!marked && !ruby)
|
|
574
|
+
if (!marked && !ruby && !kunten)
|
|
380
575
|
continue;
|
|
381
|
-
const em = fontEm(
|
|
382
|
-
const first =
|
|
576
|
+
const em = fontEm(group.like.fontString);
|
|
577
|
+
const first = group.lines[0];
|
|
383
578
|
if (!first || em <= 0)
|
|
384
579
|
continue;
|
|
385
|
-
if (
|
|
580
|
+
if (group.pageIndex >= 0) {
|
|
386
581
|
// Lines of plain paragraphs between two annotated ones are left
|
|
387
582
|
// out: the gap is then measured across them, and is wide.
|
|
388
|
-
const key =
|
|
583
|
+
const key = group.columnKey ?? group.where;
|
|
389
584
|
let column = columns.get(key);
|
|
390
585
|
if (!column)
|
|
391
586
|
columns.set(key, (column = []));
|
|
392
|
-
for (const line of
|
|
393
|
-
column.push({ line,
|
|
587
|
+
for (const line of group.lines)
|
|
588
|
+
column.push({ line, group, em, reach: lineReach(line, em) });
|
|
394
589
|
}
|
|
395
590
|
const gapEm = (first.bbox.height - em) / em;
|
|
396
|
-
const at =
|
|
397
|
-
const where = whereOf(block);
|
|
591
|
+
const { at, where } = group;
|
|
398
592
|
if (marked) {
|
|
399
|
-
const need = Math.max(...
|
|
593
|
+
const need = Math.max(...group.lines.map(marksNeed));
|
|
400
594
|
if (need > 0 && gapEm < need - 1e-6 && !reported.has(`m${where}`)) {
|
|
401
595
|
reported.add(`m${where}`);
|
|
402
596
|
warnings.push({ kind: 'cjkMarksExceedLeading', text: first.text, gapEm: round(gapEm), neededEm: need, ...at });
|
|
403
597
|
}
|
|
404
598
|
}
|
|
405
599
|
if (ruby) {
|
|
406
|
-
const need = Math.max(...
|
|
600
|
+
const need = Math.max(...group.lines.map((l) => rubyNeed(l, em)));
|
|
407
601
|
if (need > 0 && gapEm < need - 1e-6 && !reported.has(`r${where}`)) {
|
|
408
602
|
reported.add(`r${where}`);
|
|
409
603
|
warnings.push({ kind: 'rubyExceedsLeading', text: first.text, gapEm: round(gapEm), neededEm: round(need), ...at });
|
|
410
604
|
}
|
|
411
605
|
}
|
|
606
|
+
if (kunten) {
|
|
607
|
+
const need = Math.max(...group.lines.map((l) => kuntenNeed(l, em)));
|
|
608
|
+
if (need > 0 && gapEm < need - 1e-6 && !reported.has(`k${where}`)) {
|
|
609
|
+
reported.add(`k${where}`);
|
|
610
|
+
warnings.push({ kind: 'kuntenExceedsLeading', text: first.text, gapEm: round(gapEm), neededEm: round(need), ...at });
|
|
611
|
+
}
|
|
612
|
+
}
|
|
412
613
|
}
|
|
413
614
|
// The gaps two lines of a column share.
|
|
414
615
|
for (const column of columns.values()) {
|
|
@@ -422,16 +623,17 @@ export function annotateDocument(doc, cjk) {
|
|
|
422
623
|
if (need <= gap + 1e-6)
|
|
423
624
|
continue;
|
|
424
625
|
const ruby = a.reach.footRuby || b.reach.headRuby;
|
|
425
|
-
const
|
|
626
|
+
const kanbun = !ruby && (a.reach.footKunten === true || b.reach.headKunten === true);
|
|
627
|
+
const key = `${ruby ? 'r' : kanbun ? 'k' : 'm'}${b.group.where}`;
|
|
426
628
|
if (reported.has(key))
|
|
427
629
|
continue;
|
|
428
630
|
reported.add(key);
|
|
429
631
|
warnings.push({
|
|
430
|
-
kind: ruby ? 'rubyExceedsLeading' : 'cjkMarksExceedLeading',
|
|
632
|
+
kind: ruby ? 'rubyExceedsLeading' : kanbun ? 'kuntenExceedsLeading' : 'cjkMarksExceedLeading',
|
|
431
633
|
text: b.line.text,
|
|
432
634
|
gapEm: round(gap / b.em),
|
|
433
635
|
neededEm: round(need / b.em),
|
|
434
|
-
...
|
|
636
|
+
...b.group.at,
|
|
435
637
|
});
|
|
436
638
|
}
|
|
437
639
|
}
|