|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.PDFStyle
public class PDFStyle
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 PDFPage
. 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:
PDFStyle(PDFStyle)
constructor
Field Summary | |
---|---|
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' LineColor |
static 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 for setFormRadioButtonStyle(char) and setFormCheckboxStyle(char) which
sets the appearance for those elements to a check mark (a tick) when selected. |
static char |
FORMRADIOBUTTONSTYLE_CIRCLE
A value for setFormRadioButtonStyle(char) and setFormCheckboxStyle(char) which
sets the appearance for those elements to a filled circle when selected. |
static char |
FORMRADIOBUTTONSTYLE_CROSS
A value for setFormRadioButtonStyle(char) and setFormCheckboxStyle(char) which
sets the appearance for those elements to a cross or "X" when selected. |
static char |
FORMRADIOBUTTONSTYLE_DIAMOND
A value for setFormRadioButtonStyle(char) and setFormCheckboxStyle(char) which
sets the appearance for those elements to a filled diamond when selected. |
static char |
FORMRADIOBUTTONSTYLE_SQUARE
A value for setFormRadioButtonStyle(char) and setFormCheckboxStyle(char) which
sets the appearance for those elements to a filled square when selected. |
static char |
FORMRADIOBUTTONSTYLE_STAR
A value for setFormRadioButtonStyle(char) and setFormCheckboxStyle(char) which
sets the appearance for those elements to a filled five-pointed star when selected. |
static int |
FORMSTYLE_BEVEL
Style for setFormStyle(int) which draws an border around the
field so that it looks beveled. |
static int |
FORMSTYLE_CLOUDY1
Style for setFormStyle(int) which causes the border to be "cloudy" with small curves
This style only applies to some AnnotationShape classes and AnnotationText |
static int |
FORMSTYLE_CLOUDY2
Style for setFormStyle(int) which causes the border to be "cloudy" with big curves. |
static int |
FORMSTYLE_INSET
Style for setFormStyle(int) which draws an border around the
field so that it looks inset into the page. |
static int |
FORMSTYLE_INVERT
Style for setFormStyle(int) which causes the form element to be
inverted when clicked |
static int |
FORMSTYLE_OUTLINE
Style for setFormStyle(int) which causes the form element to be
outlined when clicked |
static int |
FORMSTYLE_SOLID
Style for setFormStyle(int) which draws a solid border
around the field (the default) |
static int |
FORMSTYLE_UNDERLINE
Style for setFormStyle(int) which draws a single line under the
field |
static 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 into PDFPage.beginTextLink(org.faceless.pdf2.PDFAction, org.faceless.pdf2.PDFStyle) to underline the text in the link. |
static int |
PAINTMETHOD_EVENODD
A parameter to setPaintMethod(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 to setPaintMethod(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 bottom |
static int |
TEXTALIGN_CENTER
Set the text alignment for this style to centered |
static int |
TEXTALIGN_JUSTIFY
Set the text alignment for this style to justified (the default). |
static int |
TEXTALIGN_JUSTIFY_ALL
Similar to TEXTALIGN_JUSTIFY , but will also justify the last
line of a paragraph. |
static int |
TEXTALIGN_LEFT
Set the text alignment for this style to left-aligned |
static int |
TEXTALIGN_MIDDLE
Set the vertical text alignment for this style to middle |
static int |
TEXTALIGN_RIGHT
Set the text alignment for this style to right-aligned |
static int |
TEXTALIGN_TOP
Set the vertical text alignment for this style to top |
Constructor Summary | |
---|---|
PDFStyle()
Create a new PDFStyle using the default settings. |
|
PDFStyle(PDFStyle style)
Create a new style which is a clone of the specified style |
Method Summary | |
---|---|
void |
addBackupFont(PDFFont font)
Add a backup font to the current style. |
Object |
clone()
Create a duplicate of this font. |
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 by addBackupFont(org.faceless.pdf2.PDFFont) . |
Paint |
getFillColor()
Return the fill color, as set by setFillColor(java.awt.Paint) |
PDFFont |
getFont()
Return the font, as set by setFont(org.faceless.pdf2.PDFFont, float) |
float |
getFontLeading()
Return the text leading for this styles in points. |
float |
getFontSize()
Return the font size of this style, as set by setFont(org.faceless.pdf2.PDFFont, float) |
int |
getFontStyle()
Return the font style as set by setFontStyle(int) |
char |
getFormCheckboxStyle()
Returns the checkbox style of the current style, as set by setFormCheckboxStyle(char) . |
int |
getFormFieldOrientation()
Return the form field orientation, as set by setFormFieldOrientation(int) . |
char |
getFormRadioButtonStyle()
Returns the radiobutton style of the current style, as set by setFormRadioButtonStyle(char) . |
int |
getFormStyle()
Returns the form-style of the current style, as set by setFormStyle(int) . |
int |
getLineCap()
Return the line cap, as set by setLineCap(int) |
Paint |
getLineColor()
Return the line color, as set by setLineColor(java.awt.Paint) |
float |
getLineDashOff()
Deprecated. since 2.7.8 this method has been replaced with getLineDashPattern() |
float |
getLineDashOn()
Deprecated. since 2.7.8 this method has been replaced with getLineDashPattern() |
float[] |
getLineDashPattern()
Return the line dash pattern, as set by setLineDash(float, float, float) . |
float |
getLineDashPhase()
Get the "phase" part of the line dash pattern, as set by setLineDash(float, float, float) |
int |
getLineJoin()
Return the line join, as set by setLineJoin(int) |
float |
getLineWeighting()
Return the line weighting, as set by setLineWeighting(float) |
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 by setTextIndent(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 by setTextLineSpacing(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 |
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. |
float |
getTextWidths(char[] buf,
int off,
int len,
float[] widths,
float[] kerns)
As getTextLength() 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. |
int |
hashCode()
|
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 |
setFontStyle(int style)
Set the font render style. |
void |
setFormCheckboxStyle(char style)
For FormCheckbox 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)
For FormRadioButton 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 of FORMSTYLE_SOLID ,
FORMSTYLE_INSET ,FORMSTYLE_BEVEL , FORMSTYLE_INVERT ,
FORMSTYLE_OUTLINE or FORMSTYLE_UNDERLINE . |
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 |
setLineWeighting(float weight)
Set the line weighting, for fonts and geometric shapes drawn as outlines. |
void |
setOverprint(boolean on)
Cause text and objects drawn with this style to overprint. |
void |
setPaintMethod(int method)
Set the paint method to either PAINTMETHOD_EVENODD or
PAINTMETHOD_NONZEROWINDING (the default). |
void |
setStrokeAdjustment(boolean sa)
Set whether this style uses Stroke Adjustment |
void |
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 |
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()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PDFStyle LINKSTYLE
PDFPage.beginTextLink(org.faceless.pdf2.PDFAction, org.faceless.pdf2.PDFStyle)
to underline the text in the link.
public static final int TEXTALIGN_LEFT
public static final int TEXTALIGN_RIGHT
public static final int TEXTALIGN_CENTER
public static final int TEXTALIGN_JUSTIFY
public static final int TEXTALIGN_JUSTIFY_ALL
TEXTALIGN_JUSTIFY
, but will also justify the last
line of a paragraph.
public static final int TEXTALIGN_BASELINE
public static final int TEXTALIGN_TOP
public static final int TEXTALIGN_MIDDLE
public static final int TEXTALIGN_BOTTOM
public static final int LINECAP_BUTT
public static final int LINECAP_ROUND
public static final int LINECAP_SQUARE
public static final int LINEJOIN_MITER
public static final int LINEJOIN_ROUND
public static final int LINEJOIN_BEVEL
public static final int FONTSTYLE_FILLED
public static final int FONTSTYLE_OUTLINE
public static final int FONTSTYLE_FILLEDOUTLINE
public static final int FONTSTYLE_INVISIBLE
public static final int PAINTMETHOD_NONZEROWINDING
setPaintMethod(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.
public static final int PAINTMETHOD_EVENODD
setPaintMethod(int)
to set the paint method to
use the even-odd method to determine which areas are inside or
outside a shape.
public static final int FORMSTYLE_SOLID
setFormStyle(int)
which draws a solid border
around the field (the default)
public static final int FORMSTYLE_INSET
setFormStyle(int)
which draws an border around the
field so that it looks inset into the page.
public static final int FORMSTYLE_BEVEL
setFormStyle(int)
which draws an border around the
field so that it looks beveled.
public static final int FORMSTYLE_UNDERLINE
setFormStyle(int)
which draws a single line under the
field
public static final int FORMSTYLE_INVERT
setFormStyle(int)
which causes the form element to be
inverted when clicked
public static final int FORMSTYLE_OUTLINE
setFormStyle(int)
which causes the form element to be
outlined when clicked
public static final int FORMSTYLE_CLOUDY1
setFormStyle(int)
which causes the border to be "cloudy" with small curves
This style only applies to some AnnotationShape
classes and AnnotationText
public static final int FORMSTYLE_CLOUDY2
setFormStyle(int)
which causes the border to be "cloudy" with big curves.
This style only applies to some AnnotationShape
classes and AnnotationText
public static final char FORMRADIOBUTTONSTYLE_CHECK
setFormRadioButtonStyle(char)
and setFormCheckboxStyle(char)
which
sets the appearance for those elements to a check mark (a tick) when selected. This is
the default for FormCheckbox
elements.
public static final char FORMRADIOBUTTONSTYLE_CIRCLE
setFormRadioButtonStyle(char)
and setFormCheckboxStyle(char)
which
sets the appearance for those elements to a filled circle when selected. This is
default for FormRadioButton
elements.
public static final char FORMRADIOBUTTONSTYLE_CROSS
setFormRadioButtonStyle(char)
and setFormCheckboxStyle(char)
which
sets the appearance for those elements to a cross or "X" when selected.
public static final char FORMRADIOBUTTONSTYLE_SQUARE
setFormRadioButtonStyle(char)
and setFormCheckboxStyle(char)
which
sets the appearance for those elements to a filled square when selected.
public static final char FORMRADIOBUTTONSTYLE_DIAMOND
setFormRadioButtonStyle(char)
and setFormCheckboxStyle(char)
which
sets the appearance for those elements to a filled diamond when selected.
public static final char FORMRADIOBUTTONSTYLE_STAR
setFormRadioButtonStyle(char)
and setFormCheckboxStyle(char)
which
sets the appearance for those elements to a filled five-pointed star when selected.
Constructor Detail |
---|
public PDFStyle()
public PDFStyle(PDFStyle style)
Method Detail |
---|
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
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 superclass Paint
instead.
Although most of the time the parameter will still be a plain color,
this change allows a GradientPaint
to be used as well.
paint
- the paint to use, or null
if no fill
is required.public void setLineColor(Paint paint)
null
(the default).
paint
- the Color to use, or null
if no outline
is required.public void setLineWeighting(float weight)
Changes to this setting midway through a path
don't take effect until the path is closed.
weight
- the thickness of the line in points, or 0 for "as thin as possible"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)
.
on
- how many points of the line to drawoff
- how many points of the line to skipphase
- how far into the pattern to startpublic 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. The phase
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.
pattern
- the pattern of alternating on/off segments, or null
to draw solid linesphase
- how far into the pattern to startpublic void setFont(PDFFont font, float size)
Form.setTextStyle(org.faceless.pdf2.PDFStyle)
and WidgetAnnotation.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.
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.public void setTextAlign(int textalign)
TEXTALIGN_LEFT
, TEXTALIGN_RIGHT
, TEXTALIGN_CENTER
or TEXTALIGN_JUSTIFY
), which control the horizontal alignment, added to any one of TEXTALIGN_BASELINE
, TEXTALIGN_TOP
, TEXTALIGN_MIDDLE
or TEXTALIGN_BOTTOM
, which control
the vertical alignment.
textalign
- the text alignment to use for this stylepublic 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.
spacing
- the spacing between linespublic 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.
public void setTextJustificationRatio(float i)
public void setFontStyle(int style)
FONTSTYLE_FILLED
(the default), FONTSTYLE_OUTLINE
,
FONTSTYLE_FILLEDOUTLINE
or FONTSTYLE_INVISIBLE
.
public void setOverprint(boolean on)
false
.
public void setTextUnderline(boolean on)
public void setTextDoubleUnderline(boolean on)
public void setTextStrikeOut(boolean on)
public void setTextSmallCaps(boolean on)
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.
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.PDFFont.getKerning(char, char)
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.
public void addBackupFont(PDFFont font)
font
- the font to add as a backup for the current style.public void setFormStyle(int style)
FORMSTYLE_SOLID
,
FORMSTYLE_INSET
,FORMSTYLE_BEVEL
, FORMSTYLE_INVERT
,
FORMSTYLE_OUTLINE
or FORMSTYLE_UNDERLINE
. This method can be
applied to the background style passed into the Form.setBackgroundStyle(org.faceless.pdf2.PDFStyle)
and
WidgetAnnotation.setBackgroundStyle(org.faceless.pdf2.PDFStyle)
methods, but for all other purposes
(eg. setting the style of a page), this setting is ignored.
style
- the type of background to draw the form field.public void setFormRadioButtonStyle(char style)
FormRadioButton
elements, set the type of shape to use to show
the button is selected. The default value is FORMRADIOBUTTONSTYLE_CIRCLE
,
which creates round radio buttons in the traditional HTML style
style
- one of FORMRADIOBUTTONSTYLE_CIRCLE
, FORMRADIOBUTTONSTYLE_CHECK
, FORMRADIOBUTTONSTYLE_DIAMOND
, FORMRADIOBUTTONSTYLE_CROSS
, FORMRADIOBUTTONSTYLE_SQUARE
or FORMRADIOBUTTONSTYLE_STAR
public void setFormCheckboxStyle(char style)
FormCheckbox
elements, set the type of shape to use to show
the checkbox is selected. The default value is FORMRADIOBUTTONSTYLE_CHECK
,
which creates checkboxes in the traditional HTML style
style
- one of FORMRADIOBUTTONSTYLE_CIRCLE
, FORMRADIOBUTTONSTYLE_CHECK
, FORMRADIOBUTTONSTYLE_DIAMOND
, FORMRADIOBUTTONSTYLE_CROSS
, FORMRADIOBUTTONSTYLE_SQUARE
or FORMRADIOBUTTONSTYLE_STAR
public void setPaintMethod(int method)
Set the paint method to either PAINTMETHOD_EVENODD
or
PAINTMETHOD_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.
public void setLineCap(int cap)
LINECAP_BUTT
Changes to this setting midway through a path
don't take effect until the path is closed.
cap
- one of LINECAP_BUTT
, LINECAP_ROUND
or LINECAP_SQUARE
public void setLineJoin(int join)
LINEJOIN_MITER
Changes to this setting midway through a path
don't take effect until the path is closed.
join
- one of LINEJOIN_MITER
, LINEJOIN_ROUND
or LINEJOIN_BEVEL
.public int getLineCap()
setLineCap(int)
public int getLineJoin()
setLineJoin(int)
public Paint getLineColor()
setLineColor(java.awt.Paint)
public Paint getFillColor()
setFillColor(java.awt.Paint)
public float getFontSize()
setFont(org.faceless.pdf2.PDFFont, float)
public float getTextLineSpacing()
setTextLineSpacing(float)
public float getLineWeighting()
setLineWeighting(float)
public int getTextAlign()
FormText
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.
public float getTextIndent()
setTextIndent(float)
public float getFontLeading()
getFontSize() * font.getDefaultLeading() * getLineSpacing()
public int getFontStyle()
setFontStyle(int)
public void setTextStretch(float stretch)
stretch
- the text stretch factor. Must be >0.public float getLineDashOn()
getLineDashPattern()
setLineDash(float, float, float)
public float getLineDashOff()
getLineDashPattern()
setLineDash(float, float, float)
public float getLineDashPhase()
setLineDash(float, float, float)
public float[] getLineDashPattern()
setLineDash(float, float, float)
. The returned
value is null
if no dash pattern is in use, or an array of 1
or more positive values.
public PDFFont getFont()
setFont(org.faceless.pdf2.PDFFont, float)
public PDFFont getBackupFont(int i)
addBackupFont(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.
i
- the backup font to return
null
if no backup font
exists at that index.public int getFormStyle()
setFormStyle(int)
.
public char getFormRadioButtonStyle()
setFormRadioButtonStyle(char)
.
public char getFormCheckboxStyle()
setFormCheckboxStyle(char)
.
public int getFormFieldOrientation()
setFormFieldOrientation(int)
.
Returned value will be one of 0, 90, 180 or 270.
public void setStrokeAdjustment(boolean sa)
public void setFormFieldOrientation(int rotate)
rotate
- the form rotation - one of 0 (the default), 90, 180 or 270.public float getTextLength(String s)
getTextRight()-getTextLeft()
.
This method takes track-kerning into account.
s
- the String to measure the length of
public float getTextLeft(String s)
public float getTextRight(String s)
public float getTextTop(String s)
public float getTextBottom(String s)
public float getTextWidths(char[] buf, int off, int len, float[] widths, float[] kerns)
getTextLength()
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.
buf
- the character buffer to useoff
- the offset into that buffer to start atlen
- the number of characters to processwidths
- if not null, an array len
long which will be populated
with the width of each character in pointskerns
- If not null, an array len
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.
getTextLength()
public float getTextLength(char[] c, int off, int len)
getTextLength(String)
but takes a char array, and the text must be ligaturized
first if necessary.
c
- the character buffer to useoff
- the offset into that buffer to start atlen
- the number of characters to processpublic Object clone()
PDFStyle(PDFStyle)
constructor, as it will
save you having to typecast the response
clone
in class Object
public PDFStyle superscriptClone()
public PDFStyle subscriptClone()
public String toString()
toString
in class Object
public void setBlendMode(String mode)
public PDFGlyphVector createGlyphVector(String text, Locale locale) throws CharConversionException
PDFGlyphVector
class for an example.
text
- the text to displaylocale
- the locale of the text, or null to use the default
CharConversionException
PDFGlyphVector
,
PDFCanvas.drawGlyphVector(org.faceless.pdf2.PDFGlyphVector, float, float)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |