本文整理了Java中com.itextpdf.text.pdf.BaseFont.getAscent()
方法的一些代码示例,展示了BaseFont.getAscent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BaseFont.getAscent()
方法的具体详情如下:
包路径:com.itextpdf.text.pdf.BaseFont
类名称:BaseFont
方法名:getAscent
[英]Gets the ascent of a String
in normalized 1000 units. The ascent will always be greater than or equal to zero even if all the characters have a lower ascent.
[中]以标准化的1000个单位获取String
的上升。即使所有字符的上升幅度都较低,上升幅度也始终大于或等于零。
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Gets the ascent of a <CODE>String</CODE> in points. The ascent will always be
* greater than or equal to zero even if all the characters have a lower ascent.
* @param text the <CODE>String</CODE> to get the ascent of
* @param fontSize the size of the font
* @return the ascent in points
*/
public float getAscentPoint(String text, float fontSize)
{
return getAscent(text) * 0.001f * fontSize;
}
// ia>
代码示例来源:origin: com.itextpdf/itextg
/**
* Gets the ascent of a <CODE>String</CODE> in points. The ascent will always be
* greater than or equal to zero even if all the characters have a lower ascent.
* @param text the <CODE>String</CODE> to get the ascent of
* @param fontSize the size of the font
* @return the ascent in points
*/
public float getAscentPoint(String text, float fontSize)
{
return getAscent(text) * 0.001f * fontSize;
}
// ia>
代码示例来源:origin: stackoverflow.com
BaseFont bf = BaseFont.createFont();
int textHeightInGlyphSpace = bf.getAscent(text) - bf.getDescent(text);
float fontSize = 1000f * fixedHeight / textHeightInGlyphSpace;
内容来源于网络,如有侵权,请联系作者删除!