DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28208>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28208

[PATCH] justification in PDF Renderer





------- Additional Comments From [EMAIL PROTECTED]  2004-04-06 10:34 -------
There is still a problem concerning the way the PDFRenderer behave when the 
text of a line comes from different TLM (I'm going to attach a test fo file 
showing this problem).

[from PDFRenderer.renderText(), /*** comments added ***/]
  ...
  if (!textOpen || bl != prevWordY) {
      /*** this is done for the first fragment ***/
      /*** and it's OK                         ***/
      closeText();

      pdf.append("1 0 0 -1 " + (rx / 1000f) + " " + (bl / 1000f) + " Tm "
                 + (text.getTSadjust()/1000f) + " Tw [" + startText);
      prevWordY = bl;
      textOpen = true;
  } else {
      // express the space between words in thousandths of an em
      int space = prevWordX - rx + prevWordWidth;
      float emDiff = (float) space / (float) currentFontSize * 1000f;
      // this prevents a problem in Acrobat Reader and other viewers
      // where large numbers cause text to disappear or default to
      // a limit
      if (emDiff < -33000) {
          /*** this would be OK, but it is not done ***/
          closeText();

          pdf.append("1 0 0 -1 " + (rx / 1000f) + " " + (bl / 1000f) + " Tm "
                     + (text.getTSadjust()/1000f) + " Tw [" + startText);
          textOpen = true;
      } else {
          /*** this is done for the following fragments ***/
          /*** and it is not correct because it uses the***/
          /*** space adjustment of the first fragment!! ***/
          pdf.append(Float.toString(emDiff));
          pdf.append(" ");
          pdf.append(startText);
      }
  }
  ...

So the resulting pdf code contains:
  ... 4.869 Tw [(fragment 1) 0.0 (fragment 2)] TJ
      \------/
         |
         space adjustment for the FIRST fragment
instead of:
  ... 4.869 Tw [(fragment 1)] TJ
  ... 1.853 Tw [(fragment 2)] TJ

I have tried to fix this commenting out the "if" and the "else" branch, so 
that each fragment uses its own space adjustment, and it works.
But the comment says that the if was done to prevent a problem, so I fear that 
that problem could arise againg, removing the if.

    Luca

Reply via email to