Bug 106150 - [PATCH] Arthur support for Type3 fonts -- alternative implementation
Summary: [PATCH] Arthur support for Type3 fonts -- alternative implementation
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: arthur backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-20 14:34 UTC by oliver.sander
Modified: 2018-08-20 22:07 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch that implements type3 font support in Arthur backend using beginType3Char/endType3Char (3.08 KB, patch)
2018-04-20 14:34 UTC, oliver.sander
Details | Splinter Review

Description oliver.sander 2018-04-20 14:34:40 UTC
Created attachment 138952 [details] [review]
Patch that implements type3 font support in Arthur backend using beginType3Char/endType3Char

The attached patch contains an alternative implementation of type3 font support for the Arthur backend, which uses the beginType3Char/endType3Char methods.  It is a lot simpler---just compare the size of this patch with the one from 

  https://bugs.freedesktop.org/show_bug.cgi?id=105772

The new patch is orthogonal to the old one.  You can have them both together, and switch between them using the return value of the interpretType3Chars method (false: old patch, true: new patch).  I think we need to compare the two: the new patch is much simpler, but the old one does some caching and may(!) be faster.  

Unfortunately, the patch triggers a problem which I think is a bug in Gfx.cc, but it may also be insufficient understanding on my part.  With the patch applied, poppler will only render the first type3 glyph, and all others remain invisible.  The problem is Gfx.cc:4017:

      restoreStateStack(savedState);
      // GfxState::restore() does *not* restore the current position,
      // so we deal with it here using (curX, curY) and (lineX, lineY)
      curX += tdx;
      curY += tdy;
      state->moveTo(curX, curY);
      out->updateCTM(state, 0, 0, 0, 0, 0, 0);

This code is executed after the call to endType3Char.  However, transforming the CTM by a zero matrix results in a scale factor of zero, and all glyphs are henceforth reduced to a single point.  Therefore, that call to updateCTM looks very fishy to me.  When I remove it, the type3 support in my patch works.

Now, the call to updateCTM is there for a reason.  Thomas Freitag introduced it in 182abe4ed5c0773073c6751a26a7c4e40e99e02e to fix bug #95344.  I admit haven't looked further into that issue.  Thomas, if you are reading this: do you remember why you had to multiply the CTM by 0?

Incidentally, in my understanding of the updateCTM method, the line Gfx.cc:3972

      out->updateCTM(state, 1, 0, 0, 1, 0, 0);

is useless, because it simply multiplies the current CTM by an identity matrix.
Comment 1 Albert Astals Cid 2018-07-20 22:10:10 UTC
Do you want me to run this through regtest?
Comment 2 oliver.sander 2018-07-21 04:25:02 UTC
Yes please.  But it would also be interesting to know if this implementation here is faster or slower than the current one.  Is that something that you can easily check?
Comment 3 GitLab Migration User 2018-08-20 22:07:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/206.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.