public final class BasicFormatter extends Object
This formatter does not do any font selection or font fallback, the client must have selected fonts.
The client must first pass a run corresponding to a whole paragraph to the
preFormat(com.adobe.fontengine.inlineformatting.AttributedRun, int, int) method. It can then pass fragments of the run to the
format(AttributedRun, int, int) or format(AttributedRun, int, int, boolean) method.
| Modifier and Type | Method and Description |
|---|---|
int |
format(AttributedRun run,
int start,
int limit)
Format an
AttributedRun by resolving the styling constraints
to actual fonts, glyphs and positions for those glyphs. |
int |
format(AttributedRun run,
int start,
int limit,
boolean shouldKern)
Format an
AttributedRun by resolving the styling constraints
to actual fonts, glyphs and positions for those glyphs. |
static BasicFormatter |
getFormatterInstance()
Create a BasicFormatter for formatting text.
|
int |
preFormat(AttributedRun run,
int start,
int limit)
Preformat an
AttributedRun. |
public static BasicFormatter getFormatterInstance()
public int preFormat(AttributedRun run, int start, int limit) throws InvalidFontException, UnsupportedFontException, FontLoadingException
AttributedRun.
This method should be called on a portion of an AttributedRun
corresponding to a whole paragraph, before the
format(AttributedRun, int, int) or format(AttributedRun, int, int, boolean) method.run - an AttributedRun that contains the text to be formattedstart - the index in the AttributedRun to start formatting fromlimit - the index in the AttributedRun at which formatting should cease (one
more than the last position that formatting should done to)InvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionpublic int format(AttributedRun run, int start, int limit) throws InvalidFontException, UnsupportedFontException, FontLoadingException
AttributedRun by resolving the styling constraints
to actual fonts, glyphs and positions for those glyphs.
This method should be called after the preFormat(com.adobe.fontengine.inlineformatting.AttributedRun, int, int) method.
On input:
ElementAttribute.isGlyph attribute.
ElementAttribute.locale set
ElementAttribute.bidiLevel set
ElementAttribute.joiningType set
ElementAttribute.font set
ElementAttribute.pointSize set
ElementAttribute.fontStyle set;
if not set, equivalent to FontStyle.NORMAL
ElementAttribute.typographicCase set;
if not set, equivalent to TypographicCase.NONE
ElementAttribute.digitCase set;
if not set, equivalent to DigitCase.DEFAULT
ElementAttribute.digitWidth set;
if not set, equivalent to DigitWidth.DEFAULT
InterElementAttribute.ligatureLevel set;
if not set, equivalent to LigatureLevel.COMMON
At some point during formatting,
startWorkingWithPositions
will be called on the run.
On output:
run - an AttributedRun that contains the text to be formattedstart - the index in the AttributedRun to start formatting fromlimit - the index in the AttributedRun at which formatting should cease (one
more than the last position that formatting should done to)InvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionpublic int format(AttributedRun run, int start, int limit, boolean shouldKern) throws InvalidFontException, UnsupportedFontException, FontLoadingException
AttributedRun by resolving the styling constraints
to actual fonts, glyphs and positions for those glyphs.
This method should be called after the preFormat(com.adobe.fontengine.inlineformatting.AttributedRun, int, int) method.
On input:
ElementAttribute.isGlyph attribute.
ElementAttribute.locale set
ElementAttribute.bidiLevel set
ElementAttribute.joiningType set
ElementAttribute.font set
ElementAttribute.pointSize set
ElementAttribute.fontStyle set;
if not set, equivalent to FontStyle.NORMAL
ElementAttribute.typographicCase set;
if not set, equivalent to TypographicCase.NONE
ElementAttribute.digitCase set;
if not set, equivalent to DigitCase.DEFAULT
ElementAttribute.digitWidth set;
if not set, equivalent to DigitWidth.DEFAULT
InterElementAttribute.ligatureLevel set;
if not set, equivalent to LigatureLevel.COMMON
At some point during formatting,
startWorkingWithPositions
will be called on the run.
On output:
run - an AttributedRun that contains the text to be formattedstart - the index in the AttributedRun to start formatting fromlimit - the index in the AttributedRun at which formatting should cease (one
more than the last position that formatting should done to)shouldKern - whether or not kerning should be applied to the glyphsInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved