[cairo] Help / incompatibility with the PDF output?

Behdad Esfahbod behdad at behdad.org
Thu Nov 30 17:35:15 UTC 2023


Thanks Tobias. I think you nailed it. The font is indeed a stroke user-font
on the cairo side.

So this is a cairo bug. I'll try to see if I can make sense of fixing it.
Or Adrian can... I'll file a gitlab issue.

Thanks again.

behdad
http://behdad.org/


On Thu, Nov 30, 2023 at 10:12 AM Tobias Hoffmann <
lcairo-list at thax.hardliners.org> wrote:

> Hello Behdad,
>
> from your PDF, e.g.:
> ---
> % Small pink circle left to the string "Point causing kink..."
> 1 0 1 RG /a3 gs
> 10 w
> 1 J
> 48 954 m 48 954 l S
>
> % Text "Suggested new contour..."
> 0 0 0 rg /a0 gs
> BT
> 36 0 0 -36 80 911 Tm
> /f-1-0 1 Tf
> <2c192727110023112105171125050a1d17231d191a050023021a23052d1d141723>Tj
> ET
> ---
>
> 1 0 1 RG sets the Stroking Color to DeviceRGB pink,
> 0 0 0 rg sets the Non-Stroking Color to DeviceRGB black.
>
> Evince / XPDF / Chrome PDF Plugin render the text with the non-stroking
> color, other views with the stroking color...
>
> PDF Reference 1.7 Page 391f (5.1.2 Achieving Special Graphical Effects):
> "The color used for painting glyphs is the current color in the graphics
> state: either
> the nonstroking color or the stroking color (or both), depending on the
> text rendering mode (see Section 5.2.5, “Text Rendering Mode”) [...] The
> text rendering mode parameter in the graphics state specifies whether glyph
> outlines are to be filled, stroked, used as a clipping boundary, or some
> combination of these effects. (This parameter does not apply to Type 3
> fonts.)"
>
> But your PDF does use Type 3 Fonts (possibly set up as user fonts on the
> cairo side??), which also use Stroking operations in the glyph
> definitions...
> This seems to catch cairo on the wrong foot, which does not expect text to
> behave differently for Type 3 fonts(?), and thus only sets the fill color
> to black, but not also the stroking color...
>
> The PDF Spec might have changed since 1.7; I might have overseen some
> special concession; there might be a subtle difference in how these Type 3
> fonts are represented in PostScript – but AFAIUI Evince/... seems to do it
> wrong(?).
>
> 2c
>   Tobias
>
>
>
> On 28/11/2023 18:37, Behdad Esfahbod wrote:
>
> [Resending with an even smaller image to pass the list limit...]
>
> Hi everyone,
>
> I'm facing an issue with the PDF output of cairo. Basically, the attached
> PDF *should* render all text in grayish black. And that's what I see in
> Evince. But both GitHub's web PDF viewer, and the MacOS PDF viewer, show
> them *wrong*, like below:
>
> [image: image2.png]
> I've confirmed that HTML and PS output are fine. If I use ps2pdf to
> convert the PS to PDF, then the PDF also renders fine.
>
> I *am* using multiple cairo contexts at the same time to draw those
> things. But trying to use just one context for all didn't seem to change
> anything.
>
> Any help / advice is appreciated. PDF attached.
>
> behdad
> http://behdad.org/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20231130/efc5daaa/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image2.png
Type: image/png
Size: 35264 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20231130/efc5daaa/attachment-0001.png>


More information about the cairo mailing list