publicclass BoldSpace { publicstaticvoid main(String[] s) {
BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
String errMsg = "ZWJ Space char should have 0 advance\n";
Graphics g = bi.getGraphics();
// It turns out that some fonts inexplicably treat this as // a standard character. In this 14 pt font, if we see an advance // that's clearly bigger than we'd have introduced in bolding we'll // not error out this test, presuming that its a consequence of // the actual font data. A Linux font 'TLwg Type Bold' is the case // in point. int errorMargin = 4;
g.setFont(new Font("monospaced", Font.BOLD, 14));
FontMetrics fm = g.getFontMetrics();
System.out.println("Bold: " + fm.charWidth('\u200b')); int cwid = fm.charWidth('\u200b'); if (cwid > 0 && cwid < errorMargin) { thrownew RuntimeException(errMsg);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.