pptx-glimpse 0.1.2 → 0.1.4

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/index.d.cts CHANGED
@@ -18,6 +18,25 @@ interface WarningSummary {
18
18
  declare function getWarningSummary(): WarningSummary;
19
19
  declare function getWarningEntries(): readonly WarningEntry[];
20
20
 
21
+ /**
22
+ * PPTX フォント名 → OSS 代替フォント (Google Fonts) のマッピング。
23
+ * ユーザーが拡張・上書き可能。
24
+ */
25
+ /** フォントマッピングテーブルの型 */
26
+ type FontMapping = Record<string, string>;
27
+ /** デフォルトのフォントマッピングテーブル */
28
+ declare const DEFAULT_FONT_MAPPING: Readonly<FontMapping>;
29
+ /**
30
+ * デフォルトマッピングとユーザーマッピングをマージしたテーブルを生成する。
31
+ * ユーザー指定が優先される。
32
+ */
33
+ declare function createFontMapping(userMapping?: FontMapping): FontMapping;
34
+ /**
35
+ * マッピングテーブルから OSS 代替フォント名を取得する。
36
+ * 大文字小文字を区別せずにルックアップする。
37
+ */
38
+ declare function getMappedFont(fontFamily: string | null | undefined, mapping: FontMapping): string | null;
39
+
21
40
  interface ConvertOptions {
22
41
  /** 変換対象のスライド番号 (1始まり)。未指定で全スライド */
23
42
  slides?: number[];
@@ -27,6 +46,10 @@ interface ConvertOptions {
27
46
  height?: number;
28
47
  /** 警告ログレベル。デフォルト: "off" */
29
48
  logLevel?: LogLevel;
49
+ /** 追加のフォントディレクトリパス。システムフォントに加えて検索する */
50
+ fontDirs?: string[];
51
+ /** PPTX フォント名 → OSS 代替フォントのカスタムマッピング。デフォルトマッピングにマージされる */
52
+ fontMapping?: FontMapping;
30
53
  }
31
54
  interface SlideSvg {
32
55
  slideNumber: number;
@@ -41,4 +64,24 @@ interface SlideImage {
41
64
  declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideSvg[]>;
42
65
  declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideImage[]>;
43
66
 
44
- export { type ConvertOptions, type LogLevel, type SlideImage, type SlideSvg, type WarningEntry, type WarningSummary, convertPptxToPng, convertPptxToSvg, getWarningEntries, getWarningSummary };
67
+ /** フォント収集結果 */
68
+ interface UsedFonts {
69
+ /** テーマで定義されたフォント */
70
+ theme: {
71
+ majorFont: string;
72
+ minorFont: string;
73
+ majorFontEa: string | null;
74
+ minorFontEa: string | null;
75
+ majorFontCs: string | null;
76
+ minorFontCs: string | null;
77
+ };
78
+ /** テキストランやテーマで使用されているフォント名の一覧(重複なし、ソート済み) */
79
+ fonts: string[];
80
+ }
81
+ /**
82
+ * PPTX をパースして使用されているフォント名を収集する。
83
+ * レンダリングは行わないため軽量。
84
+ */
85
+ declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
86
+
87
+ export { type ConvertOptions, DEFAULT_FONT_MAPPING, type FontMapping, type LogLevel, type SlideImage, type SlideSvg, type UsedFonts, type WarningEntry, type WarningSummary, collectUsedFonts, convertPptxToPng, convertPptxToSvg, createFontMapping, getMappedFont, getWarningEntries, getWarningSummary };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,25 @@ interface WarningSummary {
18
18
  declare function getWarningSummary(): WarningSummary;
19
19
  declare function getWarningEntries(): readonly WarningEntry[];
20
20
 
21
+ /**
22
+ * PPTX フォント名 → OSS 代替フォント (Google Fonts) のマッピング。
23
+ * ユーザーが拡張・上書き可能。
24
+ */
25
+ /** フォントマッピングテーブルの型 */
26
+ type FontMapping = Record<string, string>;
27
+ /** デフォルトのフォントマッピングテーブル */
28
+ declare const DEFAULT_FONT_MAPPING: Readonly<FontMapping>;
29
+ /**
30
+ * デフォルトマッピングとユーザーマッピングをマージしたテーブルを生成する。
31
+ * ユーザー指定が優先される。
32
+ */
33
+ declare function createFontMapping(userMapping?: FontMapping): FontMapping;
34
+ /**
35
+ * マッピングテーブルから OSS 代替フォント名を取得する。
36
+ * 大文字小文字を区別せずにルックアップする。
37
+ */
38
+ declare function getMappedFont(fontFamily: string | null | undefined, mapping: FontMapping): string | null;
39
+
21
40
  interface ConvertOptions {
22
41
  /** 変換対象のスライド番号 (1始まり)。未指定で全スライド */
23
42
  slides?: number[];
@@ -27,6 +46,10 @@ interface ConvertOptions {
27
46
  height?: number;
28
47
  /** 警告ログレベル。デフォルト: "off" */
29
48
  logLevel?: LogLevel;
49
+ /** 追加のフォントディレクトリパス。システムフォントに加えて検索する */
50
+ fontDirs?: string[];
51
+ /** PPTX フォント名 → OSS 代替フォントのカスタムマッピング。デフォルトマッピングにマージされる */
52
+ fontMapping?: FontMapping;
30
53
  }
31
54
  interface SlideSvg {
32
55
  slideNumber: number;
@@ -41,4 +64,24 @@ interface SlideImage {
41
64
  declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideSvg[]>;
42
65
  declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideImage[]>;
43
66
 
44
- export { type ConvertOptions, type LogLevel, type SlideImage, type SlideSvg, type WarningEntry, type WarningSummary, convertPptxToPng, convertPptxToSvg, getWarningEntries, getWarningSummary };
67
+ /** フォント収集結果 */
68
+ interface UsedFonts {
69
+ /** テーマで定義されたフォント */
70
+ theme: {
71
+ majorFont: string;
72
+ minorFont: string;
73
+ majorFontEa: string | null;
74
+ minorFontEa: string | null;
75
+ majorFontCs: string | null;
76
+ minorFontCs: string | null;
77
+ };
78
+ /** テキストランやテーマで使用されているフォント名の一覧(重複なし、ソート済み) */
79
+ fonts: string[];
80
+ }
81
+ /**
82
+ * PPTX をパースして使用されているフォント名を収集する。
83
+ * レンダリングは行わないため軽量。
84
+ */
85
+ declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
86
+
87
+ export { type ConvertOptions, DEFAULT_FONT_MAPPING, type FontMapping, type LogLevel, type SlideImage, type SlideSvg, type UsedFonts, type WarningEntry, type WarningSummary, collectUsedFonts, convertPptxToPng, convertPptxToSvg, createFontMapping, getMappedFont, getWarningEntries, getWarningSummary };