Hi ,

I am working project in which we make svg files with font embedded using batik.I am using SVGGeneratorContext SVGGraphics2D to set font and enabling font embedded true for the generator context.

the generated file is not using the embedded for rendering.Is there anything I am missing.

VGGeneratorContext ctx =

 

                        SVGGeneratorContext.createDefault(document);

ctx.setEmbeddedFontsOn(true);

svgGenerator = new SVGGraphics2D(ctx, false);

svgGenerator.setFont(Font Object);

It is generating file with embedded font but renderer not using the font

<?xml version="1.0" encoding="ISO-8859-1"?>

 

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>

<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; text-rendering:auto; stroke:black; stroke-linecap:square; stroke-miterlimit:10; shape-rendering:auto; stroke-opacity:1; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:&apos;Dialog&apos;; font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">

  <!--Generated by the Batik Graphics2D SVG Generator-->

  <defs id="genericDefs" />

  <g>

    <defs id="defs1">

      <font horiz-adv-x="75.0" id="font1">

        <font-face ascent="100.53711" descent="21.972656" units-per-em="100" style="font-family:OPTIBevis; font-style:normal; font-weight:bold;" />

        <missing-glyph horiz-adv-x="75.0" d="M12.5 0 L12.5 62.5 L62.5 62.5 L62.5 0 L12.5 0 ZM14.0625 1.5625 L60.9375 1.5625 L60.9375 60.9375 L14.0625 60.9375 L14.0625 1.5625 Z" />

        <glyph unicode="$" horiz-adv-x="55.615234" d="M23.875 10.5938 L23.875 31.0625 Q14.3125 33.7969 9.8438 39.3359 Q5.375 44.875 5.375 52.7812 Q5.375 60.7969 10.4297 66.2422 Q15.4844 71.6875 23.875 72.5156 L23.875 77.3438 L30.9531 77.3438 L30.9531 72.5156 Q38.7188 71.5781 43.3125 67.2109 Q47.9062 62.8438 49.1719 55.5156 L36.8125 53.9062 Q35.6875 59.6719 30.9531 61.7188 L30.9531 42.625 Q42.6719 39.4531 46.9219 34.3984 Q51.1719 29.3438 51.1719 21.4375 Q51.1719 12.5938 45.8281 6.5391 Q40.4844 0.4844 30.9531 -0.875 L30.9531 -10.0156 L23.875 -10.0156 L23.875 -1.125 Q15.4375 -0.0938 10.1641 5.1797 Q4.8906 10.4531 3.4219 20.0625 L16.1562 21.4375 Q16.9375 17.5312 19.0859 14.6953 Q21.2344 11.8594 23.875 10.5938 ZM23.875 61.8594 Q21 60.8906 19.2891 58.5469 Q17.5781 56.2031 17.5781 53.375 Q17.5781 50.7812 19.1406 48.5625 Q20.7031 46.3438 23.875 44.9688 L23.875 61.8594 ZM30.9531 9.9062 Q34.625 10.5938 36.9141 13.3047 Q39.2031 16.0156 39.2031 19.6719 Q39.2031 22.9531 37.2812 25.3203 Q35.3594 27.6875 30.9531 28.9531 L30.9531 9.9062 Z" />

        <glyph unicode="1" horiz-adv-x="55.615234" d="M39.3594 0 L25.6406 0 L25.6406 51.7031 Q18.1094 44.6719 7.9062 41.3125 L7.9062 53.7656 Q13.2812 55.5156 19.5781 60.4219 Q25.875 65.3281 28.2188 71.875 L39.3594 71.875 L39.3594 0 Z" />

        <glyph unicode="." horiz-adv-x="27.783203" d="M7.1719 0 L7.1719 13.7188 L20.9062 13.7188 L20.9062 0 L7.1719 0 Z" />

        <glyph unicode="9" horiz-adv-x="55.615234" d="M4.5469 16.5469 L17.8281 18.0156 Q18.3125 13.9688 20.3594 12.0156 Q22.4062 10.0625 25.7812 10.0625 Q30.0312 10.0625 33.0078 13.9688 Q35.9844 17.875 36.8125 30.1719 Q31.6406 24.1719 23.875 24.1719 Q15.4375 24.1719 9.3047 30.6875 Q3.1719 37.2031 3.1719 47.6562 Q3.1719 58.5469 9.6406 65.2109 Q16.1094 71.875 26.125 71.875 Q37.0156 71.875 44 63.4531 Q50.9844 55.0312 50.9844 35.75 Q50.9844 16.1094 43.7031 7.4219 Q36.4219 -1.2656 24.75 -1.2656 Q16.3594 -1.2656 11.1797 3.2031 Q6 7.6719 4.5469 16.5469 ZM35.5938 46.5312 Q35.5938 53.1719 32.5469 56.8359 Q29.5 60.5 25.4844 60.5 Q21.6875 60.5 19.1719 57.5 Q16.6562 54.5 16.6562 47.6562 Q16.6562 40.7188 19.3906 37.4766 Q22.125 34.2344 26.2188 34.2344 Q30.1719 34.2344 32.8828 37.3594 Q35.5938 40.4844 35.5938 46.5312 Z" />

      </font>

    </defs>

    <g style="font-size:13; font-weight:bold; font-family:&apos;OPTIBevis&apos;;">

      <text xml:space="preserve" x="273.4141" y="774.875" style="stroke:none;">$</text>

      <text x="283" y="783.0469" style="font-size:26; stroke:none;" xml:space="preserve">1</text>

      <text x="299.0312" y="777.2812" style="font-size:19; stroke:none;" xml:space="preserve">2</text>

      <text x="304.4056" y="777.2812" style="font-size:19; stroke:none;" xml:space="preserve">34</text>

    </g>

  </g>

</svg>

 

 

Reply via email to