Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2180

[PATCH] TTFReader: Output bounding box information for glyphs

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Resolved
    • Minor
    • Resolution: Implemented
    • 1.1
    • None
    • font/unqualified
    • None

    Description

      As I mentioned in another email, I am trying to constrain FOP to use only
      local fonts (i.e. ones described in fop.cfg). For SVGs, I have a workaround:

      • Generate fonts in SVG format using ttf2svg utility from Batik;
      • Use an XSL stylesheet to embed all the fonts used by an SVG image into the
        image itself;
      • Use such "preprocessed" SVG image as the input to FOP.

      This does not work well with JEuclid, though. When JEuclid generates SVG from
      MathML, it performs font rendering - that is, replaces characters by actual
      paths. And again, it uses system fonts, not the fonts available in FOP - even
      if running as FOP plugin.

      To work around this issue for MathML, I am currently switching from JEuclid to
      pMML2SVG (http://pmml2svg.sourceforge.net). It generates SVGs with text
      characters, not paths. But in order to do so, it needs font metrics.
      Unfortunately, font metrics produced by stock FOP TTFReader are not sufficient

      • this stylesheet also needs bounding box for each glyph. To obtain these,
        pMML2SVG currently packages an augmented TTFReader Java sources which are to
        be compiled and used in lieu of the stock one.

      Given that the patch is very small and as far as I can tell, compatible with
      current users of font metrics (it just adds 4 attributes to glyph
      description), is it possible to integrate this support into stock FOP?

      Patch from pMML2SVG, slightly modified to apply to FOP 1.1 sources, attached.

      Attachments

        1. ttfreader.diff
          2 kB
          Alexey Neyman

        Activity

          People

            phancock Peter Hancock
            stilor Alexey Neyman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: