Enum FontFamily
FontFamily
Deprecated. The methods getFontFamily()
and setFontFamily(String)
now use string
names for fonts instead of this enum. Although this enum is deprecated, it will remain
available for compatibility with older scripts.
An enumeration of the supported fonts.
Use the FontFamily
enumeration to set the font for a range of text, element or
document.
var 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.
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);
Deprecated properties
Property | Type | Description |
AMARANTH | Enum | The Amaranth font family. |
ARIAL | Enum | The Arial font family. |
ARIAL_BLACK | Enum | The Arial Black font family. |
ARIAL_NARROW | Enum | The Arial Narrow font family. |
ARVO | Enum | The Arvo font family. |
CALIBRI | Enum | The Calibri font family. |
CAMBRIA | Enum | The Cambria font family. |
COMIC_SANS_MS | Enum | The Comic Sans MS font family. |
CONSOLAS | Enum | The Consolas font family. |
CORSIVA | Enum | The Corsiva font family. |
COURIER_NEW | Enum | The Courier New font family. |
DANCING_SCRIPT | Enum | The Dancing Script font family. |
DROID_SANS | Enum | The Droid Sans font family. |
DROID_SERIF | Enum | The Droid Serif font family. |
GARAMOND | Enum | The Garamond font family. |
GEORGIA | Enum | The Georgia font family. |
GLORIA_HALLELUJAH | Enum | The Gloria Hallelujah font family. |
GREAT_VIBES | Enum | The Great Vibes font family. |
LOBSTER | Enum | The Lobster font family. |
MERRIWEATHER | Enum | The Merriweather font family. |
PACIFICO | Enum | The Pacifico font family. |
PHILOSOPHER | Enum | The Philosopher font family. |
POIRET_ONE | Enum | The Poiret One font family |
QUATTROCENTO | Enum | The Quattrocento font family. |
ROBOTO | Enum | The Roboto font family |
SHADOWS_INTO_LIGHT | Enum | The Shadows Into Light font family. |
SYNCOPATE | Enum | The Syncopate font family. |
TAHOMA | Enum | The Tahoma font family. |
TIMES_NEW_ROMAN | Enum | The Times New Roman font family. |
TREBUCHET_MS | Enum | The Trebuchet MS font family. |
UBUNTU | Enum | The Ubuntu font family. |
VERDANA | Enum | The Verdana font family. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 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."]]],[]]