@sushichan044/kg-core 0.11.2 → 0.11.3

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/README.md CHANGED
@@ -430,3 +430,22 @@ For proofreading, import `createSpaceAfterQuestionOrExclamationRule` from
430
430
  `kg/space-after-question-or-exclamation` with the successful result's value.
431
431
  An empty string adds nothing; built-in marks remain enabled. Each Unicode code
432
432
  point is a separate symbol. Non-symbol characters are rejected.
433
+
434
+ ## Font preparation
435
+
436
+ Parsing preserves the source independently of the selected font. Before composition,
437
+ call `prepareManuscriptForFont(parsed, fontPreset)`. Its `parsed` value contains the
438
+ prepared display text and annotations; `mapRange` maps existing parser diagnostics
439
+ into its grapheme coordinates while preserving source and display UTF-16 offsets.
440
+ Always prepare from the original parse when changing fonts.
441
+
442
+ `prepareTextForFont(text, fontPreset)` applies the same rules to standalone titles
443
+ and author names. `mincho` selects Rin Mincho and combines spacing kana voicing
444
+ marks; `genei-koburi` and `gothic` preserve them. Existing combining marks stay intact.
445
+ Preparation preserves notation, style and per-character ruby boundaries. The current
446
+ built-in transforms preserve UTF-16 length and do not normalize the whole source.
447
+
448
+ Font profiles declare ordered text transforms, measurement policy and OpenType
449
+ features. Add a profile and its browser assets to support another built-in font;
450
+ parsers remain independent of font selection. Browser shaping is provided by
451
+ `@sushichan044/kg-viewer/typography`; core remains synchronous and DOM independent.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as ManuscriptResult, c as DiagnosticSeverity, d as ManuscriptRangeInput, i as ParsedManuscript, l as DiagnosticOrigin, n as ValidationIssue, o as ManuscriptDiagnostic, r as NamespacedId, s as ManuscriptDiagnosticInput, t as ComposedManuscript, u as ManuscriptRange } from "./composed-manuscript-C0f3mxKs.mjs";
2
- import { d as PaperSizeId, f as ManuscriptComposer, i as novelComposer, l as NovelLayout, n as NovelComposedManuscript, p as ManuscriptParser, t as PresentationKind, u as NovelCompositionSettings } from "./presentation-kind-DnJkvxHU.mjs";
2
+ import { d as PaperSizeId, f as ManuscriptComposer, i as novelComposer, l as NovelLayout, n as NovelComposedManuscript, p as ManuscriptParser, t as PresentationKind, u as NovelCompositionSettings } from "./presentation-kind-BmW1Edu7.mjs";
3
3
  import * as v from "valibot";
4
4
  //#region src/parser/parse-error.d.ts
5
5
  /**
@@ -1814,25 +1814,25 @@ export declare const ManuscriptOffsets: {
1814
1814
  declare const ManuscriptAppearanceSettingsSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
1815
1815
  readonly paperSize: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "jis-b6", "shinsho"], undefined>;
1816
1816
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
1817
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
1817
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
1818
1818
  }, undefined>, v.ReadonlyAction<{
1819
1819
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
1820
1820
  fontSizeQ: number;
1821
- fontPreset: "gothic" | "mincho";
1821
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
1822
1822
  }>]>;
1823
1823
  /**
1824
- * Everything that changes the physical dimensions of a page, but not how text fills the grid.
1824
+ * Page dimensions and the typography profile used to prepare and measure text.
1825
1825
  */
1826
1826
  export type ManuscriptAppearanceSettings = v.InferOutput<typeof ManuscriptAppearanceSettingsSchema>;
1827
1827
  export declare const ManuscriptAppearanceSettings: {
1828
1828
  readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
1829
1829
  readonly paperSize: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "jis-b6", "shinsho"], undefined>;
1830
1830
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
1831
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
1831
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
1832
1832
  }, undefined>, v.ReadonlyAction<{
1833
1833
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
1834
1834
  fontSizeQ: number;
1835
- fontPreset: "gothic" | "mincho";
1835
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
1836
1836
  }>]>;
1837
1837
  readonly defaults: {
1838
1838
  readonly paperSize: "a5";
@@ -1952,32 +1952,59 @@ export declare const ManuscriptGeometry: {
1952
1952
  };
1953
1953
  //#endregion
1954
1954
  //#region src/appearance/font-preset-id.d.ts
1955
- declare const FontPresetIdSchema: v.PicklistSchema<["mincho", "gothic"], undefined>;
1955
+ declare const FontPresetIdSchema: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
1956
1956
  /**
1957
- * The two typeface families Japanese body text is set in: 明朝体, the serifed face a novel is normally
1958
- * set in, and ゴシック体, its sans-serif counterpart.
1957
+ * Built-in typography profiles. The persisted mincho ID selects Rin Mincho.
1959
1958
  */
1960
1959
  export type FontPresetId = v.InferOutput<typeof FontPresetIdSchema>;
1961
1960
  export declare const FontPresetId: {
1962
- readonly schema: v.PicklistSchema<["mincho", "gothic"], undefined>;
1961
+ readonly schema: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
1963
1962
  readonly is: (value: unknown) => value is FontPresetId;
1964
1963
  };
1965
1964
  //#endregion
1966
1965
  //#region src/appearance/font-preset.d.ts
1966
+ type FontTextTransform = "combine-kana-voicing-marks";
1967
1967
  export type FontPreset = Readonly<{
1968
1968
  id: FontPresetId;
1969
1969
  label: string;
1970
+ fontName: string;
1970
1971
  family: string;
1972
+ textTransforms: readonly FontTextTransform[];
1973
+ measurement: "logical" | "browser-shaped";
1974
+ rendering: Readonly<{
1975
+ features: Readonly<Record<string, number>>;
1976
+ westernKerning: "normal" | "none";
1977
+ synthesis: "weight style" | "style";
1978
+ }>;
1971
1979
  }>;
1972
1980
  export declare const FontPreset: {
1973
1981
  readonly of: (id: FontPresetId) => FontPreset;
1974
1982
  readonly all: readonly Readonly<{
1975
1983
  id: FontPresetId;
1976
1984
  label: string;
1985
+ fontName: string;
1977
1986
  family: string;
1987
+ textTransforms: readonly FontTextTransform[];
1988
+ measurement: "logical" | "browser-shaped";
1989
+ rendering: Readonly<{
1990
+ features: Readonly<Record<string, number>>;
1991
+ westernKerning: "normal" | "none";
1992
+ synthesis: "weight style" | "style";
1993
+ }>;
1978
1994
  }>[];
1979
1995
  };
1980
1996
  //#endregion
1997
+ //#region src/appearance/font-preparation.d.ts
1998
+ type PreparedFontManuscript = Readonly<{
1999
+ parsed: ParsedManuscript;
2000
+ mapRange: (range: ManuscriptRange) => ManuscriptRange;
2001
+ }>;
2002
+ export declare function prepareTextForFont(text: string, fontPreset: FontPresetId): string;
2003
+ /**
2004
+ * Prepare display text after parsing; source and UTF-16 offsets remain unchanged.
2005
+ */
2006
+ export declare function prepareManuscriptForFont(parsed: ParsedManuscript, fontPreset: FontPresetId): PreparedFontManuscript;
2007
+ //#endregion
1981
2008
  //#region src/appearance/font-size-q.d.ts
1982
2009
  declare const FontSizeQSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
1983
2010
  /**
@@ -34198,4 +34225,4 @@ declare const TextRange: {
34198
34225
  }>, "range end must not precede its start">]>;
34199
34226
  };
34200
34227
  //#endregion
34201
- export { type AnnotationPlacement, type BoldAnnotation, type CombinedGlyphUnit, type ComposeManuscriptOptions, type ComposedAnnotationFragment, type ComposedGlue, type ComposedKern, type ComposedManuscript, type CompositionStatistics, type DiagnosticOrigin, type DiagnosticSeverity, type DisplayRange, type EmphasisAnnotation, type GraphemeRange, type InlineSpan, type ItalicAnnotation, type LineBreakResult, type LineOffset, type ManuscriptAnnotation, ManuscriptDiagnostic, type ManuscriptDiagnosticInput, ManuscriptRange, type ManuscriptRangeInput, ManuscriptResult, type NovelComposedManuscript, NovelCompositionSettings, type NovelLayout, type NovelLine, type NovelPage, type NovelStage, PaperSizeId, type ParseManuscriptOptions, type ParsedGrapheme, type ParsedManuscript, type PositionedInlineItem, type PresentationKind, type RubyAnnotation, type RubyKind, type RubyReading, type SingleGlyphUnit, type SourcePlacement, type SourcePosition, type SourceRange, type SuppressedInlineItem, type TextRange, novelComposer };
34228
+ export { type AnnotationPlacement, type BoldAnnotation, type CombinedGlyphUnit, type ComposeManuscriptOptions, type ComposedAnnotationFragment, type ComposedGlue, type ComposedKern, type ComposedManuscript, type CompositionStatistics, type DiagnosticOrigin, type DiagnosticSeverity, type DisplayRange, type EmphasisAnnotation, type GraphemeRange, type InlineSpan, type ItalicAnnotation, type LineBreakResult, type LineOffset, type ManuscriptAnnotation, ManuscriptDiagnostic, type ManuscriptDiagnosticInput, ManuscriptRange, type ManuscriptRangeInput, ManuscriptResult, type NovelComposedManuscript, NovelCompositionSettings, type NovelLayout, type NovelLine, type NovelPage, type NovelStage, PaperSizeId, type ParseManuscriptOptions, type ParsedGrapheme, type ParsedManuscript, type PositionedInlineItem, type PreparedFontManuscript, type PresentationKind, type RubyAnnotation, type RubyKind, type RubyReading, type SingleGlyphUnit, type SourcePlacement, type SourcePosition, type SourceRange, type SuppressedInlineItem, type TextRange, novelComposer };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as ManuscriptRange, d as graphemeSegmenter, f as ValidationIssue, g as NamespacedId, m as ManuscriptDiagnostic, p as ManuscriptResult, u as assertNever, x as readonlyObject } from "./question-or-exclamation-spacing-D7TSDUG8.mjs";
2
- import { _ as ParsedManuscript, c as NovelFlowSettings, d as ManuscriptPageSettings, f as PaperSize, g as FontPresetId, h as FontSizeQ, l as ManuscriptOffsets, m as PaperSizeId, n as novelComposer, p as ManuscriptAppearanceSettings, s as NovelCompositionSettings, u as ManuscriptGeometry } from "./novel-composer-tcseYHc8.mjs";
2
+ import { _ as ParsedManuscript, c as NovelFlowSettings, d as ManuscriptPageSettings, f as PaperSize, g as FontPresetId, h as FontSizeQ, l as ManuscriptOffsets, m as PaperSizeId, n as novelComposer, p as ManuscriptAppearanceSettings, s as NovelCompositionSettings, u as ManuscriptGeometry } from "./novel-composer-DNsKrJIP.mjs";
3
3
  import { t as describeCause } from "./describe-cause-SABI_1ex.mjs";
4
4
  import * as v from "valibot";
5
5
  const Rejection = { schema: readonlyObject({ reason: v.string() }) };
@@ -598,16 +598,48 @@ function joinIssues(issues) {
598
598
  }
599
599
  //#endregion
600
600
  //#region src/appearance/font-preset.ts
601
+ const FIXED_PITCH = {
602
+ features: {
603
+ palt: 0,
604
+ vpal: 0,
605
+ halt: 0,
606
+ vhal: 0,
607
+ vkrn: 0,
608
+ liga: 1
609
+ },
610
+ westernKerning: "normal",
611
+ synthesis: "weight style"
612
+ };
601
613
  const FONT_PRESETS = {
602
614
  mincho: {
603
615
  id: "mincho",
604
- label: "明朝",
605
- family: "\"Yu Mincho\", \"Hiragino Mincho ProN\", \"Hiragino Mincho Pro\", serif"
616
+ label: "倫明朝",
617
+ fontName: "KGRinMincho100",
618
+ family: "\"KGRinMincho100\", \"Yu Mincho\", \"Hiragino Mincho ProN\", serif",
619
+ textTransforms: ["combine-kana-voicing-marks"],
620
+ measurement: "browser-shaped",
621
+ rendering: {
622
+ ...FIXED_PITCH,
623
+ synthesis: "style"
624
+ }
606
625
  },
607
626
  gothic: {
608
627
  id: "gothic",
609
628
  label: "ゴシック",
610
- family: "\"Yu Gothic\", \"Hiragino Kaku Gothic ProN\", system-ui, sans-serif"
629
+ fontName: "",
630
+ family: "\"Yu Gothic\", \"Hiragino Kaku Gothic ProN\", system-ui, sans-serif",
631
+ textTransforms: [],
632
+ measurement: "logical",
633
+ rendering: FIXED_PITCH
634
+ },
635
+ "genei-koburi": {
636
+ id: "genei-koburi",
637
+ label: "源暎こぶり明朝",
638
+ fontName: "KGGenEiKoburi61",
639
+ family: "\"KGGenEiKoburi61\", \"Yu Mincho\", \"Hiragino Mincho ProN\", serif",
640
+ textTransforms: [],
641
+ measurement: "browser-shaped",
642
+ rendering: FIXED_PITCH
611
643
  }
612
644
  };
613
645
  const FontPreset = {
@@ -615,4 +647,123 @@ const FontPreset = {
615
647
  all: Object.values(FONT_PRESETS)
616
648
  };
617
649
  //#endregion
618
- export { ComposeError, FontPreset, FontPresetId, FontSizeQ, ManuscriptAppearanceSettings, ManuscriptDiagnostic, ManuscriptGeometry, ManuscriptOffsets, ManuscriptPageSettings, ManuscriptRange, ManuscriptResult, NovelCompositionSettings, NovelFlowSettings, PaperSize, PaperSizeId, ParseError, composeManuscript, kakuyomuParser, novelComposer, parseManuscript, pixivParser, plainTextParser };
650
+ //#region src/appearance/internal/font-text-transforms.ts
651
+ const transforms = { "combine-kana-voicing-marks": (text) => text.replace(/([\u3041-\u3096\u30A1-\u30FA\u31F0-\u31FF])([\u309B\u309C])/gu, (_, kana, mark) => kana + (mark === "゛" ? "゙" : "゚")) };
652
+ function applyFontTextTransforms(text, rules) {
653
+ return rules.reduce((value, rule) => transforms[rule](value), text);
654
+ }
655
+ //#endregion
656
+ //#region src/appearance/font-preparation.ts
657
+ function prepareTextForFont(text, fontPreset) {
658
+ return applyFontTextTransforms(text, FontPreset.of(fontPreset).textTransforms);
659
+ }
660
+ /**
661
+ * Prepare display text after parsing; source and UTF-16 offsets remain unchanged.
662
+ */
663
+ function prepareManuscriptForFont(parsed, fontPreset) {
664
+ if (FontPreset.of(fontPreset).textTransforms.length === 0) return {
665
+ parsed,
666
+ mapRange: (range) => range
667
+ };
668
+ const boundaries = /* @__PURE__ */ new Set([0, parsed.displayText.length]);
669
+ for (const annotation of parsed.annotations) {
670
+ boundaries.add(annotation.range.display.start);
671
+ boundaries.add(annotation.range.display.end);
672
+ if (annotation.kind === "ruby" && annotation.reading.kind !== "group") for (const member of parsed.graphemes.slice(annotation.range.graphemes.start, annotation.range.graphemes.end)) boundaries.add(member.range.display.start);
673
+ }
674
+ for (const [index, member] of parsed.graphemes.entries()) {
675
+ const previous = parsed.graphemes[index - 1];
676
+ if (previous !== void 0 && previous.range.source.end !== member.range.source.start) boundaries.add(member.range.display.start);
677
+ }
678
+ const ordered = [...boundaries].sort((a, b) => a - b);
679
+ const parts = [];
680
+ const graphemes = [];
681
+ let originalIndex = 0;
682
+ for (let i = 1; i < ordered.length; i += 1) {
683
+ const start = ordered[i - 1];
684
+ const end = ordered[i];
685
+ if (start === void 0 || end === void 0) continue;
686
+ const text = prepareTextForFont(parsed.displayText.slice(start, end), fontPreset);
687
+ parts.push(text);
688
+ for (const { segment, index } of graphemeSegmenter.segment(text)) {
689
+ const displayStart = start + index;
690
+ const displayEnd = displayStart + segment.length;
691
+ while ((parsed.graphemes[originalIndex]?.range.display.end ?? Infinity) <= displayStart) originalIndex += 1;
692
+ const first = parsed.graphemes[originalIndex];
693
+ let last = first;
694
+ while (last !== void 0 && last.range.display.end < displayEnd) {
695
+ originalIndex += 1;
696
+ last = parsed.graphemes[originalIndex];
697
+ }
698
+ if (first === void 0 || last === void 0) throw new Error("Font preparation lost a source member");
699
+ graphemes.push({
700
+ value: segment,
701
+ range: ManuscriptRange.of({
702
+ source: {
703
+ start: first.range.source.start,
704
+ end: last.range.source.end
705
+ },
706
+ display: {
707
+ start: displayStart,
708
+ end: displayEnd
709
+ },
710
+ graphemes: {
711
+ start: graphemes.length,
712
+ end: graphemes.length + 1
713
+ }
714
+ })
715
+ });
716
+ }
717
+ }
718
+ const boundaryIndex = (offset, end) => {
719
+ let low = 0;
720
+ let high = graphemes.length;
721
+ while (low < high) {
722
+ const mid = Math.floor((low + high) / 2);
723
+ const member = graphemes[mid];
724
+ if (member !== void 0 && (end ? member.range.display.start < offset : member.range.display.end <= offset)) low = mid + 1;
725
+ else high = mid;
726
+ }
727
+ return low;
728
+ };
729
+ const mapRange = (range) => {
730
+ const start = boundaryIndex(range.display.start, false);
731
+ return ManuscriptRange.of({
732
+ ...range,
733
+ graphemes: {
734
+ start,
735
+ end: range.display.start === range.display.end ? start : boundaryIndex(range.display.end, true)
736
+ }
737
+ });
738
+ };
739
+ const annotations = parsed.annotations.map((annotation) => {
740
+ const range = mapRange(annotation.range);
741
+ if (annotation.kind !== "ruby") return {
742
+ ...annotation,
743
+ range
744
+ };
745
+ const reading = annotation.reading.kind === "group" ? {
746
+ kind: "group",
747
+ text: prepareTextForFont(annotation.reading.text, fontPreset)
748
+ } : {
749
+ ...annotation.reading,
750
+ segments: annotation.reading.segments.map((text) => prepareTextForFont(text, fontPreset))
751
+ };
752
+ return {
753
+ ...annotation,
754
+ range,
755
+ reading
756
+ };
757
+ });
758
+ return {
759
+ parsed: v.parse(ParsedManuscript.contractFor(parsed.source), {
760
+ source: parsed.source,
761
+ displayText: parts.join(""),
762
+ graphemes,
763
+ annotations
764
+ }),
765
+ mapRange
766
+ };
767
+ }
768
+ //#endregion
769
+ export { ComposeError, FontPreset, FontPresetId, FontSizeQ, ManuscriptAppearanceSettings, ManuscriptDiagnostic, ManuscriptGeometry, ManuscriptOffsets, ManuscriptPageSettings, ManuscriptRange, ManuscriptResult, NovelCompositionSettings, NovelFlowSettings, PaperSize, PaperSizeId, ParseError, composeManuscript, kakuyomuParser, novelComposer, parseManuscript, pixivParser, plainTextParser, prepareManuscriptForFont, prepareTextForFont };
@@ -134,7 +134,11 @@ const A6_PAGE_FORMAT = {
134
134
  };
135
135
  //#endregion
136
136
  //#region src/appearance/font-preset-id.ts
137
- const FontPresetIdSchema = v.picklist(["mincho", "gothic"]);
137
+ const FontPresetIdSchema = v.picklist([
138
+ "mincho",
139
+ "gothic",
140
+ "genei-koburi"
141
+ ]);
138
142
  const FontPresetId = {
139
143
  schema: FontPresetIdSchema,
140
144
  is: (value) => v.is(FontPresetIdSchema, value)
@@ -1139,7 +1143,7 @@ const HYPHENS = /* @__PURE__ */ new Set("‐‑⁃–");
1139
1143
  const DIVIDING_MARKS = new Set(SENTENCE_ENDING_MARKS);
1140
1144
  const COMBINED_DIVIDING_MARKS = new Set(TATE_CHU_YOKO_MARKS);
1141
1145
  const MIDDLE_DOTS = /* @__PURE__ */ new Set("・:;");
1142
- const SMALL_KANA = /* @__PURE__ */ new Set("ァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖ");
1146
+ const SMALL_KANA = /* @__PURE__ */ new Set("ァィゥェォッャュョヮヵヶㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿぁぃぅぇぉっゃゅょゎゕゖ");
1143
1147
  const ITERATION_MARKS = /* @__PURE__ */ new Set("ヽヾゝゞ々〻");
1144
1148
  const INSEPARABLE = /* @__PURE__ */ new Set("—―…‥─〳〴〵");
1145
1149
  const PREFIXED_ABBREVIATIONS = /* @__PURE__ */ new Set("¥$£##");
@@ -1162,6 +1166,7 @@ const WESTERN = /^[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}]$/u;
1162
1166
  * the same as a tate-chu-yoko run's 3.2.5.
1163
1167
  */
1164
1168
  function classify({ value, presentation }) {
1169
+ value = value.replace(/[\u3099\u309A]/gu, "");
1165
1170
  switch (presentation) {
1166
1171
  case "tate-chu-yoko": return COMBINED_DIVIDING_MARKS.has(value) ? "cl-04" : "cl-30";
1167
1172
  case "upright": return "cl-19";
@@ -1923,10 +1928,11 @@ const RunMeasurement = {
1923
1928
  //#region src/composer/internal/measurement-session.ts
1924
1929
  const MeasurementSession = { create: (provider, settings) => {
1925
1930
  const cache = /* @__PURE__ */ new Map();
1926
- const get = (text, kind, presentation = "mixed") => {
1931
+ const get = (text, kind, presentation = "mixed", style) => {
1927
1932
  const request = kind === "base" ? {
1928
1933
  text,
1929
1934
  kind,
1935
+ ...style === void 0 ? {} : { style },
1930
1936
  presentation,
1931
1937
  fontPreset: settings.appearance.fontPreset,
1932
1938
  fontSizeQ: settings.appearance.fontSizeQ,
@@ -1935,6 +1941,7 @@ const MeasurementSession = { create: (provider, settings) => {
1935
1941
  } : {
1936
1942
  text,
1937
1943
  kind,
1944
+ ...style === void 0 ? {} : { style },
1938
1945
  presentation: "mixed",
1939
1946
  fontPreset: settings.appearance.fontPreset,
1940
1947
  fontSizeQ: settings.appearance.fontSizeQ,
@@ -1949,8 +1956,8 @@ const MeasurementSession = { create: (provider, settings) => {
1949
1956
  };
1950
1957
  return {
1951
1958
  get,
1952
- pieces: (text, kind, presentation) => {
1953
- const full = get(text, kind, presentation);
1959
+ pieces: (text, kind, presentation, style) => {
1960
+ const full = get(text, kind, presentation, style);
1954
1961
  if (full === void 0) return void 0;
1955
1962
  if (full.kind === "clustered") return full.clusters.map((cluster) => ({
1956
1963
  textRange: cluster.textRange,
@@ -1980,7 +1987,7 @@ const MeasurementSession = { create: (provider, settings) => {
1980
1987
  const pieces = [];
1981
1988
  let offsetEm = 0;
1982
1989
  for (const { segment, index } of segments) {
1983
- const measured = get(segment, kind, presentation);
1990
+ const measured = get(segment, kind, presentation, style);
1984
1991
  if (measured === void 0) return void 0;
1985
1992
  const cluster = measured.kind === "clustered" ? measured.clusters[0] : void 0;
1986
1993
  pieces.push({
@@ -2929,44 +2936,81 @@ function displayedLines(graphemes) {
2929
2936
  if (lines.length > 1 && endedWithLineBreak) lines.pop();
2930
2937
  return lines;
2931
2938
  }
2939
+ function styleGroups(run, annotations) {
2940
+ const groups = [];
2941
+ if (annotations.length === 0) return [{
2942
+ members: run.members,
2943
+ style: {
2944
+ weight: 400,
2945
+ slant: "normal"
2946
+ }
2947
+ }];
2948
+ for (const member of run.members) {
2949
+ const styles = annotations.filter((annotation) => (annotation.kind === "bold" || annotation.kind === "italic") && ManuscriptRange.overlaps(annotation.range, member.range));
2950
+ const weight = styles.some(({ kind }) => kind === "bold") ? 700 : 400;
2951
+ const slant = styles.some(({ kind }) => kind === "italic") ? "italic" : "normal";
2952
+ const last = groups.at(-1);
2953
+ if (last !== void 0 && (run.presentation !== "sideways" || last.style.weight === weight && last.style.slant === slant)) last.members.push(member);
2954
+ else groups.push({
2955
+ members: [member],
2956
+ style: {
2957
+ weight,
2958
+ slant
2959
+ }
2960
+ });
2961
+ }
2962
+ return groups;
2963
+ }
2964
+ /**
2965
+ * Preserve shaped advances while keeping partial annotations on their own bases.
2966
+ */
2932
2967
  function measureSourceLine(sourceLine, annotations, measurements, additionalSentenceEndingMarks) {
2933
2968
  const runs = CompositionRun.recognize(sourceLine, additionalSentenceEndingMarks);
2934
2969
  const rubyAssociations = RubyAssociation.collect(annotations, sourceLine);
2970
+ const styles = annotations.filter(({ kind }) => kind === "bold" || kind === "italic");
2935
2971
  const atoms = [];
2972
+ let renderGroup = 0;
2936
2973
  for (const [runIndex, run] of runs.entries()) {
2937
- const text = run.members.map(({ value }) => value).join("");
2938
- const pieces = measurements.pieces(text, "base", run.presentation);
2939
- if (pieces === void 0) return void 0;
2940
- const combineRun = run.presentation === "tate-chu-yoko" || pieces.length < run.members.length;
2941
- let memberStart = 0;
2942
- for (const piece of pieces) {
2943
- const memberCount = [...graphemeSegmenter.segment(piece.value)].length;
2944
- const members = run.members.slice(memberStart, memberStart + memberCount);
2945
- const clusterRange = memberCount > 1 ? ManuscriptRange.merge(members.map(({ range }) => range)) : null;
2946
- for (const [memberIndex, grapheme] of members.entries()) {
2947
- const first = memberIndex === 0;
2948
- const renderAdvanceEm = first ? piece.renderSpan.advanceEm : 0;
2949
- const measuredAdvanceEm = first ? piece.layoutSpan.advanceEm : 0;
2950
- const sentenceEndingMark = isSentenceEndingMark(grapheme.value, additionalSentenceEndingMarks);
2951
- const characterClass = sentenceEndingMark ? "cl-04" : TYPESETTING_PROFILE.classify({
2952
- value: grapheme.value,
2953
- presentation: run.presentation
2954
- });
2955
- const metrics = TYPESETTING_PROFILE.boxMetrics(characterClass, sentenceEndingMark && !combineRun ? 1 : measuredAdvanceEm);
2956
- atoms.push({
2957
- grapheme,
2958
- runIndex,
2959
- characterClass,
2960
- intrinsicBoxAdvanceEm: metrics.advanceEm,
2961
- boxAdvanceEm: metrics.advanceEm,
2962
- renderAdvanceEm,
2963
- renderOffsetEm: metrics.renderOffsetEm + (first ? piece.renderSpan.offsetEm - piece.layoutSpan.offsetEm : 0),
2964
- presentation: run.presentation,
2965
- clusterRange,
2966
- combineRun
2967
- });
2974
+ const partialRuby = run.presentation === "sideways" && rubyAssociations.some(({ baseRange }) => ManuscriptRange.overlaps(baseRange, run.range) && (baseRange.graphemes.start > run.range.graphemes.start || baseRange.graphemes.end < run.range.graphemes.end));
2975
+ for (const group of styleGroups(run, styles)) {
2976
+ renderGroup += 1;
2977
+ const text = group.members.map(({ value }) => value).join("");
2978
+ const style = group.style.weight === 400 && group.style.slant === "normal" ? void 0 : group.style;
2979
+ const pieces = measurements.pieces(text, "base", run.presentation, style);
2980
+ if (pieces === void 0) return void 0;
2981
+ const clusteredSideways = run.presentation === "sideways" && measurements.get(text, "base", run.presentation, style)?.kind === "clustered";
2982
+ const combineRun = run.presentation === "tate-chu-yoko" || pieces.length < group.members.length || clusteredSideways && group.members.length > 1 && !partialRuby;
2983
+ let memberStart = 0;
2984
+ for (const piece of pieces) {
2985
+ const memberCount = [...graphemeSegmenter.segment(piece.value)].length;
2986
+ const members = group.members.slice(memberStart, memberStart + memberCount);
2987
+ const clusterRange = memberCount > 1 ? ManuscriptRange.merge(members.map(({ range }) => range)) : null;
2988
+ for (const [memberIndex, grapheme] of members.entries()) {
2989
+ const first = memberIndex === 0;
2990
+ const renderAdvanceEm = first ? piece.renderSpan.advanceEm : 0;
2991
+ const measuredAdvanceEm = first ? piece.layoutSpan.advanceEm : 0;
2992
+ const sentenceEndingMark = isSentenceEndingMark(grapheme.value, additionalSentenceEndingMarks);
2993
+ const characterClass = sentenceEndingMark ? "cl-04" : TYPESETTING_PROFILE.classify({
2994
+ value: grapheme.value,
2995
+ presentation: run.presentation
2996
+ });
2997
+ const metrics = TYPESETTING_PROFILE.boxMetrics(characterClass, sentenceEndingMark && !combineRun ? 1 : measuredAdvanceEm);
2998
+ atoms.push({
2999
+ grapheme,
3000
+ runIndex,
3001
+ renderGroup,
3002
+ characterClass,
3003
+ intrinsicBoxAdvanceEm: metrics.advanceEm,
3004
+ boxAdvanceEm: metrics.advanceEm,
3005
+ renderAdvanceEm,
3006
+ renderOffsetEm: metrics.renderOffsetEm + (first ? piece.renderSpan.offsetEm - piece.layoutSpan.offsetEm : 0),
3007
+ presentation: run.presentation,
3008
+ clusterRange,
3009
+ combineRun
3010
+ });
3011
+ }
3012
+ memberStart += memberCount;
2968
3013
  }
2969
- memberStart += memberCount;
2970
3014
  }
2971
3015
  }
2972
3016
  const candidateReadings = [];
@@ -2975,8 +3019,8 @@ function measureSourceLine(sourceLine, annotations, measurements, additionalSent
2975
3019
  const physicalRange = (first, last) => {
2976
3020
  const left = atoms[first];
2977
3021
  const right = atoms[last];
2978
- while (first > 0 && left?.combineRun === true && atoms[first - 1]?.runIndex === left.runIndex) first -= 1;
2979
- while (last + 1 < atoms.length && right?.combineRun === true && atoms[last + 1]?.runIndex === right.runIndex) last += 1;
3022
+ while (first > 0 && left?.combineRun === true && atoms[first - 1]?.renderGroup === left.renderGroup) first -= 1;
3023
+ while (last + 1 < atoms.length && right?.combineRun === true && atoms[last + 1]?.renderGroup === right.renderGroup) last += 1;
2980
3024
  return {
2981
3025
  start: first,
2982
3026
  end: last + 1
@@ -3113,7 +3157,7 @@ function renderUnits(raw) {
3113
3157
  const members = [first];
3114
3158
  if (first.atom.combineRun) while (index + 1 < raw.length) {
3115
3159
  const next = raw[index + 1];
3116
- if (next?.kind !== "member" || next.atom.runIndex !== first.atom.runIndex) break;
3160
+ if (next?.kind !== "member" || next.atom.renderGroup !== first.atom.renderGroup) break;
3117
3161
  members.push(next);
3118
3162
  index += 1;
3119
3163
  }
package/dist/plugin.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, r as NamespacedId } from "./composed-manuscript-C0f3mxKs.mjs";
2
- import { a as RunMeasurer, c as MeasurementRequest, f as ManuscriptComposer, m as Rejection, o as logicalRunMeasurer, p as ManuscriptParser, r as createNovelComposer, s as RunMeasurement, t as PresentationKind } from "./presentation-kind-DnJkvxHU.mjs";
2
+ import { a as RunMeasurer, c as MeasurementRequest, f as ManuscriptComposer, m as Rejection, o as logicalRunMeasurer, p as ManuscriptParser, r as createNovelComposer, s as RunMeasurement, t as PresentationKind } from "./presentation-kind-BmW1Edu7.mjs";
3
3
  import * as v from "valibot";
4
4
  //#region src/composer/measurement-text-range.d.ts
5
5
  declare const MeasurementTextRangeSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
package/dist/plugin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { f as ValidationIssue, g as NamespacedId, p as ManuscriptResult, x as readonlyObject } from "./question-or-exclamation-spacing-D7TSDUG8.mjs";
2
- import { _ as ParsedManuscript, a as MeasuredCluster, g as FontPresetId, h as FontSizeQ, i as RunMeasurement, o as MeasurementTextRange, r as logicalRunMeasurer, t as createNovelComposer } from "./novel-composer-tcseYHc8.mjs";
2
+ import { _ as ParsedManuscript, a as MeasuredCluster, g as FontPresetId, h as FontSizeQ, i as RunMeasurement, o as MeasurementTextRange, r as logicalRunMeasurer, t as createNovelComposer } from "./novel-composer-DNsKrJIP.mjs";
3
3
  import * as v from "valibot";
4
4
  const PresentationKind = { schema: v.picklist([
5
5
  "mixed",
@@ -11,6 +11,10 @@ const PresentationKind = { schema: v.picklist([
11
11
  //#region src/composer/measurement-request.ts
12
12
  const context = {
13
13
  text: v.string(),
14
+ style: v.optional(readonlyObject({
15
+ weight: v.picklist([400, 700]),
16
+ slant: v.picklist(["normal", "italic"])
17
+ })),
14
18
  fontPreset: FontPresetId.schema,
15
19
  fontSizeQ: FontSizeQ.schema,
16
20
  scale: v.pipe(v.number(), v.finite(), v.minValue(Number.MIN_VALUE)),
@@ -107,11 +107,11 @@ declare const NovelCompositionSettingsSchema: v.SchemaWithPipe<readonly [v.Schem
107
107
  readonly appearance: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
108
108
  readonly paperSize: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "jis-b6", "shinsho"], undefined>;
109
109
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
110
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
110
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
111
111
  }, undefined>, v.ReadonlyAction<{
112
112
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
113
113
  fontSizeQ: number;
114
- fontPreset: "gothic" | "mincho";
114
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
115
115
  }>]>;
116
116
  readonly page: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
117
117
  readonly lineGapMm: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -152,7 +152,7 @@ declare const NovelCompositionSettingsSchema: v.SchemaWithPipe<readonly [v.Schem
152
152
  readonly appearance: Readonly<{
153
153
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
154
154
  fontSizeQ: number;
155
- fontPreset: "gothic" | "mincho";
155
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
156
156
  }>;
157
157
  readonly page: Readonly<{
158
158
  lineGapMm: number;
@@ -186,7 +186,7 @@ declare const NovelCompositionSettingsSchema: v.SchemaWithPipe<readonly [v.Schem
186
186
  readonly appearance: Readonly<{
187
187
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
188
188
  fontSizeQ: number;
189
- fontPreset: "gothic" | "mincho";
189
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
190
190
  }>;
191
191
  readonly page: Readonly<{
192
192
  lineGapMm: number;
@@ -220,7 +220,7 @@ declare const NovelCompositionSettingsSchema: v.SchemaWithPipe<readonly [v.Schem
220
220
  readonly appearance: Readonly<{
221
221
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
222
222
  fontSizeQ: number;
223
- fontPreset: "gothic" | "mincho";
223
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
224
224
  }>;
225
225
  readonly page: Readonly<{
226
226
  lineGapMm: number;
@@ -254,7 +254,7 @@ declare const NovelCompositionSettingsSchema: v.SchemaWithPipe<readonly [v.Schem
254
254
  readonly appearance: Readonly<{
255
255
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
256
256
  fontSizeQ: number;
257
- fontPreset: "gothic" | "mincho";
257
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
258
258
  }>;
259
259
  readonly page: Readonly<{
260
260
  lineGapMm: number;
@@ -288,7 +288,7 @@ declare const NovelCompositionSettingsSchema: v.SchemaWithPipe<readonly [v.Schem
288
288
  readonly appearance: Readonly<{
289
289
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
290
290
  fontSizeQ: number;
291
- fontPreset: "gothic" | "mincho";
291
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
292
292
  }>;
293
293
  readonly page: Readonly<{
294
294
  lineGapMm: number;
@@ -354,11 +354,11 @@ declare const NovelCompositionSettings: {
354
354
  readonly appearance: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
355
355
  readonly paperSize: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "jis-b6", "shinsho"], undefined>;
356
356
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
357
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
357
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
358
358
  }, undefined>, v.ReadonlyAction<{
359
359
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
360
360
  fontSizeQ: number;
361
- fontPreset: "gothic" | "mincho";
361
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
362
362
  }>]>;
363
363
  readonly page: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
364
364
  readonly lineGapMm: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -399,7 +399,7 @@ declare const NovelCompositionSettings: {
399
399
  readonly appearance: Readonly<{
400
400
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
401
401
  fontSizeQ: number;
402
- fontPreset: "gothic" | "mincho";
402
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
403
403
  }>;
404
404
  readonly page: Readonly<{
405
405
  lineGapMm: number;
@@ -433,7 +433,7 @@ declare const NovelCompositionSettings: {
433
433
  readonly appearance: Readonly<{
434
434
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
435
435
  fontSizeQ: number;
436
- fontPreset: "gothic" | "mincho";
436
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
437
437
  }>;
438
438
  readonly page: Readonly<{
439
439
  lineGapMm: number;
@@ -467,7 +467,7 @@ declare const NovelCompositionSettings: {
467
467
  readonly appearance: Readonly<{
468
468
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
469
469
  fontSizeQ: number;
470
- fontPreset: "gothic" | "mincho";
470
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
471
471
  }>;
472
472
  readonly page: Readonly<{
473
473
  lineGapMm: number;
@@ -501,7 +501,7 @@ declare const NovelCompositionSettings: {
501
501
  readonly appearance: Readonly<{
502
502
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
503
503
  fontSizeQ: number;
504
- fontPreset: "gothic" | "mincho";
504
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
505
505
  }>;
506
506
  readonly page: Readonly<{
507
507
  lineGapMm: number;
@@ -535,7 +535,7 @@ declare const NovelCompositionSettings: {
535
535
  readonly appearance: Readonly<{
536
536
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
537
537
  fontSizeQ: number;
538
- fontPreset: "gothic" | "mincho";
538
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
539
539
  }>;
540
540
  readonly page: Readonly<{
541
541
  lineGapMm: number;
@@ -12181,7 +12181,14 @@ declare const NovelLayout: {
12181
12181
  //#region src/composer/measurement-request.d.ts
12182
12182
  declare const MeasurementRequestSchema: v.VariantSchema<"kind", [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12183
12183
  readonly text: v.StringSchema<undefined>;
12184
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
12184
+ readonly style: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12185
+ readonly weight: v.PicklistSchema<[400, 700], undefined>;
12186
+ readonly slant: v.PicklistSchema<["normal", "italic"], undefined>;
12187
+ }, undefined>, v.ReadonlyAction<{
12188
+ weight: 400 | 700;
12189
+ slant: "italic" | "normal";
12190
+ }>]>, undefined>;
12191
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
12185
12192
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12186
12193
  readonly scale: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12187
12194
  readonly writingMode: v.LiteralSchema<"vertical-rl", undefined>;
@@ -12189,7 +12196,11 @@ declare const MeasurementRequestSchema: v.VariantSchema<"kind", [v.SchemaWithPip
12189
12196
  readonly presentation: v.PicklistSchema<["mixed", "upright", "sideways", "tate-chu-yoko"], undefined>;
12190
12197
  }, undefined>, v.ReadonlyAction<{
12191
12198
  text: string;
12192
- fontPreset: "gothic" | "mincho";
12199
+ style?: Readonly<{
12200
+ weight: 400 | 700;
12201
+ slant: "italic" | "normal";
12202
+ }> | undefined;
12203
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
12193
12204
  fontSizeQ: number;
12194
12205
  scale: number;
12195
12206
  writingMode: "vertical-rl";
@@ -12197,7 +12208,14 @@ declare const MeasurementRequestSchema: v.VariantSchema<"kind", [v.SchemaWithPip
12197
12208
  presentation: "mixed" | "sideways" | "tate-chu-yoko" | "upright";
12198
12209
  }>]>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12199
12210
  readonly text: v.StringSchema<undefined>;
12200
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
12211
+ readonly style: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12212
+ readonly weight: v.PicklistSchema<[400, 700], undefined>;
12213
+ readonly slant: v.PicklistSchema<["normal", "italic"], undefined>;
12214
+ }, undefined>, v.ReadonlyAction<{
12215
+ weight: 400 | 700;
12216
+ slant: "italic" | "normal";
12217
+ }>]>, undefined>;
12218
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
12201
12219
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12202
12220
  readonly scale: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12203
12221
  readonly writingMode: v.LiteralSchema<"vertical-rl", undefined>;
@@ -12205,7 +12223,11 @@ declare const MeasurementRequestSchema: v.VariantSchema<"kind", [v.SchemaWithPip
12205
12223
  readonly presentation: v.PicklistSchema<["mixed", "sideways"], undefined>;
12206
12224
  }, undefined>, v.ReadonlyAction<{
12207
12225
  text: string;
12208
- fontPreset: "gothic" | "mincho";
12226
+ style?: Readonly<{
12227
+ weight: 400 | 700;
12228
+ slant: "italic" | "normal";
12229
+ }> | undefined;
12230
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
12209
12231
  fontSizeQ: number;
12210
12232
  scale: number;
12211
12233
  writingMode: "vertical-rl";
@@ -12219,7 +12241,14 @@ type MeasurementRequest = v.InferOutput<typeof MeasurementRequestSchema>;
12219
12241
  declare const MeasurementRequest: {
12220
12242
  readonly schema: v.VariantSchema<"kind", [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12221
12243
  readonly text: v.StringSchema<undefined>;
12222
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
12244
+ readonly style: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12245
+ readonly weight: v.PicklistSchema<[400, 700], undefined>;
12246
+ readonly slant: v.PicklistSchema<["normal", "italic"], undefined>;
12247
+ }, undefined>, v.ReadonlyAction<{
12248
+ weight: 400 | 700;
12249
+ slant: "italic" | "normal";
12250
+ }>]>, undefined>;
12251
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
12223
12252
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12224
12253
  readonly scale: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12225
12254
  readonly writingMode: v.LiteralSchema<"vertical-rl", undefined>;
@@ -12227,7 +12256,11 @@ declare const MeasurementRequest: {
12227
12256
  readonly presentation: v.PicklistSchema<["mixed", "upright", "sideways", "tate-chu-yoko"], undefined>;
12228
12257
  }, undefined>, v.ReadonlyAction<{
12229
12258
  text: string;
12230
- fontPreset: "gothic" | "mincho";
12259
+ style?: Readonly<{
12260
+ weight: 400 | 700;
12261
+ slant: "italic" | "normal";
12262
+ }> | undefined;
12263
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
12231
12264
  fontSizeQ: number;
12232
12265
  scale: number;
12233
12266
  writingMode: "vertical-rl";
@@ -12235,7 +12268,14 @@ declare const MeasurementRequest: {
12235
12268
  presentation: "mixed" | "sideways" | "tate-chu-yoko" | "upright";
12236
12269
  }>]>, v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12237
12270
  readonly text: v.StringSchema<undefined>;
12238
- readonly fontPreset: v.PicklistSchema<["mincho", "gothic"], undefined>;
12271
+ readonly style: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
12272
+ readonly weight: v.PicklistSchema<[400, 700], undefined>;
12273
+ readonly slant: v.PicklistSchema<["normal", "italic"], undefined>;
12274
+ }, undefined>, v.ReadonlyAction<{
12275
+ weight: 400 | 700;
12276
+ slant: "italic" | "normal";
12277
+ }>]>, undefined>;
12278
+ readonly fontPreset: v.PicklistSchema<["mincho", "gothic", "genei-koburi"], undefined>;
12239
12279
  readonly fontSizeQ: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12240
12280
  readonly scale: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, number, undefined>]>;
12241
12281
  readonly writingMode: v.LiteralSchema<"vertical-rl", undefined>;
@@ -12243,7 +12283,11 @@ declare const MeasurementRequest: {
12243
12283
  readonly presentation: v.PicklistSchema<["mixed", "sideways"], undefined>;
12244
12284
  }, undefined>, v.ReadonlyAction<{
12245
12285
  text: string;
12246
- fontPreset: "gothic" | "mincho";
12286
+ style?: Readonly<{
12287
+ weight: 400 | 700;
12288
+ slant: "italic" | "normal";
12289
+ }> | undefined;
12290
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
12247
12291
  fontSizeQ: number;
12248
12292
  scale: number;
12249
12293
  writingMode: "vertical-rl";
@@ -12460,7 +12504,7 @@ declare const novelComposer: Readonly<{
12460
12504
  readonly appearance: Readonly<{
12461
12505
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
12462
12506
  fontSizeQ: number;
12463
- fontPreset: "gothic" | "mincho";
12507
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
12464
12508
  }>;
12465
12509
  readonly page: Readonly<{
12466
12510
  lineGapMm: number;
@@ -12583,9 +12627,9 @@ declare const novelComposer: Readonly<{
12583
12627
  advanceEm: number;
12584
12628
  }>;
12585
12629
  }>)[];
12586
- kind: "glyph";
12587
- presentation: "mixed" | "sideways" | "upright";
12588
- disposition: "hanging" | "placed";
12630
+ kind: "combined-glyph";
12631
+ presentation: "sideways" | "tate-chu-yoko";
12632
+ disposition: "placed";
12589
12633
  }> | Readonly<{
12590
12634
  value: string;
12591
12635
  readonly range: Readonly<{
@@ -12651,9 +12695,9 @@ declare const novelComposer: Readonly<{
12651
12695
  advanceEm: number;
12652
12696
  }>;
12653
12697
  }>)[];
12654
- kind: "combined-glyph";
12655
- presentation: "sideways" | "tate-chu-yoko";
12656
- disposition: "placed";
12698
+ kind: "glyph";
12699
+ presentation: "mixed" | "sideways" | "upright";
12700
+ disposition: "hanging" | "placed";
12657
12701
  }> | Readonly<{
12658
12702
  kind: "glue";
12659
12703
  origin: "generated";
@@ -12919,7 +12963,7 @@ declare const novelComposer: Readonly<{
12919
12963
  readonly appearance: Readonly<{
12920
12964
  paperSize: "a4" | "a5" | "a6" | "jis-b5" | "jis-b6" | "shinsho";
12921
12965
  fontSizeQ: number;
12922
- fontPreset: "gothic" | "mincho";
12966
+ fontPreset: "genei-koburi" | "gothic" | "mincho";
12923
12967
  }>;
12924
12968
  readonly page: Readonly<{
12925
12969
  lineGapMm: number;
@@ -13041,9 +13085,9 @@ declare const novelComposer: Readonly<{
13041
13085
  advanceEm: number;
13042
13086
  }>;
13043
13087
  }>)[];
13044
- kind: "glyph";
13045
- presentation: "mixed" | "sideways" | "upright";
13046
- disposition: "hanging" | "placed";
13088
+ kind: "combined-glyph";
13089
+ presentation: "sideways" | "tate-chu-yoko";
13090
+ disposition: "placed";
13047
13091
  }> | Readonly<{
13048
13092
  value: string;
13049
13093
  readonly range: Readonly<{
@@ -13109,9 +13153,9 @@ declare const novelComposer: Readonly<{
13109
13153
  advanceEm: number;
13110
13154
  }>;
13111
13155
  }>)[];
13112
- kind: "combined-glyph";
13113
- presentation: "sideways" | "tate-chu-yoko";
13114
- disposition: "placed";
13156
+ kind: "glyph";
13157
+ presentation: "mixed" | "sideways" | "upright";
13158
+ disposition: "hanging" | "placed";
13115
13159
  }> | Readonly<{
13116
13160
  kind: "glue";
13117
13161
  origin: "generated";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sushichan044/kg-core",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Framework-independent parsing, composition, and proofreading for Japanese manuscripts",
5
5
  "keywords": [
6
6
  "japanese",