|
1 | | -Instead of creating a PDF, Typst can also directly render pages to scalable |
2 | | -vector graphics (SVGs), which are the preferred format for embedding vector |
3 | | -graphics in web pages. Like PDF files, SVGs display your document exactly how |
4 | | -you have laid it out in Typst. Likewise, they share the benefit of not being |
5 | | -bound to a specific resolution. Hence, you can print or view SVG files on any |
6 | | -device without incurring a loss of quality. (Note that font printing quality may |
7 | | -be better with a PDF.) In contrast to a PDF, an SVG cannot contain multiple |
8 | | -pages. When exporting a multi-page document, Typst will emit multiple SVGs. |
9 | | - |
10 | | -SVGs can represent text in two ways: By embedding the text itself and rendering |
11 | | -it with the fonts available on the viewer's computer or by embedding the shapes |
12 | | -of each glyph in the font used to create the document. To ensure that the SVG |
13 | | -file looks the same across all devices it is viewed on, Typst chooses the latter |
14 | | -method. This means that the text in the SVG cannot be extracted automatically, |
15 | | -for example by copy/paste or a screen reader. If you need the text to be |
16 | | -accessible, export a PDF or HTML file instead. |
17 | | - |
18 | | -SVGs can have transparent backgrounds. By default, Typst will output an SVG with |
19 | | -an opaque white background. You can make the background transparent using |
20 | | -`[#set page(fill: none)]`. Learn more on the |
21 | | -[`page` function's reference page]($page.fill). |
22 | | - |
23 | | -# Exporting as SVG |
24 | | -## Command Line |
25 | | -Pass `--format svg` to the `compile` or `watch` subcommand or provide an output |
26 | | -file name that ends with `.svg`. |
27 | | - |
28 | | -If your document has more than one page, Typst will create multiple image files. |
29 | | -The output file name must then be a template string containing at least one of |
30 | | -- `[{p}]`, which will be replaced by the page number |
31 | | -- `[{0p}]`, which will be replaced by the zero-padded page number (so that all |
32 | | - numbers have the same length) |
33 | | -- `[{t}]`, which will be replaced by the total number of pages |
34 | | - |
35 | | -When exporting to SVG, you have the following configuration options: |
36 | | - |
37 | | -- Which pages to export by specifying `--pages` followed by a comma-separated |
38 | | - list of numbers or dash-separated number ranges. Ranges can be half-open. |
39 | | - Example: `2,3,7-9,11-`. |
40 | | - |
41 | | -## Web App |
42 | | -Click "File" > "Export as" > "SVG" or click the downwards-facing arrow next to |
43 | | -the quick download button and select "Export as SVG". When exporting to SVG, you |
44 | | -have the following configuration options: |
45 | | - |
46 | | -- Which pages to export. Valid options are "All pages", "Current page", and |
47 | | - "Custom ranges". Custom ranges are a comma-separated list of numbers or |
48 | | - dash-separated number ranges. Ranges can be half-open. Example: `2,3,7-9,11-`. |
| 1 | +PDFを出力する代わりに、Typstはページを直接スケーラブル・ベクター・グラフィックス(SVG)としてレンダリングすることもできます。 |
| 2 | +これは、ウェブページにベクターグラフィックスを埋め込むための推奨される形式です。 |
| 3 | +PDFファイルと同様に、SVGはTypstでレイアウトした通りに文書を表示します。 |
| 4 | +さらに、特定の解像度に縛られないという利点も共有しています。 |
| 5 | +そのため、品質の低下を招くことなく、任意のデバイスでSVGファイルを印刷または表示できます。 |
| 6 | +(ただし、フォントの印刷品質はPDFの方が良い場合があります) |
| 7 | +PDFとは異なり、SVGは複数のページを含むことはできません。 |
| 8 | +複数ページのドキュメントをエクスポートする場合、Typstは複数のSVGを出力します。 |
| 9 | + |
| 10 | +SVGはテキストを2つの方法で表現できます。 |
| 11 | +テキスト自体を埋め込み、閲覧者のコンピューターで利用可能なフォントでレンダリングする方法か、 |
| 12 | +文書の作成に使用されたフォントの各グリフの形状を埋め込む方法です。 |
| 13 | +SVGファイルが表示されるすべてのデバイスで同じように見えることを保証するために、Typstは後者の方法を選択します。 |
| 14 | +これは、例えばコピー&ペーストやスクリーンリーダーなどでSVG内のテキストを自動抽出できないことを意味します。 |
| 15 | +テキストのアクセシビリティが必要な場合は、 |
| 16 | +代わりにPDFまたはHTMLファイルをエクスポートしてください。 |
| 17 | + |
| 18 | +SVGは透明な背景を持つことができます。 |
| 19 | +デフォルトでは、Typstは不透明な白背景のSVGを出力します。 |
| 20 | +`[#set page(fill: none)]`を使用して背景を透明にすることができます。 |
| 21 | +詳細は[`page`関数のリファレンスページ]($page.fill)を確認してください。 |
| 22 | + |
| 23 | +# SVG形式でのエクスポート |
| 24 | +## コマンドライン |
| 25 | +`compile`または`watch`サブコマンドで`--format svg`を指定するか、 |
| 26 | +`.svg`で終わる出力ファイル名を指定してください。 |
| 27 | + |
| 28 | +文書が複数ページからなる場合、Typstは複数の画像ファイルを生成します。 |
| 29 | +このとき、出力ファイル名は次のうち少なくとも1つを含むテンプレート文字列でなければなりません。 |
| 30 | +- `[{p}]`はページ番号に置き換えられます。 |
| 31 | +- `[{0p}]`は(すべての番号が同じ長さになるように) |
| 32 | + ゼロ埋めされたページ番号に置き換えられます。 |
| 33 | +- `[{t}]`は総ページ数に置き換えられます。 |
| 34 | + |
| 35 | +SVG形式でエクスポートする際には、以下の設定オプションが指定可能です。 |
| 36 | + |
| 37 | +- `--pages`の後に、カンマ区切りのページ番号またはダッシュによる番号範囲を指定することで、エクスポートするページを指定します。 |
| 38 | + 範囲指定は半開区間にすることもできます。 |
| 39 | + 例:`2,3,7-9,11-`。 |
| 40 | + |
| 41 | +## Webアプリ |
| 42 | +「File」>「Export as」>「SVG」をクリックするか、 |
| 43 | +クイックダウンロードボタンの横にある下向き矢印をクリックして「Export as SVG」を選択します。 |
| 44 | +SVG形式でエクスポートする際には、以下の設定項目を指定できます。 |
| 45 | + |
| 46 | +- エクスポートするページ。有効なオプションは「All pages(全てのページ)」、「Current page(現在のページ)」、および「Custom ranges(カスタム範囲)」です。 |
| 47 | + カスタム範囲は、カンマ区切りの番号リストまたはダッシュで区切られた番号範囲です。 |
| 48 | + 範囲は半開区間にすることもできます。例:`2,3,7-9,11-`。 |
0 commit comments