我在RHEL中运行时得到错误的LineMetrics(java.awt.font.LineMetrics)值(上升-240,下降240和前导240)但在Windows中运行时获得正确的值(上升10.053711,下降2.1972656和前导0.32714844 )。
JDK版本:jdk1.8.0_51
OS:RHEL,fedora 7.3 //在这里得到错误的值
操作系统:Windows 10 //在此处获取正确的值
BufferedImage image = new BufferedImage(700, 500, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
Font font = new Font("SansSerif",Font.PLAIN, 10);
LineMetrics metrics = font.getLineMetrics("ABCxyz", g2.getFontRenderContext());
System.out.println("Metrics: ");
System.out.println("\tAscent: " + metrics.getAscent());
System.out.println("\tDescent: " + metrics.getDescent());
System.out.println("\tHeight: " + metrics.getHeight());
System.out.println("\tLeading: " + metrics.getLeading());
答案 0 :(得分:0)
底层操作系统中已安装的ttf文件已损坏,因为我收到的指标不正确。