1. 02 Sep, 2021 1 commit
  2. 22 Aug, 2021 1 commit
  3. 28 Jul, 2021 1 commit
  4. 27 Jul, 2021 1 commit
  5. 26 Jul, 2021 3 commits
  6. 24 Jul, 2021 1 commit
    • Adrian Johnson's avatar
      tags: allow links to page numbers not yet created · f7c7bcb6
      Adrian Johnson authored
      Previously, forward references were required to use named destinations.
      This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr>
      that converted all links to indirect objects written at the end of the document.
      I have reworked the patch so that only forward references to future page numbers are
      written as indirect objects. Backward references and named destinations remain as they
      are. This is to minimize the number of objects written to the PDF file.
      Fixes #336
  7. 23 Jul, 2021 1 commit
    • Uli Schlachter's avatar
      pdf: Properly pass on stdio write errors · 2fbd53a6
      Uli Schlachter authored
      cairo-pdf was silently ignoring write errors in
      _cairo_pdf_surface_finish(). Any write errors that happened here ended
      up setting a "status" variable, but the value in this variable was then
      This commit fixes this bug by passing this error on to the caller.
      Additionally, this also adds a test case for this behaviour based on
      writing to /dev/full. This file is non-standard and thus the test first
      checks that this file exists and is writable before trying to write to
      This bug was found based on a report from Knut Petersen [0].
      [0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html
      Signed-off-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
  8. 18 Jul, 2021 1 commit
  9. 09 Feb, 2021 1 commit
    • Uli Schlachter's avatar
      pdf font subset: Generate valid font names · a3b69a02
      Uli Schlachter authored
      A hash value is encoded in base 26 with upper case letters for font
      Commit ed984146 replaced "numerator = abs (hash);" with "numerator =
      hash;" in this code, because hash has type uint32_t and the compiler
      warned about taking the absolute value of an unsigned value.  However,
      abs() is actually defined to take an int argument. Thus, there was some
      implicit cast.
      Since numerator has type long, i.e. is signed, it is now actually
      possible to get an overflow in the implicit cast and then have a
      negative number. The following code is not prepared for this and
      produces non-letters when encoding the hash.
      This commit fixes that problem by not using ldiv() and instead using /
      and % to directly compute the needed values. This gets rid of the need
      to convert to type long. Since now everything works with uint32_t, there
      is no more chance for negative numbers messing things up.
      Fixes: #449
      Signed-off-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
  10. 17 Jan, 2021 1 commit
    • Uli Schlachter's avatar
      'Fix' a NULL pointer 'dereference' in cairo-pdf-surface · 4e2e876b
      Uli Schlachter authored
      The expression &image_surface->base basically just casts the
      cairo_image_surface_t* to cairo_surface_t*. However, technically it is a
      NULL pointer dereference and UndefinedBehaviorSanitizer flags it as
      runtime error: member access within null pointer of type 'cairo_image_surface_t' (aka 'struct _cairo_image_surface')
      This commit fixes this by adding a NULL check.
      Signed-off-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
  11. 28 Nov, 2020 1 commit
  12. 21 Nov, 2020 1 commit
  13. 07 Nov, 2020 1 commit
  14. 25 Oct, 2018 1 commit
  15. 16 Oct, 2018 1 commit
    • Bryce Harrington's avatar
      Revert "Correctly decode Adobe CMYK JPEGs in PDF export" · bf597b89
      Bryce Harrington authored
      From further testing and investigation it appears that many PDF viewers
      already have a workaround to invert Adobe CMYK JPEGs, so our generated
      PDFs display incorrectly with those viewers due to double-inversion.
      Further investigation will be needed to find a better solution that
      doesn't cause regression for some PDF viewers; perhaps PDF viewers that
      lack this inversion workaround should be changed to include it.  For now
      we'll drop the patch to avoid shipping the regression in 1.16.0.
      This reverts commit b207a932.
      Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97612
      Fixes: #156
  16. 13 Jun, 2018 1 commit
  17. 07 May, 2018 1 commit
  18. 03 Apr, 2018 1 commit
  19. 26 Nov, 2017 1 commit
    • Adrian Johnson's avatar
      pdf: fix some annotation bugs · a7091971
      Adrian Johnson authored
      - each annotation was emitted on every page instead of just the page
        that contains the annotation
      - the document structure did not correctly link to annotation objects
      - fix some annotation related memory leaks
  20. 09 Nov, 2017 3 commits
    • Adrian Johnson's avatar
      pdf: fix mime-unique-id jpeg attached to recording test · d5cb4501
      Adrian Johnson authored
      - Restructure the emit_surface code so that mime types are checked first.
      - Add a test parameter to emit_surface to test if the surface will be emitted
        as an image or recording instead checking the surface type as the attached
        mime may override this.
      - Mark surface as not clear when mime is attached to avoid optimizing away
        "clear" surfaces that have mime attached.
      - Include entire surface in analysis if mime attached (also fixes bug with
        calculating the extents CONTENT_COLOR surfaces)
    • Adrian Johnson's avatar
      pdf: fix mime-unique-id unbounded recording test · bff47b43
      Adrian Johnson authored
      PDF XObjects need to specify the bounding box. Emit unbounded surfaces
      when finishing as at this point the extents of all uses of the
      unbounded surface are known.
    • Adrian Johnson's avatar
      pdf: fix mime-unique-id bounded recording test · cf9a0703
      Adrian Johnson authored
      The embedded bounded recording surface was being clipped to the
      extents of its first use.
  21. 24 Oct, 2017 2 commits
  22. 23 Oct, 2017 1 commit
  23. 21 Oct, 2017 2 commits
    • Adrian Johnson's avatar
      Allow mime image to be different size to cairo image · 87dfd0c1
      Adrian Johnson authored
      Previously it was assumed the mime image size is the same as the cairo
      image surface size. When using the 1 bpp formats (CCITT, JBIG2),
      creating a cairo image of the same size will have very large memory
      requirements and in some case may exceed the pixman image size
      limits. In these cases it is useful to allow the mime image to have a
      different resolution to the cairo image and in the PDF/PS output scale
      the mime image to be the same physical size as the cairo image.
      In PDF, this is easy as all PDF images are scaled to 1x1 unit and the
      CTM is used to scale the image to the required size. The PS surface
      has been changed to also scale images to 1x1 and use the CTM to get
      the required size.
    • Adrian Johnson's avatar
      Add CCITT_FAX mime type for PDF and PS surfaces · e1a02b18
      Adrian Johnson authored
      This completes the full set of PDF/PS image filters allowing image
      data to be passed though without decompressing then recompresssing in
      a less efficient format.
      The difficulty with CCITT_FAX is it needs some decoding parameters
      that are not stored inside the image data. This is achieved by using
      an additional mime type CCITT_FAX_PARAMS that contains the params in
      key=value format.
  24. 16 Sep, 2017 1 commit
  25. 26 Aug, 2017 2 commits
    • Adrian Johnson's avatar
      pdf: use link attributes instead of dest name for cairo_pdf_surface_add_outline · 12b875ae
      Adrian Johnson authored
      In PDF outline targets are specified the same way as link targets so
      there is no need to restrict the target to dest names.
    • Adrian Johnson's avatar
      pdf: fix link positions · df37baf7
      Adrian Johnson authored
      Converting the link position from cairo to pdf coordinates requires
      the page height. Since the link may point to a different page, build
      an array of the height of each page and use the target page height for
      the conversion.
      Don't default to a [0,0] position if "pos" is not specified. PDF
      allows a null destination position to be specified which means don't
      change the position if the page is already displayed or show top left
      if switching to a different page. This is more useful default
      particularly for external files where the coordinates (which must be
      in PDF coordinates as we don't know the page height) of the top left
      corner may not be known.
  26. 01 Oct, 2016 6 commits
  27. 09 Sep, 2016 1 commit
    • Peter TB Brett's avatar
      Correctly decode Adobe CMYK JPEGs in PDF export · b207a932
      Peter TB Brett authored
      Adobe PhotoShop generates CMYK JPEG files with inverted CMYK.  When a
      JPEG file with this format is included in a PDF file, a `/Decode`
      array must be included to convert to "normal" CMYK.
      These JPEG files can be detected via the presence of the APP14 "Adobe"
      marker.  However, PDF viewers are not required to detect and handle
      this private marker, so it must be detected and handled (by adding a
      `/Decode`) by the PDF generator.
      Signed-Off-By: default avatarPeter TB Brett <peter.brett@livecode.com>
  28. 19 Jul, 2016 1 commit