com.itextpdf.text.pdf.BaseFont.getAscent()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中com.itextpdf.text.pdf.BaseFont.getAscent()方法的一些代码示例,展示了BaseFont.getAscent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BaseFont.getAscent()方法的具体详情如下:
包路径:com.itextpdf.text.pdf.BaseFont
类名称:BaseFont
方法名:getAscent

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;

相关文章