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

[PATCH] Incomplete implementation of the simulate-style flag

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3
    • 2.4
    • font/unqualified
    • None
    • Patch

    Description

      The CustomFont.getSimulateStyle() is used only in:

      org.apache.fop.render.pdf.PDFPainter.drawTextWithDX(int, int, String, FontTriplet, int, int, int[])
      

      But not in:

      org.apache.fop.render.pdf.PDFPainter.drawTextWithDP(int, int, String, FontTriplet, int, int, int[][])
      

      As a result some of the font styling is not applied.

      Modifying the above method with the following patch seem to fix the problem:

      ...
                 boolean simulateStyle = tf instanceof CustomFont && ((CustomFont) tf).getSimulateStyle();
                  
                  // PATCH START 
                  // Taken from #drawTextWithDX method
                  double shear = 0;
                
                  if (simulateStyle) {
                      //Adding this breaks the PDF: generator.add("q\n")
                      if (triplet.getWeight() == 700) {
                          generator.add("2 Tr 0.31543 w\n");
                      }
                      if (triplet.getStyle().equals("italic")) {
                          shear = 0.333;
                      }
                  }
                  // PATCH END
                  tu.writeTextMatrix(new AffineTransform(1, 0, shear, -1, x / 1000f, y / 1000f));
                  tu.updateTf(fk, fsPoints, true);
                 generator.updateCharacterSpacing(letterSpacing / 1000f);
      ...
      

      Attachments

        Activity

          People

            cbowditch Chris Bowditch
            dc33 Dan Caprioara
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified