[Poppler-bugs] [Bug 19670] Colorizing text in pattern colorspace solved

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Feb 5 09:40:41 PST 2009


http://bugs.freedesktop.org/show_bug.cgi?id=19670





--- Comment #21 from thomasf <Thomas.Freitag at alfa.de>  2009-02-05 09:40:40 PST ---
(In reply to comment #20)
> The patch causes a rendering regression on
> http://www.umweltbundesamt.org/fpdf-l/2826.pdf page 24 the one with a bar graph
> that says Seite 19 on top right. Can you try to fix this?
> 
Thank You for providing that example.
If You mean with "rendering regression" that the text "Gesamtbewertung
Schadstoffe" is missing: I solved that now.
Perhaps You now can understand my "security line" in endTextObject: when
colorspace changed during rendering the text from pattern colorspace to
another, I can't not fill the text anymore. Therefore I have to do something
special if state->getFillColorSpace()->getMode() != csPattern now. But the
implemention was neither in PSOutputDev nor in SplashOutputDev good enough, and
I couldn't test that because I haven't any sample.
BTW, it could also be the other way round: if text rendering is started but the
colorspace is changed to pattern colorspace before setting the text, I don't
recognize that, and the text will be placed solid like it was done before. Once
again: because I have no sample with such a case, I can not test and therefore
it's not easy to implement that.
Unfortunately I can't not provide a good diff, because I already implemented
imagemasks in pattern colorspace. So I just insert the new implementation for
endTextObject in both cases, You'll see there is not a big difference:

void SplashOutputDev::endTextObject(GfxState *state) {
  if (haveCSPattern) {
          state->setRender(savedRender);
          haveCSPattern = gFalse;
          if (state->getFillColorSpace()->getMode() != csPattern) {
                  if (textClipPath) {
                          splash->fill(textClipPath, gTrue);
                          delete textClipPath;
                          textClipPath = NULL;
                  }
                  restoreState(state);
                  updateFillColor(state);
          }
  }
  if (textClipPath) {
    splash->clipToPath(textClipPath, gFalse);
    delete textClipPath;
    textClipPath = NULL;
  }
}

and 

void PSOutputDev::endTextObject(GfxState *state) {
  if (haveCSPattern) {
          writePS("Tclip*\n");
          haveTextClip = gFalse;
          state->setRender(savedRender);
          haveCSPattern = gFalse;
          if (state->getFillColorSpace()->getMode() != csPattern) {
                  double cxMin, cyMin, cxMax, cyMax;
                  state->getClipBBox(&cxMin, &cyMin, &cxMax, &cyMax);
                  writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} re\n",
                          cxMin, cyMin,
                          cxMax, cyMax);
                  writePS("f*\n");
                  restoreState(state);
                  updateFillColor(state);
          }
  } else if (haveTextClip) {
    writePS("Tclip\n");
    haveTextClip = gFalse;
  }
}


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list