summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/type0.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvipdfm-x/type0.c')
-rw-r--r--Build/source/texk/dvipdfm-x/type0.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/Build/source/texk/dvipdfm-x/type0.c b/Build/source/texk/dvipdfm-x/type0.c
index 919ed06a3ea..28fe907127f 100644
--- a/Build/source/texk/dvipdfm-x/type0.c
+++ b/Build/source/texk/dvipdfm-x/type0.c
@@ -35,6 +35,7 @@
#include "system.h"
#include "mem.h"
#include "error.h"
+#include "dpxconf.h"
#include "dpxfile.h"
#include "pdfobj.h"
@@ -49,16 +50,8 @@
#define TYPE0FONT_DEBUG_STR "Type0"
#define TYPE0FONT_DEBUG 3
-static int __verbose = 0;
-
static pdf_obj *pdf_read_ToUnicode_file (const char *cmap_name);
-void
-Type0Font_set_verbose(void)
-{
- __verbose++;
-}
-
/*
* used_chars:
*
@@ -149,41 +142,37 @@ Type0Font_clean (Type0Font *font)
/* PLEASE FIX THIS */
#include "tt_cmap.h"
-static pdf_obj *
-Type0Font_create_ToUnicode_stream(Type0Font *font) {
- CIDFont *cidfont = font->descendant;
- return otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
- CIDFont_get_opt_index(cidfont),
- CIDFont_get_fontname(cidfont),
- Type0Font_get_usedchars(font));
-}
-
/* Try to load ToUnicode CMap from file system first, if not found fallback to
* font CMap reverse lookup.
* CHANGED: CMap here is not always Unicode to CID mapping. Don't use reverse lookup.
*/
static pdf_obj *
Type0Font_try_load_ToUnicode_stream(Type0Font *font, char *cmap_base) {
- char *cmap_name = NEW(strlen(cmap_base) + strlen("-UTF-16"), char);
pdf_obj *tounicode;
+ char *cmap_name;
+ cmap_name = NEW(strlen(cmap_base)+strlen("-UTF16")+1, char);
sprintf(cmap_name, "%s-UTF16", cmap_base);
tounicode = pdf_read_ToUnicode_file(cmap_name);
if (!tounicode) {
sprintf(cmap_name, "%s-UCS2", cmap_base);
tounicode = pdf_read_ToUnicode_file(cmap_name);
}
-
RELEASE(cmap_name);
- if (!tounicode)
- tounicode = Type0Font_create_ToUnicode_stream(font);
+ if (!tounicode) {
+ CIDFont *cidfont = font->descendant;
+ tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
+ CIDFont_get_opt_index(cidfont),
+ CIDFont_get_fontname(cidfont),
+ Type0Font_get_usedchars(font));
+ }
return tounicode;
}
static void
-add_ToUnicode (Type0Font *font)
+Type0Font_attach_ToUnicode_stream (Type0Font *font)
{
pdf_obj *tounicode;
CIDFont *cidfont;
@@ -224,21 +213,32 @@ add_ToUnicode (Type0Font *font)
csi = CIDFont_get_CIDSysInfo(cidfont);
fontname = CIDFont_get_fontname(cidfont);
if (CIDFont_get_embedding(cidfont)) {
- fontname += 7; /* FIXME */
+ fontname += 7; /* FIXME: Skip pseudo unique tag... */
}
- if (!strcmp(csi->registry, "Adobe") &&
- !strcmp(csi->ordering, "Identity")) {
+ if (!strcmp(csi->registry, "Adobe") && !strcmp(csi->ordering, "Identity")) {
switch (CIDFont_get_subtype(cidfont)) {
case CIDFONT_TYPE2:
- /* PLEASE FIX THIS */
- tounicode = Type0Font_create_ToUnicode_stream(font);
+ /* PLEASE FIX THIS */
+ {
+ CIDFont *cidfont = font->descendant;
+ tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
+ CIDFont_get_opt_index(cidfont),
+ CIDFont_get_fontname(cidfont),
+ Type0Font_get_usedchars(font));
+ }
break;
default:
- if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) { /* FIXME */
- tounicode = Type0Font_create_ToUnicode_stream(font);
- } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) { /* FIXME */
- /* Font loader will create ToUnicode and set. */
+ if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) {
+ CIDFont *cidfont = font->descendant;
+ tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont),
+ CIDFont_get_opt_index(cidfont),
+ CIDFont_get_fontname(cidfont),
+ Type0Font_get_usedchars(font));
+ } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) {
+ /* FIXME: handled on very different timing.
+ * Font loader will create ToUnicode and set.
+ */
return;
} else {
tounicode = Type0Font_try_load_ToUnicode_stream(font, fontname);
@@ -257,7 +257,7 @@ add_ToUnicode (Type0Font *font)
pdf_new_name("ToUnicode"), tounicode);
} else {
#if defined(LIBDPX)
- if (__verbose)
+ if (dpx_conf.verbose_level > 0)
WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname);
#else
WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname);
@@ -282,8 +282,9 @@ Type0Font_dofont (Type0Font *font)
if (!font || !font->indirect)
return;
- if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) { /* FIXME */
- add_ToUnicode(font);
+ /* FIXME: Should move to pdffont.c */
+ if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) {
+ Type0Font_attach_ToUnicode_stream(font);
}
}
@@ -485,7 +486,7 @@ Type0Font_cache_find (const char *map_name, int cmap_id, fontmap_opt *fmap_opt)
*/
fontname = CIDFont_get_fontname(cidfont);
- if (__verbose) {
+ if (dpx_conf.verbose_level > 0) {
if (CIDFont_get_embedding(cidfont) && strlen(fontname) > 7)
MESG("(CID:%s)", fontname+7); /* skip XXXXXX+ */
else