/** * Gets the ascent of a <CODE>String</CODE> in normalized 1000 units. 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 * @return the ascent in normalized 1000 units */ public int getAscent(String text) { int max = 0; char chars[] = text.toCharArray(); for (int k = 0; k < chars.length; ++k) { int bbox[] = getCharBBox(chars[k]); if (bbox != null && bbox[3] > max) max = bbox[3]; } return max; }
/** * Gets the descent of a <CODE>String</CODE> in normalized 1000 units. The descent will always be * less than or equal to zero even if all the characters have an higher descent. * @param text the <CODE>String</CODE> to get the descent of * @return the descent in normalized 1000 units */ public int getDescent(String text) { int min = 0; char chars[] = text.toCharArray(); for (int k = 0; k < chars.length; ++k) { int bbox[] = getCharBBox(chars[k]); if (bbox != null && bbox[1] < min) min = bbox[1]; } return min; }
/** * Gets the ascent of a <CODE>String</CODE> in normalized 1000 units. 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 * @return the ascent in normalized 1000 units */ public int getAscent(String text) { int max = 0; char chars[] = text.toCharArray(); for (int k = 0; k < chars.length; ++k) { int bbox[] = getCharBBox(chars[k]); if (bbox != null && bbox[3] > max) max = bbox[3]; } return max; }
/** * Gets the descent of a <CODE>String</CODE> in normalized 1000 units. The descent will always be * less than or equal to zero even if all the characters have an higher descent. * @param text the <CODE>String</CODE> to get the descent of * @return the descent in normalized 1000 units */ public int getDescent(String text) { int min = 0; char chars[] = text.toCharArray(); for (int k = 0; k < chars.length; ++k) { int bbox[] = getCharBBox(chars[k]); if (bbox != null && bbox[1] < min) min = bbox[1]; } return min; }
private void setMetricDefaults() { _underlinePosition = -50; _underlineThickness = 50; int[] box = _font.getCharBBox('x'); if (box != null) { _yStrikeoutPosition = box[3] / 2 + 50; _yStrikeoutSize = 100; } else { // Do what the JDK does, size will be calculated by ITextTextRenderer _yStrikeoutPosition = _font.getFontDescriptor(BaseFont.BBOXURY, 1000f) / 3.0f; } }