Enum FontFamily

  • 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.

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.

constbody=
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.
consttext='Apps Script';
consta=body.getText().indexOf(text);
constb=a+text.length-1;
body.editAsText().setFontFamily(a,b,DocumentApp.FontFamily.COMIC_SANS_MS);

Deprecated properties

PropertyTypeDescription
AMARANTHEnumThe Amaranth font family.
ARIALEnumThe Arial font family.
ARIAL_BLACKEnumThe Arial Black font family.
ARIAL_NARROWEnumThe Arial Narrow font family.
ARVOEnumThe Arvo font family.
CALIBRIEnumThe Calibri font family.
CAMBRIAEnumThe Cambria font family.
COMIC_SANS_MSEnumThe Comic Sans MS font family.
CONSOLASEnumThe Consolas font family.
CORSIVAEnumThe Corsiva font family.
COURIER_NEWEnumThe Courier New font family.
DANCING_SCRIPTEnumThe Dancing Script font family.
DROID_SANSEnumThe Droid Sans font family.
DROID_SERIFEnumThe Droid Serif font family.
GARAMONDEnumThe Garamond font family.
GEORGIAEnumThe Georgia font family.
GLORIA_HALLELUJAHEnumThe Gloria Hallelujah font family.
GREAT_VIBESEnumThe Great Vibes font family.
LOBSTEREnumThe Lobster font family.
MERRIWEATHEREnumThe Merriweather font family.
PACIFICOEnumThe Pacifico font family.
PHILOSOPHEREnumThe Philosopher font family.
POIRET_ONEEnumThe Poiret One font family
QUATTROCENTOEnumThe Quattrocento font family.
ROBOTOEnumThe Roboto font family
SHADOWS_INTO_LIGHTEnumThe Shadows Into Light font family.
SYNCOPATEEnumThe Syncopate font family.
TAHOMAEnumThe Tahoma font family.
TIMES_NEW_ROMANEnumThe Times New Roman font family.
TREBUCHET_MSEnumThe Trebuchet MS font family.
UBUNTUEnumThe Ubuntu font family.
VERDANAEnumThe 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年12月02日 UTC.