Patch level : 10.0

Files correlati     : pdflib
Ricompilazione Demo : [ ]
Commento            :
Aggiornata pdflib.dll alla versione 7.0.4


git-svn-id: svn://10.65.10.50/trunk@18580 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-03-23 08:55:58 +00:00
parent 572e2ffc34
commit 3bf951f42c
208 changed files with 1951 additions and 955 deletions

View File

@ -3,8 +3,8 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $Id: adler32.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: adler32.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: adler32.c,v 1.4 2009-03-23 08:51:16 guy Exp $ */
/* @(#) $Id: adler32.c,v 1.4 2009-03-23 08:51:16 guy Exp $ */
#define ZLIB_INTERNAL
#include "zlib.h"

View File

@ -3,8 +3,8 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $Id: compress.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: compress.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: compress.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: compress.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#define ZLIB_INTERNAL
#include "zlib.h"

View File

@ -9,8 +9,8 @@
* factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
*/
/* $Id: crc32.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: crc32.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: crc32.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: crc32.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/*
Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore

View File

@ -47,8 +47,8 @@
*
*/
/* $Id: deflate.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: deflate.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: deflate.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: deflate.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#include "deflate.h"
@ -284,10 +284,13 @@ int ZEXPORT deflateInit2_(
s->hash_mask = s->hash_size - 1;
s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
/* PDFlib GmbH Bug #1707: increase the buffer size by 2x2 bytes to
* avoid problems with memory access beyond the end in the assembler code
*/
s->window = (Bytef *) ZALLOC(strm, 2+s->w_size, 2*sizeof(Byte));
/* we don't use calloc -> to satisfy purify
* at least here memset is needed */
memset((void *)s->window, 0, (size_t) s->w_size * 2*sizeof(Byte));
memset((void *)s->window, 0, (size_t) (2+s->w_size) * 2*sizeof(Byte));
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));

View File

@ -9,9 +9,9 @@
*/
/* $Id: deflate.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: deflate.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: deflate.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: deflate.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#ifndef DEFLATE_H
#define DEFLATE_H

View File

@ -2,7 +2,7 @@
* Copyright (C) 1995-2004 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $Id: inffast.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: inffast.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#include "zutil.h"
#include "inftrees.h"

View File

@ -79,7 +79,7 @@
*
* The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
*/
/* $Id: inflate.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: inflate.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#include "zutil.h"
#include "inftrees.h"

View File

@ -2,7 +2,7 @@
* Copyright (C) 1995-2005 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $Id: inftrees.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: inftrees.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#include "zutil.h"
#include "inftrees.h"

View File

@ -29,8 +29,8 @@
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/
/* $Id: trees.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: trees.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: trees.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: trees.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* #define GEN_TREES_H */

View File

@ -1,7 +1,7 @@
/* header created automatically with -DGEN_TREES_H */
/* $Id: trees.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: trees.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
local const ct_data static_ltree[L_CODES+2] = {
{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},

View File

@ -3,8 +3,8 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $Id: uncompr.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: uncompr.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: uncompr.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: uncompr.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#define ZLIB_INTERNAL
#include "zlib.h"

View File

@ -4,8 +4,8 @@
*/
/* $Id: zconf.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: zconf.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: zconf.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: zconf.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#ifndef ZCONF_H
#define ZCONF_H

View File

@ -29,7 +29,7 @@
*/
/* $Id: zlib.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: zlib.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#ifndef ZLIB_H
#define ZLIB_H

View File

@ -1,4 +1,4 @@
/* $Id: zprefix.h,v 1.2 2008-10-20 14:14:35 guy Exp $ */
/* $Id: zprefix.h,v 1.3 2009-03-23 08:51:17 guy Exp $ */
/*
* If you *really* need a unique prefix for all types and library functions,

View File

@ -3,8 +3,8 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $Id: zutil.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: zutil.c,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: zutil.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: zutil.c,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#include "zutil.h"

View File

@ -9,8 +9,8 @@
*/
/* $Id: zutil.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* @(#) $Id: zutil.h,v 1.3 2008-10-20 14:14:35 guy Exp $ */
/* $Id: zutil.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
/* @(#) $Id: zutil.h,v 1.4 2009-03-23 08:51:17 guy Exp $ */
#ifndef ZUTIL_H
#define ZUTIL_H

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_cid.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_cid.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT CID functions
*
@ -57,17 +57,17 @@ static const fnt_cmap_info fnt_predefined_cmaps[] =
{ "GBK-EUC-V", cc_simplified_chinese, 0, PDC_1_3, 2, 2, 2, 2, 1},
{ "GBKp-EUC-H", cc_simplified_chinese, 0, PDC_1_4, 0, 2, 2, 2, 0},
{ "GBKp-EUC-V", cc_simplified_chinese, 0, PDC_1_4, 0, 2, 2, 2, 1},
{ "GBK2K-H", cc_simplified_chinese, 0, PDC_1_4, 0, 4, 4, 4, 0},
{ "GBK2K-V", cc_simplified_chinese, 0, PDC_1_4, 0, 4, 4, 4, 1},
{ "GBK2K-H", cc_simplified_chinese, 0, PDC_1_4, 0, 4, 4, 5, 0},
{ "GBK2K-V", cc_simplified_chinese, 0, PDC_1_4, 0, 4, 4, 5, 1},
{ "UniGB-UCS2-H", cc_simplified_chinese, 2, PDC_1_3, 2, 4, 4, 4, 0},
{ "UniGB-UCS2-V", cc_simplified_chinese, 2, PDC_1_3, 2, 4, 4, 4, 1},
{ "UniGB-UTF16-H", cc_simplified_chinese, 2, PDC_1_5, 0, 0, 4, 4, 0},
{ "UniGB-UTF16-V", cc_simplified_chinese, 2, PDC_1_5, 0, 0, 4, 4, 1},
{ "UniGB-UTF16-H", cc_simplified_chinese, 2, PDC_1_5, 0, 0, 4, 5, 0},
{ "UniGB-UTF16-V", cc_simplified_chinese, 2, PDC_1_5, 0, 0, 4, 5, 1},
{ "B5pc-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0},
{ "B5pc-V", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1},
{ "HKscs-B5-H", cc_traditional_chinese, 0, PDC_1_4, 0, 3, 3, 3, 0},
{ "HKscs-B5-V", cc_traditional_chinese, 0, PDC_1_4, 0, 3, 3, 3, 1},
{ "HKscs-B5-H", cc_traditional_chinese, 0, PDC_1_4, 0, 3, 3, 5, 0},
{ "HKscs-B5-V", cc_traditional_chinese, 0, PDC_1_4, 0, 3, 3, 5, 1},
{ "ETen-B5-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0},
{ "ETen-B5-V", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1},
{ "ETenms-B5-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0},
@ -94,7 +94,7 @@ static const fnt_cmap_info fnt_predefined_cmaps[] =
{ "Identity-H", cc_identity, 0, PDC_1_3, 0, 0, 0, 0, 0},
{ "Identity-V", cc_identity, 0, PDC_1_3, 0, 0, 0, 0, 1},
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0},
{ NULL, cc_none, 0, 0, 0, 0, 0, 0, 0},
};
static int
@ -246,8 +246,11 @@ fnt_get_maxcid(int charcoll, int supplement)
return 22352;
case 4:
default:
return 29063;
case 5:
default:
return 30283;
}
case cc_traditional_chinese:
@ -266,8 +269,11 @@ fnt_get_maxcid(int charcoll, int supplement)
return 18845;
case 4:
default:
return 18964;
case 5:
default:
return 19087;
}
case cc_korean:

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_cid.h,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_cid.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* CID data structures
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_corefont.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_corefont.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT in-core and basic font metric functions
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_corefont.h,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_corefont.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* This file contains the metric for the base and
* pre-installed CID fonts of PDF
@ -2617,7 +2617,8 @@ static const char *fnt_cid_width_arrays[] =
"814 939 500\n"
"7712[517 684 723]\n"
"7716[500]\n"
"22353[462 462 500 500 500]\n",
"22353[462 462 500 500 500]\n"
"29064 30283 550\n",
/*------------------------------------------------------------------------*/

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_font.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_font.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT basic font functions
*
@ -425,24 +425,35 @@ fnt_check_weight(int weight)
static const pdc_keyconn fnt_fontweight_keylist[] =
{
{"none", FNT_FW_DONTCARE},
{"thin", FNT_FW_THIN},
{"extralight", FNT_FW_EXTRALIGHT},
{"ultralight", FNT_FW_ULTRALIGHT},
{"light", FNT_FW_LIGHT},
{"normal", FNT_FW_NORMAL},
{"regular", FNT_FW_REGULAR},
{"None", FNT_FW_DONTCARE},
{"Thin", FNT_FW_THIN},
{"Extralight", FNT_FW_EXTRALIGHT},
{"Ultralight", FNT_FW_ULTRALIGHT},
{"Light", FNT_FW_LIGHT},
{"Normal", FNT_FW_NORMAL},
{"Regular", FNT_FW_REGULAR},
{"", FNT_FW_REGULAR},
{"medium", FNT_FW_MEDIUM},
{"semibold", FNT_FW_SEMIBOLD},
{"semi", FNT_FW_SEMIBOLD},
{"demibold", FNT_FW_DEMIBOLD},
{"bold", FNT_FW_BOLD},
{"extrabold", FNT_FW_EXTRABOLD},
{"extra", FNT_FW_EXTRABOLD},
{"ultrabold", FNT_FW_ULTRABOLD},
{"heavy", FNT_FW_HEAVY},
{"black", FNT_FW_BLACK},
{"Medium", FNT_FW_MEDIUM},
{"Semibold", FNT_FW_SEMIBOLD},
{"Semi", FNT_FW_SEMIBOLD},
{"Demibold", FNT_FW_DEMIBOLD},
{"Bold", FNT_FW_BOLD},
{"Extrabold", FNT_FW_EXTRABOLD},
{"Extra", FNT_FW_EXTRABOLD},
{"Ultrabold", FNT_FW_ULTRABOLD},
{"Heavy", FNT_FW_HEAVY},
{"Black", FNT_FW_BLACK},
{"0", FNT_FW_DONTCARE},
{"100", FNT_FW_THIN},
{"200", FNT_FW_EXTRALIGHT},
{"300", FNT_FW_LIGHT},
{"400", FNT_FW_NORMAL},
{"500", FNT_FW_MEDIUM},
{"600", FNT_FW_SEMIBOLD},
{"700", FNT_FW_BOLD},
{"800", FNT_FW_EXTRABOLD},
{"900", FNT_FW_BLACK},
{NULL, 0}
};

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_font.h,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_font.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Header file for font handling
*
@ -77,7 +77,10 @@
#define FNT_SMALLCAPS (long) (1L<<17)
#define FNT_FORCEBOLD (long) (1L<<18)
#define FNT_FI_ITALIC 255
#define FNT_FI_ITALICNAME "Italic"
#define FNT_DEF_ITALICANGLE -12 /* default italic angle */
#define FNT_MISSING_FONTVAL PDC_SHRT_MIN /* missing font value */
/* start sequence of PFA files */

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_generr.h,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_generr.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT error messages
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_hostfont.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_hostfont.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT host font handling routines for Windows and Mac
*

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: ft_pdffont.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_pdffont.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Routine for parsing font dictionaries in PDF files by pCOS
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_pdffont.h,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_pdffont.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Header file for parsing font dictionaries in PDF files
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_truetype.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_truetype.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT TrueType handling routines
*
@ -496,20 +496,22 @@ tt_get_tab_cmap(tt_file *ttf)
}
/*
* platformID: 0 encodingID: 3 tableFormat: 4 (old mac)
* platformID: 3 encodingID: 0/1 tableFormat: 4 preferred!
* platformID: 0 encodingID: 3 tableFormat: 4 (old mac)
* platformID: 3 encodingID: 0/1/4 tableFormat: 4 preferred!
*/
else if (tableFormat == 4 &&
((platformID == tt_pfid_win &&
(encodingID == tt_wenc_symbol ||
encodingID == tt_wenc_text)) ||
encodingID == tt_wenc_text ||
encodingID == tt_wenc_big5)) ||
(platformID == tt_pfid_uni &&
encodingID == tt_wenc_mtext)))
{
if (tp->win == (tt_cmap4 *) 0 ||
(tp->win != (tt_cmap4 *) 0 &&
tp->win->encodingID == tt_wenc_mtext &&
encodingID < tt_wenc_mtext))
((tp->win->encodingID == tt_wenc_mtext ||
tp->win->encodingID == tt_wenc_big5) &&
encodingID < tt_wenc_mtext)))
{
if (tp->win != (tt_cmap4 *) 0)
tt_cleanup_cmap4(ttf, tp->win);
@ -538,7 +540,7 @@ tt_get_tab_cmap(tt_file *ttf)
ttf->issymbol = (tp->win && tp->win->encodingID == tt_wenc_symbol) ?
pdc_true : pdc_false;
/* has Unicode cmap */
/* has Unicode/CMap cmap */
ttf->haswinuni = (!ttf->issymbol && (tp->win || tp->ucs4)) ?
pdc_true : pdc_false;
@ -573,6 +575,7 @@ tt_get_tab_cmap(tt_file *ttf)
}
else
{
ttf->hasbig5cmap = tp->win->encodingID == tt_wenc_big5;
tp->encoding = tt_wenc_text;
tp->format = tp->win->format;
tp->offset = offset_win;
@ -586,6 +589,9 @@ tt_get_tab_cmap(tt_file *ttf)
tp->platform, tp->encoding, tp->format,
ttf->issymbol ? "symbol" : "text");
if (ttf->hasbig5cmap)
pdc_logg_cond(ttf->pdc, 1, trc_font, "\t\tCID font with Big5 cmap\n");
/* for subsetting and symbolic font:
* tp->platform = tt_pfid_mac according PDF specification
* otherwise GS will emit an error message
@ -1118,7 +1124,8 @@ tt_get_tab_OS_2(tt_file *ttf)
for (i = 0; i < PDC_NUMCHARCOLL; i++)
{
j = i + 17;
if (tp->ulCodePageRange1 & (1<<j))
if (tp->ulCodePageRange1 & (1<<j) || (ttf->hasbig5cmap &&
tt_cpflag2charcoll[i] == cc_traditional_chinese))
tp->charcolls[i] = tt_cpflag2charcoll[i];
else
tp->charcolls[i] = cc_none;
@ -1241,7 +1248,7 @@ tt_get_tab_post(tt_file *ttf)
tp->maxMemType42 = tt_get_ulong(ttf);
tp->minMemType1 = tt_get_ulong(ttf);
tp->maxMemType1 = tt_get_ulong(ttf);
tp->numberOfGlyphs = ttf->numGlyphs;
/* there are subset fonts with different number of glyphs
* see bug #1418
@ -1443,22 +1450,43 @@ tt_unicode2gidx(tt_file *ttf, int usv, pdc_bool logg)
pdc_core *pdc = ttf->pdc;
tt_cmap4 *cm4 = ttf->tab_cmap->win;
pdc_ushort uv;
int segs;
int gidx = 0;
int i;
int lo, hi, segs;
int gidx = 0, i = 0;
uv = (pdc_ushort) usv;
if (logg) pdc_logg(pdc, "\t\t\tU+%04X: ", uv);
if (logg) pdc_logg(pdc, "\t\t\tUCS2: %04X: ", uv);
segs = cm4->segCountX2 / 2;
for (i = 0; i < segs; ++i)
if (uv <= cm4->endCount[i])
break;
lo = 0;
hi = segs;
while (lo < hi)
{
i = (lo + hi) / 2;
if (logg) pdc_logg(pdc, "i=%d start=U+%04X ", i, cm4->startCount[i]);
if (uv <= cm4->endCount[i])
{
if (uv >= cm4->startCount[i])
{
break;
}
else if (!i || uv > cm4->endCount[i - 1])
{
i = -1;
break;
}
}
if (uv < cm4->startCount[i])
hi = i;
else
lo = i + 1;
}
if (logg) pdc_logg(pdc, "i=%d start=UCS2: %04X ", i, cm4->startCount[i]);
TT_IOCHECK(ttf, i != segs);
if (uv < cm4->startCount[i] || uv == 0xFFFF)
if (i == -1 || uv == 0xFFFF)
{
if (logg) pdc_logg(pdc, "==> gidx=0\n");
return 0;
@ -1534,12 +1562,16 @@ tt_gidx2width(tt_file *ttf, int gidx)
void
fnt_set_tt_fontvalues(tt_file *ttf)
{
pdc_bool logg3 = pdc_logg_is_enabled(ttf->pdc, 3, trc_font);
fnt_font *font = ttf->font;
fnt_font_metric *ftm = &font->m;
if (ttf->onlyCFF)
return;
if (logg3)
pdc_logg(ttf->pdc, "\tUnits per EM: %d\n", ttf->tab_head->unitsPerEm);
if (ttf->tab_head)
{
ftm->llx = FNT_TT2PDF(ttf->tab_head->xMin);
@ -2200,6 +2232,7 @@ fnt_check_tt_font(pdc_core *pdc, const char *filename, const char *fontname,
* ttf->kerning = pdc_true;
* ttf->vertical = pdc_true;
* ttf->ignorename = pdc_true;
* ttf->cmst = ~NULL;
* ttf->fortet = pdc_true;
*
* ttf->check = pdc_true;
@ -2261,6 +2294,7 @@ fnt_new_tt(pdc_core *pdc, fnt_font *font)
ttf->issymbol = pdc_false;
ttf->haswinuni = pdc_false;
ttf->hasonlymac = pdc_false;
ttf->hasbig5cmap = pdc_false;
ttf->forcesubset = pdc_false;
ttf->gidunequcid = pdc_false;

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_truetype.h,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_truetype.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT TrueType typedefs, structures, and enums
*
@ -145,7 +145,9 @@ typedef enum
{
tt_wenc_symbol = 0,
tt_wenc_text = 1,
tt_wenc_sjis = 2,
tt_wenc_mtext = 3,
tt_wenc_big5 = 4,
tt_wenc_utext = 10
} tt_win_encoding_id;
@ -459,10 +461,11 @@ typedef struct
pdc_bool issymbol; /* symbol font */
pdc_bool haswinuni; /* has a "Microsoft standard character
* to glyph index mapping table"
* cmap (3, 1) format 4 or
* cmap (3, 1, 4) format 4 or
* cmap (3,10) format 12 or
* cmap (0, 3) format 4 (mac old case) */
pdc_bool hasonlymac; /* has only macroman cmap (0,1) */
pdc_bool hasbig5cmap; /* has Big5 cmap cmap (3,4) */
pdc_bool forcesubset; /* subset will be forced to set unique cmap */
pdc_bool gidunequcid; /* GID != SID */

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: ft_type1.c,v 1.2 2008-10-20 14:33:17 guy Exp $
/* $Id: ft_type1.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* FONT Type1 font handling routines
*

View File

@ -8,7 +8,7 @@
#undef void
#undef const
#undef CHAR_IS_UNSIGNED
#define HAVE_STDDEF_H
/* #define HAVE_STDDEF_H PDFlib not needed */
#ifndef HAVE_STDLIB_H
#define HAVE_STDLIB_H
#endif
@ -19,6 +19,19 @@
/* Define this if you get warnings about undefined structures. */
#undef INCOMPLETE_TYPES_BROKEN
/* PDFlib GmbH: Avoid the the following message:
*
* "JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,
caller expects 464"
*/
#if defined(WIN32) && !defined(HAVE_BOOLEAN)
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#endif /* WIN32 */
#ifdef JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
@ -50,6 +63,8 @@
* PDFlib GmbH: overrides define in jmemmgr.c
* Otherwise program crashes because of not aligned pointers
*/
#define NO_GETENV /* RJS makes problems in windows debug builds */
#if defined __ILEC400__ && !defined AS400
#define AS400
#endif
@ -63,107 +78,115 @@
* PDFlib GmbH: we allow the use of PDFlib inside of programs using
* another instance of libjpeg
*/
#define jpeg_abort_compress pdf_jpeg_abort_compress
#define jpeg_CreateCompress pdf_jpeg_CreateCompress
#define jpeg_destroy_compress pdf_jpeg_destroy_compress
#define jpeg_finish_compress pdf_jpeg_finish_compress
#define jpeg_suppress_tables pdf_jpeg_suppress_tables
#define jpeg_write_marker pdf_jpeg_write_marker
#define jpeg_write_m_byte pdf_jpeg_write_m_byte
#define jpeg_write_m_header pdf_jpeg_write_m_header
#define jpeg_write_tables pdf_jpeg_write_tables
#define jpeg_start_compress pdf_jpeg_start_compress
#define jpeg_write_raw_data pdf_jpeg_write_raw_data
#define jpeg_write_scanlines pdf_jpeg_write_scanlines
#define jinit_c_coef_controller pdf_jinit_c_coef_controller
#define jinit_color_converter pdf_jinit_color_converter
#define jinit_forward_dct pdf_jinit_forward_dct
#define jinit_huff_encoder pdf_jinit_huff_encoder
#define jpeg_gen_optimal_table pdf_jpeg_gen_optimal_table
#define jpeg_make_c_derived_tbl pdf_jpeg_make_c_derived_tbl
#define jinit_compress_master pdf_jinit_compress_master
#define jinit_c_main_controller pdf_jinit_c_main_controller
#define jinit_marker_writer pdf_jinit_marker_writer
#define jinit_c_master_control pdf_jinit_c_master_control
#define jpeg_abort pdf_jpeg_abort
#define jpeg_alloc_huff_table pdf_jpeg_alloc_huff_table
#define jpeg_alloc_quant_table pdf_jpeg_alloc_quant_table
#define jpeg_destroy pdf_jpeg_destroy
#define jpeg_add_quant_table pdf_jpeg_add_quant_table
#define jpeg_default_colorspace pdf_jpeg_default_colorspace
#define jpeg_quality_scaling pdf_jpeg_quality_scaling
#define jpeg_set_colorspace pdf_jpeg_set_colorspace
#define jpeg_set_defaults pdf_jpeg_set_defaults
#define jpeg_set_linear_quality pdf_jpeg_set_linear_quality
#define jpeg_set_quality pdf_jpeg_set_quality
#define jpeg_simple_progression pdf_jpeg_simple_progression
#define jinit_phuff_encoder pdf_jinit_phuff_encoder
#define jinit_c_prep_controller pdf_jinit_c_prep_controller
#define jinit_downsampler pdf_jinit_downsampler
#define jpeg_copy_critical_parameters pdf_jpeg_copy_critical_param
#define jpeg_write_coefficients pdf_jpeg_write_coefficients
#define jpeg_abort_decompress pdf_jpeg_abort_decompress
#define jpeg_consume_input pdf_jpeg_consume_input
#define jpeg_CreateDecompress pdf_jpeg_CreateDecompress
#define jpeg_destroy_decompress pdf_jpeg_destroy_decompress
#define jpeg_finish_decompress pdf_jpeg_finish_decompress
#define jpeg_has_multiple_scans pdf_jpeg_has_multiple_scans
#define jpeg_input_complete pdf_jpeg_input_complete
#define jpeg_read_header pdf_jpeg_read_header
#define jpeg_finish_output pdf_jpeg_finish_output
#define jpeg_read_raw_data pdf_jpeg_read_raw_data
#define jpeg_read_scanlines pdf_jpeg_read_scanlines
#define jpeg_start_decompress pdf_jpeg_start_decompress
#define jpeg_start_output pdf_jpeg_start_output
#define jpeg_stdio_dest pdf_jpeg_stdio_dest
#define jpeg_stdio_src pdf_jpeg_stdio_src
#define jinit_d_coef_controller pdf_jinit_d_coef_controller
#define jinit_color_deconverter pdf_jinit_color_deconverter
#define jinit_inverse_dct pdf_jinit_inverse_dct
#define jinit_huff_decoder pdf_jinit_huff_decoder
#define jpeg_fill_bit_buffer pdf_jpeg_fill_bit_buffer
#define jpeg_huff_decode pdf_jpeg_huff_decode
#define jpeg_make_d_derived_tbl pdf_jpeg_make_d_derived_tbl
#define jpeg_reset_huff_decode pdf_jpeg_reset_huff_decode
#define jinit_input_controller pdf_jinit_input_controller
#define jinit_d_main_controller pdf_jinit_d_main_controller
#define jinit_marker_reader pdf_jinit_marker_reader
#define jpeg_resync_to_restart pdf_jpeg_resync_to_restart
#define jpeg_save_markers pdf_jpeg_save_markers
#define jpeg_set_marker_processor pdf_jpeg_set_marker_processor
#define jinit_master_decompress pdf_jinit_master_decompress
#define jpeg_calc_output_dimensions pdf_jpeg_calc_output_dimensions
#define jpeg_new_colormap pdf_jpeg_new_colormap
#define jinit_merged_upsampler pdf_jinit_merged_upsampler
#define jinit_phuff_decoder pdf_jinit_phuff_decoder
#define jinit_d_post_controller pdf_jinit_d_post_controller
#define jinit_upsampler pdf_jinit_upsampler
#define jpeg_read_coefficients pdf_jpeg_read_coefficients
#define jpeg_std_error pdf_jpeg_std_error
#define jpeg_std_message_table pdf_jpeg_std_message_table
#define jpeg_fdct_float pdf_jpeg_fdct_float
#define jpeg_fdct_ifast pdf_jpeg_fdct_ifast
#define jpeg_fdct_islow pdf_jpeg_fdct_islow
#define jpeg_idct_float pdf_jpeg_idct_float
#define jpeg_idct_ifast pdf_jpeg_idct_ifast
#define jpeg_idct_islow pdf_jpeg_idct_islow
#define jpeg_idct_1x1 pdf_jpeg_idct_1x1
#define jpeg_idct_2x2 pdf_jpeg_idct_2x2
#define jpeg_idct_4x4 pdf_jpeg_idct_4x4
#define jinit_memory_mgr pdf_jinit_memory_mgr
#define jpeg_free_large pdf_jpeg_free_large
#define jpeg_free_small pdf_jpeg_free_small
#define jpeg_get_large pdf_jpeg_get_large
#define jpeg_get_small pdf_jpeg_get_small
#define jpeg_mem_available pdf_jpeg_mem_available
#define jpeg_mem_init pdf_jpeg_mem_init
#define jpeg_mem_term pdf_jpeg_mem_term
#define jpeg_open_backing_store pdf_jpeg_open_backing_store
#define jinit_1pass_quantizer pdf_jinit_1pass_quantizer
#define jinit_2pass_quantizer pdf_jinit_2pass_quantizer
#define jcopy_block_row pdf_jcopy_block_row
#define jcopy_sample_rows pdf_jcopy_sample_rows
#define jdiv_round_up pdf_jdiv_round_up
#define jpeg_natural_order pdf_jpeg_natural_order
#define jround_up pdf_jround_up
#define jzero_far pdf_jzero_far
#ifdef PDFLIB_TET_BUILD
#define JPEG_PREFIX(x) tet_##x
#else
#define JPEG_PREFIX(x) pdf_##x
#endif /* PDFLIB_TET_BUILD */
#define jpeg_abort_compress JPEG_PREFIX(jpeg_abort_compress)
#define jpeg_CreateCompress JPEG_PREFIX(jpeg_CreateCompress)
#define jpeg_destroy_compress JPEG_PREFIX(jpeg_destroy_compress)
#define jpeg_finish_compress JPEG_PREFIX(jpeg_finish_compress)
#define jpeg_suppress_tables JPEG_PREFIX(jpeg_suppress_tables)
#define jpeg_write_marker JPEG_PREFIX(jpeg_write_marker)
#define jpeg_write_m_byte JPEG_PREFIX(jpeg_write_m_byte)
#define jpeg_write_m_header JPEG_PREFIX(jpeg_write_m_header)
#define jpeg_write_tables JPEG_PREFIX(jpeg_write_tables)
#define jpeg_start_compress JPEG_PREFIX(jpeg_start_compress)
#define jpeg_write_raw_data JPEG_PREFIX(jpeg_write_raw_data)
#define jpeg_write_scanlines JPEG_PREFIX(jpeg_write_scanlines)
#define jinit_c_coef_controller JPEG_PREFIX(jinit_c_coef_controller)
#define jinit_color_converter JPEG_PREFIX(jinit_color_converter)
#define jinit_forward_dct JPEG_PREFIX(jinit_forward_dct)
#define jinit_huff_encoder JPEG_PREFIX(jinit_huff_encoder)
#define jpeg_gen_optimal_table JPEG_PREFIX(jpeg_gen_optimal_table)
#define jpeg_make_c_derived_tbl JPEG_PREFIX(jpeg_make_c_derived_tbl)
#define jinit_compress_master JPEG_PREFIX(jinit_compress_master)
#define jinit_c_main_controller JPEG_PREFIX(jinit_c_main_controller)
#define jinit_marker_writer JPEG_PREFIX(jinit_marker_writer)
#define jinit_c_master_control JPEG_PREFIX(jinit_c_master_control)
#define jpeg_abort JPEG_PREFIX(jpeg_abort)
#define jpeg_alloc_huff_table JPEG_PREFIX(jpeg_alloc_huff_table)
#define jpeg_alloc_quant_table JPEG_PREFIX(jpeg_alloc_quant_table)
#define jpeg_destroy JPEG_PREFIX(jpeg_destroy)
#define jpeg_add_quant_table JPEG_PREFIX(jpeg_add_quant_table)
#define jpeg_default_colorspace JPEG_PREFIX(jpeg_default_colorspace)
#define jpeg_quality_scaling JPEG_PREFIX(jpeg_quality_scaling)
#define jpeg_set_colorspace JPEG_PREFIX(jpeg_set_colorspace)
#define jpeg_set_defaults JPEG_PREFIX(jpeg_set_defaults)
#define jpeg_set_linear_quality JPEG_PREFIX(jpeg_set_linear_quality)
#define jpeg_set_quality JPEG_PREFIX(jpeg_set_quality)
#define jpeg_simple_progression JPEG_PREFIX(jpeg_simple_progression)
#define jinit_phuff_encoder JPEG_PREFIX(jinit_phuff_encoder)
#define jinit_c_prep_controller JPEG_PREFIX(jinit_c_prep_controller)
#define jinit_downsampler JPEG_PREFIX(jinit_downsampler)
#define jpeg_copy_critical_parameters JPEG_PREFIX(jpeg_copy_critical_param)
#define jpeg_write_coefficients JPEG_PREFIX(jpeg_write_coefficients)
#define jpeg_abort_decompress JPEG_PREFIX(jpeg_abort_decompress)
#define jpeg_consume_input JPEG_PREFIX(jpeg_consume_input)
#define jpeg_CreateDecompress JPEG_PREFIX(jpeg_CreateDecompress)
#define jpeg_destroy_decompress JPEG_PREFIX(jpeg_destroy_decompress)
#define jpeg_finish_decompress JPEG_PREFIX(jpeg_finish_decompress)
#define jpeg_has_multiple_scans JPEG_PREFIX(jpeg_has_multiple_scans)
#define jpeg_input_complete JPEG_PREFIX(jpeg_input_complete)
#define jpeg_read_header JPEG_PREFIX(jpeg_read_header)
#define jpeg_finish_output JPEG_PREFIX(jpeg_finish_output)
#define jpeg_read_raw_data JPEG_PREFIX(jpeg_read_raw_data)
#define jpeg_read_scanlines JPEG_PREFIX(jpeg_read_scanlines)
#define jpeg_start_decompress JPEG_PREFIX(jpeg_start_decompress)
#define jpeg_start_output JPEG_PREFIX(jpeg_start_output)
#define jpeg_stdio_dest JPEG_PREFIX(jpeg_stdio_dest)
#define jpeg_stdio_src JPEG_PREFIX(jpeg_stdio_src)
#define jinit_d_coef_controller JPEG_PREFIX(jinit_d_coef_controller)
#define jinit_color_deconverter JPEG_PREFIX(jinit_color_deconverter)
#define jinit_inverse_dct JPEG_PREFIX(jinit_inverse_dct)
#define jinit_huff_decoder JPEG_PREFIX(jinit_huff_decoder)
#define jpeg_fill_bit_buffer JPEG_PREFIX(jpeg_fill_bit_buffer)
#define jpeg_huff_decode JPEG_PREFIX(jpeg_huff_decode)
#define jpeg_make_d_derived_tbl JPEG_PREFIX(jpeg_make_d_derived_tbl)
#define jpeg_reset_huff_decode JPEG_PREFIX(jpeg_reset_huff_decode)
#define jinit_input_controller JPEG_PREFIX(jinit_input_controller)
#define jinit_d_main_controller JPEG_PREFIX(jinit_d_main_controller)
#define jinit_marker_reader JPEG_PREFIX(jinit_marker_reader)
#define jpeg_resync_to_restart JPEG_PREFIX(jpeg_resync_to_restart)
#define jpeg_save_markers JPEG_PREFIX(jpeg_save_markers)
#define jpeg_set_marker_processor JPEG_PREFIX(jpeg_set_marker_processor)
#define jinit_master_decompress JPEG_PREFIX(jinit_master_decompress)
#define jpeg_calc_output_dimensions JPEG_PREFIX(jpeg_calc_output_dimensions)
#define jpeg_new_colormap JPEG_PREFIX(jpeg_new_colormap)
#define jinit_merged_upsampler JPEG_PREFIX(jinit_merged_upsampler)
#define jinit_phuff_decoder JPEG_PREFIX(jinit_phuff_decoder)
#define jinit_d_post_controller JPEG_PREFIX(jinit_d_post_controller)
#define jinit_upsampler JPEG_PREFIX(jinit_upsampler)
#define jpeg_read_coefficients JPEG_PREFIX(jpeg_read_coefficients)
#define jpeg_std_error JPEG_PREFIX(jpeg_std_error)
#define jpeg_std_message_table JPEG_PREFIX(jpeg_std_message_table)
#define jpeg_fdct_float JPEG_PREFIX(jpeg_fdct_float)
#define jpeg_fdct_ifast JPEG_PREFIX(jpeg_fdct_ifast)
#define jpeg_fdct_islow JPEG_PREFIX(jpeg_fdct_islow)
#define jpeg_idct_float JPEG_PREFIX(jpeg_idct_float)
#define jpeg_idct_ifast JPEG_PREFIX(jpeg_idct_ifast)
#define jpeg_idct_islow JPEG_PREFIX(jpeg_idct_islow)
#define jpeg_idct_1x1 JPEG_PREFIX(jpeg_idct_1x1)
#define jpeg_idct_2x2 JPEG_PREFIX(jpeg_idct_2x2)
#define jpeg_idct_4x4 JPEG_PREFIX(jpeg_idct_4x4)
#define jinit_memory_mgr JPEG_PREFIX(jinit_memory_mgr)
#define jpeg_free_large JPEG_PREFIX(jpeg_free_large)
#define jpeg_free_small JPEG_PREFIX(jpeg_free_small)
#define jpeg_get_large JPEG_PREFIX(jpeg_get_large)
#define jpeg_get_small JPEG_PREFIX(jpeg_get_small)
#define jpeg_mem_available JPEG_PREFIX(jpeg_mem_available)
#define jpeg_mem_init JPEG_PREFIX(jpeg_mem_init)
#define jpeg_mem_term JPEG_PREFIX(jpeg_mem_term)
#define jpeg_open_backing_store JPEG_PREFIX(jpeg_open_backing_store)
#define jinit_1pass_quantizer JPEG_PREFIX(jinit_1pass_quantizer)
#define jinit_2pass_quantizer JPEG_PREFIX(jinit_2pass_quantizer)
#define jcopy_block_row JPEG_PREFIX(jcopy_block_row)
#define jcopy_sample_rows JPEG_PREFIX(jcopy_sample_rows)
#define jdiv_round_up JPEG_PREFIX(jdiv_round_up)
#define jpeg_natural_order JPEG_PREFIX(jpeg_natural_order)
#define jround_up JPEG_PREFIX(jround_up)
#define jzero_far JPEG_PREFIX(jzero_far)

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_chartabs.c,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_chartabs.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDFlib routines for converting glyph or character names to Unicode
* and vice versa
@ -635,7 +635,7 @@ pdc_string2unicode(pdc_core *pdc, const char *text, int i_flags,
if (seterr)
{
pdc_set_errmsg(pdc, PDC_E_CONV_ILLUTF32, &text[i], 0, 0, 0);
pdc_set_errmsg(pdc, PDC_E_CONV_ILLUTF32CHAR, &text[i], 0, 0, 0);
if (verbose)
pdc_error(pdc, -1, 0, 0, 0, 0);
}

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_chartabs.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_chartabs.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* This file contains Adobe Glyph Names, HTML character reference names and
* some special glyph names.

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_classic.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_classic.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Header for CodeWarrior to activate Classic builds (without CarbonLib).
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_config.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_config.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib portability and configuration definitions
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_contain.c,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_contain.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDFlib generic container classes
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_contain.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_contain.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDFlib generic container classes
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_core.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_core.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib core services
*
@ -863,6 +863,7 @@ pdc_push_errmsg(
const pdc_error_info *ei = get_error_info(pdc, errnum);
pdc_pop_errmsg(pdc);
pdc->pr->errnum = 0;
make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_false);
@ -879,13 +880,17 @@ pdc_set_errmsg(
const char *parm3,
const char *parm4)
{
const pdc_error_info *ei = get_error_info(pdc, errnum);
if (errnum != 0)
{
const pdc_error_info *ei = get_error_info(pdc, errnum);
make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_false);
make_errmsg(pdc, ei, parm1, parm2, parm3, parm4, pdc_false);
}
pdc->pr->errnum = errnum;
pdc_logg_cond(pdc, 2, trc_warning,
if (errnum)
pdc_logg_cond(pdc, 2, trc_warning,
"[Reason for error message %d: \"%s\"]\n",
pdc->pr->errnum, pdc->pr->errbuf);
@ -929,7 +934,7 @@ pdc_error(
const char *parm3,
const char *parm4)
{
const char *logmsg;
const char *logmsg = NULL;
/* avoid recursive errors, but allow rethrow.
*/
@ -949,18 +954,22 @@ pdc_error(
if (pdc->pr->x_sp > pdc->pr->x_sp0)
{
logmsg = "\n[/// Exception %d in %s ]";
if (pdc_logg_is_enabled(pdc, 2, trc_warning))
logmsg = "[Nested exception %d in %s]";
}
else
{
logmsg = "\n[+++ Exception %d in %s ]";
logmsg = "\n[Last exception %d in %s]";
}
pdc_logg(pdc, logmsg, pdc->pr->errnum,
(pdc->pr->errnum == 0 || !pdc->pr->apiname) ? "" : pdc->pr->apiname,
pdc->pr->x_sp0 + 1, pdc->pr->x_sp - pdc->pr->x_sp0);
if (logmsg != NULL)
{
pdc_logg(pdc, logmsg, pdc->pr->errnum,
(pdc->pr->errnum == 0 || !pdc->pr->apiname) ? "" : pdc->pr->apiname,
pdc->pr->x_sp0 + 1, pdc->pr->x_sp - pdc->pr->x_sp0);
pdc_logg(pdc, "[\"%s\"]\n\n", pdc->pr->errbuf);
pdc_logg(pdc, "[\"%s\"]\n\n", pdc->pr->errbuf);
}
if (pdc->pr->x_sp == -1)
{
@ -995,6 +1004,9 @@ pdc_jbuf(pdc_core *pdc)
{
static const char fn[] = "pdc_jbuf";
pdc_logg_cond(pdc, 3, trc_api,
"[TRY to level %d]\n", pdc->pr->x_sp + 1);
if (++pdc->pr->x_sp == pdc->pr->x_ssize)
{
pdc_xframe *aux;
@ -1054,6 +1066,9 @@ pdc_jbuf(pdc_core *pdc)
void
pdc_exit_try(pdc_core *pdc)
{
pdc_logg_cond(pdc, 3, trc_api,
"[EXIT_TRY at level %d]\n", pdc->pr->x_sp);
if (pdc->pr->x_sp == -1)
{
strcpy(pdc->pr->errbuf, "exception stack underflow");
@ -1070,6 +1085,9 @@ pdc_catch_intern(pdc_core *pdc)
{
pdc_bool result;
pdc_logg_cond(pdc, 3, trc_api,
"[CATCH intern at level %d]\n", pdc->pr->x_sp);
if (pdc->pr->x_sp == -1)
{
strcpy(pdc->pr->errbuf, "exception stack underflow");
@ -1092,6 +1110,9 @@ pdc_catch_extern(pdc_core *pdc)
{
pdc_bool result;
pdc_logg_cond(pdc, 3, trc_api,
"[CATCH at level %d]\n", pdc->pr->x_sp);
if (pdc->pr->x_sp == -1)
{
strcpy(pdc->pr->errbuf, "exception stack underflow");
@ -1150,14 +1171,6 @@ pdc_get_errpref(pdc_core *pdc)
return pdc->pr->premsg;
}
/* ----------- service function to get PDF version string -------------- */
const char *
pdc_get_pdfversion(pdc_core *pdc, int compatibility)
{
return pdc_errprintf(pdc, "%d.%d", compatibility / 10, compatibility % 10);
}
#ifdef PDC_DEBUG

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_core.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_core.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib core services:
* - memory management
@ -37,7 +37,7 @@
#define PDF_FEATURE_NOT_PUBLIC
/* ------------------------- general ------------------------- */
/* ------------------------- C types ------------------------- */
typedef struct pdc_core_priv_s pdc_core_priv;
typedef struct pdc_core_s pdc_core;
@ -79,39 +79,12 @@ typedef unsigned int pdc_uint32;
*/
typedef long pdc_off_t1;
/* boolean values */
#define pdc_undef -1
#define pdc_false 0
#define pdc_true 1
#define PDC_1_1 11 /* PDF 1.1 = Acrobat 2 */
#define PDC_1_2 12 /* PDF 1.2 = Acrobat 3 */
#define PDC_1_3 13 /* PDF 1.3 = Acrobat 4 */
#define PDC_1_4 14 /* PDF 1.4 = Acrobat 5 */
#define PDC_1_5 15 /* PDF 1.5 = Acrobat 6 */
#define PDC_1_6 16 /* PDF 1.6 = Acrobat 7 */
#define PDC_1_7 17 /* PDF 1.7 = Acrobat 8 */
#define PDC_X_X_LAST 17
/* Acrobat limit for page dimensions */
#define PDF_ACRO_MINPAGE (3.0) /* 1/24 inch = 0.106 cm */
#define PDF_ACRO_MAXPAGE (14400.0) /* 200 inch = 508 cm */
typedef enum
{
xmp_validation_none = 1,
xmp_validation_create,
xmp_validation_pdfa
} xmp_validation_mode;
/* --------------------------- new pdcore --------------------------- */
typedef void (*pdc_error_fp)(void *opaque, int type, const char *msg);
typedef void* (*pdc_alloc_fp)(void *opaque, size_t size, const char *caller);
@ -125,16 +98,6 @@ pdc_core *pdc_new_core(pdc_error_fp errorhandler, pdc_alloc_fp allocproc,
void pdc_delete_core(pdc_core *pdc);
typedef enum
{
pdc_pbox_none,
pdc_pbox_art,
pdc_pbox_bleed,
pdc_pbox_crop,
pdc_pbox_media,
pdc_pbox_trim
} pdc_pagebox;
/* ------------------------- memory management ------------------------- */
void *pdc_malloc(pdc_core *pdc, size_t size, const char *caller);
@ -253,11 +216,6 @@ void pdc_rethrow(pdc_core *pdc);
#define PDC_RETHROW(pdc) pdc_rethrow(pdc)
/* ----------- service function to get PDF version string -------------- */
const char *pdc_get_pdfversion(pdc_core *pdc, int compatibility);
/* --------------------------- debug hexdump --------------------------- */
#ifdef PDC_DEBUG
@ -280,6 +238,9 @@ void pdc_hexdump(pdc_core *pdc, const char *msg, const char *text, int tlen);
*/
#define PDC_LICFILE_ENV "PDFLIBLICENSEFILE"
/* default base name for license file
*/
#define PDC_LICFILE_NAME "licensekeys.txt"
#endif /* PC_CORE_H */

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_crypt.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_crypt.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Routines for PDF encryption and decryption
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_crypt.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_crypt.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Crypto routines
*

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_ctype.c,v 1.2 2008-10-20 14:35:00 guy Exp $ */
/* $Id: pc_ctype.c,v 1.3 2009-03-23 08:51:17 guy Exp $ */
#include "pc_ctype.h"

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_ctype.h,v 1.2 2008-10-20 14:35:00 guy Exp $ */
/* $Id: pc_ctype.h,v 1.3 2009-03-23 08:51:17 guy Exp $ */
#ifndef PC_CTYPE_H_INCLUDED
#define PC_CTYPE_H_INCLUDED

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_digsig.c,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_digsig.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*/

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_digsig.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_digsig.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Digital Signature hashing/signing routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_ebcdic.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_ebcdic.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* EBCDIC conversion routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_ebcdic.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_ebcdic.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* EBCDIC conversion routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_encoding.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_encoding.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib in-core encodings and basic encoding functions
*
@ -1378,25 +1378,46 @@ pdc_new_encoding(pdc_core *pdc, const char *name)
return(ev);
}
void
pdc_refresh_encoding(pdc_core *pdc, pdc_encodingvector *ev, const char *name)
{
int slot;
if (ev->apiname != NULL)
{
pdc_free(pdc, ev->apiname);
ev->apiname = NULL;
}
if (name != NULL)
{
ev->apiname = pdc_strdup(pdc, name);
}
for (slot = 0; slot < 256; slot++)
{
if (ev->flags & PDC_ENC_ALLOCCHARS && ev->chars[slot] != NULL)
pdc_free(pdc, ev->chars[slot]);
ev->codes[slot] = 0;
ev->chars[slot] = NULL;
ev->given[slot] = 0;
}
if (ev->sortedslots != NULL)
{
pdc_free(pdc, ev->sortedslots);
ev->sortedslots = NULL;
}
ev->nslots = 0;
ev->flags = 0;
}
void
pdc_cleanup_encoding(pdc_core *pdc, pdc_encodingvector *ev)
{
int slot;
if (ev->apiname)
pdc_free(pdc, ev->apiname);
if (ev->flags & PDC_ENC_ALLOCCHARS)
{
for (slot = 0; slot < 256; slot++)
if (ev->chars[slot])
pdc_free(pdc, ev->chars[slot]);
}
if (ev->sortedslots)
pdc_free(pdc, ev->sortedslots);
pdc_refresh_encoding(pdc, ev, NULL);
pdc_free(pdc, ev);
}

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_encoding.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_encoding.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Encoding data structures and routines
*
@ -231,6 +231,8 @@ pdc_priv_glyphtab *pdc_get_pglyphtab_ptr(pdc_core *pdc);
void pdc_init_encoding(pdc_core *pdc, pdc_encodingvector *ev,
const char *name);
pdc_encodingvector *pdc_new_encoding(pdc_core *pdc, const char *name);
void pdc_refresh_encoding(pdc_core *pdc, pdc_encodingvector *ev,
const char *name);
void pdc_cleanup_encoding(pdc_core *pdc, pdc_encodingvector *ev);
pdc_encodingvector *pdc_copy_encoding(pdc_core *pdc, pdc_encodingvector *evfrom,
const char *name);

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_exports.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_exports.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Header for CodeWarrior to create a PDFlib DLL
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_file.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_file.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Various file routines
*
@ -500,6 +500,31 @@ pdc_set_fopen_errmsg(pdc_core *pdc, int errnum, const char *qualifier,
pdc_set_errmsg(pdc, errnum, qualifier, filename, stemp1, stemp2);
}
void
pdc_set_fwrite_errmsg(pdc_core *pdc, const char *filename)
{
const char *stemp1 = NULL;
const char *stemp2 = NULL;
int errno1 = errno;
int errnum = PDC_E_IO_WRITE;
#if defined(EMACOSERR)
#if defined(MAC) && defined(PDF_ALLOW_MAC_DEPR_FUNCS)
errno1 = (int) __MacOSErrNo;
#endif
#endif
stemp1 = pdc_errprintf(pdc, "%d", errno1);
#ifdef PDC_HAS_STRERROR
stemp2 = strerror(errno1);
if (stemp2 != NULL)
errnum = PDC_E_IO_WRITE_CODETEXT;
#endif
pdc_set_errmsg(pdc, errnum, filename, stemp1, stemp2, 0);
}
pdc_bool
pdc_check_fopen_errmsg(pdc_core *pdc, pdc_bool requested)
{
@ -583,6 +608,7 @@ filelen = len;
* will be deleted and a new char pointer to the Latin-1 string will
* be returned. Otherwise an execption will be thrown.
*
* Returned string is temporary allocated.
*/
char *
pdc_check_filename(pdc_core *pdc, char *filename)
@ -590,7 +616,7 @@ pdc_check_filename(pdc_core *pdc, char *filename)
#if !defined(PDC_UNICODE_FILENAME)
char *ffname = pdc_utf8_to_hostbytes(pdc, pdc->honorlang, filename);
pdc_free(pdc, filename);
pdc_free_tmp(pdc, filename);
if (ffname == NULL)
pdc_error(pdc, PDC_E_IO_UNSUPP_UNINAME, 0, 0, 0, 0);
filename = (char *) ffname;
@ -599,6 +625,9 @@ pdc_check_filename(pdc_core *pdc, char *filename)
return filename;
}
/*
* Returned string is temporary allocated.
*/
char *
pdc_get_filename(pdc_core *pdc, char *filename)
{
@ -607,7 +636,7 @@ pdc_get_filename(pdc_core *pdc, char *filename)
#if defined(PDC_UNICODE_FILENAME)
static const char fn[] = "pdc_get_filename";
ffname = pdc_strdup_ext(pdc, filename, 0, fn);
ffname = pdc_strdup_ext(pdc, filename, PDC_CONV_TMPALLOC, fn);
#else
ffname = pdc_hostbytes_to_utf8(pdc, pdc->honorlang, filename);
#endif
@ -617,11 +646,13 @@ pdc_get_filename(pdc_core *pdc, char *filename)
/*
* pdc_convert_filename_ext converts a file name as string of name type
* (see function pdc_convert_name) to a [EBCDIC-]UTF-8 string with or
* (see function pdc_convert_name_ext) to a [EBCDIC-]UTF-8 string with or
* without a BOM. If the compiler doesn't allow Unicode filenames
* (see define PDC_UNICODE_FILENAME) the filename is Latin-1 encoded
* if possible or an exception will be thrown.
*
* Returned string is temporary allocated.
*
*/
const char *
pdc_convert_filename_ext(pdc_core *pdc, const char *filename, int len,
@ -635,6 +666,9 @@ pdc_convert_filename_ext(pdc_core *pdc, const char *filename, int len,
if (filename == NULL)
pdc_error(pdc, PDC_E_ILLARG_EMPTY, paramname, 0, 0, 0);
/* temporary allocation will be enforced */
flags |= PDC_CONV_TMPALLOC;
fname = pdc_convert_name_ext(pdc, filename, len, enc, codepage, flags);
if (fname == NULL || *fname == '\0')
@ -649,12 +683,13 @@ pdc_convert_filename_ext(pdc_core *pdc, const char *filename, int len,
#endif
}
outfilename = pdc_errprintf(pdc, "%s", &fname[i]);
pdc_free(pdc, fname);
outfilename = &fname[i];
return outfilename;
}
/*
* Returned string is temporary allocated.
*/
const char *
pdc_convert_filename(pdc_core *pdc, const char *filename, int len,
const char *paramname, pdc_bool withbom)
@ -677,6 +712,7 @@ FILE *
pdc_fopen_logg(pdc_core *pdc, const char *filename, const char *mode)
{
FILE *fp = NULL;
int i = 0;
#if defined(PDC_UNICODE_FILENAME)
@ -684,10 +720,13 @@ pdc_fopen_logg(pdc_core *pdc, const char *filename, const char *mode)
pdc_byte *outfilename = NULL;
pdc_text_format nameformat = PDC_UTF8;
pdc_text_format targetnameformat = pdc_utf16;
int len = (int) strlen(filename);
int len = (int) pdc_strlen(filename);
int outlen = 0;
/* convert filename from UTF-8 to UTF-16 or Latin-1 */
if (pdc_is_utf16be_unicode(filename))
nameformat = pdc_utf16be;
/* convert filename from UTF-8 / UTF-16BE to UTF-16 or Latin-1 */
pdc_convert_string(pdc, nameformat, 0, NULL, (pdc_byte *) filename, len,
&targetnameformat, NULL, &outfilename, &outlen,
PDC_CONV_TRYBYTES | PDC_CONV_NOBOM, pdc_true);
@ -699,7 +738,6 @@ pdc_fopen_logg(pdc_core *pdc, const char *filename, const char *mode)
else
{
wchar_t wmode[8];
int i;
len = (int) strlen(mode);
for (i = 0; i < len; i++)
@ -714,7 +752,11 @@ pdc_fopen_logg(pdc_core *pdc, const char *filename, const char *mode)
#else
(void) pdc;
fp = fopen(filename, mode);
/* due to honorlang, codeset of LANG: UTF-8 */
if (pdc_is_utf8_bytecode(filename))
i = 3;
fp = fopen(&filename[i], mode);
#endif
pdc_logg_openclose(pdc, fp, pdc_true);
@ -731,6 +773,9 @@ pdc_fopen(pdc_core *pdc, const char *filename, const char *qualifier,
static const char fn[] = "pdc_fopen";
pdc_file *sfp;
/* reset error number */
pdc_set_errmsg(pdc, 0, 0, 0, 0, 0);
sfp = (pdc_file *) pdc_calloc(pdc, sizeof(pdc_file), fn);
/* initialize */
@ -1024,7 +1069,17 @@ pdc_fwrite(const void *ptr, size_t size, size_t nmemb, pdc_file *sfp)
size_t poslen, nbytes = 0;
if (sfp->fp)
return pdc__fwrite(ptr, size, nmemb, sfp->fp);
{
size_t total = pdc__fwrite(ptr, size, nmemb, sfp->fp);
if (total < size * nmemb)
{
pdc_set_fwrite_errmsg(sfp->pdc, sfp->filename);
PDC_RETHROW(sfp->pdc);
}
return total;
}
nbytes = size * nmemb;
if (sfp->pos + nbytes > sfp->limit)
@ -1145,6 +1200,7 @@ pdc_file_fullname(pdc_core *pdc, const char *dirname, const char *basename,
char *fullname)
{
const char *pathsep = PDC_PATHSEP;
const char *stemp = NULL;
size_t len = 0;
#ifdef MVS
@ -1225,7 +1281,12 @@ pdc_file_fullname(pdc_core *pdc, const char *dirname, const char *basename,
return;
PDC_FILE_ERROR:
pdc_error(pdc, PDC_E_IO_TOOLONG_FULLNAME, fullname, 0, 0, 0);
if (!dirname || !dirname[0])
stemp = pdc_errprintf(pdc, "%s", basename);
else
stemp = pdc_errprintf(pdc, "%s%s%s", dirname, pathsep, basename);
pdc_error(pdc, PDC_E_IO_TOOLONG_FULLNAME, stemp, 0, 0, 0);
}
#define EXTRA_SPACE 32 /* extra space for separators, FILEQUOT etc. */
@ -1573,7 +1634,7 @@ pdc_fwrite_ascii(pdc_core *pdc, const char *str, size_t len, FILE *fp)
{
(void) pdc;
len = fwrite(str, 1, len, fp);
len = pdc__fwrite(str, 1, len, fp);
return len;
@ -1598,11 +1659,12 @@ pdc_write_file(
if (sfp != NULL)
{
wlen = pdc_fwrite_ascii(pdc, content, len, sfp->fp);
pdc_fclose(sfp);
if (wlen != len)
if (wlen < len)
{
pdc_set_errmsg(pdc, PDC_E_IO_WRITE, filename, 0, 0, 0);
pdc_set_fwrite_errmsg(pdc, filename);
PDC_RETHROW(pdc);
}
pdc_fclose(sfp);
}

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_file.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_file.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Definitions for file routines
*
@ -70,6 +70,7 @@ pdc_core *pdc_get_pdcptr(pdc_file *sfp);
int pdc_get_fopen_errnum(pdc_core *pdc, int errnum);
void pdc_set_fopen_errmsg(pdc_core *pdc, int errnum, const char *qualifier,
const char *filename);
void pdc_set_fwrite_errmsg(pdc_core *pdc, const char *filename);
pdc_bool pdc_check_fopen_errmsg(pdc_core *pdc, pdc_bool requested);
void *pdc_read_file(pdc_core *pdc, FILE *fp, pdc_off_t *o_filelen,

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------*
| PDFlib - A library for generating PDF on the fly |
+---------------------------------------------------------------------------+
| Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. |
| Copyright (c) 1997-2009 Thomas Merz and PDFlib GmbH. All rights reserved. |
+---------------------------------------------------------------------------+
| |
| This software is subject to the PDFlib license. It is NOT in the |
@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_generr.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_generr.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDCORE error messages
*
@ -120,9 +120,13 @@ gen(0, 1052, IO_NOBUFFER, "Don't fetch buffer contents when writing to file")
gen(2, 1054, IO_BADFORMAT, "'$1' does not appear to be a $2 file")
gen(2, 1055, IO_WRITE,
"Error writing data to file '$1' (system error code $2)")
gen(1, 1056, IO_READ, "Error reading data from file '$1'")
gen(1, 1057, IO_WRITE, "Error writing data to file '$1'")
gen(3, 1057, IO_WRITE_CODETEXT,
"Error writing data to file '$1' (system error code $2: $3)")
gen(3, 1058, IO_ILLSYNTAX, "$1file '$2': Syntax error in line $3")
@ -182,7 +186,7 @@ gen(1, 1111, ILLARG_FLOAT_NAN,
gen(1, 1112, ILLARG_UTF, "Illegal UTF-$1 sequence in string")
*/
gen(2, 1114, ILLARG_MATRIX, "Matrix [$1] is degenerate")
gen(2, 1114, ILLARG_MATRIX, "Matrix [$1] is degenerated")
gen(2, 1116, ILLARG_TOOLONG,
"String parameter '$1' is limited to $2 characters")
@ -235,6 +239,8 @@ gen(1, 1220, PAR_UNSUPPKEY, "Unknown or unsupported key '$1'")
gen(1, 1250, PAR_ILLSECT, "Illegal section '$1'")
gen(1, 1260, PAR_NODATA, "No data supplied ($1)")
@ -333,13 +339,19 @@ gen(2, 1501, CONV_ILLUTF16SUR, "Invalid UTF-16 surrogate pair <U+$1,U+$2>")
gen(0, 1502, CONV_MEMOVERFLOW, "Out of memory in UTF string conversion")
gen(0, 1503, CONV_ILLUTF32,
"Invalid UTF-32 string (byte count not a multiple of four)")
gen(1, 1504, CONV_ILLUTF, "Invalid UTF-$1 string")
gen(1, 1505, CONV_ILLUTF32, "Invalid UTF-32 character U+$1")
gen(1, 1505, CONV_ILLUTF32CHAR, "Invalid UTF-32 character U+$1")
gen(1, 1506, CONV_ILL_MBTEXTSTRING,
"Invalid text string according to the current codepage '$1'")
gen(2, 1507, CONV_ILLUTF8SEQU,
"Invalid UTF-8 sequence $1 at byte index $2")
gen(1, 1508, CONV_UNSUPP_MBTEXTFORM,
"Multi byte text format (codepage $1) not supported on this platform")
@ -409,6 +421,8 @@ gen(0, 1907, INT_ILLFLOAT, "Bad floating point number for PDF")
gen(2, 1908, INT_BADFORMAT, "Unknown vsprintf() format '$1' ($2)")
gen(0, 1909, INT_FORMOVERFLOW, "Buffer overflow in formatting function")
gen(1, 1910, INT_ALLOC0,
"Tried to allocate 0 or negative number of bytes in function $1")
@ -445,6 +459,8 @@ gen(1, 1940, INT_BADERRNO,
gen(1, 1950, INT_LONGNAME_MISSING, "Long name is missing at index $1")
gen(1, 1970, INT_ILLDOCTYPE, "Illegal document type '$1'")
@ -455,3 +471,5 @@ gen(1, 1950, INT_LONGNAME_MISSING, "Long name is missing at index $1")

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_geom.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_geom.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Various geometry routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_geom.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_geom.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib core geometry utilities
*

View File

@ -1,4 +1,4 @@
/* $Id: pc_md5.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_md5.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib MD5 message digest routines
*

View File

@ -1,4 +1,4 @@
/* $Id: pc_md5.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_md5.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Header file for the PDFlib MD5 message digest routines
*

View File

@ -10,13 +10,14 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_optparse.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_optparse.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Parser options routines
*
*/
#include "pc_util.h"
#include "pc_file.h"
#include "pc_geom.h"
#include "pc_ctype.h"
@ -454,7 +455,7 @@ pdc_parse_optionlist(pdc_core *pdc, const char *optlist,
boolval = pdc_false;
break;
}
else
else if (isequal)
{
boolval = pdc_true;
break;
@ -1448,6 +1449,26 @@ pdc_get_opt_utf8strings(pdc_core *pdc, const char *keyword, pdc_resopt *resopt,
return ns;
}
const char *
pdc_get_opt_filename(pdc_core *pdc, const char *keyword, pdc_resopt *resopts)
{
const char *filename = NULL;
char **strlist;
if (pdc_get_optvalues(keyword, resopts, NULL, &strlist))
{
pdc_bool isutf8 = pdc_is_lastopt_utf8(resopts);
int flags = PDC_CONV_WITHBOM;
if (isutf8)
flags |= PDC_CONV_ISUTF8;
filename = pdc_convert_filename(pdc, strlist[0], 0, keyword, flags);
}
return filename;
}
void
pdc_cleanup_optionlist(pdc_core *pdc, pdc_resopt *resopt)
{

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_optparse.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_optparse.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Definitions for option parser routines
*
@ -286,6 +286,8 @@ pdc_bool pdc_is_lastopt_percent(pdc_resopt *resopt, int ind);
pdc_bool pdc_is_lastopt_utf8(pdc_resopt *resopt);
int pdc_get_opt_utf8strings(pdc_core *pdc, const char *keyword,
pdc_resopt *resopt, int flags, char ***strings);
const char *pdc_get_opt_filename(pdc_core *pdc, const char *keyword,
pdc_resopt *resopts);
void pdc_cleanup_optionlist(pdc_core *pdc, pdc_resopt *resopt);
void pdc_cleanup_optstringlist(pdc_core *pdc, char **stringlist, int ns);
const char *pdc_get_handletype(pdc_opttype type);

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_output.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_output.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib output routines
*
@ -103,6 +103,14 @@ struct pdc_output_s {
void *opaque; /* this will be used to store PDF *p */
};
/* ----------- service function to get PDF version string -------------- */
const char *
pdc_get_pdfversion(pdc_core *pdc, int compatibility)
{
return pdc_errprintf(pdc, "%d.%d", compatibility / 10, compatibility % 10);
}
/* --------------------- PDFlib stream handling ----------------------- */
void *
@ -788,38 +796,73 @@ void
pdc_put_pdffilename(pdc_output *out, const char *text, int len)
{
static const char *fn = "pdc_put_pdffilename";
pdc_byte *btext = (pdc_byte *) text;
pdc_bool isuni = pdc_is_utf16be_unicode(btext);
char *ttext;
int i, j = 0;
pdc_byte c, cp, cpp;
int i, ia = 0, j = 0;
ttext = (char *) pdc_malloc(out->pdc, (size_t) (len + 4), fn);
ttext = (char *) pdc_calloc(out->pdc, (size_t) (len + 4), fn);
if (isuni)
{
ttext[0] = PDF_BOM0;
ttext[1] = PDF_BOM1;
ia = 2;
j = 2;
}
/* absolute path name:
* r:\pdfdocs\spec.pdf -> /r/pdfdocs/spec.pdf
* pclib/eng:\pdfdocs\spec.pdf -> /pclib/eng/pdfdocs/spec.pdf
*/
if (strchr(text, PDF_COLON))
cp = 0x7F;
for (i = ia; i < len; i++)
{
ttext[j] = PDF_SLASH;
j++;
}
for (i = 0; i < len; i++)
{
if (text[i] == PDF_BACKSLASH || text[i] == PDF_SLASH ||
text[i] == PDF_COLON)
c = btext[i];
if (c == PDF_COLON && (!isuni || cp == 0))
{
/* convert to slash, but avoid multiple slashes */
if (!j || ttext[j - 1] != PDF_SLASH)
if (isuni)
{
ttext[j] = PDF_SLASH;
ttext[j] = 0;
j++;
}
}
else
{
ttext[j] = text[i];
ttext[j] = PDF_SLASH;
j++;
break;
}
cp = c;
}
cp = 0x7F;
cpp = 0x7F;
for (i = ia; i < len; i++)
{
c = btext[i];
if ((c == PDF_BACKSLASH || c == PDF_SLASH || c == PDF_COLON) &&
(!isuni || cp == 0))
{
/* convert to slash, but avoid multiple slashes */
if (cpp != PDF_SLASH)
{
c = PDF_SLASH;
}
else
{
if (isuni)
j--;
continue;
}
}
ttext[j] = c;
j++;
cp = c;
if (c)
cpp = c;
}
len = j;
@ -1068,8 +1111,6 @@ pdc_write_trailer(
/* ---------------------- High-level output functions ---------------------- */
#define PDC_LINEBUFLEN 4048 /* len of line output buffer */
/*
* Write a native encoded string to the output.
*/
@ -1106,7 +1147,7 @@ pdc_putc(pdc_output *out, const char c)
void
pdc_printf(pdc_output *out, const char *fmt, ...)
{
char buf[PDC_LINEBUFLEN];
char buf[PDC_GEN_BUFSIZE];
va_list ap;
va_start(ap, fmt);

View File

@ -10,20 +10,41 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_output.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_output.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib output routines
* PDFlib output defines and routines
*
*/
#ifndef PC_OUTPUT_H
#define PC_OUTPUT_H
/* --------------------------- General --------------------------- */
/* Define to test special MVS output features */
#undef MVS_TEST
/* -------------------- some ASCII characters and strings ------------- */
#define PDF_NEWLINE ((char) 0x0A) /* ASCII '\n' */
#define PDF_RETURN ((char) 0x0D) /* ASCII '\r' */
#define PDF_SPACE ((char) 0x20) /* ASCII ' ' */
#define PDF_HASH ((char) 0x23) /* ASCII '#' */
#define PDF_PARENLEFT ((char) 0x28) /* ASCII '(' */
#define PDF_PARENRIGHT ((char) 0x29) /* ASCII ')' */
#define PDF_PLUS ((char) 0x2B) /* ASCII '+' */
#define PDF_SLASH ((char) 0x2F) /* ASCII '/' */
#define PDF_COLON ((char) 0x3A) /* ASCII ':' */
#define PDF_BACKSLASH ((char) 0x5C) /* ASCII '\\' */
#define PDF_A ((char) 0x41) /* ASCII 'A' */
#define PDF_n ((char) 0x6E) /* ASCII 'n' */
#define PDF_r ((char) 0x72) /* ASCII 'r' */
#define PDF_STRING_0123456789ABCDEF \
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46"
/* ------------------------ some PDF constant -------------------------- */
/* Acrobat viewers change absolute values < 1/65536 to zero */
#define PDF_SMALLREAL (0.000015)
@ -49,25 +70,42 @@
/* maximum capacity of indirect objects */
#define PDF_MAXINDOBJS (8388607)
/* some ASCII characters and strings, deliberately defined as hex/oct codes */
/* Acrobat limit for page dimensions */
#define PDF_ACRO_MINPAGE (3.0) /* 1/24 inch = 0.106 cm */
#define PDF_ACRO_MAXPAGE (14400.0) /* 200 inch = 508 cm */
#define PDF_NEWLINE ((char) 0x0A) /* ASCII '\n' */
#define PDF_RETURN ((char) 0x0D) /* ASCII '\r' */
#define PDF_SPACE ((char) 0x20) /* ASCII ' ' */
#define PDF_HASH ((char) 0x23) /* ASCII '#' */
#define PDF_PARENLEFT ((char) 0x28) /* ASCII '(' */
#define PDF_PARENRIGHT ((char) 0x29) /* ASCII ')' */
#define PDF_PLUS ((char) 0x2B) /* ASCII '+' */
#define PDF_SLASH ((char) 0x2F) /* ASCII '/' */
#define PDF_COLON ((char) 0x3A) /* ASCII ':' */
#define PDF_BACKSLASH ((char) 0x5C) /* ASCII '\\' */
/* PDF versions */
#define PDC_1_1 11 /* PDF 1.1 = Acrobat 2 */
#define PDC_1_2 12 /* PDF 1.2 = Acrobat 3 */
#define PDC_1_3 13 /* PDF 1.3 = Acrobat 4 */
#define PDC_1_4 14 /* PDF 1.4 = Acrobat 5 */
#define PDC_1_5 15 /* PDF 1.5 = Acrobat 6 */
#define PDC_1_6 16 /* PDF 1.6 = Acrobat 7 */
#define PDC_1_7 17 /* PDF 1.7 = Acrobat 8 */
#define PDC_X_X_LAST 17
#define PDF_A ((char) 0x41) /* ASCII 'A' */
#define PDF_n ((char) 0x6E) /* ASCII 'n' */
#define PDF_r ((char) 0x72) /* ASCII 'r' */
#define PDF_STRING_0123456789ABCDEF \
"\060\061\062\063\064\065\066\067\070\071\101\102\103\104\105\106"
/* ------------------- some defines for special PDFs ----------------------- */
/* ------------------- some special enumerations -------------------------- */
typedef enum
{
pdc_pbox_none,
pdc_pbox_art,
pdc_pbox_bleed,
pdc_pbox_crop,
pdc_pbox_media,
pdc_pbox_trim
}
pdc_pagebox;
/* ----------------------- PDF output ---------------------------- */
typedef struct pdc_output_s pdc_output;
@ -107,6 +145,12 @@ typedef struct
#endif
} pdc_outctl;
/* ----------- service function to get PDF version string -------------- */
const char *pdc_get_pdfversion(pdc_core *pdc, int compatibility);
/* --------------------------- Setup --------------------------- */
pdc_output * pdc_boot_output(pdc_core *pdc);

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_prefix.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_prefix.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDCORE: unique renaming of function names shared by different applications
*/

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_pstok.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_pstok.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDCORE PostScript token scanner.
*

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------*
| PDFlib - A library for generating PDF on the fly |
+---------------------------------------------------------------------------+
| Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. |
| Copyright (c) 1997-2008 Thomas Merz and PDFlib GmbH. All rights reserved. |
+---------------------------------------------------------------------------+
| |
| This software is subject to the PDFlib license. It is NOT in the |
@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_resource.c,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_resource.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Resource routines
*
@ -219,6 +219,7 @@ pdc_get_resourcefile(pdc_core *pdc)
static void
pdc_read_resourcefile(pdc_core *pdc, const char *filename)
{
pdc_bool logg1 = pdc_logg_is_enabled(pdc, 1, trc_resource);
pdc_reslist *resl = pdc_get_reslist(pdc);
pdc_file *fp = NULL;
char **linelist;
@ -226,7 +227,9 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
char *category = NULL;
char *uprfilename = NULL;
char tmpname[PDC_FILENAMELEN];
#if defined(AS400) || defined(WIN32)
char prodname[32];
char prodversion[32];
char *c;
#define BUFSIZE 2048
char buffer[BUFSIZE];
#ifdef WIN32
@ -234,11 +237,35 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
HKEY hKey = NULL;
DWORD size, lType;
#endif
#endif
int il, nlines = 0, nextcat, begin;
int il, ip, nlines = 0, nextcat, begin;
pdc_logg_cond(pdc, 1, trc_resource,
"\n\tSearching for resource file...\n");
if (logg1)
pdc_logg(pdc, "\n\tSearching for resource file...\n");
/* product name */
strcpy(prodname, pdc->prodname);
/* product version: <major>.<minor> */
strcpy(prodversion, pdc->version);
if (strlen(pdc->version))
{
c = strchr(prodversion, '.');
if (c != NULL)
{
c++;
if (*c)
{
c++;
if (pdc_isdigit(*c))
c++;
*c = 0;
}
}
}
if (logg1)
pdc_logg(pdc, "\tProduct name=%s, version=%s\n",
prodname, prodversion);
#ifdef WIN32
@ -251,24 +278,28 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
#endif /* WIN32 */
#ifdef AS400
pdc_logg_cond(pdc, 1, trc_resource,
"\tSet AS400 default resources\n");
strcpy (buffer, "/pdflib/");
strcat (buffer, pdc->version);
il = (int) strlen(buffer);
strcat (buffer, "/fonts");
if (logg1)
pdc_logg(pdc, "\tSet AS400 default SearchPath entries\n");
sprintf(buffer, "/%s/%s/fonts", prodname, pdc->version);
pdc_add_resource(pdc, "SearchPath", buffer, "");
strcpy(&buffer[il], "/bind/data");
sprintf(buffer, "/%s/%s/bind/data", prodname, pdc->version);
pdc_add_resource(pdc, "SearchPath", buffer, "");
#endif /* AS400 */
#ifdef MVS
(void) buffer;
(void) ip;
#endif
#ifdef WIN32
/* process registry entries */
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, regkey, 0L,
(REGSAM) KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
pdc_logg_cond(pdc, 1, trc_resource,
"\tRead registry key \"%s\":\n", regkey);
if (logg1)
pdc_logg(pdc, "\tRead registry key \"%s\":\n", regkey);
size = BUFSIZE - 2;
if (RegQueryValueExA(hKey, "searchpath", (LPDWORD) NULL,
@ -276,10 +307,10 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
== ERROR_SUCCESS && *buffer)
{
char **pathlist;
int ip, np;
int np;
pdc_logg_cond(pdc, 1, trc_resource,
"\tsearchpath entry: \"%s\"\n", buffer);
if (logg1)
pdc_logg(pdc, "\tsearchpath entry: \"%s\"\n", buffer);
np = pdc_split_stringlist(pdc, buffer, ";", 0, &pathlist);
for (ip = 0; ip < np; ip++)
@ -291,6 +322,28 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
}
#endif /* WIN32 */
#if !defined(WIN32) && !defined(AS400) && !defined(MVS)
if (logg1)
pdc_logg(pdc, "\tSet UNIX default SearchPath entries\n");
for (il = 0; rootdirectories[il] != NULL; il++)
{
const char *home = pdc_getenv("HOME");
if (home != NULL)
sprintf(tmpname, rootdirectories[il], home);
else
strcpy(tmpname, rootdirectories[il]);
for (ip = 0; defsearchpathlist[ip] != NULL; ip++)
{
sprintf(buffer, defsearchpathlist[ip],
tmpname, prodname, prodversion);
pdc_add_resource(pdc, "SearchPath", buffer, "");
}
}
#endif /* !WIN32 && !AS400 && !MVS */
/* searching for name of upr file */
uprfilename = (char *)filename;
if (uprfilename == NULL || *uprfilename == '\0')
@ -312,8 +365,8 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
&lType, (LPBYTE) buffer, &size)
== ERROR_SUCCESS && *buffer)
{
pdc_logg_cond(pdc, 1, trc_resource,
"\tresourcefile entry: \"%s\"\n", buffer);
if (logg1)
pdc_logg(pdc, "\tresourcefile entry: \"%s\"\n", buffer);
uprfilename = buffer;
}
@ -330,7 +383,7 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
uprfilename = pdc_strtolower(tmpname);
/* user-supplied upr file */
fp = pdc_fsearch_fopen(pdc, uprfilename, NULL, NULL, 0);
fp = pdc_fsearch_fopen(pdc, uprfilename, NULL, "UPR ", 0);
if (fp == NULL)
{
uprfilename = NULL;
@ -342,8 +395,8 @@ pdc_read_resourcefile(pdc_core *pdc, const char *filename)
{
char *resfilename = resl->filename;
pdc_logg_cond(pdc, 1, trc_resource,
"\tRead resource file \"%s\":\n", uprfilename);
if (logg1)
pdc_logg(pdc, "\tRead resource file \"%s\":\n", uprfilename);
resl->filename = pdc_strdup(pdc, uprfilename);
if (resfilename)
@ -417,23 +470,26 @@ pdc_add_resource_ext(pdc_core *pdc, const char *category, const char *resname,
const char *resvalue, pdc_encoding enc, int codepage)
{
static const char fn[] = "pdc_add_resource";
pdc_bool logg1 = pdc_logg_is_enabled(pdc, 1, trc_resource);
pdc_reslist *resl = pdc_get_reslist(pdc);
pdc_rescategory rescat;
pdc_category *cat = NULL, *lastcat = NULL;
pdc_res *res = NULL, *lastres = NULL;
char *resnamutf8 = NULL;
char *resvalutf8 = NULL;
int resnamflags = PDC_CONV_EBCDIC;
int resvalflags = PDC_CONV_EBCDIC;
int resnamflags = PDC_CONV_EBCDIC | PDC_CONV_TMPALLOC;
int resvalflags = PDC_CONV_EBCDIC | PDC_CONV_TMPALLOC;
int k;
if (!resvalue || !strlen(resvalue))
pdc_logg_cond(pdc, 1, trc_resource,
"\tAdd \"%s\" to resource category \"%s\"\n", resname, category);
else
pdc_logg_cond(pdc, 1, trc_resource,
"\tAdd \"%s=%s\" to resource category \"%s\"\n",
resname, resvalue, category);
if (logg1)
{
if (!resvalue || !strlen(resvalue))
pdc_logg(pdc, "\tAdd \"%s\" to resource category \"%s\"\n",
resname, category);
else
pdc_logg(pdc, "\tAdd \"%s=%s\" to resource category \"%s\"\n",
resname, resvalue, category);
}
/* We no longer raise an error but silently ignore unknown categories */
k = pdc_get_keycode_ci(category, pdc_rescategories);
@ -508,7 +564,7 @@ pdc_add_resource_ext(pdc_core *pdc, const char *category, const char *resname,
}
else
{
resvalutf8 = pdc_strdup(pdc, "");
resvalutf8 = pdc_strdup_ext(pdc, "", PDC_CONV_TMPALLOC, fn);
}
pdc_cleanup_stringlist(pdc, strlist);
}
@ -537,8 +593,6 @@ pdc_add_resource_ext(pdc_core *pdc, const char *category, const char *resname,
{
if (!strlen(resnamutf8) || !strlen(resvalutf8))
{
pdc_free(pdc, resnamutf8);
pdc_free(pdc, resvalutf8);
if (resvalue == NULL)
pdc_error(pdc, PDC_E_RES_BADRES, resname, category, 0, 0);
else
@ -555,15 +609,12 @@ pdc_add_resource_ext(pdc_core *pdc, const char *category, const char *resname,
{
if (strlen(resvalutf8))
{
if (resnamutf8 != NULL)
pdc_free(pdc, resnamutf8);
pdc_free(pdc, resvalutf8);
pdc_error(pdc, PDC_E_RES_BADRES, resname, category, 0, 0);
}
if (resvalutf8 != NULL)
{
pdc_free(pdc, resvalutf8);
pdc_free_tmp(pdc, resvalutf8);
resvalutf8 = NULL;
}
@ -576,11 +627,12 @@ pdc_add_resource_ext(pdc_core *pdc, const char *category, const char *resname,
{
/* delete all entries */
if (resnamutf8 != NULL)
pdc_free(pdc, resnamutf8);
pdc_free_tmp(pdc, resnamutf8);
pdc_delete_rescategory(pdc, lastcat, cat, pdc_true);
pdc_logg_cond(pdc, 1, trc_resource,
"\tResource category \"%s\" removed\n", category);
if (logg1)
pdc_logg(pdc, "\tResource category \"%s\" removed\n",
category);
return;
}
@ -609,26 +661,27 @@ pdc_add_resource_ext(pdc_core *pdc, const char *category, const char *resname,
else
cat->kids = res;
res->prev = lastres;
res->name = resnamutf8;
res->name = pdc_strdup(pdc, resnamutf8);
}
else
{
pdc_free(pdc, resnamutf8);
pdc_free_tmp(pdc, resnamutf8);
}
/* New value */
if (res->value)
pdc_free(pdc, res->value);
res->value = resvalutf8;
res->value = pdc_strdup(pdc, resvalutf8);
if (res->value && strlen(res->value))
pdc_logg_cond(pdc, 1, trc_resource,
"\tNew category.resource: \"%s.%s = %s\"\n",
category, res->name, res->value);
else
pdc_logg_cond(pdc, 1, trc_resource,
"\tNew category.resource: \"%s.%s\"\n",
category, res->name);
if (logg1)
{
if (res->value && strlen(res->value))
pdc_logg(pdc, "\tNew category.resource: \"%s.%s = %s\"\n",
category, res->name, res->value);
else
pdc_logg(pdc, "\tNew category.resource: \"%s.%s\"\n",
category, res->name);
}
}
void
@ -743,7 +796,7 @@ pdc_find_resource_nr(pdc_core *pdc, const char *category, int nr)
pdc_errprintf(pdc, "%s%s%s", resname, separ, resval);
if (tobefree)
pdc_free(pdc, resval);
pdc_free_tmp(pdc, resval);
return retval;
}
@ -804,13 +857,17 @@ pdc__create_pvf(pdc_core *pdc, const char *filename,
static const char fn[] = "pdc__create_pvf";
pdc_bool iscopy = pdc_false;
pdc_virtfile *vfile, *lastvfile = NULL;
const char *stemp = NULL;
pdc_resopt *results;
if (!data)
pdc_error(pdc, PDC_E_ILLARG_EMPTY, "data", 0, 0, 0);
if (data == NULL)
stemp = "data = NULL";
if (!size)
pdc_error(pdc, PDC_E_ILLARG_EMPTY, "size", 0, 0, 0);
stemp = "size = 0";
if (stemp != NULL)
pdc_error(pdc, PDC_E_PAR_NODATA, stemp, 0, 0, 0);
/* Parse optlist */
results = pdc_parse_optionlist(pdc, optlist, pdc_create_pvf_options,
@ -1312,7 +1369,10 @@ pdc_set_logg_options(pdc_core *pdc, const char *optlist)
if (!logg->fromenviron)
{
pdc_get_optvalues("filename", resopts, filename, NULL);
const char *fname = pdc_get_opt_filename(pdc, "filename", resopts);
if (fname != NULL)
strcpy(filename, fname);
}
@ -1421,12 +1481,15 @@ pdc_set_logg_options(pdc_core *pdc, const char *optlist)
/* open file */
if (!logg->flush)
{
/* due to honorlang, codeset of LANG: UTF-8 */
i = pdc_is_utf8_bytecode(logg->filename) ? 3 : 0;
if (!strcmp(logg->filename, "stdout"))
logg->fp = stdout;
else if (!strcmp(logg->filename, "stderr"))
logg->fp = stderr;
else
logg->fp = fopen(logg->filename, APPENDMODE);
logg->fp = fopen(&logg->filename[i], APPENDMODE);
if (logg->fp == NULL)
{
pdc_error(pdc, PDC_E_IO_WROPEN, "log ", logg->filename,
@ -1502,12 +1565,15 @@ pdc_logg_output(pdc_core *pdc, const char *fmt, va_list ap)
{
FILE *fp = NULL;
/* due to honorlang, codeset of LANG: UTF-8 */
int i = pdc_is_utf8_bytecode(logg->filename) ? 3 : 0;
if (!strcmp(logg->filename, "stdout"))
fp = stdout;
else if (!strcmp(logg->filename, "stderr"))
fp = stderr;
else
fp = fopen(logg->filename, APPENDMODE);
fp = fopen(&logg->filename[i], APPENDMODE);
if (fp == NULL)
{

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_resource.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_resource.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* Resource routines
*
@ -19,6 +19,40 @@
#ifndef PC_RESOURCE_H
#define PC_RESOURCE_H
#ifdef PC_RESOURCE_C
#if !defined(WIN32) && !defined(AS400) && !defined(MVS)
/* default SearchPath list for UNIX like systems
*/
/* %s: $HOME
*/
static const char *rootdirectories[] =
{
"/usr/local",
"%s",
NULL
};
/*
* first %s: root directory
* second %s: pdc->prodname
* third %s: pdc->version without revision: <major>.<minor>
*/
static const char *defsearchpathlist[] =
{
"%s/PDFlib",
"%s/PDFlib/%s",
"%s/PDFlib/%s/%s",
"%s/PDFlib/%s/%s/resource/cmap",
"%s/PDFlib/%s/%s/resource/fonts",
"%s/PDFlib/%s/%s/resource/icc",
NULL
};
#endif /* !WIN32 && !AS400 && !MVS */
#endif /* PC_RESOURCE_C */
/* pdcore logg classes (maximal PDC_CLASSLIST_SIZE) */
typedef enum
{

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_scan.c,v 1.2 2008-10-20 14:35:00 guy Exp $ */
/* $Id: pc_scan.c,v 1.3 2009-03-23 08:51:17 guy Exp $ */
#include "pc_util.h"

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_scan.h,v 1.2 2008-10-20 14:35:00 guy Exp $ */
/* $Id: pc_scan.h,v 1.3 2009-03-23 08:51:17 guy Exp $ */
#ifndef PC_SCAN_H_INCLUDED
#define PC_SCAN_H_INCLUDED

View File

@ -6,7 +6,7 @@
| Proprietary source code -- do not redistribute! |
*---------------------------------------------------------------------------*/
/* $Id: pc_scantok.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_scantok.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDCORE generic token scanner standard tokens.
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_scope.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_scope.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Scoping routines and macros
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_scope.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_scope.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Scoping routines and macros
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_string.c,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_string.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* The core string classes.
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_string.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_string.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* The core string classes.
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_unicode.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_unicode.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib Unicode converting routines
*
@ -596,6 +596,12 @@ pdc_convertUTF8toUTF32 (
--------------------------------------------------------------------- */
const char *
pdc_get_textformat(int textformat)
{
return pdc_get_keyword(textformat, pdc_textformat_keylist);
}
static const pdc_keyconn pdc_utfformat_keylist[] =
{
{"8", pdc_utf8},
@ -792,6 +798,7 @@ pdc_convert_textstring(pdc_core *pdc,
static const char *fn = "pdc_convert_textstring";
pdc_bool logg = flags & PDC_CONV_LOGGING;
const char *stemp1 = NULL, *stemp2 = NULL;
char sbuf[64];
pdc_text_format oututf = *oututf_p;
pdc_text_format oututf_s;
pdc_ushort *usinstr = (pdc_ushort *) instring;
@ -807,8 +814,9 @@ pdc_convert_textstring(pdc_core *pdc,
(void) tabsize;
(void) replchar;
if (!logg && pdc_logg_is_enabled(pdc, 5, trc_encoding))
if (logg || pdc_logg_is_enabled(pdc, 5, trc_encoding))
{
pdc_logg(pdc, "\n");
if (!logg)
pdc_logg(pdc, "\t\ttext string of length %d will be converted...\n",
inlen);
@ -816,9 +824,17 @@ pdc_convert_textstring(pdc_core *pdc,
}
if (logg)
{
pdc_logg(pdc, "\t\tinput textformat for string conversion: %s\n",
pdc_get_keyword(inutf, pdc_textformat_keylist));
if (inev != NULL)
pdc_logg(pdc, "\t\tinput encoding: %s\n", inev->apiname);
if (outev != NULL)
pdc_logg(pdc, "\t\toutput encoding: %s\n", outev->apiname);
}
/* prophylactic */
if (!inlen)
{
@ -1015,13 +1031,13 @@ pdc_convert_textstring(pdc_core *pdc,
(inutf == pdc_utf16le && PDC_ISBIGENDIAN)))
{
if (inalloc)
pdc_swap_bytes((char *) instring, inlen, NULL);
pdc_swap_bytes2((char *) instring, inlen, NULL);
else
{
instr = (pdc_byte *) ((flags & PDC_CONV_TMPALLOC) ?
pdc_calloc_tmp(pdc, (size_t) (inlen + 2), fn, NULL, NULL) :
pdc_calloc(pdc, (size_t) (inlen + 2), fn));
pdc_swap_bytes((char *) instring, inlen, (char *) instr);
pdc_swap_bytes2((char *) instring, inlen, (char *) instr);
inalloc = pdc_true;
instring = instr;
@ -1031,10 +1047,36 @@ pdc_convert_textstring(pdc_core *pdc,
inutf = pdc_utf16;
}
/* illegal UTF-16 */
/* conversion to UTF-32 by swapping */
if (inlen && inutf == pdc_utf32)
{
if ((pdc_is_utf32be_unicode(instring) && !PDC_ISBIGENDIAN) ||
(pdc_is_utf32le_unicode(instring) && PDC_ISBIGENDIAN))
{
if (inalloc)
pdc_swap_bytes4((char *) instring, inlen, NULL);
else
{
instr = (pdc_byte *) ((flags & PDC_CONV_TMPALLOC) ?
pdc_calloc_tmp(pdc, (size_t) (inlen + 4), fn, NULL, NULL) :
pdc_calloc(pdc, (size_t) (inlen + 4), fn));
pdc_swap_bytes4((char *) instring, inlen, (char *) instr);
inalloc = pdc_true;
instring = instr;
instr = NULL;
}
}
}
/* illegal UTF-16 / UTF-32 */
if (inutf >= pdc_utf16 && inlen % 2)
{
errcode = PDC_E_CONV_ILLUTF16;
if (inutf == pdc_utf32 && inlen % 4)
errcode = PDC_E_CONV_ILLUTF32;
else
errcode = PDC_E_CONV_ILLUTF16;
goto PDC_CONV_ERROR;
}
@ -1111,7 +1153,7 @@ pdc_convert_textstring(pdc_core *pdc,
{
pdc_convers_result result = conversionOK;
pdc_byte *instringa, *instra, *instringe, *instre;
UTF8 *isa8, *ise8;
UTF8 *isa8 = NULL, *ise8 = NULL;
UTF16 *isa16, *ise16;
UTF32 *isa32, *ise32;
@ -1206,16 +1248,44 @@ pdc_convert_textstring(pdc_core *pdc,
case sourceExhausted:
case sourceIllegal:
if (inutf == pdc_utf8 && (flags & PDC_CONV_INFLATE))
if (inutf == pdc_utf8)
{
pdc_inflate_ascii((char *) instring, inlen, (char *) instr,
pdc_utf16);
instra = instr + 2 * inlen;
UTF8 *bp, *bpe;
char *sb = sbuf;
bpe = MIN(ise8 - 1, isa8 + 3);
for (bp = isa8; bp <= bpe; bp++)
sb += sprintf(sb, "\\x%02X", *bp);
if (*bp)
sb += sprintf(sb, "...");
sb += sprintf(sb, " (");
for (bp = isa8; bp <= bpe; bp++)
sb += sprintf(sb, "%c", *bp);
if (*bp)
sb += sprintf(sb, "...");
sb += sprintf(sb, ")");
stemp1 = sbuf;
stemp2 = pdc_errprintf(pdc, "%d", isa8 - (UTF8 *)instringa);
if (flags & PDC_CONV_INFLATE)
{
pdc_warning(pdc, PDC_E_CONV_ILLUTF8SEQU, stemp1, stemp2,
0, 0);
pdc_inflate_ascii((char *) instring, inlen,
(char *) instr, pdc_utf16);
instra = instr + 2 * inlen;
}
else
{
errcode = PDC_E_CONV_ILLUTF8SEQU;
}
}
else
{
errcode = PDC_E_CONV_ILLUTF;
stemp1 = pdc_get_keyword((int)inutf, pdc_utfformat_keylist);
errcode = PDC_E_CONV_ILLUTF;
}
break;
@ -1466,7 +1536,7 @@ pdc_convert_textstring(pdc_core *pdc,
toswap = PDC_ISBIGENDIAN;
}
if (toswap)
pdc_swap_bytes((char *) &instring[i], inlen - i, NULL);
pdc_swap_bytes2((char *) &instring[i], inlen - i, NULL);
}
if (hasbom)
@ -1550,6 +1620,7 @@ char *
pdc_convert_name_ext(pdc_core *pdc, const char *name, int len,
pdc_encoding enc, int codepage, int flags)
{
static const char fn[] = "pdc_convert_name_ext";
pdc_encodingvector *ev = NULL;
pdc_text_format nameformat = pdc_utf16;
pdc_text_format outnameformat = pdc_utf8;
@ -1562,22 +1633,20 @@ pdc_convert_name_ext(pdc_core *pdc, const char *name, int len,
if (len == 0)
{
pdc_bool hasbom = pdc_is_utf8_bytecode(name);
pdc_bool withbom = (flags & PDC_CONV_WITHBOM) ? pdc_true : pdc_false;
/* already [EBCDIC-]UTF-8 encoded */
if ((flags & PDC_CONV_ISUTF8) || hasbom)
if ((flags & PDC_CONV_ISUTF8) || pdc_is_utf8_bytecode(name))
{
if ((hasbom && withbom) || (!hasbom && !withbom))
outname = pdc_strdup(pdc, name);
else if (hasbom && !withbom)
outname = pdc_strdup(pdc, &name[3]);
else if (!hasbom && withbom)
outname = pdc_strdup_withbom(pdc, name);
if (!(flags & PDC_CONV_WITHBOM))
flags |= PDC_CONV_NOBOM;
if (!(flags & PDC_CONV_EBCDIC))
flags |= PDC_CONV_ASCII;
/* On EBCDIC platforms EBCDIC-UTF-8 name strings are expected */
outname = pdc_strdup_ext(pdc, name, (flags & ~PDC_CONV_EBCDIC), fn);
if (outname != NULL)
{
return outname;
}
}
/* see bug #1486 */
@ -1622,6 +1691,8 @@ pdc_convert_name(pdc_core *pdc, const char *name, int len, int flags)
return pdc_convert_name_ext(pdc, name, len, pdc_invalidenc, 0, flags);
}
/* returned string is temporary allocated
*/
char *
pdc_utf8_to_hostbytes(pdc_core *pdc, pdc_bool honorlang, char *name)
{
@ -1643,16 +1714,19 @@ pdc_utf8_to_hostbytes(pdc_core *pdc, pdc_bool honorlang, char *name)
pdc_convert_string(pdc, informat, 0, NULL, (pdc_byte *) name, len,
&outformat, outev, &outname, &len,
PDC_CONV_TRYBYTES | PDC_CONV_NOBOM, pdc_true);
PDC_CONV_TRYBYTES | PDC_CONV_NOBOM | PDC_CONV_TMPALLOC,
pdc_true);
if (outformat == pdc_utf16)
{
pdc_free(pdc, outname);
pdc_free_tmp(pdc, outname);
outname = NULL;
}
return (char *) outname;
}
/* returned string is temporary allocated
*/
char *
pdc_hostbytes_to_utf8(pdc_core *pdc, pdc_bool honorlang, char *name)
{
@ -1674,7 +1748,7 @@ pdc_hostbytes_to_utf8(pdc_core *pdc, pdc_bool honorlang, char *name)
pdc_convert_string(pdc, informat, 0, inev, (pdc_byte *) name, len,
&outformat, NULL, &outname, &len,
PDC_CONV_NOBOM, pdc_true);
PDC_CONV_NOBOM | PDC_CONV_TMPALLOC, pdc_true);
return (char *) outname;
}
@ -1722,11 +1796,37 @@ pdc_utf8_to_utf16(pdc_core *pdc, const char *utf8string, const char *format,
if (format && *format)
{
int k = pdc_get_keycode_ci(format, pdc_textformat_keylist);
/* see bug #2175 */
if (k == PDC_KEY_NOTFOUND)
{
char **sfl;
const char *sf;
int ns, i;
sf = NULL;
ns = pdc_split_stringlist(pdc, format, NULL, 0, &sfl);
for (i = 0; i < ns; i++)
{
if (!strcmp(sfl[i], "inflate"))
flags |= PDC_CONV_INFLATE;
else
sf = sfl[i];
}
if (sf != NULL)
k = pdc_get_keycode_ci(sf, pdc_textformat_keylist);
else
k = pdc_utf16;
pdc_cleanup_stringlist(pdc, sfl);
}
if (k == PDC_KEY_NOTFOUND ||
((pdc_text_format) k != pdc_utf16 &&
(pdc_text_format) k != pdc_utf16be &&
(pdc_text_format) k != pdc_utf16le))
pdc_error(pdc, PDC_E_ILLARG_STRING, "format", format, 0, 0);
outtextformat = (pdc_text_format) k;
}
@ -1895,7 +1995,7 @@ pdc_char32_to_char16(pdc_core *pdc, int usv, pdc_ushort *uvlist,
return 2;
}
pdc_set_errmsg(pdc, PDC_E_CONV_ILLUTF32,
pdc_set_errmsg(pdc, PDC_E_CONV_ILLUTF32CHAR,
pdc_errprintf(pdc, "%05X", usv), 0, 0, 0);
if (verbose)

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_unicode.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_unicode.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Unicode glyph name conversion routines
*
@ -134,8 +134,8 @@
#define PDF_BOM4 0xBF
/*
* check whether the string is plain C or UTF16 unicode
* by looking for the BOM in big-endian or little-endian format resp.
* check whether the string is UTF-16 unicode by looking for the BOM
* in big-endian or little-endian format resp.
* s must not be NULL.
*/
#define pdc_is_utf16be_unicode(s) \
@ -147,8 +147,24 @@
((pdc_byte *)(s))[1] == PDF_BOM0)
/*
* check whether the string is plain C or UTF8 unicode
* by looking for the BOM
* check whether the string is UTF-32 unicode by looking for the BOM
* in big-endian or little-endian format resp.
* s must not be NULL.
*/
#define pdc_is_utf32be_unicode(s) \
(((pdc_byte *)(s))[0] == 0x00 && \
((pdc_byte *)(s))[1] == 0x00 && \
((pdc_byte *)(s))[2] == PDF_BOM0 && \
((pdc_byte *)(s))[3] == PDF_BOM1)
#define pdc_is_utf32le_unicode(s) \
(((pdc_byte *)(s))[0] == PDF_BOM1 && \
((pdc_byte *)(s))[1] == PDF_BOM0 && \
((pdc_byte *)(s))[2] == 0x00 && \
((pdc_byte *)(s))[3] == 0x00)
/*
* check whether the string is UTF-8 unicode by looking for the BOM
* s must not be NULL.
*/
#define pdc_is_utf8_unicode(s) \
@ -211,6 +227,10 @@ pdc_convers_flags;
#define PDC_CONV_KEEPLBCHAR (1<<15)
#define PDC_CONV_LOGGING (1<<16)
#define PDC_CONV_ISUTF8 (1<<17)
#define PDC_CONV_ASCII (1<<18)
#define PDC_CONV_MAXSTRLEN (1<<19)
#define PDC_CONV_FILENAME (1<<20)
/* DON'T change the order */
typedef enum
@ -242,7 +262,9 @@ static const pdc_keyconn pdc_textformat_keylist[] =
{"utf16le", pdc_utf16le},
{NULL, 0}
};
#endif /* PC_UNICODE_C */
#endif /* PC_UNICODE_C */
const char *pdc_get_textformat(int textformat);
int pdc_convert_string(pdc_core *pdc,
pdc_text_format inutf, int codepage, pdc_encodingvector *inev,

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_util.c,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_util.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib various utility routines
*
@ -50,7 +50,7 @@
#endif
/* ------------------- Floating-point number check ----------------------- */
/* ---------------------- finite() workarounds -------------------------- */
@ -393,12 +393,20 @@ pdc_check_lang_code(pdc_core *pdc, const char* lang_code)
/* -------------------------- Bit arryas ------------------------------ */
/* set bit right to left within a byte */
void
pdc_setbit(char *bitarr, int bit)
{
bitarr[bit/8] |= (char) (1<<(bit%8));
}
/* set bit left to right within a byte */
void
pdc_setbit_l2r(char *bitarr, int bit)
{
bitarr[bit/8] |= (char) (0x80>>(bit%8));
}
pdc_bool
pdc_getbit(const char *bitarr, int bit)
{
@ -529,11 +537,12 @@ pdc_strlen(const char *str)
* must be terminated by a single null byte.
* The caller is responsible for freeing the buffer.
*
* The special functions pdc_strdup and pdc_strdup_tmp
* The special functions pdc_strdup, pdc_strdup_tmp and pdc_strdup_withbom
* should be replaced by the more sophisticated function pdc_strdup_ext.
* There: flags (see pc_unicode.h):
*
* PDC_CONV_TMPALLOC, PDC_CONV_EBCDIC
* PDC_CONV_TMPALLOC, PDC_CONV_EBCDIC, PDC_CONV_ASCII,
* PDC_CONV_WITHBOM, PDC_CONV_NOBOM, PDC_CONV_MAXSTRLEN
*
*/
char *
@ -544,19 +553,55 @@ pdc_strdup_ext(pdc_core *pdc, const char *text, int flags, const char *fn)
if (text != NULL)
{
size_t len = pdc_strlen(text) + 1;
size_t is = 0, it = 0;
if ((flags & PDC_CONV_MAXSTRLEN) && len > PDC_ERR_MAXSTRLEN)
len = PDC_ERR_MAXSTRLEN;
if ((flags & PDC_CONV_NOBOM) && pdc_is_utf8_bytecode(text))
is = 3;
if ((flags & PDC_CONV_WITHBOM) && !pdc_is_utf8_bytecode(text))
it = 3;
len += it - is;
if (flags & PDC_CONV_TMPALLOC)
buf = (char *) pdc_malloc_tmp(pdc, len + 1, fn, NULL, NULL);
else
buf = (char *) pdc_malloc(pdc, len + 1, fn);
memcpy(buf, text, len);
memcpy(&buf[it], &text[is], len - it);
buf[len] = 0;
if (it == 3)
pdc_copy_utf8_bom(buf);
}
return buf;
}
/* Convenience functions
*/
char *
pdc_strdup_tmp(pdc_core *pdc, const char *text)
{
static const char fn[] = "pdc_strdup_tmp";
return pdc_strdup_ext(pdc, text, PDC_CONV_TMPALLOC, fn);
}
char *
pdc_strdup_withbom(pdc_core *pdc, const char *text)
{
static const char fn[] = "pdc_strdup_withbom";
return pdc_strdup_ext(pdc, text, PDC_CONV_WITHBOM, fn);
}
/* Rapid function
*/
char *
pdc_strdup(pdc_core *pdc, const char *text)
{
@ -591,53 +636,18 @@ pdc_strdup2(pdc_core *pdc, const char *text, size_t len)
return buf;
}
char *
pdc_strdup_tmp(pdc_core *pdc, const char *text)
{
char *buf = NULL;
static const char fn[] = "pdc_strdup_tmp";
if (text != NULL)
{
size_t len = pdc_strlen(text) + 1;
buf = (char *) pdc_malloc_tmp(pdc, len + 1, fn, NULL, NULL);
memcpy(buf, text, len);
buf[len] = 0;
}
return buf;
}
/* Allocate a local buffer and copy a locale UTF-8 string
* provided with an UTF-8 BOM.
* The caller is responsible for freeing the buffer.
/* Convert Pascal string to a null terminated C string.
* Size of C string: at least 256 bytes
*/
char *
pdc_strdup_withbom(pdc_core *pdc, const char *text)
int
pdc_convert_pascal_str(const char *pstr, char *cstr)
{
char *buf = NULL;
static const char fn[] = "pdc_strdup_withbom";
int len = (int) *((pdc_byte *) pstr);
if (text != NULL)
{
size_t len;
memcpy(cstr, pstr + 1, (size_t) len);
cstr[len] = 0;
if (pdc_is_utf8_bytecode(text))
{
buf = pdc_strdup(pdc, text);
}
else
{
len = strlen(text);
buf = (char *) pdc_malloc(pdc, len + 4, fn);
pdc_copy_utf8_bom(buf);
strcpy(&buf[3], text);
}
}
return buf;
return len;
}
char *
@ -820,11 +830,16 @@ pdc_strprint(pdc_core *pdc, const char *str, int leni, int maxchar,
return (char *) pdc_calloc_tmp(pdc, 1, fn, NULL, NULL);
}
/*
* Returned string is temporary allocated.
*/
const char *
pdc_utf8strprint(pdc_core *pdc, const char *str)
{
int i = pdc_is_utf8_bytecode(str) ? 3 : 0;
return pdc_errprintf(pdc, "%.*s", PDC_ERR_MAXSTRLEN, &str[i]);
static const char fn[] = "pdc_utf8strprint";
return pdc_strdup_ext(pdc, str,
PDC_CONV_TMPALLOC | PDC_CONV_NOBOM | PDC_CONV_MAXSTRLEN, fn);
}
/*
@ -852,8 +867,7 @@ pdc_split_stringlist(pdc_core *pdc, const char *text, const char *i_separstr,
static const char fn[] = "pdc_split_stringlist";
const char *separstr = " \f\n\r\t\v";
const char *oldtext;
char **strlist = NULL, *newtext;
pdc_bool isoptlist = (flags & PDC_SPLIT_ISOPTLIST);
char **strlist = NULL, *newtext = NULL;
int it, len, jt = 0, jtb = 0, maxk = 0, count = 0, inside = 0;
int ns, nbs = 0, nbss;
@ -869,7 +883,8 @@ pdc_split_stringlist(pdc_core *pdc, const char *text, const char *i_separstr,
ns = (int) strspn(text, separstr);
oldtext = &text[ns];
len = (int) strlen(oldtext);
if (!len) return 0;
if (!len)
return 0;
/* check for UTF-8-BOM */
if (pdc_is_utf8_bytecode(oldtext))
@ -879,11 +894,13 @@ pdc_split_stringlist(pdc_core *pdc, const char *text, const char *i_separstr,
ns = (int) strspn(oldtext, separstr);
oldtext = &oldtext[ns];
len -= ns;
if (!len) return 0;
if (!len)
return 0;
}
/* new string */
newtext = (char *) pdc_malloc(pdc, (size_t) (len + 1), fn);
if (stringlist != NULL)
newtext = (char *) pdc_malloc(pdc, (size_t) (len + 1), fn);
for (it = 0; it <= len; it++)
{
/* check for separators */
@ -897,16 +914,17 @@ pdc_split_stringlist(pdc_core *pdc, const char *text, const char *i_separstr,
/* close text part */
if (ns)
{
newtext[jt] = 0;
if (count == maxk)
if (stringlist != NULL)
{
maxk += 16;
strlist = (strlist == NULL) ?
(char **) pdc_malloc(pdc, maxk * sizeof(char *), fn):
(char **) pdc_realloc(pdc, strlist, maxk *
sizeof(char *), fn);
newtext[jt] = 0;
if (count == maxk)
{
maxk += 16;
strlist = (char **) pdc_realloc(pdc, strlist,
maxk * sizeof(char *), fn);
}
strlist[count] = &newtext[jtb];
}
strlist[count] = &newtext[jtb];
count++;
/* Exit */
@ -919,7 +937,7 @@ pdc_split_stringlist(pdc_core *pdc, const char *text, const char *i_separstr,
}
/* option list */
if (isoptlist)
if (flags & PDC_SPLIT_ISOPTLIST)
{
/* save backslash counter */
nbss = nbs;
@ -965,12 +983,48 @@ pdc_split_stringlist(pdc_core *pdc, const char *text, const char *i_separstr,
}
}
/* argument list */
else if (flags & PDC_SPLIT_ISARGLIST)
{
/* save backslash counter */
nbss = nbs;
/* backslash */
if (oldtext[it] == '\\')
{
nbs++;
if (!(nbs % 2))
continue;
}
else
{
nbs = 0;
}
/* open and close quotation mark */
if (oldtext[it] == '"')
{
if (!(nbss % 2))
{
inside = 1 - inside;
continue;
}
else
{
jt--;
}
}
}
/* save character */
newtext[jt] = oldtext[it];
jt++;
if (stringlist != NULL)
{
newtext[jt] = oldtext[it];
jt++;
}
}
if (stringlist)
if (stringlist != NULL)
*stringlist = strlist;
return inside ? -count : count;
@ -1275,35 +1329,51 @@ pdc_strtolower(char *str)
}
void
pdc_swap_bytes(char *instring, int inlen, char *outstring)
pdc_swap_bytes2(const char *instring, int inlen, char *outstring)
{
char c;
int i,j;
pdc_ushort *inp, *outp;
int i;
if (instring == NULL)
return;
if (outstring == NULL)
outstring = instring;
outstring = (char *) instring;
inlen = 2 * inlen / 2;
inp = (pdc_ushort *) instring;
outp = (pdc_ushort *) outstring;
inlen /= sizeof(pdc_ushort);
for (i = 0; i < inlen; i++)
{
j = i;
i++;
c = instring[j];
outstring[j] = instring[i];
outstring[i] = c;
outp[i] = (pdc_ushort) (((inp[i] & (pdc_ushort)0x00FFu) << 8) |
((inp[i] & (pdc_ushort)0xFF00u) >> 8));
}
}
void
pdc_swap_unicodes(char *instring)
pdc_swap_bytes4(const char *instring, int inlen, char *outstring)
{
if (instring &&
((pdc_is_utf16be_unicode(instring) && !PDC_ISBIGENDIAN) ||
(pdc_is_utf16le_unicode(instring) && PDC_ISBIGENDIAN)))
pdc_swap_bytes(&instring[2], (int) (pdc_wstrlen(instring) - 2), NULL);
pdc_uint32 *inp, *outp;
int i;
if (instring == NULL)
return;
if (outstring == NULL)
outstring = (char *) instring;
inp = (pdc_uint32 *) instring;
outp = (pdc_uint32 *) outstring;
inlen /= sizeof(pdc_uint32);
for (i = 0; i < inlen; i++)
{
outp[i] = (pdc_uint32) (((inp[i] & (pdc_uint32)0x000000FFu) << 24) |
((inp[i] & (pdc_uint32)0x0000FF00u) << 8) |
((inp[i] & (pdc_uint32)0x00FF0000u) >> 8) |
((inp[i] & (pdc_uint32)0xFF000000u) >> 24));
}
}
void
@ -1896,7 +1966,7 @@ pdc_ltoa(char *buf, long n, int width, char pad, int base)
static char *
pdc_ulong2a(
char * buf,
pdc_ulong n,
pdc_off_t n,
int width,
char pad,
int base,
@ -1905,9 +1975,21 @@ pdc_ulong2a(
char aux[100];
int k, i = sizeof aux;
char * dest = buf;
pdc_bool sign;
aux[--i] = digits[n % base];
n = n / base;
if (n < 0)
{
--width;
sign = pdc_true;
aux[--i] = digits[- (n % base)];
n = n / -base;
}
else
{
sign = pdc_false;
aux[--i] = digits[n % base];
n = n / base;
}
while (0 < n)
{
@ -1923,6 +2005,9 @@ pdc_ulong2a(
*(dest++) = pad;
}
if (sign)
*(dest++) = '-';
memcpy(dest, &aux[i], sizeof aux - i);
dest += sizeof aux - i;
@ -1942,7 +2027,8 @@ pdc_off_t2a(
pdc_off_t n,
int width,
char pad,
pdc_bool left_justify)
pdc_bool left_justify,
pdc_bool pos_sign)
{
char aux[100];
int k, i = sizeof aux;
@ -1958,6 +2044,9 @@ pdc_off_t2a(
}
else
{
if (pos_sign)
--width;
sign = pdc_false;
aux[--i] = digits[n % 10];
n = n / 10;
@ -1978,7 +2067,13 @@ pdc_off_t2a(
}
if (sign)
{
*(dest++) = '-';
}
else if (pos_sign)
{
*(dest++) = '+';
}
memcpy(dest, &aux[i], sizeof aux - i);
dest += sizeof aux - i;
@ -2082,6 +2177,17 @@ pdc_ftoa_pdfconf(pdc_core *pdc, char *buf, double x)
ifd = pdc->floatdigits;
powd = pow10[ifd];
/* number <= 1/powd will be mappepd to 1/powd */
if (x <= 1 / powd)
{
*(dest++) = '0';
*(dest++) = '.';
while (--ifd)
*(dest++) = '0';
*(dest++) = '1';
return dest;
}
fract = modf(x, &integ);
f = (long) (fract * powd + 0.5);
@ -2126,12 +2232,23 @@ pdc_ftoa_pdfconf(pdc_core *pdc, char *buf, double x)
} /* pdc_ftoa_pdfconf */
/* flags for formatting function pdc_vxprintf()
*/
typedef enum
{
pdc_form_nolimit, /* no buffer limit supplied, no overflow check */
pdc_form_fixlimit, /* fix buffer limit, buffer overflow causes exception */
pdc_form_varlimit /* buffer overflow causes string truncation */
}
pdc_limitkind;
/* write to string or file
*/
static char *
write_sf(
pdc_core *pdc,
FILE *fp,
pdc_limitkind ltd,
char *dst,
char *limit,
const char *src,
@ -2141,26 +2258,40 @@ write_sf(
{
pdc_fwrite_ascii(pdc, src, (size_t) n, fp);
}
else if (dst < limit)
else
{
int avail = (int) (limit - dst);
if (ltd != pdc_form_nolimit)
{
int avail = (int) (limit - dst);
if (avail < n)
n = avail;
if (avail < n)
{
if (ltd == pdc_form_fixlimit)
{
pdc_error(pdc, PDC_E_INT_FORMOVERFLOW, 0, 0, 0, 0);
}
else
{
n = MAX(avail, 0);
}
}
}
memcpy(dst, src, (size_t) n);
dst += n;
if (n > 0)
{
memcpy(dst, src, (size_t) n);
dst += n;
}
}
return dst;
} /* write2buf */
#define BIG_STR_SIZE 100000
static int
pdc_vxprintf(
pdc_core *pdc,
pdc_bool pdfconf,
pdc_limitkind ltd,
char *cp,
size_t size,
FILE *fp,
@ -2174,7 +2305,7 @@ pdc_vxprintf(
int result = 0;
char *limit = (char *) 0;
if (cp != (char *) 0)
if (cp != (char *) 0 && ltd != pdc_form_nolimit)
limit = cp + (int) (size - 1);
for (/* */ ; /* */ ; /* */)
@ -2183,6 +2314,7 @@ pdc_vxprintf(
int prec = -1; /* = no precision specified */
char pad = ' ';
pdc_bool left_justify = pdc_false;
pdc_bool pos_sign = pdc_false;
char fbuf[100]; /* format buffer for %f and %g */
char * fscan = fbuf;
@ -2196,7 +2328,7 @@ pdc_vxprintf(
{
int inbuf = (int) (dest - buf);
cp = write_sf(pdc, fp, cp, limit, buf, inbuf);
cp = write_sf(pdc, fp, ltd, cp, limit, buf, inbuf);
result += inbuf;
dest = buf;
}
@ -2220,6 +2352,9 @@ pdc_vxprintf(
case '-': left_justify = pdc_true;
break;
case '+': pos_sign = pdc_true;
break;
case '0': pad = '0';
break;
@ -2298,7 +2433,7 @@ pdc_vxprintf(
case 'x':
case 'X':
dest = pdc_ulong2a(
dest, (pdc_ulong) va_arg(args, pdc_uint),
dest, (pdc_off_t) va_arg(args, pdc_uint),
width, pad, 16, left_justify);
break;
@ -2308,12 +2443,12 @@ pdc_vxprintf(
case 'd':
dest = pdc_off_t2a(dest, (pdc_off_t) va_arg(args, int),
width, pad, left_justify);
width, pad, left_justify, pos_sign);
break;
case 'u':
dest = pdc_ulong2a(
dest, (pdc_ulong) va_arg(args, pdc_ulong),
dest, (pdc_off_t) va_arg(args, pdc_ulong),
width, pad, 10, left_justify);
break;
@ -2332,7 +2467,6 @@ pdc_vxprintf(
case 'l':
{
pdc_off_t n = 0;
pdc_ulong u = 0;
pdc_bool ll = pdc_false;
if (*(++format) == 'l')
@ -2343,7 +2477,10 @@ pdc_vxprintf(
if (strchr("xXu", *format))
{
u = va_arg(args, pdc_ulong);
if (ll)
n = va_arg(args, pdc_off_t);
else
n = va_arg(args, pdc_ulong);
}
else if (*format == 'd')
{
@ -2366,17 +2503,17 @@ pdc_vxprintf(
case 'x':
case 'X':
dest = pdc_ulong2a(
dest, u, width, pad, 16, left_justify);
dest, n, width, pad, 16, left_justify);
break;
case 'd':
dest = pdc_off_t2a(
dest, n, width, pad, left_justify);
dest = pdc_off_t2a(dest, n, width, pad,
left_justify, pos_sign);
break;
case 'u':
dest = pdc_ulong2a(
dest, u, width, pad, 10, left_justify);
dest, n, width, pad, 10, left_justify);
break;
default:
@ -2408,34 +2545,41 @@ pdc_vxprintf(
const char *cstr = str;
pdc_bool tobefree = pdc_false;
size_t len;
int llen;
if (str == 0)
cstr = "(NULL)";
len = strlen(cstr);
if (*format == 'T')
if (str != 0)
{
int l = va_arg(args, int);
if (str != 0)
if (*format == 'T')
{
cstr = pdc_print_loggstring(pdc, str, l);
len = strlen(cstr);
llen = va_arg(args, int);
cstr = pdc_print_loggstring(pdc, str, llen);
}
else if (*format == 'a')
{
cstr = pdc_strdup_ext(pdc, str, PDC_CONV_EBCDIC, fn);
tobefree = pdc_true;
}
}
if (*format == 'a' && str != 0)
else
{
cstr = pdc_strdup_ext(pdc, str, PDC_CONV_EBCDIC, fn);
tobefree = pdc_true;
cstr = "(NULL)";
if (*format == 'T')
llen = va_arg(args, int);
}
len = strlen(cstr);
if (prec != -1 && prec < len)
{
len = prec;
}
if (!left_justify && len < (size_t) width)
{
int inbuf = (int) (width - len);
memset(buf, pad, (size_t) inbuf);
cp = write_sf(pdc, fp, cp, limit, buf, inbuf);
cp = write_sf(pdc, fp, ltd, cp, limit, buf, inbuf);
result += inbuf;
}
@ -2447,19 +2591,20 @@ pdc_vxprintf(
{
pdc_fwrite_ascii(pdc, cstr, len, fp);
}
else if (cp < limit)
{
if (result >= (int) size)
{
memcpy(cp, cstr, (size_t) (limit - cp));
cp = limit;
}
else
{
memcpy(cp, cstr, len);
cp += (int) len;
}
}
else if (ltd == pdc_form_nolimit || result < (int) size)
{
memcpy(cp, cstr, len);
cp += (int) len;
}
else if (ltd == pdc_form_fixlimit)
{
pdc_error(pdc, PDC_E_INT_FORMOVERFLOW, 0, 0, 0, 0);
}
else if (cp < limit)
{
memcpy(cp, cstr, (size_t) (limit - cp));
cp = limit;
}
if (tobefree)
pdc_free(pdc, (char *) cstr);
@ -2470,7 +2615,7 @@ pdc_vxprintf(
int inbuf = (int) (width - len);
memset(buf, pad, (size_t) inbuf);
cp = write_sf(pdc, fp, cp, limit, buf, inbuf);
cp = write_sf(pdc, fp, ltd, cp, limit, buf, inbuf);
result += inbuf;
}
@ -2503,7 +2648,8 @@ int
pdc_vfprintf(pdc_core *pdc, pdc_bool pdfconf, FILE *fp,
const char *format, va_list args)
{
return pdc_vxprintf(pdc, pdfconf, NULL, 0, fp, format, args);
return pdc_vxprintf(pdc, pdfconf, pdc_form_nolimit,
NULL, 0, fp, format, args);
} /* pdc_vfprintf */
int
@ -2514,7 +2660,8 @@ pdc_fprintf(pdc_core *pdc, pdc_bool pdfconf, FILE *fp,
va_list ap;
va_start(ap, format);
result = pdc_vxprintf(pdc, pdfconf, NULL, 0, fp, format, ap);
result = pdc_vxprintf(pdc, pdfconf, pdc_form_nolimit,
NULL, 0, fp, format, ap);
va_end(ap);
return result;
@ -2528,7 +2675,8 @@ int
pdc_vsprintf(pdc_core *pdc, pdc_bool pdfconf, char *buf,
const char *format, va_list args)
{
return pdc_vxprintf(pdc, pdfconf, buf, BIG_STR_SIZE, NULL, format, args);
return pdc_vxprintf(pdc, pdfconf, pdc_form_fixlimit,
buf, PDC_GEN_BUFSIZE, NULL, format, args);
} /* pdc_vsprintf */
int
@ -2539,7 +2687,8 @@ pdc_sprintf(pdc_core *pdc, pdc_bool pdfconf, char *buf,
va_list ap;
va_start(ap, format);
result = pdc_vxprintf(pdc, pdfconf, buf, BIG_STR_SIZE, NULL, format, ap);
result = pdc_vxprintf(pdc, pdfconf, pdc_form_nolimit,
buf, 0, NULL, format, ap);
va_end(ap);
return result;
@ -2549,7 +2698,8 @@ int
pdc_vsnprintf(pdc_core *pdc, char *buf, size_t size,
const char *format, va_list args)
{
return pdc_vxprintf(pdc, pdc_false, buf, size, NULL, format, args);
return pdc_vxprintf(pdc, pdc_false, pdc_form_varlimit,
buf, size, NULL, format, args);
} /* pdc_vsnprintf */
@ -2608,7 +2758,9 @@ pdc_create_treebranch(pdc_core *pdc, pdc_branch *root, const char *pathname,
name = namelist[i];
if (name_p)
*name_p = pdc_errprintf(pdc, "%.*s", PDC_ERR_MAXSTRLEN, name);
{
*name_p = pdc_utf8strprint(pdc, name);
}
nkids = parent->nkids;
for (j = 0; j < nkids; j++)
@ -2642,8 +2794,8 @@ pdc_create_treebranch(pdc_core *pdc, pdc_branch *root, const char *pathname,
if (!strcmp(kid->name, name))
{
if (errcode) *errcode = tree_nameexists;
if (name_p) *name_p =
pdc_errprintf(pdc, "%.*s", PDC_ERR_MAXSTRLEN, name);
if (name_p) *name_p = pdc_utf8strprint(pdc, name);
pdc_free(pdc, name);
return NULL;
}

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_util.h,v 1.3 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_util.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Declaration of various utility routines
*
@ -105,9 +105,22 @@ struct pdc_core_s
#define PDC_FLOAT_ISNULL(x) \
(((((x) < 0) ? -1 * (x) : (x)) < PDC_FLOAT_PREC) ? pdc_true : pdc_false)
#define PDC_SIGN(x) \
(((x) < 0) ? -1 : 1)
/*
* general buffer size and
* obligatory size of buffers for formatting function pdc_vsprintf().
*/
#define PDC_GEN_BUFSIZE 4096
#define PDC_TIME_SBUF_SIZE 50
/* flags for pdc_split_stringlist */
#define PDC_SPLIT_ISOPTLIST (1L<<0)
#define PDC_SPLIT_ISARGLIST (1L<<1)
/* flags for convert functions */
#define PDC_INT_UNSIGNED (1L<<0)
#define PDC_INT_CHAR (1L<<1)
#define PDC_INT_SHORT (1L<<2)
@ -147,10 +160,6 @@ pdc_branch_error;
typedef struct pdc_branch_s pdc_branch;
#define PDC_TIME_SBUF_SIZE 50
#define PDC_GEN_BUFSIZE 1024
void pdc_set_unsupp_error(pdc_core *pdc, int err_config, int err_lite,
pdc_bool warning);
void pdc_ascii_error(pdc_core *pdc, int errnum, int flags, const char *parm1,
@ -179,6 +188,7 @@ void pdc_get_timestr(char *str, pdc_bool ktoascii);
pdc_bool pdc_check_lang_code(pdc_core *pdc, const char* lang_code);
void pdc_setbit(char *bitarr, int bit);
void pdc_setbit_l2r(char *bitarr, int bit);
pdc_bool pdc_getbit(const char *bitarr, int bit);
void pdc_setbit_text(char *bitarr, const unsigned char *text,
int len, int nbits, int size);
@ -202,6 +212,7 @@ char *pdc_strdup_ext(pdc_core *pdc, const char *text, int flags,
char *pdc_strdup(pdc_core *pdc, const char *text);
char *pdc_strdup2(pdc_core *pdc, const char *text, size_t len);
char *pdc_strdup_tmp(pdc_core *pdc, const char *text);
int pdc_convert_pascal_str(const char *pstr, char *cstr);
pdc_bool pdc_logg_isprint(int c);
char *pdc_strprint(pdc_core *pdc, const char *str, int leni,
int maxchar, pdc_strform_kind strform);
@ -224,8 +235,8 @@ char *pdc_strtrim(char *m_str);
char *pdc_str2trim(char *m_str);
char *pdc_strtoupper(char *str);
char *pdc_strtolower(char *str);
void pdc_swap_bytes(char *instring, int inlen, char *outstring);
void pdc_swap_unicodes(char *instring);
void pdc_swap_bytes2(const char *instring, int inlen, char *outstring);
void pdc_swap_bytes4(const char *instring, int inlen, char *outstring);
char *pdc_strdup_withbom(pdc_core *pdc, const char *text);
void pdc_inflate_ascii(const char *instring, int inlen, char *outstring,
pdc_text_format textformat);

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_xmp.c,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_xmp.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* The core XMP support.
*
@ -31,6 +31,15 @@

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: pc_xmp.h,v 1.2 2008-10-20 14:35:00 guy Exp $
/* $Id: pc_xmp.h,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* The public core XMP support.
*
@ -28,3 +28,6 @@

View File

@ -9,7 +9,7 @@
| available, please check http://www.pdflib.com. |
*---------------------------------------------------------------------------*/
/* $Id: p_3d.c,v 1.2 2008-10-20 14:34:16 guy Exp $
/* $Id: p_3d.c,v 1.3 2009-03-23 08:51:17 guy Exp $
*
* PDFlib 3D functions routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_actions.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_actions.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib actions handling routines
*
@ -244,6 +244,7 @@ typedef struct pdf_action_s
pdf_dest *dest;
pdc_encoding hypertextencoding;
char *filename;
char *nativefilename;
char *parameters;
char *operation;
char *defaultdir;
@ -274,6 +275,7 @@ pdf_reclaim_action(void *item)
action->dest = NULL;
action->hypertextencoding = pdc_invalidenc;
action->filename = NULL;
action->nativefilename = NULL;
action->parameters = NULL;
action->operation = NULL;
action->defaultdir = NULL;
@ -308,6 +310,12 @@ pdf_release_action(void *context, void *item)
action->filename = NULL;
}
if (action->nativefilename)
{
pdc_free(p->pdc, action->nativefilename);
action->nativefilename = NULL;
}
if (action->parameters)
{
pdc_free(p->pdc, action->parameters);
@ -483,20 +491,26 @@ pdf__create_action(PDF *p, const char *type, const char *optlist)
for (i = 0; ; i++)
{
keyword = pdf_filename_keylist[i].word;
if (keyword)
{
if (pdf_get_opt_textlist(p, keyword, resopts, htenc, htcp, pdc_true,
NULL, &action->filename, NULL))
{
if (!pdf_opt_effectless(p, keyword, atype,
(pdf_actiontype) pdf_filename_keylist[i].code))
pdc_save_lastopt(resopts, PDC_OPT_SAVE1ELEM);
else
action->filename = NULL;
}
}
else
if (keyword == NULL)
break;
if (!pdc_get_optvalues(keyword, resopts, NULL, NULL) ||
pdf_opt_effectless(p, keyword, atype,
(pdf_actiontype) pdf_filename_keylist[i].code))
continue;
/* DON'T change order */
/* native filename */
if (!i)
action->nativefilename = pdf_get_opt_filename(p, keyword, resopts,
htenc, htcp);
/* Unicode filename */
pdf_get_opt_textlist(p, keyword, resopts, htenc, htcp, pdc_true,
NULL, &action->filename, NULL);
pdc_save_lastopt(resopts, PDC_OPT_SAVE1ELEM);
}
keyword = "parameters";
@ -675,12 +689,12 @@ pdf_write_action(PDF *p, pdf_action *action, pdc_id next_id)
pdc_puts(p->out, "/Win");
pdc_begin_dict(p->out); /* Win dict */
pdc_puts(p->out, "/F");
pdf_put_pdffilename(p, action->filename);
pdf_put_pdffilename(p, action->nativefilename);
pdc_puts(p->out, "\n");
if (p->compatibility >= PDC_1_7)
{
pdc_puts(p->out, "/UF");
pdf_put_hypertext(p, action->filename);
pdf_put_pdfunifilename(p, action->filename);
pdc_puts(p->out, "\n");
}
if (action->parameters)
@ -714,12 +728,12 @@ pdf_write_action(PDF *p, pdf_action *action, pdc_id next_id)
pdc_begin_dict(p->out); /* F dict */
pdc_puts(p->out, "/Type/Filespec\n");
pdc_puts(p->out, "/F");
pdf_put_pdffilename(p, action->filename);
pdf_put_pdffilename(p, action->nativefilename);
pdc_puts(p->out, "\n");
if (p->compatibility >= PDC_1_7)
{
pdc_puts(p->out, "/UF");
pdf_put_hypertext(p, action->filename);
pdf_put_pdfunifilename(p, action->filename);
pdc_puts(p->out, "\n");
}
pdc_end_dict(p->out); /* F dict */

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_afm.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_afm.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib AFM parsing routines
*
@ -218,7 +218,7 @@ pdf_parse_afm(
static const char fn[] = "pdf_parse_afm";
fnt_font_metric *ftm = &font->ft.m;
const char *afmtype = NULL;
char **wordlist, *keyword, *arg1;
char **wordlist = NULL, *keyword, *arg1;
char line[AFM_LINEBUF];
int i, cmp, lo, hi, nwords, nglyphs = 0, nline = 0;
int tablen = ((sizeof keyStrings) / (sizeof (char *)));

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_annots.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_annots.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib routines for annnotations
*
@ -516,6 +516,7 @@ typedef struct pdf_annot_s
char *subject;
char *contents;
char *filename;
char *nativefilename;
char *mimetype;
const char *iconname;
pdc_off_t filesize;
@ -580,6 +581,7 @@ pdf_reclaim_annot(void *item)
ann->subject = NULL;
ann->contents = NULL;
ann->filename = NULL;
ann->nativefilename = NULL;
ann->mimetype = NULL;
ann->iconname = NULL;
ann->filesize = 0;
@ -650,6 +652,11 @@ pdf_release_annot(void *context, void *item)
pdc_free(p->pdc, ann->filename);
ann->filename = NULL;
}
if (ann->nativefilename)
{
pdc_free(p->pdc, ann->nativefilename);
ann->nativefilename = NULL;
}
if (ann->mimetype)
{
pdc_free(p->pdc, ann->mimetype);
@ -1149,21 +1156,23 @@ pdf__create_annotation(PDF *p,
}
keyword = "filename";
if (pdf_get_opt_textlist(p, keyword, resopts, ann->hypertextencoding,
ann->hypertextcodepage, pdc_true,
NULL, &ann->filename, NULL))
if (pdc_get_optvalues(keyword, resopts, NULL, NULL) &&
!pdf_opt_effectless(p, keyword, atype,
(pdf_annottype) (ann_fileattachment | ann_movie)))
{
if (!pdf_opt_effectless(p, keyword, atype,
(pdf_annottype) (ann_fileattachment | ann_movie)))
{
pdc_save_lastopt(resopts, PDC_OPT_SAVE1ELEM);
if (atype == ann_fileattachment)
ann->filesize = pdf_check_file(p, ann->filename, pdc_true);
}
else
{
ann->filename = NULL;
}
/* DON'T change order */
/* native filename */
ann->nativefilename = pdf_get_opt_filename(p, keyword, resopts,
ann->hypertextencoding, ann->hypertextcodepage);
pdf_get_opt_textlist(p, keyword, resopts, ann->hypertextencoding,
ann->hypertextcodepage, pdc_true,
NULL, &ann->filename, NULL);
pdc_save_lastopt(resopts, PDC_OPT_SAVE1ELEM);
if (atype == ann_fileattachment)
ann->filesize = pdf_check_file(p, ann->filename, pdc_true);
}
keyword = "mimetype";
@ -1868,7 +1877,7 @@ pdf_write_page_annots(PDF *p, pdc_vtr *annots)
case ann_fileattachment:
{
/* see bug #1439 */
const char *basename = pdc_file_strip_dirs(ann->filename);
const char *basename = pdc_file_strip_dirs(ann->nativefilename);
pdc_puts(p->out, "/FS");
pdc_begin_dict(p->out); /* FS dict */
@ -1879,7 +1888,7 @@ pdf_write_page_annots(PDF *p, pdc_vtr *annots)
if (p->compatibility >= PDC_1_7)
{
pdc_puts(p->out, "/UF");
pdf_put_hypertext(p, basename);
pdf_put_pdfunifilename(p, basename);
pdc_puts(p->out, "\n");
}
@ -1904,12 +1913,12 @@ pdf_write_page_annots(PDF *p, pdc_vtr *annots)
pdc_begin_dict(p->out); /* F dict */
pdc_puts(p->out, "/Type/Filespec\n");
pdc_puts(p->out, "/F");
pdf_put_pdffilename(p, ann->filename);
pdf_put_pdffilename(p, ann->nativefilename);
pdc_puts(p->out, "\n");
if (p->compatibility >= PDC_1_7)
{
pdc_puts(p->out, "/UF");
pdf_put_hypertext(p, ann->filename);
pdf_put_pdfunifilename(p, ann->filename);
pdc_puts(p->out, "\n");
}
pdc_end_dict(p->out); /* F dict */
@ -2162,6 +2171,7 @@ pdf__attach_file(
pdf_init_rectangle(p, ann, llx, lly, urx, ury, NULL);
pdf_insert_annot_params(p, ann);
ann->filename = pdc_strdup(p->pdc, filename);
ann->nativefilename = pdc_strdup(p->pdc, filename);
ann->filesize = pdf_check_file(p, ann->filename, pdc_true);
ann->contents = pdf_convert_hypertext_depr(p, description, len_descr);
ann->title = pdf_convert_hypertext_depr(p, author, len_auth);

View File

@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------*
| PDFlib - A library for generating PDF on the fly |
+---------------------------------------------------------------------------+
| Copyright (c) 1997-2007 Thomas Merz and PDFlib GmbH. All rights reserved. |
| Copyright (c) 1997-2009 Thomas Merz and PDFlib GmbH. All rights reserved. |
+---------------------------------------------------------------------------+
| |
| This software is subject to the PDFlib license. It is NOT in the |
@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_block.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_block.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Block processing routines (require the PDI library)
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_bmp.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_bmp.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* BMP processing for PDFlib
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_ccitt.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_ccitt.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* CCITT (Fax G3 and G4) processing for PDFlib
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_cid.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_cid.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib CID font handling routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_color.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_color.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib color routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_color.h,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_color.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib color definitions
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_defopt.h,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_defopt.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib shared option definitions and structures
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_document.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_document.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib document related routines
*
@ -31,6 +31,8 @@
#include "pc_strconst.h"
#if (defined(WIN32) || defined(OS2)) && !defined(WINCE)
#include <fcntl.h>
@ -351,6 +353,11 @@ struct pdf_document_s
#if defined(MVS) || defined(MVS_TEST)
char *fopenparams; /* additional fopen() parameter string */
char **tempfilenames; /* 2 temporary file names */
#endif
pdc_bool moddate; /* modified date will be created */
char lang[PDF_MAX_LANGCODE + 1]; /* default natural language */
char *action; /* document actions */
@ -394,6 +401,11 @@ pdf_init_get_document(PDF *p)
#if defined(MVS) || defined(MVS_TEST)
doc->fopenparams = NULL;
doc->tempfilenames = NULL;
#endif
doc->moddate = pdc_false;
doc->lang[0] = 0;
doc->action = NULL;
@ -452,6 +464,20 @@ pdf_cleanup_document_internal(PDF *p)
#if defined(MVS) || defined(MVS_TEST)
if (doc->fopenparams)
{
pdc_free(p->pdc, doc->fopenparams);
doc->fopenparams = NULL;
}
if (doc->tempfilenames)
{
pdc_cleanup_optstringlist(p->pdc, doc->tempfilenames, 2);
doc->tempfilenames = NULL;
}
#endif
if (doc->searchindexname)
{
@ -766,7 +792,7 @@ pdf_write_search_indexes(PDF *p)
if (p->compatibility >= PDC_1_7)
{
pdc_printf(p->out, "/UF");
pdf_put_hypertext(p, doc->searchindexname);
pdf_put_pdfunifilename(p, doc->searchindexname);
}
pdc_end_dict(p->out); /* Index */
pdc_end_dict(p->out); /* Indexes */
@ -914,7 +940,7 @@ pdf_write_attachments(PDF *p)
if (p->compatibility >= PDC_1_7)
{
pdc_printf(p->out, "/UF");
pdf_put_hypertext(p, basename);
pdf_put_pdfunifilename(p, basename);
pdc_puts(p->out, "\n");
}
@ -1210,6 +1236,14 @@ pdf_begin_document_internal(PDF *p, const char *optlist, pdc_bool callback)
#if defined(MVS) || defined(MVS_TEST)
if (pdc_get_optvalues("filemode", resopts, NULL, NULL))
{
doc->fopenparams =
(char *) pdc_save_lastopt(resopts, PDC_OPT_SAVE1ELEM);
}
#endif
n_groups = pdc_get_optvalues("groups", resopts, NULL, &groups);
}
@ -1653,7 +1687,8 @@ pdf_write_pages_and_catalog(PDF *p, pdc_id orig_root_id)
for (i = 0; i < p->names_number; i++)
{
inlen = strlen(p->names[i].name);
name = pdf_convert_pdfstring(p, p->names[i].name, inlen, &outlen);
name = pdf_convert_pdfstring(p, p->names[i].name, inlen,
PDC_CONV_WITHBOM | PDC_CONV_TRYBYTES, &outlen);
if (name != p->names[i].name)
pdc_free(p->pdc, p->names[i].name);
@ -2043,3 +2078,4 @@ pdf_set_viewerpreference(PDF *p, const char *viewerpreference)

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_draw.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_draw.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib drawing routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_encoding.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_encoding.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib encoding handling routines
*
@ -153,6 +153,14 @@ pdf_get_hypertextencoding_param(PDF *p, int *codepage)
if (codepage)
*codepage = p->hypertextcodepage;
pdc_logg_cond(p->pdc, 3, trc_encoding,
"\t\thypertextformat=%d\n"
"\t\thypertextencoding=%s\n"
"\t\thypertextcodepage=%d\n",
p->hypertextformat,
pdc_get_user_encoding(p->pdc, p->hypertextencoding),
p->hypertextcodepage);
return p->hypertextencoding;
}

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_fields.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_fields.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib form fields handling routines
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_filter.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_filter.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Compressed and uncompressed stream output
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_font.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_font.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib font handling routines
*
@ -437,6 +437,7 @@ static pdc_bool
pdf_get_metrics_core(PDF *p, pdf_font *font, const char *fontname,
const char *outfilename, pdc_encoding enc, pdc_bool checktimes)
{
static const char fn[] = "pdf_get_metrics_core";
const char *fname = NULL;
const fnt_font_metric *ftm;
@ -445,6 +446,12 @@ pdf_get_metrics_core(PDF *p, pdf_font *font, const char *fontname,
{
fontname = fname;
font->opt.fontstyle = fnt_Normal;
if (font->apiname != NULL)
{
pdc_free(p->pdc, font->apiname);
font->apiname = pdc_strdup_ext(p->pdc, fontname, 0, fn);
}
}
ftm = fnt_get_core_metric(fontname);
@ -1004,6 +1011,7 @@ pdf_check_font_embedding(PDF *p, pdf_font *font, const char *fontname)
int
pdf_load_font_internal(PDF *p, pdf_font_options *fo)
{
pdc_bool logg1 = pdc_logg_is_enabled(p->pdc, 1, trc_font);
pdc_bool logg2 = pdc_logg_is_enabled(p->pdc, 2, trc_font);
const char *fontname;
const char *encoding;
@ -1041,10 +1049,14 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
else
{
fontname = pdc_utf8strprint(p->pdc, fontname_p);
pdc_free(p->pdc, fontname_p);
pdc_free_tmp(p->pdc, fontname_p);
}
fontname_p = NULL;
if (logg1)
pdc_logg(p->pdc, "\tCanonical font name: \"%s\"\n",
fontname);
/* font encoding */
encoding = fo->encoding;
encoding_aux = encoding;
@ -1065,8 +1077,9 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
/* UTF-8 font name with BOM */
font->ft.utf8name = pdc_strdup(p->pdc, fo->fontname);
pdc_logg_cond(p->pdc, 1, trc_font, "\tFont UTF-8 name: \"%s\"\n",
font->ft.utf8name);
if (logg1)
pdc_logg(p->pdc, "\tFont UTF-8 name: \"%s\"\n",
font->ft.utf8name);
/* specified encoding name */
font->encapiname = pdc_strdup(p->pdc, encoding);
@ -1137,8 +1150,8 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
* is found, make a copy in a new slot and attach the requested encoding.
*/
pdc_logg_cond(p->pdc, 1, trc_font,
"\tFont will be searched in the PDFlib font cache\n");
if (logg1)
pdc_logg(p->pdc, "\tFont will be searched in the PDFlib font cache\n");
for (slot = 0; slot < p->fonts_number; slot++)
{
if (p->fonts[slot].obj_id == PDC_BAD_ID &&
@ -1258,8 +1271,8 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
}
slot = -1;
pdc_logg_cond(p->pdc, 1, trc_font,
"\tFont not found in the PDFlib font cache\n");
if (logg1)
pdc_logg(p->pdc, "\tFont not found in the PDFlib font cache\n");
/* embedding check */
if (!pdf_check_font_embedding(p, font, fontname))
@ -1297,8 +1310,8 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
fontname_p = mastername;
/* protocol */
pdc_logg_cond(p->pdc, 1, trc_font,
"\tPDFlib font name: \"%s\"\n", fontname_p);
if (logg1)
pdc_logg(p->pdc, "\tPDFlib font name: \"%s\"\n", fontname_p);
/* Font file search hierarchy
* - Check "FontOutline" resource entry and check TrueType font
@ -1386,8 +1399,8 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
retval = pdc_false;
/* Searching for a metric file */
pdc_logg_cond(p->pdc, 1, trc_font,
"\tSearching for font metrics data file:\n");
if (logg1)
pdc_logg(p->pdc, "\tSearching for font metrics data file:\n");
filename = testfilename;
for (i = 0; i < 100; i++)
@ -1442,9 +1455,10 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
{
retval = pdc_false;
pdc_logg_cond(p->pdc, 1, trc_font,
"\tMetric data file for font \"%s\" not available\n",
fontname_p);
if (logg1)
pdc_logg(p->pdc,
"\tMetric data file for font \"%s\" not available\n",
fontname_p);
pdc_set_errmsg(p->pdc, PDF_E_FONT_NOMETRICS, 0, 0, 0, 0);
}
@ -1492,8 +1506,9 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
else
{
/* Searching font outline file */
pdc_logg_cond(p->pdc, 1, trc_font,
"\tSearching for font outline data file:\n");
if (logg1)
pdc_logg(p->pdc,
"\tSearching for font outline data file:\n");
outfilename = testfilename;
for (i = 0; i < 100; i++)
@ -1528,25 +1543,33 @@ pdf_load_font_internal(PDF *p, pdf_font_options *fo)
if (retval == pdc_undef)
{
retval = pdc_false;
pdc_set_errmsg(p->pdc, PDF_E_FONT_NOOUTLINE, 0, 0, 0, 0);
if (font->ft.m.type == fnt_Type1 ||
font->ft.m.type == fnt_MMType1)
pdc_set_errmsg(p->pdc, PDF_E_FONT_NOOUTLINE_PS,
0, 0, 0, 0);
else
pdc_set_errmsg(p->pdc, PDF_E_FONT_NOOUTLINE_TT,
0, 0, 0, 0);
}
}
if (retval == pdc_false)
{
pdc_logg_cond(p->pdc, 1, trc_font,
"\tOutline data file for font \"%s\" not found\n",
fontname_p);
if (logg1)
pdc_logg(p->pdc,
"\tOutline data file for font \"%s\" not found\n",
fontname_p);
}
else
{
if (!font->ft.img)
font->filename = font->ft.filename;
pdc_logg_cond(p->pdc, 1, trc_font,
"\tFont outline data file \"%s\" available\n",
font->filename ?
font->filename : font->ft.imgname);
if (logg1)
pdc_logg(p->pdc,
"\tFont outline data file \"%s\" available\n",
font->filename ?
font->filename : font->ft.imgname);
}
}
}
@ -1800,6 +1823,7 @@ pdf_put_font(PDF *p, pdf_font *font)
/* save font struct members */
pdc_encodingvector *ev = NULL;
pdc_encoding font_encoding = font->ft.enc;
pdc_encoding font_towinansi = font->towinansi;
int font_numcodes = font->ft.numcodes;
int font_codesize = font->codesize;
@ -1970,6 +1994,10 @@ pdf_put_font(PDF *p, pdf_font *font)
{
fontdescriptor_id = pdc_alloc_id(p->out);
pdc_objref(p->out, "/FontDescriptor", fontdescriptor_id);
/* bug #1036 */
if (font->ft.isstdfont == pdc_true)
break;
}
/* determine missing width.
@ -2433,6 +2461,7 @@ pdf_put_font(PDF *p, pdf_font *font)
/* restore font struct members */
font->ft.enc = font_encoding;
font->towinansi = font_towinansi;
font->ft.numcodes = font_numcodes;
font->codesize = font_codesize;

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_font.h,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_font.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* Header file for the PDFlib font subsystem
*
@ -126,7 +126,7 @@ struct pdf_font_s
/* pdflib encoding and CMap properties */
char *encapiname; /* encoding name specified in API call */
char *outcmapname; /* output CMap namel */
char *outcmapname; /* output CMap name */
int codepage; /* OEM multi byte code-page number */
pdc_encoding towinansi; /* convert to 'towinansi' enc. for output */
pdc_bool hasnomac; /* TT font has no macroman cmap */

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_generr.h,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_generr.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib error messages
*
@ -222,6 +222,8 @@ gen(1, 2220, TEMPLATE_SELF,
gen(1, 2222, TEXT_ALIGNCHARNOTFOUND,
"Character U+$1 for option 'alignchar' not found in font or encoding")
gen(1, 2223, TEXT_BADTEXTFORMAT, "Bad textformat '$1' (must be 'bytes')")
/* UNUSED
gen(1, 2230, TEXT_UNICODENOTSHOW,
"Can't show character with Unicode value U+$1")
@ -469,9 +471,18 @@ gen(0, 2509, FONT_FORCECVTUNI,
gen(0, 2514, FONT_EMBEDMM, "Multiple Master font cannot be embedded")
gen(0, 2516, FONT_NOMETRICS, "Metrics data not found")
gen(0, 2516, FONT_NOMETRICS,
"Font file (AFM, PFM, TTF, OTF etc.) or host font not found")
gen(0, 2517, FONT_NOOUTLINE_PS,
"Font cannot be embedded (PFA or PFB font file not found)")
/* Unused
gen(0, 2518, FONT_NOOUTLINE, "File with outline data not found")
*/
gen(0, 2519, FONT_NOOUTLINE_TT,
"Font cannot be embedded (TTF or OTF font file not found)")
/* Unused
gen(0, 2520, FONT_NOGLYPHID, "Font doesn't contain any glyph IDs")
@ -637,6 +648,10 @@ gen(1, 2830, FF_NOEMBEDFONT,
gen(1, 2832, FF_SUBSETTFONT,
"Specified font '$1' not allowed for fields (must not be subset)")
gen(2, 2833, FF_NOPDFDOCFONT,
"Specified encoding '$1' of font '$2' not recommended for fields "
"(please use encoding 'pdfdoc')")
gen(1, 2834, FF_CAPTMISSING, "No caption or icon specified for field '$1'")
gen(0, 2836, FF_DIFFSTRLISTS,
@ -721,7 +736,7 @@ gen(1, 2912, INT_SSTACK_UNDER, "State stack underflow in function '$1'")
gen(3, 2914, INT_WRAPPER, "Error in PDFlib $1 wrapper function $2 ($3)")
gen(0, 2990, OT_UNSUPP_SID2CID,
"Accented characters not supported; contact support@pdflib.com")
"Accented characters not supported; use autocidfont=false in PDF_load_font()")

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_gif.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_gif.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* GIF processing for PDFlib
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_gstate.c,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_gstate.c,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib routines dealing with the graphics states
*
@ -23,15 +23,31 @@
void
pdf_concat_raw(PDF *p, pdc_matrix *m)
{
if (pdc_is_identity_matrix(m))
return;
if (!pdc_is_identity_matrix(m))
{
char sa[32], sb[32], sc[32], sd[32];
pdf_end_text(p);
pdc_sprintf(p->pdc, pdc_true, sa, "%f", m->a);
pdc_sprintf(p->pdc, pdc_true, sb, "%f", m->b);
pdc_sprintf(p->pdc, pdc_true, sc, "%f", m->c);
pdc_sprintf(p->pdc, pdc_true, sd, "%f", m->d);
pdc_printf(p->out, "%f %f %f %f %f %f cm\n",
m->a, m->b, m->c, m->d, m->e, m->f);
if ((!strcmp(sa, "0") || !strcmp(sd, "0")) &&
(!strcmp(sb, "0") || !strcmp(sc, "0")))
{
pdc_error(p->pdc, PDC_E_ILLARG_MATRIX,
pdc_errprintf(p->pdc, "%f %f %f %f %f %f",
m->a, m->b, m->c, m->d, m->e, m->f),
0, 0, 0);
}
pdc_multiply_matrix(m, &p->curr_ppt->gstate[p->curr_ppt->sl].ctm);
pdf_end_text(p);
pdc_printf(p->out, "%s %s %s %s %f %f cm\n",
sa, sb, sc, sd, m->e, m->f);
pdc_multiply_matrix(m, &p->curr_ppt->gstate[p->curr_ppt->sl].ctm);
}
}
void
@ -189,7 +205,6 @@ pdf__concat(PDF *p, pdc_scalar a, pdc_scalar b, pdc_scalar c, pdc_scalar d,
pdc_scalar e, pdc_scalar f)
{
pdc_matrix m;
pdc_scalar det = a * d - b * c;
pdc_check_number(p->pdc, "a", a);
pdc_check_number(p->pdc, "b", b);
@ -198,11 +213,6 @@ pdf__concat(PDF *p, pdc_scalar a, pdc_scalar b, pdc_scalar c, pdc_scalar d,
pdc_check_number(p->pdc, "e", e);
pdc_check_number(p->pdc, "f", f);
if (fabs(det) < PDF_SMALLREAL)
pdc_error(p->pdc, PDC_E_ILLARG_MATRIX,
pdc_errprintf(p->pdc, "%f %f %f %f %f %f", a, b, c, d, e, f),
0, 0, 0);
m.a = a;
m.b = b;
m.c = c;
@ -217,13 +227,6 @@ void
pdf_setmatrix_e(PDF *p, pdc_matrix *n)
{
pdc_matrix m;
pdc_scalar det = n->a * n->d - n->b * n->c;
if (fabs(det) < PDF_SMALLREAL)
pdc_error(p->pdc, PDC_E_ILLARG_MATRIX,
pdc_errprintf(p->pdc, "%f %f %f %f %f %f",
n->a, n->b, n->c, n->d, n->e, n->f),
0, 0, 0);
pdc_invert_matrix(p->pdc, &m, &p->curr_ppt->gstate[p->curr_ppt->sl].ctm);
pdc_multiply_matrix(n, &m);

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_hkscmyk.h,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_hkscmyk.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib HKS spot CMYK color table
*

View File

@ -10,7 +10,7 @@
| |
*---------------------------------------------------------------------------*/
/* $Id: p_hkslab.h,v 1.3 2008-10-20 14:34:15 guy Exp $
/* $Id: p_hkslab.h,v 1.4 2009-03-23 08:51:17 guy Exp $
*
* PDFlib HKS spot Lab color table
*

Some files were not shown because too many files have changed in this diff Show More