Class PDFStyle
- java.lang.Object
-
- org.faceless.pdf2.PDFStyle
-
- All Implemented Interfaces:
Cloneable
public class PDFStyle extends Object implements Cloneable
A PDFStyle controls the colors, font and many other aspects of the actual display of elements on a PDF page. It's conceptually similar to a CSS style used with HTML markup.
The idea behind the PDFStyle class is that you create a style and then apply it to the
ExamplePDFPage
. This means you can switch from one style to another with a single command, and switch back just as easily. It makes defining a consistant "feel" to your document much easier than it would if you had to set the font and color separately.import java.awt.Color; // Create a new style "normal": 12pt black Times-Roman, with // line-spacing of 1.5 PDFStyle normal = new PDFStyle(); normal.setFont(new StandardFont(StandardFont.TIMES), 12); normal.setFillColor(Color.black); normal.setTextLineSpacing(1.5); // Create a new varient of "normal": 12pt red Times-Italic with // the same line-spacing PDFStyle italic = new PDFStyle(normal); italic.setFont(new StandardFont(StandardFont.TIMESITALIC), 12); italic.setFillColor(Color.red); // Create a style to draw a box around the text in green, with a // line width of 2 points PDFStyle boxstyle = new PDFStyle(); boxstyle.setLineColor(Color.green); boxstyle.setLineWeighting(2); // Now use these styles in a document PDF p = new PDF(); PDFPage page = p.newPage(PDF.PAGESIZE_A4); page.setStyle(normal); page.drawText("This is in 12pt black Times Roman", 100, 100); page.setStyle(italic); page.drawText("This is in 12pt red Times Italic", 100, 120); // Draw a box around them in green page.setStyle(boxstyle); page.drawRectangle(90,90, 200, 40);
This shows several useful aspects of styles:
- Styles can easily be extended by using the
PDFStyle(PDFStyle)
constructor - Not all the aspects of a style need to be set
- Styles can be given meaningful names
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
BREAK_LEGACY
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules that applied in the PDF Library before release 2.22.1.static int
BREAK_LINE_ANYWHERE
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:anywhere" in css-text-3.static int
BREAK_LINE_LOOSE
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:loose" in css-text-3.static int
BREAK_LINE_NORMAL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:normal" in css-text-3.static int
BREAK_LINE_STRICT
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:strict" in css-text-3.static int
BREAK_UAX14
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules exactly as described in UAX14static int
BREAK_WORD_BREAKALL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "word-break:break-all" in css-text-3.static int
BREAK_WORD_KEEPALL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "word-break:keep-all" in css-text-3.static int
BREAK_WORD_NORMAL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "word-break:normal" in css-text-3.static int
FONTSTYLE_FILLED
Set any text rendered in this style to be filled with the styles FillColor (the default)static int
FONTSTYLE_FILLEDOUTLINE
Set any text rendered in this style to be filled with the styles FillColor, then to be outlined with the styles' LineColorstatic int
FONTSTYLE_INVISIBLE
Set any text rendered in this style to be invisible.static int
FONTSTYLE_OUTLINE
Set any text rendered in this style to be drawn as a hollow outline with the styles LineColor (the default)static char
FORMRADIOBUTTONSTYLE_CHECK
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a check mark (a tick) when selected.static char
FORMRADIOBUTTONSTYLE_CIRCLE
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled circle when selected.static char
FORMRADIOBUTTONSTYLE_CROSS
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a cross or "X" when selected.static char
FORMRADIOBUTTONSTYLE_DIAMOND
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled diamond when selected.static char
FORMRADIOBUTTONSTYLE_SQUARE
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled square when selected.static char
FORMRADIOBUTTONSTYLE_STAR
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled five-pointed star when selected.static int
FORMSTYLE_BEVEL
Style forsetFormStyle(int)
which draws an border around the field so that it looks beveled.static int
FORMSTYLE_CLOUDY1
Style forsetFormStyle(int)
which causes the border to be "cloudy" with small curves This style only applies to someAnnotationShape
classes andAnnotationText
static int
FORMSTYLE_CLOUDY2
Style forsetFormStyle(int)
which causes the border to be "cloudy" with big curves.static int
FORMSTYLE_INSET
Style forsetFormStyle(int)
which draws an border around the field so that it looks inset into the page.static int
FORMSTYLE_INVERT
Style forsetFormStyle(int)
which causes the form element to be inverted when clickedstatic int
FORMSTYLE_OUTLINE
Style forsetFormStyle(int)
which causes the form element to be outlined when clickedstatic int
FORMSTYLE_SOLID
Style forsetFormStyle(int)
which draws a solid border around the field (the default)static int
FORMSTYLE_UNDERLINE
Style forsetFormStyle(int)
which draws a single line under the fieldstatic int
LINECAP_BUTT
Set the end of a line to be squared off at the end.static int
LINECAP_ROUND
Set the end of a line to be rounded at the end.static int
LINECAP_SQUARE
Set the end of a line to be squared at the end.static int
LINEJOIN_BEVEL
Sets the join style of two lines so that the lines are beveled.static int
LINEJOIN_MITER
Sets the join style of two lines so that the lines are extended so they meet at a point (like a picture frame).static int
LINEJOIN_ROUND
Sets the join style of two lines so that the lines are rounded, equivalent to drawing a circle with a diameter of the linewidth where the lines meet.static PDFStyle
LINKSTYLE
This style is a predefined convenience style - it can be passed intoPDFPage.beginTextLink(org.faceless.pdf2.PDFAction, org.faceless.pdf2.PDFStyle)
to underline the text in the link.static int
PAINTMETHOD_EVENODD
A parameter tosetPaintMethod(int)
to set the paint method to use the even-odd method to determine which areas are inside or outside a shape.static int
PAINTMETHOD_NONZEROWINDING
A parameter tosetPaintMethod(int)
to set the paint method to use the non-zero winding number method to determine which areas are inside or outside a shape.static int
TEXTALIGN_BASELINE
Set the vertical text alignment for this style to baseline (the default).static int
TEXTALIGN_BOTTOM
Set the vertical text alignment for this style to bottomstatic int
TEXTALIGN_CENTER
Set the text alignment for this style to centeredstatic int
TEXTALIGN_JUSTIFY
Set the text alignment for this style to justified (the default).static int
TEXTALIGN_JUSTIFY_ALL
Similar toTEXTALIGN_JUSTIFY
, but will also justify the last line of a paragraph.static int
TEXTALIGN_LEFT
Set the text alignment for this style to left-alignedstatic int
TEXTALIGN_MIDDLE
Set the vertical text alignment for this style to middlestatic int
TEXTALIGN_RIGHT
Set the text alignment for this style to right-alignedstatic int
TEXTALIGN_TOP
Set the vertical text alignment for this style to top
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBackupFont(PDFFont font)
Add a backup font to the current style.Object
clone()
Create a duplicate of this font.PDFGlyphVector
createGlyphVector(String text, int offset, Locale locale, int level)
Returns a PDFGlyphVector containing the glyph codes for the specified text in this style.PDFGlyphVector
createGlyphVector(String text, Locale locale)
Returns a PDFGlyphVector containing the glyph codes for the specified text in this style.boolean
equals(Object o)
PDFFont
getBackupFont(int i)
Get the specified backup font, as set byaddBackupFont(org.faceless.pdf2.PDFFont)
.String
getBlendMode()
Return the previously set blend modePaint
getFillColor()
Return the fill color, as set bysetFillColor(java.awt.Paint)
PDFFont
getFont()
Return the font, as set bysetFont(org.faceless.pdf2.PDFFont, float)
int
getFontFeature(String feature)
Get the specified font feature.float
getFontLeading()
Return the text leading for this styles in points.float
getFontSize()
Return the font size of this style, as set bysetFont(org.faceless.pdf2.PDFFont, float)
int
getFontStyle()
Return the font style as set bysetFontStyle(int)
char
getFormCheckboxStyle()
Returns the checkbox style of the current style, as set bysetFormCheckboxStyle(char)
.int
getFormFieldOrientation()
Return the form field orientation, as set bysetFormFieldOrientation(int)
.char
getFormRadioButtonStyle()
Returns the radiobutton style of the current style, as set bysetFormRadioButtonStyle(char)
.int
getFormStyle()
Returns the form-style of the current style, as set bysetFormStyle(int)
.int
getLineBreakBehaviour()
Return the line-break behaviour, as set bysetLineBreakBehaviour(int)
int
getLineCap()
Return the line cap, as set bysetLineCap(int)
Paint
getLineColor()
Return the line color, as set bysetLineColor(java.awt.Paint)
float[]
getLineDashPattern()
Return the line dash pattern, as set bysetLineDash(float, float, float)
.float
getLineDashPhase()
Get the "phase" part of the line dash pattern, as set bysetLineDash(float, float, float)
int
getLineJoin()
Return the line join, as set bysetLineJoin(int)
float
getLineJoinMiterLimit()
Return the line join miter limit, as set bysetLineJoinMiterLimit(float)
float
getLineWeighting()
Return the line weighting, as set bysetLineWeighting(float)
OpenTypeFont.Palette
getOpenTypeFontPalette()
Get the OpenTypeFont.Palette previously specified with #setOpenTypeFontPaletteboolean
getOverprint()
Return whether this text has the overprint flag, as set bysetOverprint(boolean)
int
getTextAlign()
Return the text alignment.float
getTextBottom(String s)
Get the bottom-most Y co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size.float
getTextIndent()
Return the text indent value as set bysetTextIndent(float)
float
getTextLeft(String s)
Get the left-most X co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size.float
getTextLength(char[] c, int off, int len)
Get the length of the specified string in points, using the styles font and font size.float
getTextLength(String s)
Get the length of the specified string in points, using the styles font and font size.float
getTextLineSpacing()
Return the text line spacing, as set bysetTextLineSpacing(float)
float
getTextRight(String s)
Get the right-most X co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size.float
getTextRise()
Return the text rise as set bysetTextRise(float)
float
getTextStretch()
Return the value of the text-stretch parameter, as set bysetTextStretch(float)
boolean
getTextStrikeOut()
Return whether this text is struck out or not, as set bysetTextStrikeOut(boolean)
float
getTextTop(String s)
Get the top-most Y co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size.int
getTextUnderline()
Return whether this text is underlined or not, as set bysetTextUnderline(boolean)
float
getTextWidths(char[] buf, int off, int len, float[] widths, float[] kerns)
Deprecated.callcreateGlyphVector(java.lang.String, java.util.Locale)
and retrieve this information from thereint
getTrackKerning()
Return the track kerning, as set bysetTrackKerning(float)
int
hashCode()
boolean
isTextSmallCaps()
Return whether this text is displayed with small-caps, as set bysetTextSmallCaps(boolean)
Since 2.22 this is identical togetFontFeature("smallcaps")
void
setBlendMode(String mode)
Set the "Blend Mode" of this style.void
setFillColor(Paint paint)
Set the fill color.void
setFont(PDFFont font, float size)
Set the font and font size for this style.void
setFontFeature(String feature, boolean on)
Set the specified font feature.void
setFontFeature(String feature, int value)
Set the specified font feature.void
setFontStyle(int style)
Set the font render style.void
setFormCheckboxStyle(char style)
ForFormCheckbox
elements, set the type of shape to use to show the checkbox is selected.void
setFormFieldOrientation(int rotate)
Set the angle of rotation for form fields created with this style as a background style.void
setFormRadioButtonStyle(char style)
ForFormRadioButton
elements, set the type of shape to use to show the button is selected.void
setFormStyle(int style)
Sets the style of a form fields background to one ofFORMSTYLE_SOLID
,FORMSTYLE_INSET
,FORMSTYLE_BEVEL
,FORMSTYLE_INVERT
,FORMSTYLE_OUTLINE
orFORMSTYLE_UNDERLINE
.void
setLineBreakBehaviour(int breakbehaviour)
Set the line-break behaviour, which determines how words break at the end of the line.void
setLineCap(int cap)
Set the line cap style.void
setLineColor(Paint paint)
Set the line color.void
setLineDash(float[] pattern, float phase)
Set the line dashing pattern.void
setLineDash(float on, float off, float phase)
Set the line dashing pattern.void
setLineJoin(int join)
Set the line join style.void
setLineJoinMiterLimit(float limit)
Set the miter limit for mitered line joins.void
setLineWeighting(float weight)
Set the line weighting, for fonts and geometric shapes drawn as outlines.void
setOpenTypeFontPalette(OpenTypeFont.Palette palette)
If the font being used with this Style is an OpenTypeFont which has one or morecolor palettes
, set the Palette to use.void
setOverprint(boolean on)
Cause text and objects drawn with this style to overprint.void
setPaintMethod(int method)
Set the paint method to eitherPAINTMETHOD_EVENODD
orPAINTMETHOD_NONZEROWINDING
(the default).void
setStrokeAdjustment(boolean sa)
Set whether this style uses Stroke Adjustmentvoid
setTextAlign(int textalign)
Set the text alignment for this style.void
setTextDoubleUnderline(boolean on)
Set whether text rendered with this style is double-underlined or not.void
setTextIndent(float indent)
Set the number of points to indent the first line of any text drawn in this style.void
setTextJustificationRatio(float i)
Set the text justification ratio for a style.void
setTextLineSpacing(float spacing)
Set the spacing between lines of text.void
setTextRise(float offset)
Set the text vertical offset - the distance between the standard baseline and the basline for this style, as a proportion of the font size.void
setTextSmallCaps(boolean on)
Set whether text in this style is displayed with "small-caps" - ie. all lower case letters are displayed as upper-case but at 80% of the original font-size.void
setTextStretch(float stretch)
Set how much text is stretched horizontally.void
setTextStrikeOut(boolean on)
Set whether text rendered with this style is struck-out or not.void
setTextUnderline(boolean on)
Set whether text rendered with this style is underlined or not.void
setTrackKerning(float kern)
Allows you to explicitly set the kerning between characters for a font.PDFStyle
subscriptClone()
Return a new style which is the "subscripted" version of the current style.PDFStyle
superscriptClone()
Return a new style which is the "superscripted" version of the current style.String
toString()
-
-
-
Field Detail
-
LINKSTYLE
public static final PDFStyle LINKSTYLE
This style is a predefined convenience style - it can be passed intoPDFPage.beginTextLink(org.faceless.pdf2.PDFAction, org.faceless.pdf2.PDFStyle)
to underline the text in the link.
-
TEXTALIGN_LEFT
public static final int TEXTALIGN_LEFT
Set the text alignment for this style to left-aligned- See Also:
- Constant Field Values
-
TEXTALIGN_RIGHT
public static final int TEXTALIGN_RIGHT
Set the text alignment for this style to right-aligned- See Also:
- Constant Field Values
-
TEXTALIGN_CENTER
public static final int TEXTALIGN_CENTER
Set the text alignment for this style to centered- See Also:
- Constant Field Values
-
TEXTALIGN_JUSTIFY
public static final int TEXTALIGN_JUSTIFY
Set the text alignment for this style to justified (the default). Justification is only useful when text is written within a paragraph. When a single element of text is drawn, the effect is the same as left-alignment.- See Also:
- Constant Field Values
-
TEXTALIGN_JUSTIFY_ALL
public static final int TEXTALIGN_JUSTIFY_ALL
Similar toTEXTALIGN_JUSTIFY
, but will also justify the last line of a paragraph.- Since:
- 2.2.1
- See Also:
- Constant Field Values
-
TEXTALIGN_BASELINE
public static final int TEXTALIGN_BASELINE
Set the vertical text alignment for this style to baseline (the default).- See Also:
- Constant Field Values
-
TEXTALIGN_TOP
public static final int TEXTALIGN_TOP
Set the vertical text alignment for this style to top- See Also:
- Constant Field Values
-
TEXTALIGN_MIDDLE
public static final int TEXTALIGN_MIDDLE
Set the vertical text alignment for this style to middle- See Also:
- Constant Field Values
-
TEXTALIGN_BOTTOM
public static final int TEXTALIGN_BOTTOM
Set the vertical text alignment for this style to bottom- See Also:
- Constant Field Values
-
LINECAP_BUTT
public static final int LINECAP_BUTT
Set the end of a line to be squared off at the end. There is no projection beyond the end of the path. This is the default- See Also:
- Constant Field Values
-
LINECAP_ROUND
public static final int LINECAP_ROUND
Set the end of a line to be rounded at the end. Effectively draws a circle with a diameter of the line width at the end of each line.- See Also:
- Constant Field Values
-
LINECAP_SQUARE
public static final int LINECAP_SQUARE
Set the end of a line to be squared at the end. Effectively extends each line by half the linewidth.- See Also:
- Constant Field Values
-
LINEJOIN_MITER
public static final int LINEJOIN_MITER
Sets the join style of two lines so that the lines are extended so they meet at a point (like a picture frame). For extremely sharp angles, this will automatically be converted to a LINEJOIN_BEVEL. This is the default.- See Also:
- Constant Field Values
-
LINEJOIN_ROUND
public static final int LINEJOIN_ROUND
Sets the join style of two lines so that the lines are rounded, equivalent to drawing a circle with a diameter of the linewidth where the lines meet.- See Also:
- Constant Field Values
-
LINEJOIN_BEVEL
public static final int LINEJOIN_BEVEL
Sets the join style of two lines so that the lines are beveled. The two lines are drawn with LINECAP_BUTT ends, and the notch between the two segments is filled in with a triangle.- See Also:
- Constant Field Values
-
FONTSTYLE_FILLED
public static final int FONTSTYLE_FILLED
Set any text rendered in this style to be filled with the styles FillColor (the default)- See Also:
- Constant Field Values
-
FONTSTYLE_OUTLINE
public static final int FONTSTYLE_OUTLINE
Set any text rendered in this style to be drawn as a hollow outline with the styles LineColor (the default)- See Also:
- Constant Field Values
-
FONTSTYLE_FILLEDOUTLINE
public static final int FONTSTYLE_FILLEDOUTLINE
Set any text rendered in this style to be filled with the styles FillColor, then to be outlined with the styles' LineColor- See Also:
- Constant Field Values
-
FONTSTYLE_INVISIBLE
public static final int FONTSTYLE_INVISIBLE
Set any text rendered in this style to be invisible. This becomes useful in applications like OCR, where the original scanned image is displayed on the screen and invisible text written above it, allowing the text to be cut and pasted.- See Also:
- Constant Field Values
-
PAINTMETHOD_NONZEROWINDING
public static final int PAINTMETHOD_NONZEROWINDING
A parameter tosetPaintMethod(int)
to set the paint method to use the non-zero winding number method to determine which areas are inside or outside a shape. This is the default.- See Also:
- Constant Field Values
-
PAINTMETHOD_EVENODD
public static final int PAINTMETHOD_EVENODD
A parameter tosetPaintMethod(int)
to set the paint method to use the even-odd method to determine which areas are inside or outside a shape.- See Also:
- Constant Field Values
-
FORMSTYLE_SOLID
public static final int FORMSTYLE_SOLID
Style forsetFormStyle(int)
which draws a solid border around the field (the default)- See Also:
- Constant Field Values
-
FORMSTYLE_INSET
public static final int FORMSTYLE_INSET
Style forsetFormStyle(int)
which draws an border around the field so that it looks inset into the page.- See Also:
- Constant Field Values
-
FORMSTYLE_BEVEL
public static final int FORMSTYLE_BEVEL
Style forsetFormStyle(int)
which draws an border around the field so that it looks beveled.- See Also:
- Constant Field Values
-
FORMSTYLE_UNDERLINE
public static final int FORMSTYLE_UNDERLINE
Style forsetFormStyle(int)
which draws a single line under the field- See Also:
- Constant Field Values
-
FORMSTYLE_INVERT
public static final int FORMSTYLE_INVERT
Style forsetFormStyle(int)
which causes the form element to be inverted when clicked- See Also:
- Constant Field Values
-
FORMSTYLE_OUTLINE
public static final int FORMSTYLE_OUTLINE
Style forsetFormStyle(int)
which causes the form element to be outlined when clicked- See Also:
- Constant Field Values
-
FORMSTYLE_CLOUDY1
public static final int FORMSTYLE_CLOUDY1
Style forsetFormStyle(int)
which causes the border to be "cloudy" with small curves This style only applies to someAnnotationShape
classes andAnnotationText
- Since:
- 2.11.17
- See Also:
- Constant Field Values
-
FORMSTYLE_CLOUDY2
public static final int FORMSTYLE_CLOUDY2
Style forsetFormStyle(int)
which causes the border to be "cloudy" with big curves. This style only applies to someAnnotationShape
classes andAnnotationText
- Since:
- 2.11.17
- See Also:
- Constant Field Values
-
FORMRADIOBUTTONSTYLE_CHECK
public static final char FORMRADIOBUTTONSTYLE_CHECK
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a check mark (a tick) when selected. This is the default forFormCheckbox
elements.- Since:
- 2.0
- See Also:
- Constant Field Values
-
FORMRADIOBUTTONSTYLE_CIRCLE
public static final char FORMRADIOBUTTONSTYLE_CIRCLE
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled circle when selected. This is default forFormRadioButton
elements.- Since:
- 2.0
- See Also:
- Constant Field Values
-
FORMRADIOBUTTONSTYLE_CROSS
public static final char FORMRADIOBUTTONSTYLE_CROSS
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a cross or "X" when selected.- Since:
- 2.0
- See Also:
- Constant Field Values
-
FORMRADIOBUTTONSTYLE_SQUARE
public static final char FORMRADIOBUTTONSTYLE_SQUARE
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled square when selected.- Since:
- 2.0
- See Also:
- Constant Field Values
-
FORMRADIOBUTTONSTYLE_DIAMOND
public static final char FORMRADIOBUTTONSTYLE_DIAMOND
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled diamond when selected.- Since:
- 2.0
- See Also:
- Constant Field Values
-
FORMRADIOBUTTONSTYLE_STAR
public static final char FORMRADIOBUTTONSTYLE_STAR
A value forsetFormRadioButtonStyle(char)
andsetFormCheckboxStyle(char)
which sets the appearance for those elements to a filled five-pointed star when selected.- Since:
- 2.0
- See Also:
- Constant Field Values
-
BREAK_LEGACY
public static final int BREAK_LEGACY
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules that applied in the PDF Library before release 2.22.1. These rules were as defined in UAX#13 version 12.
-
BREAK_UAX14
public static final int BREAK_UAX14
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules exactly as described in UAX14- Since:
- 2.22.1
-
BREAK_LINE_NORMAL
public static final int BREAK_LINE_NORMAL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:normal" in css-text-3. This value can be combined with aBREAK_WORD_n
value using a logical-or- Since:
- 2.22.1
-
BREAK_LINE_LOOSE
public static final int BREAK_LINE_LOOSE
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:loose" in css-text-3. This value can be combined with aBREAK_WORD_n
value using a logical-or- Since:
- 2.22.1
-
BREAK_LINE_STRICT
public static final int BREAK_LINE_STRICT
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:strict" in css-text-3. This value can be combined with aBREAK_WORD_n
value using a logical-or- Since:
- 2.22.1
-
BREAK_LINE_ANYWHERE
public static final int BREAK_LINE_ANYWHERE
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "line-break:anywhere" in css-text-3. It will allow a breakpoint between any two glyphs.- Since:
- 2.22.1
-
BREAK_WORD_BREAKALL
public static final int BREAK_WORD_BREAKALL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "word-break:break-all" in css-text-3. This value can be combined with aBREAK_LINE_n
value using a logical-or- Since:
- 2.22.1
-
BREAK_WORD_KEEPALL
public static final int BREAK_WORD_KEEPALL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "word-break:keep-all" in css-text-3. This value can be combined with aBREAK_LINE_n
value using a logical-or- Since:
- 2.22.1
-
BREAK_WORD_NORMAL
public static final int BREAK_WORD_NORMAL
A value forsetLineBreakBehaviour(int)
that will use the line-breaking rules as described for "word-break:normal" in css-text-3. This value can be combined with aBREAK_LINE_n
value using a logical-or- Since:
- 2.22.1
-
-
Constructor Detail
-
PDFStyle
public PDFStyle()
Create a new PDFStyle using the default settings. No fill color, line color or font is specified
-
PDFStyle
public PDFStyle(PDFStyle style)
Create a new style which is a clone of the specified style- Since:
- 2.0
-
-
Method Detail
-
setFillColor
public void setFillColor(Paint paint)
Set the fill color. For text, this is the color of the text. For geometric shapes, this is paint to fill those shapes with. To draw only outlines, set it to
null
(the default).Prior to release 1.2, this method took a
Color
as an argument, but this has been changed to its superclassPaint
instead. Although most of the time the parameter will still be a plain color, this change allows aGradientPaint
to be used as well.- Parameters:
paint
- the paint to use, ornull
if no fill is required.- Since:
- 1.0
-
setLineColor
public void setLineColor(Paint paint)
Set the line color. For text, this is the color of the outline of the text. For geometric shapes, this is color to draw the outlines of those shapes. If no outline is required, set it tonull
(the default).- Parameters:
paint
- the Color to use, ornull
if no outline is required.- Since:
- 1.0
-
setLineWeighting
public void setLineWeighting(float weight)
Set the line weighting, for fonts and geometric shapes drawn as outlines. The minimum possible value is zero, which indicates to the PDF renderer to use the thinest line possible. On high-resolution devices this will become nearly invisible, and because of its device-dependent nature a value of 0 is not recommended.Changes to this setting midway through a
path
don't take effect until the path is closed.- Parameters:
weight
- the thickness of the line in points, or 0 for "as thin as possible"- Since:
- 1.0
-
setLineDash
public void setLineDash(float on, float off, float phase)
Set the line dashing pattern. Since 2.7.8 this method simply calls
setLineDash(new float[] { on, off }, phase)
.- Parameters:
on
- how many points of the line to drawoff
- how many points of the line to skipphase
- how far into the pattern to start- Since:
- 1.0
-
setLineDash
public void setLineDash(float[] pattern, float phase)
Set the line dashing pattern. The
pattern
parameter is an array of 1 or more float values that are > 0, which define the length in points of the alternating "on" and "off" segments of any lines drawn with this style. Thephase
paramter determines how far into this pattern to start.To draw solid lines, the first parameter should be
null
.Changes to this setting midway through a
path
don't take effect until the path is closed.- Parameters:
pattern
- the pattern of alternating on/off segments, ornull
to draw solid linesphase
- how far into the pattern to start- Since:
- 2.7.8
-
setFont
public void setFont(PDFFont font, float size)
Set the font and font size for this style. For styles passed in toForm.setTextStyle(org.faceless.pdf2.PDFStyle)
andWidgetAnnotation.setTextStyle(org.faceless.pdf2.PDFStyle)
, a font size of zero means "autosize" the text. In other situatios, a zero size will cause an error when the style is used to render text.- Parameters:
font
- the font to usesize
- the size of the font. Must be greater than zero, except in the situation above when it may also be equal to zero.- Since:
- 1.0
-
setFontFeature
public void setFontFeature(String feature, boolean on)
Set the specified font feature. This method takes the same parameters as thePDFFont.setFeature(String,boolean)
method, but the features will be only be applied to the font for text created with this style.- Since:
- 2.14.1
-
setFontFeature
public void setFontFeature(String feature, int value)
Set the specified font feature. This method takes the same parameters as thePDFFont.setFeature(String,int)
method, but the features will be only be applied to the font for text created with this style.- Since:
- 2.22
-
getFontFeature
public int getFontFeature(String feature)
Get the specified font feature. This method will return the value set bysetFontFeature(java.lang.String, boolean)
, or if not set the value ofPDFFont.getFeature(java.lang.String)
for the style's font. If no font is set it will always return0
- Since:
- 2.14.1 (prior to 2.22 this returned a boolean)
-
getOpenTypeFontPalette
public OpenTypeFont.Palette getOpenTypeFontPalette()
Get the OpenTypeFont.Palette previously specified with #setOpenTypeFontPalette- Since:
- 2.24.1
-
setOpenTypeFontPalette
public void setOpenTypeFontPalette(OpenTypeFont.Palette palette)
If the font being used with this Style is an OpenTypeFont which has one or morecolor palettes
, set the Palette to use. Any text created with that font will use the specified palette, provided the "color" feature is also set. Note it is possible to set a custom palette not retrieved from the font, provided it has the correct number of entries. If no palette is specified, the first palette from the font will be used (this is the default).- Parameters:
palette
- the color palette to use when rendering the font- Since:
- 2.24.1
-
setTextAlign
public void setTextAlign(int textalign)
Set the text alignment for this style. The alignment may be any one ofTEXTALIGN_LEFT
,TEXTALIGN_RIGHT
,TEXTALIGN_CENTER
orTEXTALIGN_JUSTIFY
, which control the horizontal alignment, added to any one ofTEXTALIGN_BASELINE
,TEXTALIGN_TOP
,TEXTALIGN_MIDDLE
orTEXTALIGN_BOTTOM
, which control the vertical alignment.- Parameters:
textalign
- the text alignment to use for this style- Since:
- 1.0, with vertical alignment added in 1.2
-
setTextLineSpacing
public void setTextLineSpacing(float spacing)
Set the spacing between lines of text. The paramater is a multiple of the default spacing between lines for this font (as determined by the
PDFFont.getDefaultLeading()
method). This allows individual fonts to set their preferred line spacing more accurately.The default value is 1, for single-spaced text. A value of 1.5 sets line-and-a-half spacing, a value of 2 gives double spacing, and so on.
- Parameters:
spacing
- the spacing between lines- Since:
- 1.0
-
setTextIndent
public void setTextIndent(float indent)
Set the number of points to indent the first line of any text drawn in this style. Positive values result in the first line being indented to the right, negative values in the first line being indented to the left (this is reversed for RTL scripts)
Note that mixing styles with different text-indent levels on the first line of text in a paragraph will result in unpredictable results.
- Since:
- 1.1.21
-
setTextJustificationRatio
public void setTextJustificationRatio(float i)
Set the text justification ratio for a style. When a line of text is padded to justify it against two margins, there is always the the option of extending the space between each character, extending the space between each word, or a combination of the two. The "justification ratio" determines how much to apply to each. A ratio of 0 means "only extend the spaces between words", a ratio of 1 means "only extend the spaces between letters". The default is 0.5.- Since:
- 1.0
-
setFontStyle
public void setFontStyle(int style)
Set the font render style. Can be one ofFONTSTYLE_FILLED
(the default),FONTSTYLE_OUTLINE
,FONTSTYLE_FILLEDOUTLINE
orFONTSTYLE_INVISIBLE
.- Since:
- 1.1
-
setOverprint
public void setOverprint(boolean on)
Cause text and objects drawn with this style to overprint. Has no effect unless the fill and/or line color are CMYK or Spot colors. The default isfalse
.- Since:
- 2.10
-
setTextUnderline
public void setTextUnderline(boolean on)
Set whether text rendered with this style is underlined or not. The exact position and width of the underlining is font specific. The default is false.- Since:
- 1.1
-
setTextDoubleUnderline
public void setTextDoubleUnderline(boolean on)
Set whether text rendered with this style is double-underlined or not. The exact position and width of the underlining is font specific. The default is false.- Since:
- 2.11.12
-
setTextStrikeOut
public void setTextStrikeOut(boolean on)
Set whether text rendered with this style is struck-out or not. The default is false.- Since:
- 1.1
-
setTextSmallCaps
public void setTextSmallCaps(boolean on)
Set whether text in this style is displayed with "small-caps" - ie. all lower case letters are displayed as upper-case but at 80% of the original font-size. The default is false. Since 2.22 this is identical tosetFontFeature("smallcaps")
- Since:
- 2.5
-
setTrackKerning
public void setTrackKerning(float kern)
Allows you to explicitly set the kerning between characters for a font. This method may be called as many times as necessary - between each character if required - to set the kerning distance between characters for all future text rendered in this style ("characters" in this context includes spaces). This "track kerning" is used as well as the standard "pair-wise" kerning, as returned by
PDFFont.getKerning(char, char)
.If text-alignment is set to
TEXTALIGN_JUSTIFY
, kerning (both track and pairwise) is scaled up or down depending on the justification required.- Parameters:
kern
- the space to place between each character in millipoints (thousandths of a point) if this font was rendered one point high. May be positive, which moves the characters apart, or negative to move them closer together.- Since:
- 1.1.14
- See Also:
PDFFont.getKerning(char, char)
-
setTextRise
public void setTextRise(float offset)
Set the text vertical offset - the distance between the standard baseline and the basline for this style, as a proportion of the font size. This is mainly used for superscripting or subscripting. text.
As an example, if you wanted to create a line of text that was 6 points high and 6 points above the standard baseline, set the font size to 6 and the TextRise() to 1. (1x6 = 6 points above the baseline). To place the same text 3 points below the baseline, set the offset to -0.5.
- Since:
- 1.1
-
addBackupFont
public void addBackupFont(PDFFont font)
Add a backup font to the current style. Backup fonts are used when the standard font doesn't have a character defined - for example, creating a style with the "Times Roman" font and then adding a backup font of "Symbol" would allow text to be written in both English and Greek without changing styles. As many backup fonts as are required may be added.- Parameters:
font
- the font to add as a backup for the current style.- Since:
- 1.2
-
setFormStyle
public void setFormStyle(int style)
Sets the style of a form fields background to one ofFORMSTYLE_SOLID
,FORMSTYLE_INSET
,FORMSTYLE_BEVEL
,FORMSTYLE_INVERT
,FORMSTYLE_OUTLINE
orFORMSTYLE_UNDERLINE
. This method can be applied to the background style passed into theForm.setBackgroundStyle(org.faceless.pdf2.PDFStyle)
andWidgetAnnotation.setBackgroundStyle(org.faceless.pdf2.PDFStyle)
methods, but for all other purposes (eg. setting the style of a page), this setting is ignored.- Parameters:
style
- the type of background to draw the form field.- Since:
- 1.1.23
-
setFormRadioButtonStyle
public void setFormRadioButtonStyle(char style)
ForFormRadioButton
elements, set the type of shape to use to show the button is selected. The default value isFORMRADIOBUTTONSTYLE_CIRCLE
, which creates round radio buttons in the traditional HTML style- Parameters:
style
- one ofFORMRADIOBUTTONSTYLE_CIRCLE
,FORMRADIOBUTTONSTYLE_CHECK
,FORMRADIOBUTTONSTYLE_DIAMOND
,FORMRADIOBUTTONSTYLE_CROSS
,FORMRADIOBUTTONSTYLE_SQUARE
orFORMRADIOBUTTONSTYLE_STAR
- Since:
- 2.0
-
setFormCheckboxStyle
public void setFormCheckboxStyle(char style)
ForFormCheckbox
elements, set the type of shape to use to show the checkbox is selected. The default value isFORMRADIOBUTTONSTYLE_CHECK
, which creates checkboxes in the traditional HTML style- Parameters:
style
- one ofFORMRADIOBUTTONSTYLE_CIRCLE
,FORMRADIOBUTTONSTYLE_CHECK
,FORMRADIOBUTTONSTYLE_DIAMOND
,FORMRADIOBUTTONSTYLE_CROSS
,FORMRADIOBUTTONSTYLE_SQUARE
orFORMRADIOBUTTONSTYLE_STAR
- Since:
- 2.0
-
setPaintMethod
public void setPaintMethod(int method)
Set the paint method to either
PAINTMETHOD_EVENODD
orPAINTMETHOD_NONZEROWINDING
(the default). The paint method determines which area of a self-intersecting polygon is filled. If your polygons aren't self-intersecting, it has no effect.This setting is very obscure and is really only here for completeness. For a full discussion of the difference see the PDF Reference manual version 1.4, page 169.
- Since:
- 1.1.5
-
setLineCap
public void setLineCap(int cap)
Set the line cap style. Line caps are the shape of the end of the line - normally not noticable unless you're drawing very thick lines or are zoomed in a long way. The default isLINECAP_BUTT
Changes to this setting midway through a
This setting is very obscure and is really only here for completeness. For a full discussion of the difference see the PDF Reference manual version 1.4, page 153.path
don't take effect until the path is closed.- Parameters:
cap
- one ofLINECAP_BUTT
,LINECAP_ROUND
orLINECAP_SQUARE
- Since:
- 1.0
-
setLineJoin
public void setLineJoin(int join)
Set the line join style. Line caps are the shape of the join between two line segments - normally not noticable unless you're drawing very thick lines or are zoomed in a long way. The default isLINEJOIN_MITER
Changes to this setting midway through a
This setting is very obscure and is really only here for completeness. For a full discussion of the difference see the PDF Reference manual version 1.4, page 153.path
don't take effect until the path is closed.- Parameters:
join
- one ofLINEJOIN_MITER
,LINEJOIN_ROUND
orLINEJOIN_BEVEL
.- Since:
- 1.0
-
setLineJoinMiterLimit
public void setLineJoinMiterLimit(float limit)
Set the miter limit for mitered line joins. The default is 10.- Since:
- 2.23.1
-
getLineCap
public int getLineCap()
Return the line cap, as set bysetLineCap(int)
-
getLineJoin
public int getLineJoin()
Return the line join, as set bysetLineJoin(int)
-
getLineJoinMiterLimit
public float getLineJoinMiterLimit()
Return the line join miter limit, as set bysetLineJoinMiterLimit(float)
-
getLineColor
public Paint getLineColor()
Return the line color, as set bysetLineColor(java.awt.Paint)
-
getFillColor
public Paint getFillColor()
Return the fill color, as set bysetFillColor(java.awt.Paint)
-
getFontSize
public float getFontSize()
Return the font size of this style, as set bysetFont(org.faceless.pdf2.PDFFont, float)
- Since:
- 1.0
-
getOverprint
public boolean getOverprint()
Return whether this text has the overprint flag, as set bysetOverprint(boolean)
- Since:
- 2.21
-
getTextUnderline
public int getTextUnderline()
Return whether this text is underlined or not, as set bysetTextUnderline(boolean)
- Since:
- 2.21
-
getTextStrikeOut
public boolean getTextStrikeOut()
Return whether this text is struck out or not, as set bysetTextStrikeOut(boolean)
- Since:
- 2.21
-
isTextSmallCaps
public boolean isTextSmallCaps()
Return whether this text is displayed with small-caps, as set bysetTextSmallCaps(boolean)
Since 2.22 this is identical togetFontFeature("smallcaps")
- Since:
- 2.21
-
getTextLineSpacing
public float getTextLineSpacing()
Return the text line spacing, as set bysetTextLineSpacing(float)
-
getLineWeighting
public float getLineWeighting()
Return the line weighting, as set bysetLineWeighting(float)
-
getTrackKerning
public int getTrackKerning()
Return the track kerning, as set bysetTrackKerning(float)
- Since:
- 2.21
-
getTextAlign
public int getTextAlign()
Return the text alignment. This method can be used to return the alignment ofFormText
Widget annotations. It can not be used to determine the alignment of text extracted from the body of the PDF - alignment is not a concept used by PDF except in form fields.- Since:
- 2.6.5
-
getTextIndent
public float getTextIndent()
Return the text indent value as set bysetTextIndent(float)
- Since:
- 1.1.21
-
getFontLeading
public float getFontLeading()
Return the text leading for this styles in points. The leading is the distance between the baseline of two successive lines of text, and is defined as:
getFontSize() * font.getDefaultLeading() * getTextLineSpacing()
- Since:
- 1.0
-
getFontStyle
public int getFontStyle()
Return the font style as set bysetFontStyle(int)
-
getTextRise
public float getTextRise()
Return the text rise as set bysetTextRise(float)
- Since:
- 2.21
-
setTextStretch
public void setTextStretch(float stretch)
Set how much text is stretched horizontally. By default the text has a horizontal stretch factor of 1.0, but this can be increased (to widen the text) or reduced to narrow it. The supplied value must be greater than zero.- Parameters:
stretch
- the text stretch factor. Must be > 0.- Since:
- 2.0.3
-
getTextStretch
public float getTextStretch()
Return the value of the text-stretch parameter, as set bysetTextStretch(float)
- Since:
- 2.21
-
getLineDashPhase
public float getLineDashPhase()
Get the "phase" part of the line dash pattern, as set bysetLineDash(float, float, float)
- Since:
- 1.1
-
getLineDashPattern
public float[] getLineDashPattern()
Return the line dash pattern, as set bysetLineDash(float, float, float)
. The returned value isnull
if no dash pattern is in use, or an array of 1 or more positive values.- Since:
- 2.7.8
-
getFont
public PDFFont getFont()
Return the font, as set bysetFont(org.faceless.pdf2.PDFFont, float)
- Since:
- 1.0
-
getBackupFont
public PDFFont getBackupFont(int i)
Get the specified backup font, as set byaddBackupFont(org.faceless.pdf2.PDFFont)
. The argument to this method determines which backup font to return - zero for the first, one for the second and so on.- Parameters:
i
- the backup font to return- Returns:
- the specified backup font, or
null
if no backup font exists at that index. - Since:
- 1.2
-
getFormStyle
public int getFormStyle()
Returns the form-style of the current style, as set bysetFormStyle(int)
.- Since:
- 1.1.23
-
getFormRadioButtonStyle
public char getFormRadioButtonStyle()
Returns the radiobutton style of the current style, as set bysetFormRadioButtonStyle(char)
.- Since:
- 2.0
-
getFormCheckboxStyle
public char getFormCheckboxStyle()
Returns the checkbox style of the current style, as set bysetFormCheckboxStyle(char)
.- Since:
- 2.0
-
getFormFieldOrientation
public int getFormFieldOrientation()
Return the form field orientation, as set bysetFormFieldOrientation(int)
. Returned value will be one of 0, 90, 180 or 270.- Since:
- 2.7.7
-
setStrokeAdjustment
public void setStrokeAdjustment(boolean sa)
Set whether this style uses Stroke Adjustment
-
setFormFieldOrientation
public void setFormFieldOrientation(int rotate)
Set the angle of rotation for form fields created with this style as a background style.- Parameters:
rotate
- the form rotation - one of 0 (the default), 90, 180 or 270.- Since:
- 2.7.7
-
setLineBreakBehaviour
public void setLineBreakBehaviour(int breakbehaviour)
Set the line-break behaviour, which determines how words break at the end of the line. Valid values are- {link #BREAK_UAX14}, to use the rules defined in the most recent version of UAX #14
- {link #BREAK_LEGACY}, to use the legacy rules used by the PDF Library up until 2.22.1, and based on UAX#14 version 12
- {link #BREAK_WORD_NORMAL}, to use same rules as CSS word-break: normal-all
- {link #BREAK_WORD_BREAKALL}, to use same rules as CSS word-break: break-all
- {link #BREAK_WORD_KEEPALL}, to use same rules as CSS word-break: keep-all
- {link #BREAK_LINE_LOOSE}, to use same rules as CSS line-break: loose
- {link #BREAK_LINE_NORMAL}, to use same rules as CSS line-break: normal
- {link #BREAK_LINE_STRICT}, to use same rules as CSS line-break: strict
- {link #BREAK_LINE_ANYWHERE}, to use same rules as CSS line-break: anywhere
style.setLineBreakBehaviour(PDFStyle.BREAK_LINE_NORMAL | PDFStyle.BREAK_WORD_NORMAL)
- Since:
- 2.22.1
-
getLineBreakBehaviour
public int getLineBreakBehaviour()
Return the line-break behaviour, as set bysetLineBreakBehaviour(int)
- Since:
- 2.22.1
-
getTextLength
public float getTextLength(String s)
Get the length of the specified string in points, using the styles font and font size. The line of text must not contain any newlines. Note this is a legacy method; for styles containing no backup fonts, it is faster to use aPDFGlyphVector
to measure and display text.- Parameters:
s
- the String to measure the length of- Returns:
- the length of the string in points if drawn in this style
-
getTextLeft
public float getTextLeft(String s)
Get the left-most X co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size. The line of text must not contain any newlines. This method takes track-kerning into account.- Returns:
- the left edge of the string in points if drawn in this style
-
getTextRight
public float getTextRight(String s)
Get the right-most X co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size. The line of text must not contain any newlines. This method takes track-kerning into account.- Returns:
- the right edge of the string in points if drawn in this style
-
getTextTop
public float getTextTop(String s)
Get the top-most Y co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size. The line of text must not contain any newlines.- Returns:
- the top edge of the string in points if drawn in this style
-
getTextBottom
public float getTextBottom(String s)
Get the bottom-most Y co-ordinate of the specified string in points if it was rendered at (0,0), using the styles font and font size. The line of text must not contain any newlines.- Returns:
- the bottom edge of the string in points if drawn in this style
-
getTextWidths
@Deprecated public float getTextWidths(char[] buf, int off, int len, float[] widths, float[] kerns)
Deprecated.callcreateGlyphVector(java.lang.String, java.util.Locale)
and retrieve this information from thereAsgetTextLength()
but sets the width of each character in the specified arrays; a very low level routine unlikely to be used by many, but useful for calculating break points for advanced layout engines like the Report Generator.- Parameters:
buf
- the character buffer to useoff
- the offset into that buffer to start atlen
- the number of characters to processwidths
- if not null, an arraylen
long which will be populated with the width of each character in pointskerns
- If not null, an arraylen
long which will be populated with the kerning values after each character, in points. Negative values move the next character closer, positive moves them further away.- Returns:
- the total width of the text, as from
getTextLength()
- Since:
- 2.6
-
getTextLength
public float getTextLength(char[] c, int off, int len)
Get the length of the specified string in points, using the styles font and font size. Identical togetTextLength(String)
- Parameters:
c
- the character buffer to useoff
- the offset into that buffer to start atlen
- the number of characters to process- Since:
- 1.2.1
-
clone
public Object clone()
Create a duplicate of this font. It's probably more convenient to use thePDFStyle(PDFStyle)
constructor, as it will save you having to typecast the response
-
superscriptClone
public PDFStyle superscriptClone()
Return a new style which is the "superscripted" version of the current style.- Since:
- 1.1
-
subscriptClone
public PDFStyle subscriptClone()
Return a new style which is the "subscripted" version of the current style.- Since:
- 1.1
-
setBlendMode
public void setBlendMode(String mode)
Set the "Blend Mode" of this style. The mode may be one of "Normal", "Multiply", "Screen", "Overlay", "Darken", "Lighten", "ColorDodge", "ColorBurn", "HardLight", "SoftLight", "Difference", "Exclusion", "Hue", "Color", "Saturation" or "Luminosity". Blend modes may not work in all situations.- Since:
- 2.11.7
-
getBlendMode
public String getBlendMode()
Return the previously set blend mode
-
createGlyphVector
public PDFGlyphVector createGlyphVector(String text, Locale locale)
Returns a PDFGlyphVector containing the glyph codes for the specified text in this style. Simply returnscreateGlyphVector(text, 0, locale, 0)
- Parameters:
text
- the text to displaylocale
- the locale of the text, or null to use the default- Since:
- 2.11.22
- See Also:
PDFGlyphVector
,PDFCanvas.drawGlyphVector(org.faceless.pdf2.PDFGlyphVector, float, float)
-
createGlyphVector
public PDFGlyphVector createGlyphVector(String text, int offset, Locale locale, int level)
Returns a PDFGlyphVector containing the glyph codes for the specified text in this style. This can then be drawn directly to a PDFCanvas. See the
PDFGlyphVector
class for an example.Note that the returned PDFGlyphVector may not represent the complete String: the returned item will contain as many characters as can be displayed in this font, which may be the same as
text.length()
, or empty if none of the characters are available in the font. SeePDFGlyphVector.getTextLength()
to determine how many characters were consumed.- Parameters:
text
- the text to displaytext
- the offset to add to any indices into that text, as returned byPDFGlyphVector.getFirstIndex(int)
(0 if in doubt)locale
- the locale of the text, ornull
to use the defaultlevel
- the level in the Unicode bidirectional algorithm for this glyph vector, or 0 if it doesn't apply.- See Also:
PDFGlyphVector
,PDFCanvas.drawGlyphVector(org.faceless.pdf2.PDFGlyphVector, float, float)
-
-