Enum FontFamily

FontFamily

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

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

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

var body = DocumentApp.getActiveDocument().getBody();

// Insert a paragraph at the start of the document.
body.insertParagraph(0, "Hello, Apps Script!");

// Set the document 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.
var text = 'Apps Script';
var a = body.getText().indexOf(text);
var b = a + text.length - 1;
body.editAsText().setFontFamily(a, b, DocumentApp.FontFamily.COMIC_SANS_MS);