Class PDF16PlainTextFormatter
- java.lang.Object
-
- com.adobe.fontengine.inlineformatting.PDF16PlainTextFormatter
-
public final class PDF16PlainTextFormatter extends java.lang.Object
Inline formatter for PDF 1.6 plain text form fields.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 theformat(AttributedRun, int, int, boolean)
orformat(AttributedRun, int, int, boolean, boolean)
method.
-
-
Field Summary
Fields Modifier and Type Field Description static InterElementAttribute
newComb
Interelement attribute to mark comb boundaries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
format(AttributedRun run, int start, int limit, boolean onComb)
Format anAttributedRun
by resolving the styling constraints to glyphs and positions for those glyphs.int
format(AttributedRun run, int start, int limit, boolean onComb, boolean shouldKern)
Format anAttributedRun
by resolving the styling constraints to glyphs and positions for those glyphs.static PDF16PlainTextFormatter
getFormatterInstance(FallbackFontSet fallbackFontSet)
Create a PDF16PlainTextFormatter for formatting text.int
preFormat(AttributedRun run, int start, int limit)
Preformat anAttributedRun
.
-
-
-
Field Detail
-
newComb
public static final InterElementAttribute newComb
Interelement attribute to mark comb boundaries. The value of this attribute is aBoolean
. The preceding and following elements should be in the same comb iff this attribute has the valueBoolean.FALSE
-
-
Method Detail
-
getFormatterInstance
public static PDF16PlainTextFormatter getFormatterInstance(FallbackFontSet fallbackFontSet)
Create a PDF16PlainTextFormatter for formatting text.Concurrency
The PDF16PlainTextFormatter instance that is returned from this method is not in general thread safe.- Parameters:
fallbackFontSet
- the fonts to use for character fallback- Returns:
- A PDF16PlainTextFormatter to be used for formatting text
-
preFormat
public int preFormat(AttributedRun run, int start, int limit) throws FontException, FormattingException
Preformat anAttributedRun
. This method should be called on a portion of an AttributedRun corresponding to a whole paragraph, before theformat(AttributedRun, int, int, boolean)
orformat(AttributedRun, int, int, boolean, boolean)
method.- Parameters:
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)- Returns:
- The new limit of the original range in the AttributedRun after the formatting operation.
- Throws:
FontException
FormattingException
-
format
public int format(AttributedRun run, int start, int limit, boolean onComb) throws FontException, FormattingException
Format anAttributedRun
by resolving the styling constraints to glyphs and positions for those glyphs.This method should be called after the
preFormat(com.adobe.fontengine.inlineformatting.AttributedRun, int, int)
method.On input:
- each element must be a character, i.e. must have the
ElementAttribute.isGlyph
attribute set toBoolean.FALSE
- each element must have
ElementAttribute.locale
set - each element must have
ElementAttribute.bidiLevel
set - each element must have
ElementAttribute.font
set to the desired font - each element must have
ElementAttribute.pointSize
set to the desired point size - each character element can have
ElementAttribute.fontStyle
set; if not set, equivalent toFontStyle.NORMAL
- each character element can have
ElementAttribute.typographicCase
set; if not set, interpreted asTypographicCase.NONE
. - each character element can have
ElementAttribute.digitCase
set; if not set, equivalent toDigitCase.DEFAULT
- each character element can have
ElementAttribute.digitWidth
set; if not set, equivalent toDigitWidth.DEFAULT
- each interelement can have
InterElementAttribute.ligatureLevel
set; if not set, equivalent toLigatureLevel.COMMON
At some point during formatting,
startWorkingWithPositions
will be called on the run.On output:
- each element in the run will be a glyph, i.e.
ElementAttribute.isGlyph
will beBoolean.TRUE
- each element will have a placement and advance vector
- each element will have
ElementAttribute.font
set to the actual font to use - each element will have
ElementAttribute.pointSize
set to the actual point size to use - if
onComb
is true, then each interelement will have thenewComb
attribute set
- Parameters:
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)onComb
- true iff the attributed run is displayed in a comb- Returns:
- The new limit of the original range in the AttributedRun after the formatting operation.
- Throws:
FontException
FormattingException
- each element must be a character, i.e. must have the
-
format
public int format(AttributedRun run, int start, int limit, boolean onComb, boolean shouldKern) throws FontException, FormattingException
Format anAttributedRun
by resolving the styling constraints to glyphs and positions for those glyphs.This method should be called after the
preFormat(com.adobe.fontengine.inlineformatting.AttributedRun, int, int)
method.On input:
- each element must be a character, i.e. must have the
ElementAttribute.isGlyph
attribute set toBoolean.FALSE
- each element must have
ElementAttribute.locale
set - each element must have
ElementAttribute.bidiLevel
set - each element must have
ElementAttribute.font
set to the desired font - each element must have
ElementAttribute.pointSize
set to the desired point size - each character element can have
ElementAttribute.fontStyle
set; if not set, equivalent toFontStyle.NORMAL
- each character element can have
ElementAttribute.typographicCase
set; if not set, interpreted asTypographicCase.NONE
. - each character element can have
ElementAttribute.digitCase
set; if not set, equivalent toDigitCase.DEFAULT
- each character element can have
ElementAttribute.digitWidth
set; if not set, equivalent toDigitWidth.DEFAULT
- each interelement can have
InterElementAttribute.ligatureLevel
set; if not set, equivalent toLigatureLevel.COMMON
At some point during formatting,
startWorkingWithPositions
will be called on the run.On output:
- each element in the run will be a glyph, i.e.
ElementAttribute.isGlyph
will beBoolean.TRUE
- each element will have a placement and advance vector
- each element will have
ElementAttribute.font
set to the actual font to use - each element will have
ElementAttribute.pointSize
set to the actual point size to use - if
onComb
is true, then each interelement will have thenewComb
attribute set
- Parameters:
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)onComb
- true iff the attributed run is displayed in a combshouldKern
- whether or not kerning should be applied to the glyphs- Returns:
- The new limit of the original range in the AttributedRun after the formatting operation.
- Throws:
FontException
FormattingException
- each element must be a character, i.e. must have the
-
-