⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdfstyle.java

📁 Java生成PDF Java生成PDF Java生成PDF
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	int newmethod = style.PAINTMETHOD_EVENODD;	if (method==PAINTMETHOD_NONZEROWINDING) newmethod = style.PAINTMETHOD_NONZEROWINDING;	style.setPaintMethod(newmethod);    }    /**     * Set the font and font size for the style.     * @param font the <code>PDFFont</code> to use     * @param size the size of the font, in points     */    public void setFont(PDFFont font, float size)    {	style.setFont(font==null ? null : font.font, size);    }    /**     * 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.     * @param font the font to add as a backup for the current style.     * @since 1.2     */    public void addBackupFont(PDFFont font)    {	style.addBackupFont(font==null ? null : font.font);    }    /**     * Get the specified backup font. The argument to this method determines     * which backup font to return - zero for the first, one for the second and     * so on.     * @param i the backup font to return     * @return the specified backup font, or <code>null</code> if no backup font     * exists at that index.     * @since 1.2     */    public PDFFont getBackupFont(int i)    {	return (PDFFont)PeeredObject.getPeer(style.getBackupFont(i));    }    /**     * Set the font render style. Can be one of {@link #FONTSTYLE_FILLED}     * (the default), {@link #FONTSTYLE_OUTLINE},     * {@link #FONTSTYLE_FILLEDOUTLINE} or {@link #FONTSTYLE_INVISIBLE}.     * @since 1.1     */    public void setFontStyle(int fontstyle)    {	int newfontstyle=org.faceless.pdf2.PDFStyle.FONTSTYLE_FILLED;	if (fontstyle==FONTSTYLE_OUTLINE) newfontstyle=org.faceless.pdf2.PDFStyle.FONTSTYLE_OUTLINE;	else if (fontstyle==FONTSTYLE_FILLEDOUTLINE) newfontstyle=org.faceless.pdf2.PDFStyle.FONTSTYLE_FILLEDOUTLINE;	else if (fontstyle==FONTSTYLE_INVISIBLE) newfontstyle=org.faceless.pdf2.PDFStyle.FONTSTYLE_INVISIBLE;	style.setFontStyle(newfontstyle);    }    /**     * <p>     * 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)     * </p><p>     * Note that mixing styles with different text-indent levels on     * the first line of text in a paragraph will result in     * unpredictable results.     * </p>     * @since 1.1.21     */    public void setTextIndent(float indent)    {	style.setTextIndent(indent);    }    /**     * 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. For horizontal fonts, this is equivalent to     * <code>getTextRight()-getTextLeft()</code>.     * This method takes track-kerning into account.     */    public float getTextLength(String s)    {	return style.getTextLength(s);    }    /**     * Get the length of the specified string in points, using the     * styles font and font size. As for {@link #getTextLength(String)}     * but takes a char array, and the text must be {@link PDFFont#ligaturize ligaturized}     * first if necessary.     * @since 1.2.1     */    public float getTextLength(char[] c, int off, int len)    {	return style.getTextLength(c,off,len);    }    /**     * 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.     */    public float getTextLeft(String s)    {	return style.getTextLeft(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.     */    public float getTextRight(String s)    {	return style.getTextRight(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.     * This method takes track-kerning into account.     */    public float getTextTop(String s)    {	return style.getTextTop(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.     * This method takes track-kerning into account.     */    public float getTextBottom(String s)    {	return style.getTextBottom(s);    }    /**     * Get 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:<BR>     * <code>getFontSize() * font.getDefaultLeading() * getLineSpacing()</code>     */    public float getFontLeading()    {	return style.getFontLeading();    }    /**     * Get the styles line thickness, in points.     */    public float getLineWeighting()    { 	return style.getLineWeighting();    }    /**     * Get the paint method as set by {@link #setPaintMethod}     */    public int getPaintMethod()    {	return PAINTMETHOD_EVENODD;    }    /**     * Get the spacing between lines of text, as a ratio of default spacing     * between lines of this point size - i.e. the value is "1" for single     * spaced, "2" for double spaced and so on.     */    public float getTextLineSpacing()    {	return style.getTextLineSpacing();    }    /**     * Get the styles text justification ratio     */    public float getTextJustificationRatio()    {	return 0.5f;    }    /**     * Get whether the style has text underlining set     */    public boolean getTextUnderline()    {	return false;    }    /**     * Get whether the style has text strikeout set     */    public boolean getTextStrikeOut()    {	return false;    }    /**     * Get the styles' fill color. Since 1.2, this method returns a     * {@link java.awt.Paint} instead of its subclass, {@link java.awt.Color}.     */    public Paint getFillColor()    {	return style.getFillColor();    }    /**     * Get the styles line color     */    public Color getLineColor()    {	return (Color)style.getLineColor();    }    /**     * Get the styles font     */    public PDFFont getFont()    {	return (PDFFont)PeeredObject.getPeer(style.getFont());    }    /**     * Get the styles font size in points.     */    public float getFontSize()    {	return style.getFontSize();    }    /**     * Get the styles line join style.     */    public int getLineJoin()    {	return style.getLineJoin();    }    /**     * Get the styles line cap style.     */    public int getLineCap()    {	return style.getLineCap();    }    /**     * Get the styles line dash pattern. The returned array is two elements     * long, with element zero being the "on" and element one the "off".     * Since 1.1.5, this value is a float (rather than int)     */    public float[] getLineDashPattern()    {	float[] f = new float[2];	f[0] = style.getLineDashOn();	f[1] = style.getLineDashOff();	return f;    }    /**     * Get the styles line dash phase - how far into the dash pattern the     * line should start. Since 1.1.5, this value is a float (rather than int)     */    public float getLineDashPhase()    {	return style.getLineDashPhase();    }    /**     * Get the styles text alignment     */    public int getTextAlign()    {        return 0;    }    /**     * Get the font style.     */    public int getFontStyle()    {	int newfontstyle=style.getFontStyle();	if (newfontstyle==org.faceless.pdf2.PDFStyle.FONTSTYLE_OUTLINE) return FONTSTYLE_OUTLINE;	else if (newfontstyle==org.faceless.pdf2.PDFStyle.FONTSTYLE_FILLEDOUTLINE) return FONTSTYLE_FILLEDOUTLINE;	else if (newfontstyle==org.faceless.pdf2.PDFStyle.FONTSTYLE_INVISIBLE) return FONTSTYLE_INVISIBLE;	return FONTSTYLE_FILLED;    }    /**     * Get the text vertical offset for this style     */    public float getTextRise()    {	return 0;    }    /**     * Get the track kerning value as set by {@link #setTrackKerning}     * @since 1.1.14     */    public float getTrackKern()    {        return 0;    }    /**     * Get the text indent value as set by {@link #setTextIndent}     * @since 1.1.21     */    public float getTextIndent()    {        return style.getTextIndent();    }    /**     * Get a shallow copy of this style.     */    public Object clone()    {	return PeeredObject.getPeer(style.clone());    }        /**     * Convenience Method - Get a clone of this style, typecast to PDFStyle     */    public PDFStyle styleClone()    {        return (PDFStyle)clone();    }    /**     * Return a new style which is the "superscripted" version of     * the current style.     * @since 1.1     */    public PDFStyle superscriptClone()    {	return new PDFStyle(style.superscriptClone());    }    /**     * Return a new style which is the "subscripted" version of     * the current style.     * @since 1.1     */    public PDFStyle subscriptClone()    {	return new PDFStyle(style.subscriptClone());    }    /**     * <p>     * 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 {@link PDFSimpleFont#getKerning}.     * </p><p>     * If text-alignment is set to {@link #TEXTALIGN_JUSTIFY}, kerning (both     * track and pairwise) is scaled up or down depending on the justification     * required.     * </p>     * @param millipoints 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.     * @see PDFSimpleFont#getKerning     *     * @since 1.1.14     */    public void setTrackKerning(float millipoints)    {	style.setTrackKerning(millipoints);    }    /**     * Style for {@link #setFormStyle} which draws a solid border     * around the field (the default)     */    public static final int FORMSTYLE_SOLID=0;    /**     * Style for {@link #setFormStyle} which draws an border around the     * field so that it looks inset into the page.     */    public static final int FORMSTYLE_INSET=1;    /**     * Style for {@link #setFormStyle} which draws an border around the     * field so that it looks beveled.     */    public static final int FORMSTYLE_BEVEL=2;    /**     * Style for {@link #setFormStyle} which draws a single line under the     * field     */    public static final int FORMSTYLE_UNDERLINE=3;    /**     * Sets the style of a form fields background to one of {@link #FORMSTYLE_SOLID},     * {@link #FORMSTYLE_INSET}, {@link #FORMSTYLE_BEVEL} or     * {@link #FORMSTYLE_UNDERLINE}. This method can be applied to the background     * style passed into the <code>setStyle</code> method of a {@link FormElement},     * but for all other purposes such as setting the style of a page, this setting is     * ignored.     * @param style the type of background to draw the form field.     * @since 1.1.23     */    public void setFormStyle(int formstyle)    {	int newstyle=style.FORMSTYLE_SOLID;	if (formstyle==FORMSTYLE_SOLID)			newstyle=style.FORMSTYLE_SOLID;	else if (formstyle==FORMSTYLE_BEVEL)		newstyle=style.FORMSTYLE_BEVEL;	else if (formstyle==FORMSTYLE_INSET)		newstyle=style.FORMSTYLE_INSET;	else if (formstyle==FORMSTYLE_UNDERLINE)	newstyle=style.FORMSTYLE_UNDERLINE;	style.setFormStyle(newstyle);    }     /**     * Returns the form-style of the current style, as set by {@link #setFormStyle}.     * @since 1.1.23     */    public int getFormStyle()    {	int formstyle = style.getFormStyle();	int newstyle=FORMSTYLE_SOLID;	if (formstyle==style.FORMSTYLE_SOLID)		newstyle=FORMSTYLE_SOLID;	else if (formstyle==style.FORMSTYLE_BEVEL)	newstyle=FORMSTYLE_BEVEL;	else if (formstyle==style.FORMSTYLE_INSET)	newstyle=FORMSTYLE_INSET;	else if (formstyle==style.FORMSTYLE_UNDERLINE)	newstyle=FORMSTYLE_UNDERLINE;	return newstyle;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -