Compare commits

..

No commits in common. "cd1406e1586feb98adc333e925ddb317cfd42732" and "a43a9d9e3229ef726c63f5781e199820046fb652" have entirely different histories.

14 changed files with 29 additions and 35 deletions

View File

@ -2,8 +2,8 @@ Changes in PDFio
================ ================
v1.2.0 (January 24, 2024) v1.2.0 (Month DD, YYYY)
------------------------- -----------------------
- Now use autoconf to configure the PDFio sources (Issue #54) - Now use autoconf to configure the PDFio sources (Issue #54)
- Added `pdfioFileCreateNumberObj` and `pdfioFileCreateStringObj` functions - Added `pdfioFileCreateNumberObj` and `pdfioFileCreateStringObj` functions

View File

@ -172,7 +172,6 @@ valgrind: testpdfio
# pdfio library # pdfio library
libpdfio.a: $(LIBOBJS) libpdfio.a: $(LIBOBJS)
echo Archiving $@... echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS) $(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@ $(RANLIB) $@
@ -227,7 +226,7 @@ ttf.o: ttf.h
# Make documentation using Codedoc <https://www.msweet.org/codedoc> # Make documentation using Codedoc <https://www.msweet.org/codedoc>
DOCFLAGS = \ DOCFLAGS = \
--author "Michael R Sweet" \ --author "Michael R Sweet" \
--copyright "Copyright (c) 2021-2024 by Michael R Sweet" \ --copyright "Copyright (c) 2021-2023 by Michael R Sweet" \
--docversion $(PDFIO_VERSION) --docversion $(PDFIO_VERSION)
.PHONY: doc .PHONY: doc

2
NOTICE
View File

@ -1,6 +1,6 @@
PDFio - PDF Read/Write Library PDFio - PDF Read/Write Library
Copyright © 2021-2024 by Michael R Sweet. Copyright © 2021-2023 by Michael R Sweet.
(Optional) Exceptions to the Apache 2.0 License: (Optional) Exceptions to the Apache 2.0 License:
================================================ ================================================

View File

@ -89,7 +89,7 @@ generates a static library that will be installed under "/usr/local" with:
Legal Stuff Legal Stuff
----------- -----------
PDFio is Copyright © 2021-2024 by Michael R Sweet. PDFio is Copyright © 2021-2023 by Michael R Sweet.
This software is licensed under the Apache License Version 2.0 with an This software is licensed under the Apache License Version 2.0 with an
(optional) exception to allow linking against GPL2/LGPL2 software. See the (optional) exception to allow linking against GPL2/LGPL2 software. See the

View File

@ -54,7 +54,7 @@ starting at 0. A feature release has a "PATCH" value of 0, for example:
1.1.0 1.1.0
2.0.0 2.0.0
Beta releases and release candidates are *not* production releases and use Beta releases and release candidates are *not* prodution releases and use
semantic version numbers of the form: semantic version numbers of the form:
MAJOR.MINORbNUMBER MAJOR.MINORbNUMBER

View File

@ -1,7 +1,7 @@
dnl dnl
dnl Configuration script for PDFio dnl Configuration script for PDFio
dnl dnl
dnl Copyright © 2023-2024 by Michael R Sweet dnl Copyright © 2023 by Michael R Sweet
dnl dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information. dnl information.
@ -105,8 +105,8 @@ dnl ZLIB
AC_MSG_CHECKING([for zlib via pkg-config]) AC_MSG_CHECKING([for zlib via pkg-config])
AS_IF([$PKGCONFIG --exists zlib], [ AS_IF([$PKGCONFIG --exists zlib], [
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
CPPFLAGS="$($PKGCONFIG --cflags zlib) $CPPFLAGS"
LIBS="$($PKGCONFIG --libs zlib) $LIBS" LIBS="$($PKGCONFIG --libs zlib) $LIBS"
CPPFLAGS="$($PKGCONFIG --cflags zlib) $CPPFLAGS"
],[ ],[
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
AC_CHECK_HEADER([zlib.h]) AC_CHECK_HEADER([zlib.h])
@ -116,7 +116,6 @@ AS_IF([$PKGCONFIG --exists zlib], [
AC_MSG_ERROR([Sorry, this software requires zlib 1.1 or higher.]) AC_MSG_ERROR([Sorry, this software requires zlib 1.1 or higher.])
]) ])
PKGCONFIG_REQUIRES=""
PKGCONFIG_LIBS_PRIVATE="-lz $PKGCONFIG_LIBS_PRIVATE" PKGCONFIG_LIBS_PRIVATE="-lz $PKGCONFIG_LIBS_PRIVATE"
]) ])

View File

@ -1,4 +1,4 @@
.TH pdfio 3 "pdf read/write library" "2024-01-24" "pdf read/write library" .TH pdfio 3 "pdf read/write library" "2023-12-05" "pdf read/write library"
.SH NAME .SH NAME
pdfio \- pdf read/write library pdfio \- pdf read/write library
.SH Introduction .SH Introduction
@ -34,7 +34,7 @@ PDFio is
.I not .I not
concerned with rendering or viewing a PDF file, although a PDF RIP or viewer could be written using it. concerned with rendering or viewing a PDF file, although a PDF RIP or viewer could be written using it.
.PP .PP
PDFio is Copyright \[co] 2021\-2024 by Michael R Sweet and is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software. See the files "LICENSE" and "NOTICE" for more information. PDFio is Copyright \[co] 2021\-2023 by Michael R Sweet and is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software. See the files "LICENSE" and "NOTICE" for more information.
.SS Requirements .SS Requirements
.PP .PP
PDFio requires the following to build the software: PDFio requires the following to build the software:
@ -3087,4 +3087,4 @@ typedef enum pdfio_valtype_e pdfio_valtype_t;
Michael R Sweet Michael R Sweet
.SH COPYRIGHT .SH COPYRIGHT
.PP .PP
Copyright (c) 2021-2024 by Michael R Sweet Copyright (c) 2021-2023 by Michael R Sweet

View File

@ -6,7 +6,7 @@
<meta name="generator" content="codedoc v3.7"> <meta name="generator" content="codedoc v3.7">
<meta name="author" content="Michael R Sweet"> <meta name="author" content="Michael R Sweet">
<meta name="language" content="en-US"> <meta name="language" content="en-US">
<meta name="copyright" content="Copyright © 2021-2024 by Michael R Sweet"> <meta name="copyright" content="Copyright © 2021-2023 by Michael R Sweet">
<meta name="version" content="1.2.0"> <meta name="version" content="1.2.0">
<style type="text/css"><!-- <style type="text/css"><!--
body { body {
@ -247,7 +247,7 @@ span.string {
<p><img class="title" src="pdfio-512.png"></p> <p><img class="title" src="pdfio-512.png"></p>
<h1 class="title">PDFio Programming Manual v1.2.0</h1> <h1 class="title">PDFio Programming Manual v1.2.0</h1>
<p>Michael R Sweet</p> <p>Michael R Sweet</p>
<p>Copyright © 2021-2024 by Michael R Sweet</p> <p>Copyright © 2021-2023 by Michael R Sweet</p>
</div> </div>
<div class="contents"> <div class="contents">
<h2 class="title">Contents</h2> <h2 class="title">Contents</h2>
@ -501,7 +501,7 @@ span.string {
</li> </li>
</ul> </ul>
<p>PDFio is <em>not</em> concerned with rendering or viewing a PDF file, although a PDF RIP or viewer could be written using it.</p> <p>PDFio is <em>not</em> concerned with rendering or viewing a PDF file, although a PDF RIP or viewer could be written using it.</p>
<p>PDFio is Copyright © 2021-2024 by Michael R Sweet and is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software. See the files &quot;LICENSE&quot; and &quot;NOTICE&quot; for more information.</p> <p>PDFio is Copyright © 2021-2023 by Michael R Sweet and is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software. See the files &quot;LICENSE&quot; and &quot;NOTICE&quot; for more information.</p>
<h3 class="title" id="requirements">Requirements</h3> <h3 class="title" id="requirements">Requirements</h3>
<p>PDFio requires the following to build the software:</p> <p>PDFio requires the following to build the software:</p>
<ul> <ul>

View File

@ -15,7 +15,7 @@ goals of pdfio are:
PDFio is *not* concerned with rendering or viewing a PDF file, although a PDF PDFio is *not* concerned with rendering or viewing a PDF file, although a PDF
RIP or viewer could be written using it. RIP or viewer could be written using it.
PDFio is Copyright © 2021-2024 by Michael R Sweet and is licensed under the PDFio is Copyright © 2021-2023 by Michael R Sweet and is licensed under the
Apache License Version 2.0 with an (optional) exception to allow linking against Apache License Version 2.0 with an (optional) exception to allow linking against
GPL2/LGPL2 software. See the files "LICENSE" and "NOTICE" for more information. GPL2/LGPL2 software. See the files "LICENSE" and "NOTICE" for more information.

View File

@ -1131,20 +1131,20 @@ pdfioContentTextMeasure(
if (ch < 128) if (ch < 128)
{ {
// ASCII // ASCII
*tempptr++ = (char)ch; *tempptr++ = ch;
} }
else if (ch < 2048) else if (ch < 2048)
{ {
// 2-byte UTF-8 // 2-byte UTF-8
*tempptr++ = (char)(0xc0 | ((ch >> 6) & 0x1f)); *tempptr++ = 0xc0 | ((ch >> 6) & 0x1f);
*tempptr++ = (char)(0x80 | (ch & 0x3f)); *tempptr++ = 0x80 | (ch & 0x3f);
} }
else else
{ {
// 3-byte UTF-8 // 3-byte UTF-8
*tempptr++ = (char)(0xe0 | ((ch >> 12) & 0x0f)); *tempptr++ = 0xe0 | ((ch >> 12) & 0x0f);
*tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *tempptr++ = 0x80 | ((ch >> 6) & 0x3f);
*tempptr++ = (char)(0x80 | (ch & 0x3f)); *tempptr++ = 0x80 | (ch & 0x3f);
} }
} }
@ -1152,7 +1152,7 @@ pdfioContentTextMeasure(
s = temp; s = temp;
} }
ttfGetExtents(ttf, (float)size, s, &extents); ttfGetExtents(ttf, size, s, &extents);
return (extents.right - extents.left); return (extents.right - extents.left);
} }
@ -1642,7 +1642,7 @@ pdfioFileCreateFontObjFromFile(
*bufptr++ = (unsigned char)(cmap[i] >> 8); *bufptr++ = (unsigned char)(cmap[i] >> 8);
*bufptr++ = (unsigned char)(cmap[i] & 255); *bufptr++ = (unsigned char)(cmap[i] & 255);
glyphs[cmap[i]] = (unsigned short)i; glyphs[cmap[i]] = i;
if (cmap[i] < min_glyph) if (cmap[i] < min_glyph)
min_glyph = cmap[i]; min_glyph = cmap[i];
if (cmap[i] > max_glyph) if (cmap[i] > max_glyph)
@ -1727,9 +1727,9 @@ pdfioFileCreateFontObjFromFile(
if ((w_array = pdfioArrayCreate(pdf)) == NULL) if ((w_array = pdfioArrayCreate(pdf)) == NULL)
goto done; goto done;
for (start = 0, w0 = ttfGetWidth(font, 0), w1 = 0, i = 1; i < 65536; start = i, w0 = w1, i ++) for (start = 0, w0 = ttfGetWidth(font, 0), i = 1; i < 65536; start = i, w0 = w1, i ++)
{ {
while (i < 65536 && (w1 = ttfGetWidth(font, (int)i)) == w0) while (i < 65536 && (w1 = ttfGetWidth(font, i)) == w0)
i ++; i ++;
if ((i - start) > 1) if ((i - start) > 1)
@ -1750,7 +1750,7 @@ pdfioFileCreateFontObjFromFile(
pdfioArrayAppendNumber(temp_array, w0); pdfioArrayAppendNumber(temp_array, w0);
for (w0 = w1, i ++; i < 65536; w0 = w1, i ++) for (w0 = w1, i ++; i < 65536; w0 = w1, i ++)
{ {
if ((w1 = ttfGetWidth(font, (int)i)) == w0 && i < 65535) if ((w1 = ttfGetWidth(font, i)) == w0 && i < 65535)
break; break;
pdfioArrayAppendNumber(temp_array, w0); pdfioArrayAppendNumber(temp_array, w0);

View File

@ -138,10 +138,6 @@ _pdfioValueDecrypt(pdfio_file_t *pdf, // I - PDF file
switch (v->type) switch (v->type)
{ {
default :
// Do nothing
break;
case PDFIO_VALTYPE_ARRAY : case PDFIO_VALTYPE_ARRAY :
return (_pdfioArrayDecrypt(pdf, obj, v->value.array, depth + 1)); return (_pdfioArrayDecrypt(pdf, obj, v->value.array, depth + 1));
break; break;

View File

@ -13,7 +13,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>PDFio Library for VS2019+</description> <description>PDFio Library for VS2019+</description>
<summary>PDFio is a simple C library for reading and writing PDF files. PDFio is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GNU GPL2-only software.</summary> <summary>PDFio is a simple C library for reading and writing PDF files. PDFio is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GNU GPL2-only software.</summary>
<copyright>Copyright © 2019-2024 by Michael R Sweet</copyright> <copyright>Copyright © 2019-2023 by Michael R Sweet</copyright>
<tags>pdf file native</tags> <tags>pdf file native</tags>
<dependencies> <dependencies>
<dependency id="pdfio_native.redist" version="1.2.0" /> <dependency id="pdfio_native.redist" version="1.2.0" />

View File

@ -13,7 +13,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>PDFio Library for VS2019+</description> <description>PDFio Library for VS2019+</description>
<summary>PDFio is a simple C library for reading and writing PDF files. This package provides the redistributable content for the PDFio library. PDFio is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GNU GPL2-only software.</summary> <summary>PDFio is a simple C library for reading and writing PDF files. This package provides the redistributable content for the PDFio library. PDFio is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GNU GPL2-only software.</summary>
<copyright>Copyright © 2019-2024 by Michael R Sweet</copyright> <copyright>Copyright © 2019-2023 by Michael R Sweet</copyright>
<tags>pdf file native</tags> <tags>pdf file native</tags>
<dependencies> <dependencies>
<dependency id="zlib_native.redist" version="1.2.11" /> <dependency id="zlib_native.redist" version="1.2.11" />

2
ttf.c
View File

@ -1307,7 +1307,7 @@ read_cmap(ttf_t *font) // I - Font
{ {
// Use an "obscure indexing trick" (words from the spec, not // Use an "obscure indexing trick" (words from the spec, not
// mine) to look up the glyph index... // mine) to look up the glyph index...
temp = (int)(segment->idRangeOffset / 2 - segCount + (ch - segment->startCode) + (segment - segments)); temp = segment->idRangeOffset / 2 - segCount + (ch - segment->startCode) + (segment - segments);
TTF_DEBUG("read_cmap: ch=%d, temp=%d\n", ch, temp); TTF_DEBUG("read_cmap: ch=%d, temp=%d\n", ch, temp);
if (temp < 0 || temp >= numGlyphIdArray) if (temp < 0 || temp >= numGlyphIdArray)