(FontRenderContext frc, String name, int style, int size)
| 56 | } |
| 57 | |
| 58 | private static void show(FontRenderContext frc, String name, int style, int size) { |
| 59 | Font f=new Font(name, style, size);//.deriveFont(style, size * 2); |
| 60 | TextLayout tl = new TextLayout("X", f, frc); |
| 61 | float leading = tl.getLeading(); |
| 62 | float ascent = tl.getAscent(); |
| 63 | float descent = tl.getDescent(); |
| 64 | |
| 65 | // glyphs are not supported |
| 66 | // GlyphVector gv = new StandardGlyphVector(f, "test".toCharArray(), 0, 4, frc); |
| 67 | // System.out.println(gv.getLogicalBounds()); |
| 68 | |
| 69 | System.out.println(f.getStringBounds("test", frc)); |
| 70 | // |
| 71 | FontMetrics fm = SwingUtilities2.getFontMetrics(null, f); |
| 72 | System.out.println("fm " + size + " A=" + fm.getAscent() + " D=" + fm.getDescent() + " =" + fm.getHeight()); |
| 73 | |
| 74 | |
| 75 | System.out.println(size + "\t" + f.getSize() + "\t" + (name + " ").substring(0, 5) |
| 76 | + "\t" + style |
| 77 | + "\t" + ascent + " \t" + descent + "\t" + leading |
| 78 | + "\t" + f.getStringBounds("X", frc)); |
| 79 | // LineMetrics lm = f.getLineMetrics("X", frc); |
| 80 | // System.out.println(size + " so=" + lm.getStrikethroughOffset() |
| 81 | // + " st="+ lm.getStrikethroughThickness() + "/" + (size/4f) |
| 82 | // + " uo=" + lm.getUnderlineOffset() |
| 83 | // + " ut= " + lm.getUnderlineThickness() |
| 84 | // ); |
| 85 | } |
| 86 | |
| 87 | } |
no test coverage detected