Class SVGFont

java.lang.Object
org.apache.batik.svggen.font.SVGFont
All Implemented Interfaces:
XMLConstants, FeatureTags, ScriptTags, CSSConstants, SVGConstants

public class SVGFont extends Object implements XMLConstants, SVGConstants, ScriptTags, FeatureTags
Converts a TrueType font to an SVG embedded font.
Version:
$Id: SVGFont.java 1851346 2019-01-15 13:41:00Z ssteiner $
  • Field Details

    • EOL

      static final String EOL
    • PROPERTY_LINE_SEPARATOR

      static final String PROPERTY_LINE_SEPARATOR
      See Also:
    • PROPERTY_LINE_SEPARATOR_DEFAULT

      static final String PROPERTY_LINE_SEPARATOR_DEFAULT
      See Also:
    • DEFAULT_FIRST

      static final int DEFAULT_FIRST
      See Also:
    • DEFAULT_LAST

      static final int DEFAULT_LAST
      See Also:
    • QUOT_EOL

      private static String QUOT_EOL
    • CONFIG_USAGE

      private static String CONFIG_USAGE
      Defines the application arguments.
    • CONFIG_SVG_BEGIN

      private static String CONFIG_SVG_BEGIN
      Defines the start of the generated SVG document {0} SVG public ID {1} SVG system ID
    • CONFIG_SVG_TEST_CARD_START

      private static String CONFIG_SVG_TEST_CARD_START
      Defines the SVG start fragment that exercise the generated Font.
    • CONFIG_SVG_TEST_CARD_END

      private static String CONFIG_SVG_TEST_CARD_END
      Defines the end of the SVG fragment that exercise the generated Font.
    • ARG_KEY_START_CHAR

      public static final char ARG_KEY_START_CHAR
      See Also:
    • ARG_KEY_CHAR_RANGE_LOW

      public static final String ARG_KEY_CHAR_RANGE_LOW
      See Also:
    • ARG_KEY_CHAR_RANGE_HIGH

      public static final String ARG_KEY_CHAR_RANGE_HIGH
      See Also:
    • ARG_KEY_ID

      public static final String ARG_KEY_ID
      See Also:
    • ARG_KEY_ASCII

      public static final String ARG_KEY_ASCII
      See Also:
    • ARG_KEY_TESTCARD

      public static final String ARG_KEY_TESTCARD
      See Also:
    • ARG_KEY_AUTO_RANGE

      public static final String ARG_KEY_AUTO_RANGE
      See Also:
    • ARG_KEY_OUTPUT_PATH

      public static final String ARG_KEY_OUTPUT_PATH
      See Also:
  • Constructor Details

    • SVGFont

      public SVGFont()
  • Method Details

    • encodeEntities

      protected static String encodeEntities(String s)
    • getContourAsSVGPathData

      protected static String getContourAsSVGPathData(Glyph glyph, int startIndex, int count)
    • getSVGFontFaceElement

      protected static String getSVGFontFaceElement(Font font)
    • writeFontAsSVGFragment

      protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean autoRange, boolean forceAscii) throws Exception
      Returns a <font>...</font> block, defining the specified font.
      Parameters:
      font - The TrueType font to be converted to SVG
      id - An XML id attribute for the font element
      first - The first character in the output range
      last - The last character in the output range
      forceAscii - Force the use of the ASCII character map
      Throws:
      Exception
    • getGlyphAsSVG

      protected static String getGlyphAsSVG(Font font, Glyph glyph, int glyphIndex, int defaultHorizAdvanceX, String attrib, String code)
    • getGlyphAsSVG

      protected static String getGlyphAsSVG(Font font, Glyph glyph, int glyphIndex, int defaultHorizAdvanceX, SingleSubst arabInitSubst, SingleSubst arabMediSubst, SingleSubst arabTermSubst, String code)
    • getKerningPairAsSVG

      protected static String getKerningPairAsSVG(KerningPair kp, PostTable post)
    • writeSvgBegin

      protected static void writeSvgBegin(PrintStream ps)
    • writeSvgDefsBegin

      protected static void writeSvgDefsBegin(PrintStream ps)
    • writeSvgDefsEnd

      protected static void writeSvgDefsEnd(PrintStream ps)
    • writeSvgEnd

      protected static void writeSvgEnd(PrintStream ps)
    • writeSvgTestCard

      protected static void writeSvgTestCard(PrintStream ps, String fontFamily)
    • main

      public static void main(String[] args)
      Starts the application.
      Parameters:
      args - an array of command-line arguments
    • chopUpStringBuffer

      private static void chopUpStringBuffer(StringBuffer sb)
    • midValue

      private static int midValue(int a, int b)
    • parseArgs

      private static String parseArgs(String[] args, String name)
    • usage

      private static void usage()