Class FontGlyphReader

java.lang.Object
org.locationtech.jts.awt.FontGlyphReader

public class FontGlyphReader extends Object
Provides methods to read Font glyphs for strings into Polygonal geometry.

It is suggested to use larger point sizes to render fonts glyphs, to reduce the effects of scale-dependent hints. The result geometry is in the base coordinate system of the font. The geometry can be further transformed as necessary using AffineTransformations.

Author:
Martin Davis
  • Field Details

    • FONT_SERIF

      public static final String FONT_SERIF
      The font name of the Java logical font Serif.
      See Also:
    • FONT_SANSERIF

      public static final String FONT_SANSERIF
      The font name of the Java logical font SansSerif.

      DEPRECATED - use FONT_SANSSERIF

      See Also:
    • FONT_SANSSERIF

      public static final String FONT_SANSSERIF
      The font name of the Java logical font SansSerif.
      See Also:
    • FONT_MONOSPACED

      public static final String FONT_MONOSPACED
      The font name of the Java logical font Monospaced.
      See Also:
  • Method Details

    • read

      public static Geometry read(String text, String fontName, int pointSize, GeometryFactory geomFact)
      Converts text rendered in the given font and pointsize to a Geometry using a standard flatness factor.
      Parameters:
      text - the text to render
      fontName - the name of the font
      pointSize - the pointSize to render at
      geomFact - the geometryFactory to use to create the result
      Returns:
      a polygonal geometry representing the rendered text
    • read

      public static Geometry read(String text, Font font, GeometryFactory geomFact)
      Converts text rendered in the given Font to a Geometry using a standard flatness factor.
      Parameters:
      text - the text to render
      font - the font to render with
      geomFact - the geometryFactory to use to create the result
      Returns:
      a polygonal geometry representing the rendered text
    • read

      public static Geometry read(String text, Font font, double flatness, GeometryFactory geomFact)
      Converts text rendered in the given Font to a Geometry
      Parameters:
      text - the text to render
      font - the font to render with
      flatness - the flatness factor to use
      geomFact - the geometryFactory to use to create the result
      Returns:
      a polygonal geometry representing the rendered text