Class HelveticaMetrics


  • public final class HelveticaMetrics
    extends java.lang.Object
    Character advance widths (per 1000 text-space units, i.e. AFM/PDF glyph metric convention) for the standard 14 font Helvetica, covering ASCII 0x20-0x7E. These are the standard, freely-republished Adobe Core 14 AFM numbers (the same table every PDF library, including PDFBox, ships) -- metric data, not copyrightable expression. Useful whenever code building a COS content stream (an annotation appearance, a signature's visible appearance, ...) needs to word-wrap text without embedding a font program; characters outside this range fall back to the (also standard) 556 average width.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int charWidth​(char c)
      Width of one character, in 1000ths of the font size (multiply by fontSize/1000 to get points).
      static float stringWidth​(java.lang.String text, float fontSize)
      Width of text at fontSize points, in points.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • charWidth

        public static int charWidth​(char c)
        Width of one character, in 1000ths of the font size (multiply by fontSize/1000 to get points).
      • stringWidth

        public static float stringWidth​(java.lang.String text,
                                        float fontSize)
        Width of text at fontSize points, in points.