This package contains classes that implement inline text formatting.
The job of a full-fledged layout engine can be roughly described as the interpretation of some input, typically mixing characters and images on which styling constraints are applied, to produce an output which is a set of positioned glyphs and images. To accomplish this job, a layout engine will maintain data structures, and invoke a number of subcomponents to modify and refine those datastructures (e.g. a table formatter, an hyphenation engine).
A subcomponent of particular interest is an inline text formatter: this subcomponent is concerned with text only, and is tasked with the selection of fonts, glyphs in those fonts, and positions for those glyphs. �inline� refers to the fact that this subcomponent has a limited view of layout: the text is set on a single infinite line, without direct consideration of column alignment and such. It is the job of the layout engine to slice the output of the inline text formatter into lines, align columns, etc.
The inline formatters implemented in this package do not have
an explicit knowledge of the data structure of the layout
engine they support. Instead, they have a view on those data
structure through the
AttributedRun interface. This interface captures the idea of
a run of characters or glyphs, with attributes which describe
the styling constraints. The attributes are key/value pairs.
The typical client of this package will build some object that
implements the AttributedRun interface. This run contains
characters. In addition, the client sets some well-known
attributes on the run. For example, if the target formatter is
a CSS formatter, the client sets attributes such as
ElementAttributes.CSSFamily to communicate the styling
constraints to the formatter. The formatter can also be
configured with resources external to the document, such as
the set of fonts which can be used. The client then invokes
format method of the formatter, passing it
the object implementing
AttributedRun. As the
formatter does its work, it transforms the
AttributedRun, making successive decisions on how
to achieve the styling constraints. At the end, the
AttributedRun contains selected fonts, selected glyphs, and
selected positions for those glyphs.
Each formatter defines the set of styling attributes it
interprets. Those attributes are key/value pairs, where the
key is an object of type
InterElementAttribute. The identity of those objects defines
the styling attributes; in other words, the object
CSS20Attribute (and only this object) is the key that CSS
formatters will use to retrieve the CSS properties specified
by the client. Similarly, each formatter defines the
attributes under which the result of formatting can be
accessed by the client.
AFE offers three formatters:
BasicFormatter: the client selects the font(s) with which the run must be formatted.
PDF16PlainTextFormatter: targeted at the formatting of plain text form fields in PDF 1.6.
PDF16RichTextFormatter: targeted at the formatting of rich text form fields in PDF 1.6.
Writing systems and font layout technologies
While each formatter suports a different set of styling attributes, they all support the same set of writing systems and font layout technologies.
The following writing systems are supported:
- Han ideographs and Kana (CCJKV)
- Korean Hangul, modern syllables only
The following font layout technologies are supported:
- OpenType layout, using 'cmap', 'GSUB', 'GPOS', 'GDEF' tables
- TrueType layout, using only the 'cmap' and 'kern' tables
- Name-keyed layout, using the names of the glyphs, interpreted according the Adobe Glyph Naming Convention
- CID-keyed layout, using the CIDs of the glyphs, for the Adobe-Japan1, Adobe-CNS1, Adobe-GB1, and Adobe-Korea1 ROS
The precise definitions of the writing systems, font technologies and combinations of them which are supported are described here.
Interface Summary Interface Description AttributeAttribute AttributedRunA run of element occurrences with attributes, with support for transformations, used by inline text formatters.
Class Summary Class Description BasicFormatterGeneral purpose inline formatter. DigitCaseEnumerated values for
DigitWidthEnumerated values for
ElementAttributeThis class defines attributes which can be placed on elements on
FallbackFontSetA set of fonts indexed by
ULocale, typically used for fallback.
FontStyleEnumerated values for
InterElementAttributeThis class defines attributes which can be placed between elements on
LigatureLevelEnumerated values for
PDF16PlainTextFormatterInline formatter for PDF 1.6 plain text form fields. PDF16RichTextFormatterInline formatter for PDF 1.6 rich text form fields. TypographicCaseEnumerated values for
Exception Summary Exception Description FormattingExceptionFormattingException. NoSuitableFontExceptionNoSuitableFontException.