[texworks] Mac OS TeXworks + fontconfig

Stefan Löffler st.loeffler at gmail.com
Sun Jun 5 09:22:50 CEST 2011


finally, the pieces of the puzzle are starting to fit together :).

On 2011-06-04 22:47, Charlie Sharpsteen wrote:
>     >   - Changing Helvitical to HelviticaFoo and altering the ZapfDingbat
>     > substitution to operate on it instead had no effect.
>     No effect meaning that the "Bogus..." messages didn't change,
>     right? So
>     they are still coming form ZapfDingbats, not from the replaced
>     Helvetica?
> No effect meaning that the substitution of "Helvitica" for
> "HelviticaFoo" produces no side effects such as "Bogus" messages from
> the Goo allocator unlike the substitution of "ZapfDingbatsITC" for
> "ZapfDingbats". Should have been more clear about that :). I also
> tried a similar test with Courier and got no error messages.

OK, so it really is just a ZapfDingbats issue, and not an issue with the
substitution code.
>     >   - I followed the function calls out of GlobalParamsMac.cc and into
>     > SplashOutputDev.cc.  They don't occur in
>     > `SplashOutputDev::doUpdateFont` which is the function that calls
>     > `getDisplayFont` from GlobalParamsMac.cc.
>     >
>     > Not sure what else to do at this point.
>     Hm, I wonder... The "Bogus..." messages always occur after all "Lookup
>     font..." messages right? This might suggest that they occur not in the
>     initialization phase but in the actual drawing phase (possibly in
>     SplashOutputDev::drawChar).
> Good guess about `SplashOutputDev::drawChar`.  Getting Poppler to
> build in a GDB-friendly way took some hair pulling---the Autotools
> build uses libtool and libtool "helpfully" nukes object files after it
> gets done linking libraries.  Previously, I got into a fight with
> libtool when compiling Poppler for the the Leopard builds as it was
> also "helpfully" stripping some essential compiler flags.
> I am now officially not a fan of libtool, it seriously needs a
> `--dont-try-to-be-clever` flag.
> Fortunately the Poppler CMake build doesn't try to pull such
> shenanigans. It faithfully passes compiler flags and leaves object
> files alone.  I expanded `poppler-mac-font-handling.patch` to add the
> Mac font handling option to the Poppler CMake build as well as the
> Autotools build:
>     https://github.com/Sharpie/TeXworks/commit/251eb23
> As I recall, lack of CMake support may have been an issue that kept
> Jonathan's patch out of the official Poppler tree:
>     http://lists.freedesktop.org/archives/poppler/2009-July/004972.html
> Anyway, after getting TeXworks and Poppler to run through GDB, a
> backtrace from the error message indicates that the problem occurs in
> `SplashFTFont::makeGlyph` at `SplashFTFont.cc:244` which is a couple
> steps down the call chain from `SplashOutputDev::drawChar`.  I'll try
> to look over this later to see if I can figure anything out, but here
> is the full backtrace:
>     Formatted:
>     https://gist.github.com/1008336
>     Raw:
> https://gist.github.com/raw/1008336/1c01061723261e5d3b6d583ff059a82ac0f00482/texworks_gdb_log.mdown 
> Let me know if anything jumps out!

Awesome work! In fact, I think the solution jumped out. From looking at
the source code, it seems that bitmap->h (which is the number of rows to
allocate) is 0, hence the warnings. My guess is it is caused by a
zero-dimension "glyph" for the space character. Anyway, it should be
fixed easily (see attached patch). So, hopefully this settles that once
and for all.

Just for the record (and for submitting the patches upstream): did this
happen with an unpatched poppler as well? I.e., are those zero-height
glyphs picked up by fontconfig as well, or do they require/use other
font files that don't show this issue?

Thanks again for the immense amount of work you've put into this!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20110605/412c71ec/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poppler-bogus-memory-allocation-fix.diff
Type: text/x-patch
Size: 464 bytes
Desc: not available
URL: <http://tug.org/pipermail/texworks/attachments/20110605/412c71ec/attachment-0001.bin>

More information about the texworks mailing list