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);
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2024-12-03 UTC"],[[["`FontFamily` is deprecated and now uses string names for fonts instead of the enum, but remains for compatibility."],["This enum allows you to set the font for text ranges, elements, or entire Google Docs documents."],["Supported fonts include Arial, Calibri, Comic Sans MS, Times New Roman, Verdana, and many more."],["You can use methods like `setFontFamily()` within Google Apps Script to apply these fonts."]]],[]]