Returns how far the text is raised, as a percentage of its size: positive for superscript,
negative for subscript, 0 on the baseline.
Returns whether the text is bold: a weight above 400.
Returns the text color.
Returns the families drawn when IFontStyle.getFamily cannot draw a character, in order.
Returns the typeface drawn: the one stated, or the theme's font when the style names a theme font or none.
Returns whether the text is italic.
Returns the space added between characters, in points; 0 for none, negative to condense.
Returns the size in points.
Returns how the text is struck through; 'none' when it is not.
Returns the theme font the style follows, or null when it names its own family.
Returns how the text is underlined; 'none' when it is not.
Returns the weight, 400 being regular and 700 bold.
Returns true when other measures text the same, so a measured width can be reused.
Raises or lowers the text by a percentage of its size; 0 puts it back on the baseline.
Optionaloptions: ITransaction.OperationOptionsSets the weight to bold (700) or regular (400).
Optionaloptions: ITransaction.OperationOptionsSets the color: an IColor, #FF0000, rgb(…), or a theme color such as accent1.
Optionaloptions: ITransaction.OperationOptionsOptionaloptions: ITransaction.OperationOptionsSets the typeface: a family name, or a IFontStyle.ThemeFamily to follow the theme's
heading or body font. null clears it.
Optionaloptions: ITransaction.OperationOptionsOptionaloptions: ITransaction.OperationOptionsOptionaloptions: ITransaction.OperationOptionsSets the size in points.
Optionaloptions: ITransaction.OperationOptionsSets how the text is struck through; 'none' removes the line.
Optionaloptions: ITransaction.OperationOptionsSets how the text is underlined; 'none' removes the underline.
Optionaloptions: ITransaction.OperationOptionsOptionaloptions: ITransaction.OperationOptionsReturns the style as CSS properties.
Optionalmode: CSSMode
How colors are written.
Optionalzoom: number
Scales the font size.
OptionalignoreNormal: boolean
Leaves out what equals the Normal style's font, where there is one.
Serializes to a JSON object.
Sets several properties at once, as one step to undo.
Optionaloptions: ITransaction.OperationOptions
How text is drawn: its typeface, size, weight, slant, lines, color, spacing and baseline.
Remarks
A cell's font (
range.getStyle().getFont()) and the text of a chart part (title.getStyle().getFont()on a title, legend, axis or data labels) are both text styles, so the same code formats either.What a style does not state it takes from the text around it: a cell's from the Normal style, a chart title's from the chart, the chart's from the theme. Reads answer what is drawn, stated or not.
Setters return the text style to keep chaining on. A cell's font is a snapshot of the cell, so its setters return the updated font rather than the one they were called on.
Example