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.
Reviewed against engine v0.71.9
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 · CharacterStyle | Values | Seen in |
|---|---|---|
| Name | text | 100% |
| Self | CharacterStyle reference | 100% |
| Imported | false | 89% |
| EmitCss | true | 87% |
| SplitDocument | false | 87% |
| StyleUniqueId | builtin / text | 87% |
| IncludeClass | true | 28% |
| ExtendedKeyboardShortcut | number-list | 24% |
| BasedOn in Properties | — | 18% |
| KeyboardShortcut | number-list | 18% |
| PreviewColor in Properties | — | 18% |
| FillColor | Color reference | 17% |
| FontStyle | text | 14% |
| AppliedFont in Properties | ref | 8% |
A few attributes need more than a name:
Capitalization—Normal,AllCaps,SmallCapsorCapToSmallCap.AllCapsshows the text in capitals without changing the stored characters.SmallCapsturns lowercase letters into small capitals and leaves capitals full height;CapToSmallCapturns capitals into small capitals too. InDesign uses the font's OpenType small capitals (smcp, plusc2scforCapToSmallCap) and scales ordinary capitals when the font has none.Position—Normal,Superscript,Subscript, and the OpenType variantsOTSuperscript,OTSubscript,OTNumerator,OTDenominator.SuperscriptandSubscriptshrink and shift the glyphs by the size and offset set in the document's text preferences.KerningMethod— InDesign writes$ID/Metrics,$ID/Opticalor$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,OTFFigureStyleandOTFStylisticSets. See composer and OpenType features.
In Paged: the character attributes above are applied, including small capitals through the font's
Supported · verified Supported · verified Supported · verifiedsmcpandc2sc(a font without them shows the letters unchanged, not scaled capitals),AllCapswith the font's case-sensitive forms and capital spacing (caseandcpsp), andVerticalScale.SuperscriptandSubscriptuse InDesign's default size and offset (58.3 % and 33.3 %; the document's own settings are not read yet). The four OpenType positions use the font'ssups,subs,numranddnomglyphs at the run's size on its baseline; a font without the feature prints the plain glyph.KerningMethodis read with or without the$ID/prefix;Opticalis set like metric kerning. Underline and strikethrough are drawn; their gap colours are not.
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.
<?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.
Paragraph styles
The ParagraphStyle element — identity, BasedOn parent, character defaults, paragraph geometry and the option families it carries, as InDesign writes them.
Object styles
The ObjectStyle element — the page-item analogue of a text style — its fill, stroke and corner attributes, its Enable switches, and the built-in [None] style.