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

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

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

BaseFont.getCidCode介绍

[英]Gets the CID code given an Unicode. It has only meaning with CJK fonts.
[中]获取给定Unicode的CID代码。它仅对CJK字体有意义。

代码示例

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Gets the width of a <CODE>char</CODE> in normalized 1000 units.
 * @param char1 the unicode <CODE>char</CODE> to get the width of
 * @return the width in normalized 1000 units
 */
@Override
public int getWidth(int char1) {
  if (isType0) {
    if(hMetrics != null && cjkMirror != null && !cjkMirror.isVertical()) {
      int c = cjkMirror.getCidCode(char1);
      int v = hMetrics.get(c);
      if (v > 0)
        return v;
      else
        return defaultWidth;
    } else {
      int[] ws = metrics.get(Integer.valueOf(char1));
      if (ws != null)
        return ws[1];
      else
        return 0;
    }
  }
  if (cjkMirror != null)
    return cjkMirror.getWidth(char1);
  return super.getWidth(char1);
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Gets the width of a <CODE>char</CODE> in normalized 1000 units.
 * @param char1 the unicode <CODE>char</CODE> to get the width of
 * @return the width in normalized 1000 units
 */
@Override
public int getWidth(int char1) {
  if (isType0) {
    if(hMetrics != null && cjkMirror != null && !cjkMirror.isVertical()) {
      int c = cjkMirror.getCidCode(char1);
      int v = hMetrics.get(c);
      if (v > 0)
        return v;
      else
        return defaultWidth;
    } else {
      int[] ws = metrics.get(Integer.valueOf(char1));
      if (ws != null)
        return ws[1];
      else
        return 0;
    }
  }
  if (cjkMirror != null)
    return cjkMirror.getWidth(char1);
  return super.getWidth(char1);
}

相关文章