pptx-glimpse 1.1.1 → 1.1.2
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.cjs +11233 -8081
- package/dist/index.d.cts +96 -96
- package/dist/index.d.ts +96 -96
- package/dist/index.js +11234 -8082
- package/package.json +4 -43
- package/README.md +0 -344
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* テキスト→パス変換用のフォントリゾルバーコンテキスト。
|
|
3
|
+
* opentype.js の getPath() メソッドを持つ Font オブジェクトへのアクセスを提供する。
|
|
4
|
+
*/
|
|
5
|
+
interface OpentypePath {
|
|
6
|
+
toPathData(decimalPlaces?: number): string;
|
|
7
|
+
}
|
|
8
|
+
interface OpentypeFullFont {
|
|
9
|
+
unitsPerEm: number;
|
|
10
|
+
ascender: number;
|
|
11
|
+
descender: number;
|
|
12
|
+
getPath(text: string, x: number, y: number, fontSize: number): OpentypePath;
|
|
13
|
+
getAdvanceWidth(text: string, fontSize: number): number;
|
|
14
|
+
}
|
|
15
|
+
interface TextPathFontResolver {
|
|
16
|
+
resolveFont(fontFamily: string | null | undefined, fontFamilyEa: string | null | undefined, jpanFallback?: string | null): OpentypeFullFont | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
/**
|
|
2
20
|
* PPTX フォント名 → OSS 代替フォント (Google Fonts) のマッピング。
|
|
3
21
|
* ユーザーが拡張・上書き可能。
|
|
@@ -13,84 +31,6 @@ declare const DEFAULT_FONT_MAPPING: Readonly<FontMapping>;
|
|
|
13
31
|
declare function createFontMapping(userMapping?: FontMapping): FontMapping;
|
|
14
32
|
declare function getMappedFont(fontFamily: string | null | undefined, mapping: FontMapping): string | null;
|
|
15
33
|
|
|
16
|
-
type LogLevel = "off" | "warn" | "debug";
|
|
17
|
-
interface WarningEntry {
|
|
18
|
-
/** The feature key, e.g. "sp.style", "bodyPr@vert" */
|
|
19
|
-
feature: string;
|
|
20
|
-
/** Human-readable description */
|
|
21
|
-
message: string;
|
|
22
|
-
/** Location context, e.g. "Slide 1" */
|
|
23
|
-
context?: string;
|
|
24
|
-
}
|
|
25
|
-
interface WarningSummary {
|
|
26
|
-
totalCount: number;
|
|
27
|
-
features: {
|
|
28
|
-
feature: string;
|
|
29
|
-
message: string;
|
|
30
|
-
count: number;
|
|
31
|
-
}[];
|
|
32
|
-
}
|
|
33
|
-
declare function getWarningSummary(): WarningSummary;
|
|
34
|
-
declare function getWarningEntries(): readonly WarningEntry[];
|
|
35
|
-
|
|
36
|
-
interface ConvertOptions {
|
|
37
|
-
/** 変換対象のスライド番号 (1始まり)。未指定で全スライド */
|
|
38
|
-
slides?: number[];
|
|
39
|
-
/** 出力画像の幅 (ピクセル)。デフォルト: 960 */
|
|
40
|
-
width?: number;
|
|
41
|
-
/** 出力画像の高さ (ピクセル)。widthと同時指定時はwidthが優先 */
|
|
42
|
-
height?: number;
|
|
43
|
-
/** 警告ログレベル。デフォルト: "off" */
|
|
44
|
-
logLevel?: LogLevel;
|
|
45
|
-
/** 追加のフォントディレクトリパス。システムフォントに加えて検索する */
|
|
46
|
-
fontDirs?: string[];
|
|
47
|
-
/** PPTX フォント名 → OSS 代替フォントのカスタムマッピング。デフォルトマッピングにマージされる */
|
|
48
|
-
fontMapping?: FontMapping;
|
|
49
|
-
/** true のとき OS のシステムフォントをスキャンせず fontDirs のみを使用する */
|
|
50
|
-
skipSystemFonts?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* SVG でのテキスト出力方式。デフォルト: "path"
|
|
53
|
-
* - "path": グリフをアウトライン化した <path> として出力する。フォント環境に依存しない
|
|
54
|
-
* - "text": ネイティブ <text> 要素 + サブセット化フォントの @font-face (data URI) 埋め込みで出力する。
|
|
55
|
-
* ブラウザでのインライン表示時にネイティブテキスト描画 (ヒンティング等) が効き、テキスト選択も可能になる。
|
|
56
|
-
* <img src="...svg"> 参照やサニタイズ環境では期待どおり描画されないことがある。
|
|
57
|
-
* convertPptxToPng では無視され、常に "path" で変換される (resvg は @font-face を解釈しないため)
|
|
58
|
-
*/
|
|
59
|
-
textOutput?: "path" | "text";
|
|
60
|
-
}
|
|
61
|
-
interface SlideSvg {
|
|
62
|
-
slideNumber: number;
|
|
63
|
-
svg: string;
|
|
64
|
-
}
|
|
65
|
-
interface SlideImage {
|
|
66
|
-
slideNumber: number;
|
|
67
|
-
png: Buffer;
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
}
|
|
71
|
-
declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideSvg[]>;
|
|
72
|
-
declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideImage[]>;
|
|
73
|
-
|
|
74
|
-
/** フォント収集結果 */
|
|
75
|
-
interface UsedFonts {
|
|
76
|
-
/** テーマで定義されたフォント */
|
|
77
|
-
theme: {
|
|
78
|
-
majorFont: string;
|
|
79
|
-
minorFont: string;
|
|
80
|
-
majorFontEa: string | null;
|
|
81
|
-
minorFontEa: string | null;
|
|
82
|
-
majorFontCs: string | null;
|
|
83
|
-
minorFontCs: string | null;
|
|
84
|
-
};
|
|
85
|
-
/** テキストランやテーマで使用されているフォント名の一覧(重複なし、ソート済み) */
|
|
86
|
-
fonts: string[];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* PPTX をパースして使用されているフォント名を収集する。
|
|
90
|
-
* レンダリングは行わないため軽量。
|
|
91
|
-
*/
|
|
92
|
-
declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
|
|
93
|
-
|
|
94
34
|
/**
|
|
95
35
|
* テキストの幅と行高さを計測するインターフェース。
|
|
96
36
|
* デフォルトでは静的フォントメトリクスによる計測が使われる。
|
|
@@ -149,24 +89,6 @@ declare class OpentypeTextMeasurer implements TextMeasurer {
|
|
|
149
89
|
private resolveFont;
|
|
150
90
|
}
|
|
151
91
|
|
|
152
|
-
/**
|
|
153
|
-
* テキスト→パス変換用のフォントリゾルバーコンテキスト。
|
|
154
|
-
* opentype.js の getPath() メソッドを持つ Font オブジェクトへのアクセスを提供する。
|
|
155
|
-
*/
|
|
156
|
-
interface OpentypePath {
|
|
157
|
-
toPathData(decimalPlaces?: number): string;
|
|
158
|
-
}
|
|
159
|
-
interface OpentypeFullFont {
|
|
160
|
-
unitsPerEm: number;
|
|
161
|
-
ascender: number;
|
|
162
|
-
descender: number;
|
|
163
|
-
getPath(text: string, x: number, y: number, fontSize: number): OpentypePath;
|
|
164
|
-
getAdvanceWidth(text: string, fontSize: number): number;
|
|
165
|
-
}
|
|
166
|
-
interface TextPathFontResolver {
|
|
167
|
-
resolveFont(fontFamily: string | null | undefined, fontFamilyEa: string | null | undefined, jpanFallback?: string | null): OpentypeFullFont | null;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
92
|
/** フォントバッファの入力形式 */
|
|
171
93
|
interface FontBuffer {
|
|
172
94
|
name?: string;
|
|
@@ -204,4 +126,82 @@ declare function clearFontCache(): void;
|
|
|
204
126
|
*/
|
|
205
127
|
declare function initResvgWasm(): Promise<void>;
|
|
206
128
|
|
|
129
|
+
type LogLevel = "off" | "warn" | "debug";
|
|
130
|
+
interface WarningEntry {
|
|
131
|
+
/** The feature key, e.g. "sp.style", "bodyPr@vert" */
|
|
132
|
+
feature: string;
|
|
133
|
+
/** Human-readable description */
|
|
134
|
+
message: string;
|
|
135
|
+
/** Location context, e.g. "Slide 1" */
|
|
136
|
+
context?: string;
|
|
137
|
+
}
|
|
138
|
+
interface WarningSummary {
|
|
139
|
+
totalCount: number;
|
|
140
|
+
features: {
|
|
141
|
+
feature: string;
|
|
142
|
+
message: string;
|
|
143
|
+
count: number;
|
|
144
|
+
}[];
|
|
145
|
+
}
|
|
146
|
+
declare function getWarningSummary(): WarningSummary;
|
|
147
|
+
declare function getWarningEntries(): readonly WarningEntry[];
|
|
148
|
+
|
|
149
|
+
interface ConvertOptions {
|
|
150
|
+
/** 変換対象のスライド番号 (1始まり)。未指定で全スライド */
|
|
151
|
+
slides?: number[];
|
|
152
|
+
/** 出力画像の幅 (ピクセル)。デフォルト: 960 */
|
|
153
|
+
width?: number;
|
|
154
|
+
/** 出力画像の高さ (ピクセル)。widthと同時指定時はwidthが優先 */
|
|
155
|
+
height?: number;
|
|
156
|
+
/** 警告ログレベル。デフォルト: "off" */
|
|
157
|
+
logLevel?: LogLevel;
|
|
158
|
+
/** 追加のフォントディレクトリパス。システムフォントに加えて検索する */
|
|
159
|
+
fontDirs?: string[];
|
|
160
|
+
/** PPTX フォント名 → OSS 代替フォントのカスタムマッピング。デフォルトマッピングにマージされる */
|
|
161
|
+
fontMapping?: FontMapping;
|
|
162
|
+
/** true のとき OS のシステムフォントをスキャンせず fontDirs のみを使用する */
|
|
163
|
+
skipSystemFonts?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* SVG でのテキスト出力方式。デフォルト: "path"
|
|
166
|
+
* - "path": グリフをアウトライン化した <path> として出力する。フォント環境に依存しない
|
|
167
|
+
* - "text": ネイティブ <text> 要素 + サブセット化フォントの @font-face (data URI) 埋め込みで出力する。
|
|
168
|
+
* ブラウザでのインライン表示時にネイティブテキスト描画 (ヒンティング等) が効き、テキスト選択も可能になる。
|
|
169
|
+
* <img src="...svg"> 参照やサニタイズ環境では期待どおり描画されないことがある。
|
|
170
|
+
* convertPptxToPng では無視され、常に "path" で変換される (resvg は @font-face を解釈しないため)
|
|
171
|
+
*/
|
|
172
|
+
textOutput?: "path" | "text";
|
|
173
|
+
}
|
|
174
|
+
interface SlideSvg {
|
|
175
|
+
slideNumber: number;
|
|
176
|
+
svg: string;
|
|
177
|
+
}
|
|
178
|
+
interface SlideImage {
|
|
179
|
+
slideNumber: number;
|
|
180
|
+
png: Buffer;
|
|
181
|
+
width: number;
|
|
182
|
+
height: number;
|
|
183
|
+
}
|
|
184
|
+
declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideSvg[]>;
|
|
185
|
+
declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideImage[]>;
|
|
186
|
+
|
|
187
|
+
/** フォント収集結果 */
|
|
188
|
+
interface UsedFonts {
|
|
189
|
+
/** テーマで定義されたフォント */
|
|
190
|
+
theme: {
|
|
191
|
+
majorFont: string;
|
|
192
|
+
minorFont: string;
|
|
193
|
+
majorFontEa: string | null;
|
|
194
|
+
minorFontEa: string | null;
|
|
195
|
+
majorFontCs: string | null;
|
|
196
|
+
minorFontCs: string | null;
|
|
197
|
+
};
|
|
198
|
+
/** テキストランやテーマで使用されているフォント名の一覧(重複なし、ソート済み) */
|
|
199
|
+
fonts: string[];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* PPTX をパースして使用されているフォント名を収集する。
|
|
203
|
+
* レンダリングは行わないため軽量。
|
|
204
|
+
*/
|
|
205
|
+
declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
|
|
206
|
+
|
|
207
207
|
export { type ConvertOptions, DEFAULT_FONT_MAPPING, type FontBuffer, type FontMapping, type LogLevel, type OpentypeSetup, type SlideImage, type SlideSvg, type UsedFonts, type WarningEntry, type WarningSummary, clearFontCache, collectUsedFonts, convertPptxToPng, convertPptxToSvg, createFontMapping, createOpentypeSetupFromBuffers, createOpentypeTextMeasurerFromBuffers, getMappedFont, getWarningEntries, getWarningSummary, initResvgWasm };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* テキスト→パス変換用のフォントリゾルバーコンテキスト。
|
|
3
|
+
* opentype.js の getPath() メソッドを持つ Font オブジェクトへのアクセスを提供する。
|
|
4
|
+
*/
|
|
5
|
+
interface OpentypePath {
|
|
6
|
+
toPathData(decimalPlaces?: number): string;
|
|
7
|
+
}
|
|
8
|
+
interface OpentypeFullFont {
|
|
9
|
+
unitsPerEm: number;
|
|
10
|
+
ascender: number;
|
|
11
|
+
descender: number;
|
|
12
|
+
getPath(text: string, x: number, y: number, fontSize: number): OpentypePath;
|
|
13
|
+
getAdvanceWidth(text: string, fontSize: number): number;
|
|
14
|
+
}
|
|
15
|
+
interface TextPathFontResolver {
|
|
16
|
+
resolveFont(fontFamily: string | null | undefined, fontFamilyEa: string | null | undefined, jpanFallback?: string | null): OpentypeFullFont | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
/**
|
|
2
20
|
* PPTX フォント名 → OSS 代替フォント (Google Fonts) のマッピング。
|
|
3
21
|
* ユーザーが拡張・上書き可能。
|
|
@@ -13,84 +31,6 @@ declare const DEFAULT_FONT_MAPPING: Readonly<FontMapping>;
|
|
|
13
31
|
declare function createFontMapping(userMapping?: FontMapping): FontMapping;
|
|
14
32
|
declare function getMappedFont(fontFamily: string | null | undefined, mapping: FontMapping): string | null;
|
|
15
33
|
|
|
16
|
-
type LogLevel = "off" | "warn" | "debug";
|
|
17
|
-
interface WarningEntry {
|
|
18
|
-
/** The feature key, e.g. "sp.style", "bodyPr@vert" */
|
|
19
|
-
feature: string;
|
|
20
|
-
/** Human-readable description */
|
|
21
|
-
message: string;
|
|
22
|
-
/** Location context, e.g. "Slide 1" */
|
|
23
|
-
context?: string;
|
|
24
|
-
}
|
|
25
|
-
interface WarningSummary {
|
|
26
|
-
totalCount: number;
|
|
27
|
-
features: {
|
|
28
|
-
feature: string;
|
|
29
|
-
message: string;
|
|
30
|
-
count: number;
|
|
31
|
-
}[];
|
|
32
|
-
}
|
|
33
|
-
declare function getWarningSummary(): WarningSummary;
|
|
34
|
-
declare function getWarningEntries(): readonly WarningEntry[];
|
|
35
|
-
|
|
36
|
-
interface ConvertOptions {
|
|
37
|
-
/** 変換対象のスライド番号 (1始まり)。未指定で全スライド */
|
|
38
|
-
slides?: number[];
|
|
39
|
-
/** 出力画像の幅 (ピクセル)。デフォルト: 960 */
|
|
40
|
-
width?: number;
|
|
41
|
-
/** 出力画像の高さ (ピクセル)。widthと同時指定時はwidthが優先 */
|
|
42
|
-
height?: number;
|
|
43
|
-
/** 警告ログレベル。デフォルト: "off" */
|
|
44
|
-
logLevel?: LogLevel;
|
|
45
|
-
/** 追加のフォントディレクトリパス。システムフォントに加えて検索する */
|
|
46
|
-
fontDirs?: string[];
|
|
47
|
-
/** PPTX フォント名 → OSS 代替フォントのカスタムマッピング。デフォルトマッピングにマージされる */
|
|
48
|
-
fontMapping?: FontMapping;
|
|
49
|
-
/** true のとき OS のシステムフォントをスキャンせず fontDirs のみを使用する */
|
|
50
|
-
skipSystemFonts?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* SVG でのテキスト出力方式。デフォルト: "path"
|
|
53
|
-
* - "path": グリフをアウトライン化した <path> として出力する。フォント環境に依存しない
|
|
54
|
-
* - "text": ネイティブ <text> 要素 + サブセット化フォントの @font-face (data URI) 埋め込みで出力する。
|
|
55
|
-
* ブラウザでのインライン表示時にネイティブテキスト描画 (ヒンティング等) が効き、テキスト選択も可能になる。
|
|
56
|
-
* <img src="...svg"> 参照やサニタイズ環境では期待どおり描画されないことがある。
|
|
57
|
-
* convertPptxToPng では無視され、常に "path" で変換される (resvg は @font-face を解釈しないため)
|
|
58
|
-
*/
|
|
59
|
-
textOutput?: "path" | "text";
|
|
60
|
-
}
|
|
61
|
-
interface SlideSvg {
|
|
62
|
-
slideNumber: number;
|
|
63
|
-
svg: string;
|
|
64
|
-
}
|
|
65
|
-
interface SlideImage {
|
|
66
|
-
slideNumber: number;
|
|
67
|
-
png: Buffer;
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
}
|
|
71
|
-
declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideSvg[]>;
|
|
72
|
-
declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideImage[]>;
|
|
73
|
-
|
|
74
|
-
/** フォント収集結果 */
|
|
75
|
-
interface UsedFonts {
|
|
76
|
-
/** テーマで定義されたフォント */
|
|
77
|
-
theme: {
|
|
78
|
-
majorFont: string;
|
|
79
|
-
minorFont: string;
|
|
80
|
-
majorFontEa: string | null;
|
|
81
|
-
minorFontEa: string | null;
|
|
82
|
-
majorFontCs: string | null;
|
|
83
|
-
minorFontCs: string | null;
|
|
84
|
-
};
|
|
85
|
-
/** テキストランやテーマで使用されているフォント名の一覧(重複なし、ソート済み) */
|
|
86
|
-
fonts: string[];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* PPTX をパースして使用されているフォント名を収集する。
|
|
90
|
-
* レンダリングは行わないため軽量。
|
|
91
|
-
*/
|
|
92
|
-
declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
|
|
93
|
-
|
|
94
34
|
/**
|
|
95
35
|
* テキストの幅と行高さを計測するインターフェース。
|
|
96
36
|
* デフォルトでは静的フォントメトリクスによる計測が使われる。
|
|
@@ -149,24 +89,6 @@ declare class OpentypeTextMeasurer implements TextMeasurer {
|
|
|
149
89
|
private resolveFont;
|
|
150
90
|
}
|
|
151
91
|
|
|
152
|
-
/**
|
|
153
|
-
* テキスト→パス変換用のフォントリゾルバーコンテキスト。
|
|
154
|
-
* opentype.js の getPath() メソッドを持つ Font オブジェクトへのアクセスを提供する。
|
|
155
|
-
*/
|
|
156
|
-
interface OpentypePath {
|
|
157
|
-
toPathData(decimalPlaces?: number): string;
|
|
158
|
-
}
|
|
159
|
-
interface OpentypeFullFont {
|
|
160
|
-
unitsPerEm: number;
|
|
161
|
-
ascender: number;
|
|
162
|
-
descender: number;
|
|
163
|
-
getPath(text: string, x: number, y: number, fontSize: number): OpentypePath;
|
|
164
|
-
getAdvanceWidth(text: string, fontSize: number): number;
|
|
165
|
-
}
|
|
166
|
-
interface TextPathFontResolver {
|
|
167
|
-
resolveFont(fontFamily: string | null | undefined, fontFamilyEa: string | null | undefined, jpanFallback?: string | null): OpentypeFullFont | null;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
92
|
/** フォントバッファの入力形式 */
|
|
171
93
|
interface FontBuffer {
|
|
172
94
|
name?: string;
|
|
@@ -204,4 +126,82 @@ declare function clearFontCache(): void;
|
|
|
204
126
|
*/
|
|
205
127
|
declare function initResvgWasm(): Promise<void>;
|
|
206
128
|
|
|
129
|
+
type LogLevel = "off" | "warn" | "debug";
|
|
130
|
+
interface WarningEntry {
|
|
131
|
+
/** The feature key, e.g. "sp.style", "bodyPr@vert" */
|
|
132
|
+
feature: string;
|
|
133
|
+
/** Human-readable description */
|
|
134
|
+
message: string;
|
|
135
|
+
/** Location context, e.g. "Slide 1" */
|
|
136
|
+
context?: string;
|
|
137
|
+
}
|
|
138
|
+
interface WarningSummary {
|
|
139
|
+
totalCount: number;
|
|
140
|
+
features: {
|
|
141
|
+
feature: string;
|
|
142
|
+
message: string;
|
|
143
|
+
count: number;
|
|
144
|
+
}[];
|
|
145
|
+
}
|
|
146
|
+
declare function getWarningSummary(): WarningSummary;
|
|
147
|
+
declare function getWarningEntries(): readonly WarningEntry[];
|
|
148
|
+
|
|
149
|
+
interface ConvertOptions {
|
|
150
|
+
/** 変換対象のスライド番号 (1始まり)。未指定で全スライド */
|
|
151
|
+
slides?: number[];
|
|
152
|
+
/** 出力画像の幅 (ピクセル)。デフォルト: 960 */
|
|
153
|
+
width?: number;
|
|
154
|
+
/** 出力画像の高さ (ピクセル)。widthと同時指定時はwidthが優先 */
|
|
155
|
+
height?: number;
|
|
156
|
+
/** 警告ログレベル。デフォルト: "off" */
|
|
157
|
+
logLevel?: LogLevel;
|
|
158
|
+
/** 追加のフォントディレクトリパス。システムフォントに加えて検索する */
|
|
159
|
+
fontDirs?: string[];
|
|
160
|
+
/** PPTX フォント名 → OSS 代替フォントのカスタムマッピング。デフォルトマッピングにマージされる */
|
|
161
|
+
fontMapping?: FontMapping;
|
|
162
|
+
/** true のとき OS のシステムフォントをスキャンせず fontDirs のみを使用する */
|
|
163
|
+
skipSystemFonts?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* SVG でのテキスト出力方式。デフォルト: "path"
|
|
166
|
+
* - "path": グリフをアウトライン化した <path> として出力する。フォント環境に依存しない
|
|
167
|
+
* - "text": ネイティブ <text> 要素 + サブセット化フォントの @font-face (data URI) 埋め込みで出力する。
|
|
168
|
+
* ブラウザでのインライン表示時にネイティブテキスト描画 (ヒンティング等) が効き、テキスト選択も可能になる。
|
|
169
|
+
* <img src="...svg"> 参照やサニタイズ環境では期待どおり描画されないことがある。
|
|
170
|
+
* convertPptxToPng では無視され、常に "path" で変換される (resvg は @font-face を解釈しないため)
|
|
171
|
+
*/
|
|
172
|
+
textOutput?: "path" | "text";
|
|
173
|
+
}
|
|
174
|
+
interface SlideSvg {
|
|
175
|
+
slideNumber: number;
|
|
176
|
+
svg: string;
|
|
177
|
+
}
|
|
178
|
+
interface SlideImage {
|
|
179
|
+
slideNumber: number;
|
|
180
|
+
png: Buffer;
|
|
181
|
+
width: number;
|
|
182
|
+
height: number;
|
|
183
|
+
}
|
|
184
|
+
declare function convertPptxToSvg(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideSvg[]>;
|
|
185
|
+
declare function convertPptxToPng(input: Buffer | Uint8Array, options?: ConvertOptions): Promise<SlideImage[]>;
|
|
186
|
+
|
|
187
|
+
/** フォント収集結果 */
|
|
188
|
+
interface UsedFonts {
|
|
189
|
+
/** テーマで定義されたフォント */
|
|
190
|
+
theme: {
|
|
191
|
+
majorFont: string;
|
|
192
|
+
minorFont: string;
|
|
193
|
+
majorFontEa: string | null;
|
|
194
|
+
minorFontEa: string | null;
|
|
195
|
+
majorFontCs: string | null;
|
|
196
|
+
minorFontCs: string | null;
|
|
197
|
+
};
|
|
198
|
+
/** テキストランやテーマで使用されているフォント名の一覧(重複なし、ソート済み) */
|
|
199
|
+
fonts: string[];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* PPTX をパースして使用されているフォント名を収集する。
|
|
203
|
+
* レンダリングは行わないため軽量。
|
|
204
|
+
*/
|
|
205
|
+
declare function collectUsedFonts(input: Buffer | Uint8Array): UsedFonts;
|
|
206
|
+
|
|
207
207
|
export { type ConvertOptions, DEFAULT_FONT_MAPPING, type FontBuffer, type FontMapping, type LogLevel, type OpentypeSetup, type SlideImage, type SlideSvg, type UsedFonts, type WarningEntry, type WarningSummary, clearFontCache, collectUsedFonts, convertPptxToPng, convertPptxToSvg, createFontMapping, createOpentypeSetupFromBuffers, createOpentypeTextMeasurerFromBuffers, getMappedFont, getWarningEntries, getWarningSummary, initResvgWasm };
|