Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-1109

svggen.font.SVGFont doesn't always calculate the correct path



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7
    • Fix Version/s: None
    • Component/s: SVGGraphics2D
    • Labels:


      We at PDFBox have used the code at
      for TT font rendering. There've been some problems (see PDFBOX-1435, scroll to second half), and after bugfixes didn't work (see PDFBOX-1206), I had the idea to create a SVG file by hand with the calculations mentioned in the file.

      I calculated the SVG values for the outer circle of that "o" of PDFBOX-1435 with the Batik source and added 100 to each y value (before I found out that svg allows translating). Here's the svg file I get:

      <?xml version="1.0" standalone="no"?>
      <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
      <svg width="12cm" height="12cm" viewBox="0 0 1200 1200"
           xmlns="http://www.w3.org/2000/svg" version="1.1">
        <rect x="1" y="1" width="1000" height="1000"
              fill="none" stroke="blue" stroke-width="1" />
      <g transform="scale(7)">
        <path d="M85,53 T74,49 T54,48.5 T39.5,59.5 T35.5,76.5 T44,94 T62,102 T79.5,97 T89.5,82.5 T88.5,63 Z"
              fill="none" stroke="red" stroke-width="5"  />

      This can be displayed with firefox, and this "o" has an angle The reason is that the Batik algorithm doesn't work for contours made entirely with off-curve points.

      I didn't actually run the Batik code, the calculations were done on paper.

      Further thoughts on the TT path drawing algorithm can be found at PDFBOX-1206. We ended up using the code from PDF.js, and maybe you should too


        1. TestSVGGen.java
          2 kB
          Tilman Hausherr
        2. test.svg
          24 kB
          Tilman Hausherr
        3. FreeSans.ttf
          698 kB
          Tilman Hausherr

          Issue Links



              • Assignee:
                tilman Tilman Hausherr
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: