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);
属性类型说明
AMARANTHEnumAmaranth 字体系列。
ARIALEnumArial 字体系列。
ARIAL_BLACKEnumArial Black 字体系列。
ARIAL_NARROWEnumArial Narrow 字体系列。
ARVOEnumArvo 字体系列。
CALIBRIEnumCalibri 字体系列。
CAMBRIAEnumCambria 字体系列。
COMIC_SANS_MSEnumComic Sans MS 字体系列。
CONSOLASEnumConsolas 字体系列。
CORSIVAEnumCorsiva 字体系列。
COURIER_NEWEnumCourier New 字体系列。
DANCING_SCRIPTEnumDancing Script 字体系列。
DROID_SANSEnumDroid Sans 字体系列。
DROID_SERIFEnumDroid Serif 字体系列。
GARAMONDEnumGaramond 字体系列。
GEORGIAEnumGeorgia 字体系列。
GLORIA_HALLELUJAHEnumGloria Hallelujah 字体系列。
GREAT_VIBESEnumGreat Vibes 字体系列。
LOBSTEREnumLobster 字体系列。
MERRIWEATHEREnumMerriweather 字体系列。
PACIFICOEnumPacifico 字体系列。
PHILOSOPHEREnumPhilosopher 字体系列。
POIRET_ONEEnumPoiret One 字体系列
QUATTROCENTOEnumQuattrocento 字体系列。
ROBOTOEnumRoboto 字体系列
SHADOWS_INTO_LIGHTEnumShadows Into Light 字体系列。
SYNCOPATEEnumSyncopate 字体系列。
TAHOMAEnumTahoma 字体系列。
TIMES_NEW_ROMANEnumTimes New Roman 字体系列。
TREBUCHET_MSEnumTrebuchet MS 字体系列。
UBUNTUEnumUbuntu 字体系列。
VERDANAEnumVerdana 字体系列。