summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2005-12-21 17:30:33 +0000
committerKristian Høgsberg <krh@redhat.com>2005-12-21 17:30:33 +0000
commit97243286560cb4f264b875185c8768a6af09d554 (patch)
tree979af959195938358f661fc35ee35b83dcd90bfe
parentcf887a9a9fae7272165d3aae05c85444ff5ca604 (diff)
2005-12-21 Kristian Høgsberg <krh@redhat.com>
* utils/Makefile.am: Add parseargs.h to sources and add -I$(top_srcdir)/poppler to INCLUDES. * poppler/CairoFontEngine.cc: Apply patch from Hiroyuki Ikezoe to man non-embedded CJK fonts work.
-rw-r--r--ChangeLog14
-rw-r--r--configure.ac2
-rw-r--r--poppler/CairoFontEngine.cc52
-rw-r--r--utils/Makefile.am15
4 files changed, 68 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index e9fa9a03..fe1e6bde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,23 @@
+2005-12-21 Kristian Høgsberg <krh@redhat.com>
+
+ * utils/Makefile.am: Add parseargs.h to sources and add
+ -I$(top_srcdir)/poppler to INCLUDES.
+
+ * poppler/CairoFontEngine.cc: Apply patch from Hiroyuki Ikezoe to
+ man non-embedded CJK fonts work.
+
2005-12-18 Albert Astals Cid <aacid@kde.org>
* configure.ac: Better jpeg detection, refer to ml PCbsd problem
* utils/Makefile.am: Add fontconfig cflags to utils as not always is
on /usr/include Fixes build problems on Slackware. Patch adapted from
- a Giovanni Venturi patch
+ a Giovanni Venturi patch.
* poppler/Page.cc: Only discard cropbox sizes one by one and not
- completely. Jeff and Martin were right
+ completely. Jeff and Martin were right.
2005-12-12 Albert Astals Cid <aacid@kde.org>
- * poppler/Page.cc: Ignore cropBox if it seems incorrect
+ * poppler/Page.cc: Ignore cropBox if it seems incorrect.
2005-12-12 Kristian Høgsberg <krh@redhat.com>
diff --git a/configure.ac b/configure.ac
index 33c8636d..c3403a41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,7 @@ dnl Based on kde acinclude.m4.in, LGPL Licensed
AC_PREREQ(2.59)
-AC_INIT(poppler, 0.5.0-cvs)
+AC_INIT(poppler, 0.5.0)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(poppler/poppler-config.h)
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index bd9cf863..f5ab8cb0 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -12,6 +12,7 @@
#include "config.h"
#include <string.h>
#include "CairoFontEngine.h"
+#include "CharCodeToUnicode.h"
#include "GlobalParams.h"
#include <fofi/FoFiTrueType.h>
#include <fofi/FoFiType1C.h>
@@ -43,14 +44,17 @@ CairoFont::CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs
GooString *tmpFileName, *fileName, *substName,*tmpFileName2;
DisplayFontParam *dfp;
FILE *tmpFile;
- int c, i, n;
+ int c, i, n, code, cmap;
GfxFontType fontType;
char **enc;
char *name;
FoFiTrueType *ff;
FoFiType1C *ff1c;
+ CharCodeToUnicode *ctu;
+ Unicode uBuf[8];
static cairo_user_data_key_t cairo_font_face_key;
+ dfp = NULL;
codeToGID = NULL;
codeToGIDLen = 0;
cairo_font_face = NULL;
@@ -123,11 +127,49 @@ CairoFont::CairoFont(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs
break;
case fontCIDType2:
- n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
+ codeToGID = NULL;
+ n = 0;
+ if (dfp) {
+ // create a CID-to-GID mapping, via Unicode
+ if ((ctu = ((GfxCIDFont *)gfxFont)->getToUnicode())) {
+ if ((ff = FoFiTrueType::load(fileName->getCString()))) {
+ // look for a Unicode cmap
+ for (cmap = 0; cmap < ff->getNumCmaps(); ++cmap) {
+ if ((ff->getCmapPlatform(cmap) == 3 &&
+ ff->getCmapEncoding(cmap) == 1) ||
+ ff->getCmapPlatform(cmap) == 0) {
+ break;
+ }
+ }
+ if (cmap < ff->getNumCmaps()) {
+ // map CID -> Unicode -> GID
+ n = ctu->getLength();
+ codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort));
+ for (code = 0; code < n; ++code) {
+ if (ctu->mapToUnicode(code, uBuf, 8) > 0) {
+ codeToGID[code] = ff->mapCodeToGID(cmap, uBuf[0]);
+ } else {
+ codeToGID[code] = 0;
+ }
+ }
+ }
+ delete ff;
+ }
+ ctu->decRefCnt();
+ } else {
+ error(-1, "Couldn't find a mapping to Unicode for font '%s'",
+ gfxFont->getName() ? gfxFont->getName()->getCString()
+ : "(unnamed)");
+ }
+ } else {
+ if (((GfxCIDFont *)gfxFont)->getCIDToGID()) {
+ n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
+ codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort));
+ memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
+ n * sizeof(Gushort));
+ }
+ }
codeToGIDLen = n;
- codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort));
- memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
- n * sizeof(Gushort));
/* Fall through */
case fontTrueType:
if (!(ff = FoFiTrueType::load(fileName->getCString()))) {
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 9a9434a3..d00bad7f 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,5 +1,6 @@
INCLUDES = \
-I$(top_srcdir) \
+ -I$(top_srcdir)/utils \
-I$(top_srcdir)/poppler \
$(UTILS_CFLAGS)
@@ -10,10 +11,12 @@ bin_PROGRAMS = pdffonts pdfimages pdfinfo pdftops pdftotext pdftohtml
man1_MANS = pdffonts.1 pdfimages.1 pdfinfo.1 pdftops.1 pdftotext.1 pdftohtml.1
-pdffonts_SOURCES = pdffonts.cc parseargs.c
-pdfimages_SOURCES = pdfimages.cc ImageOutputDev.cc parseargs.c
-pdfinfo_SOURCES = pdfinfo.cc parseargs.c
-pdftops_SOURCES = pdftops.cc parseargs.c
-pdftotext_SOURCES = pdftotext.cc parseargs.c
-pdftohtml_SOURCES = pdftohtml.cc parseargs.c \
+common = parseargs.c parseargs.h
+
+pdffonts_SOURCES = pdffonts.cc $(common)
+pdfimages_SOURCES = pdfimages.cc ImageOutputDev.cc $(common)
+pdfinfo_SOURCES = pdfinfo.cc $(common)
+pdftops_SOURCES = pdftops.cc $(common)
+pdftotext_SOURCES = pdftotext.cc $(common)
+pdftohtml_SOURCES = pdftohtml.cc $(common) \
HtmlFonts.cc HtmlLinks.cc HtmlOutputDev.cc