paged.IDML Reference
Styles

Character styles

The CharacterStyle element — identity, BasedOn, the attributes it usually sets, and how a range that applies a character style can still override one attribute.

Tier: ProProIIIreference

A character style formats a run inside a paragraph, and usually sets only the few attributes that differ from the text around it.

In short A <CharacterStyle> is applied to a run through AppliedCharacterStyle on a <CharacterStyleRange>. Unlike a paragraph style, it is sparse: a "Bold" style sets FontStyle="Bold" and nothing else, and everything it leaves out comes from the paragraph style. Character styles inherit through BasedOn like every other style and end at [No character style], which sets nothing. As on paragraph styles, InDesign writes the font, the parent and the leading as typed children of <Properties>.

Where they live

Character styles sit under <RootCharacterStyleGroup> in Resources/Styles.xml, optionally inside <CharacterStyleGroup> folders. The root, CharacterStyle/$ID/[No character style], is what a run applies when it wants nothing but its paragraph's formatting.

A character style's AppliedFont, BasedOn and Leading are typed children of its <Properties> block, spelled exactly as on a paragraph style.

Attributes

Attribute · CharacterStyleValuesPagedpaged.set
Nametextread · writtenname
SelfCharacterStyle referenceread · written
Importedfalsenot read
EmitCsstruenot read
SplitDocumentfalsenot read
StyleUniqueIdbuiltin / textnot read
IncludeClasstruenot read
ExtendedKeyboardShortcutnumber-listnot read
BasedOn
in Properties
—read · written
KeyboardShortcutnumber-listnot read
PreviewColor
in Properties
—not read
FillColorColor referenceread · writtencharacterFillColor
FontStyletextread · writtencharacterFontStyle
AppliedFont
in Properties
refread · writtencharacterFontFamily
The 14 attributes real documents use most. All 36 attributes of CharacterStyle →

A few attributes need more than a name:

  • Capitalization — Normal, AllCaps, SmallCaps or CapToSmallCap. AllCaps shows the text in capitals without changing the stored characters. SmallCaps turns lowercase letters into small capitals and leaves capitals full height; CapToSmallCap turns capitals into small capitals too. InDesign uses the font's OpenType small capitals (smcp, plus c2sc for CapToSmallCap) and scales ordinary capitals when the font has none.
  • Position — Normal, Superscript, Subscript, and the OpenType variants OTSuperscript, OTSubscript, OTNumerator, OTDenominator. Superscript and Subscript shrink and shift the glyphs by the size and offset set in the document's text preferences.
  • KerningMethod — InDesign writes $ID/Metrics, $ID/Optical or $ID/None, with the $ID/ prefix. See spacing and leading.
  • Leading — a character attribute in InDesign: each line takes the largest leading among its runs. On a style it is the typed <Leading> child.
  • OpenType features — Ligatures, OTFContextualAlternate, OTFDiscretionaryLigature, OTFFraction, OTFOrdinal, OTFSwash, OTFTitling, OTFSlashedZero, OTFFigureStyle and OTFStylisticSets. See composer and OpenType features.

In Paged: the character attributes above are applied, including small capitals through the font's smcp and c2sc (a font without them shows the letters unchanged, not scaled capitals), Position with InDesign's default size and offset (58.3 % and 33.3 %; the document's own settings are not read yet), and VerticalScale. KerningMethod values with the $ID/ prefix are not recognised yet and fall back to metric kerning. Underline and strikethrough are drawn; their gap colours are not.

Supported · verified Supported · verified Supported · verified

A local override beats the style

A run can apply a character style and set an attribute on its own range as well. The range's value wins, for that range only. In the example below both runs apply Emphasis, which sets PointSize="12"; the second range adds PointSize="24" and sets at 24 pt.

Two runs, one character style; the second range overrides PointSize locally.

Stories/Story_ustory.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="20.0">
  <Story Self="ustory">
    <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]">
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Emphasis">
        <Content>Emphasis as defined, </Content>
      </CharacterStyleRange>
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Emphasis" PointSize="24">
        <Content>then PointSize overridden to 24 on the range.</Content>
      </CharacterStyleRange>
    </ParagraphStyleRange>
  </Story>
</idPkg:Story>

The full order (the range, then the character style's chain, then the paragraph style's chain) is on conflict resolution.

Frequently asked questions

What is a character style for? Formatting a run inside a paragraph, such as a bold word or a coloured product name. It usually sets only the attributes that differ; the rest comes from the paragraph style.

How does a run reference a character style? Through AppliedCharacterStyle on its <CharacterStyleRange>, set to the style's Self id. A run that wants only its paragraph's formatting applies CharacterStyle/$ID/[No character style].

Can a character style set the leading? Yes. In InDesign leading is a character attribute, and a character style can carry it as a typed <Leading> child of <Properties>. A line takes the largest leading among its runs.

What does CapToSmallCap do? It sets the whole run in small capitals, capitals included. SmallCaps turns only the lowercase letters into small capitals and keeps capitals full height.

On this page