Enum FontFamily

Bộ phông chữ

Không dùng nữa. Các phương thức getFontFamily()setFontFamily(String) hiện sử dụng tên chuỗi cho phông chữ thay vì enum này. Mặc dù enum này không còn được dùng nữa, nhưng vẫn sẽ được cung cấp để tương thích với các tập lệnh cũ.

Liệt kê các phông chữ được hỗ trợ.

Sử dụng enum FontFamily để đặt phông chữ cho một phạm vi văn bản, phần tử hoặc tài liệu.

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);
Thuộc tínhLoạiMô tả
AMARANTHEnumBộ phông chữ Amaranth.
ARIALEnumBộ phông chữ Arial.
ARIAL_BLACKEnumBộ phông chữ Arial Black.
ARIAL_NARROWEnumBộ phông chữ Arial Narrow.
ARVOEnumBộ phông chữ Arvo.
CALIBRIEnumBộ phông chữ Calibri.
CAMBRIAEnumBộ phông chữ Cambria.
COMIC_SANS_MSEnumBộ phông chữ Comic Sans MS.
CONSOLASEnumBộ phông chữ Consolas.
CORSIVAEnumBộ phông chữ Corsiva.
COURIER_NEWEnumBộ phông chữ Courier New.
DANCING_SCRIPTEnumBộ phông chữ Dancing Script.
DROID_SANSEnumBộ phông chữ Droid Sans.
DROID_SERIFEnumBộ phông chữ Droid Serif.
GARAMONDEnumBộ phông chữ Garamond.
GEORGIAEnumBộ phông chữ Georgia.
GLORIA_HALLELUJAHEnumBộ phông chữ Gloria Hallelujah.
GREAT_VIBESEnumBộ phông chữ Great Vibes.
LOBSTEREnumBộ phông chữ Lobster.
MERRIWEATHEREnumBộ phông chữ Merriweather.
PACIFICOEnumBộ phông chữ Pacifico.
PHILOSOPHEREnumBộ phông chữ Philosopher.
POIRET_ONEEnumBộ phông chữ Poiret One
QUATTROCENTOEnumBộ phông chữ Quattrocento.
ROBOTOEnumBộ phông chữ Roboto
SHADOWS_INTO_LIGHTEnumBộ phông chữ Shadows Into Light.
SYNCOPATEEnumBộ phông chữ Syncopate.
TAHOMAEnumBộ phông chữ Tahoma.
TIMES_NEW_ROMANEnumBộ phông chữ Times New Roman.
TREBUCHET_MSEnumBộ phông chữ Trebuchet MS.
UBUNTUEnumBộ phông chữ Ubuntu.
VERDANAEnumBộ phông chữ Verdana.