非推奨。メソッド get
と set
で、この列挙型ではなくフォント文字列名を使用するようになりました。この列挙型は非推奨ですが、古いスクリプトとの互換性を確保するために引き続き使用できます。
サポートされているフォントの列挙。
Font
列挙型を使用して、テキスト、要素、ドキュメントの範囲にフォントを設定します。
const body = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(); // Insert a paragraph at the start of the document. body.insertParagraph(0, 'Hello, Apps Script!'); // Set the tab font to Calibri. body.editAsText().setFontFamily(DocumentApp.FontFamily.CALIBRI); // Set the first paragraph font to Arial. body.getParagraphs()[0].setFontFamily(DocumentApp.FontFamily.ARIAL); // Set "Apps Script" to Comic Sans MS. const text = 'Apps Script'; const a = body.getText().indexOf(text); const b = a + text.length - 1; body.editAsText().setFontFamily(a, b, DocumentApp.FontFamily.COMIC_SANS_MS);
サポートが終了したプロパティ
プロパティ | タイプ | 説明 |
---|---|---|
AMARANTH | Enum | Amaranth フォント ファミリー。 |
ARIAL | Enum | Arial フォント ファミリー。 |
ARIAL_BLACK | Enum | Arial Black フォント ファミリー。 |
ARIAL_NARROW | Enum | Arial Narrow フォント ファミリー。 |
ARVO | Enum | Arvo フォント ファミリー。 |
CALIBRI | Enum | Calibri フォント ファミリー。 |
CAMBRIA | Enum | Cambria フォント ファミリー。 |
COMIC_SANS_MS | Enum | Comic Sans MS フォント ファミリー。 |
CONSOLAS | Enum | Consolas フォント ファミリー。 |
CORSIVA | Enum | Corsiva フォント ファミリー。 |
COURIER_NEW | Enum | Courier New フォント ファミリー。 |
DANCING_SCRIPT | Enum | Dancing Script フォント ファミリー。 |
DROID_SANS | Enum | Droid Sans フォント ファミリー。 |
DROID_SERIF | Enum | Droid Serif フォント ファミリー。 |
GARAMOND | Enum | Garamond フォント ファミリー。 |
GEORGIA | Enum | Georgia フォント ファミリー。 |
GLORIA_HALLELUJAH | Enum | Gloria Hallelujah フォント ファミリー。 |
GREAT_VIBES | Enum | Great Vibes フォント ファミリー。 |
LOBSTER | Enum | Lobster フォント ファミリー。 |
MERRIWEATHER | Enum | Merriweather フォント ファミリー。 |
PACIFICO | Enum | Pacifico フォント ファミリー。 |
PHILOSOPHER | Enum | Philosopher フォント ファミリー。 |
POIRET_ONE | Enum | Poiret One フォント ファミリー |
QUATTROCENTO | Enum | Quattrocento フォント ファミリー。 |
ROBOTO | Enum | Roboto フォント ファミリー |
SHADOWS_INTO_LIGHT | Enum | Shadows Into Light フォント ファミリー。 |
SYNCOPATE | Enum | Syncopate フォント ファミリー。 |
TAHOMA | Enum | Tahoma フォント ファミリー。 |
TIMES_NEW_ROMAN | Enum | Times New Roman フォント ファミリー。 |
TREBUCHET_MS | Enum | Trebuchet MS フォント ファミリー。 |
UBUNTU | Enum | Ubuntu フォント ファミリー。 |
VERDANA | Enum | Verdana フォント ファミリー。 |