Enum FontFamily

フォントファミリー

非推奨。メソッド getFontFamily()setFontFamily(String) で、この列挙型ではなくフォント文字列名を使用するようになりました。この列挙型は非推奨ですが、古いスクリプトとの互換性を確保するために引き続き使用できます。

サポートされているフォントの列挙。

FontFamily 列挙型を使用して、テキスト、要素、ドキュメントの範囲にフォントを設定します。

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);