summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-12-18 22:04:28 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-12-18 22:04:28 +0000
commit22c37c9baa7011b264591e1f908aa3a5749acad3 (patch)
tree11ee8e81d15508031810b865db1db539ee24cb5d /Build
parent5b93ff7dd2c31198af58b9f879d4e0852b900eaa (diff)
dvipdfm-x: recover the original type1.c for [x]dvipdfmx
git-svn-id: svn://tug.org/texlive/trunk@42743 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/dvipdfm-x/type1.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/Build/source/texk/dvipdfm-x/type1.c b/Build/source/texk/dvipdfm-x/type1.c
index b74030c986f..ce935d923e3 100644
--- a/Build/source/texk/dvipdfm-x/type1.c
+++ b/Build/source/texk/dvipdfm-x/type1.c
@@ -324,14 +324,36 @@ add_metrics (pdf_font *font, cff_font *cffont, char **enc_vec, double *widths, i
pdf_release_obj(tmp_array);
return;
}
+#if !defined(LIBDPX)
+ /* PLEASE FIX THIS
+ * It's wrong to use TFM width here... We should warn if TFM width
+ * and actual glyph width are different.
+ */
+#endif /* !LIBDPX */
tfm_id = tfm_open(pdf_font_get_mapname(font), 0);
for (code = firstchar; code <= lastchar; code++) {
if (usedchars[code]) {
double width;
if (tfm_id < 0) /* tfm is not found */
width = scaling * widths[cff_glyph_lookup(cffont, enc_vec[code])];
+#if defined(LIBDPX)
else
- width = 1000. * tfm_get_width(tfm_id, code);
+#else
+ else {
+ double diff;
+#endif /* LIBDPX */
+ width = 1000.0 * tfm_get_width(tfm_id, code);
+#if !defined(LIBDPX)
+ diff = width -
+ scaling * widths[cff_glyph_lookup(cffont, enc_vec[code])];
+ if (fabs(diff) > 1.0) {
+ WARN("Glyph width mismatch for TFM and font (%s)",
+ pdf_font_get_mapname(font));
+ WARN("TFM: %g vs. Type1 font: %g",
+ width, widths[cff_glyph_lookup(cffont, enc_vec[code])]);
+ }
+ }
+#endif /* !LIBDPX */
pdf_add_array(tmp_array,
pdf_new_number(ROUND(width, 0.1)));
} else {
@@ -356,7 +378,11 @@ add_metrics (pdf_font *font, cff_font *cffont, char **enc_vec, double *widths, i
static int
+#if defined(LIBDPX)
write_fontfile (pdf_font *font, cff_font *cffont)
+#else
+write_fontfile (pdf_font *font, cff_font *cffont, pdf_obj *pdfcharset)
+#endif /* LIBDPX */
{
pdf_obj *descriptor;
pdf_obj *fontfile, *stream_dict;
@@ -467,7 +493,12 @@ write_fontfile (pdf_font *font, cff_font *cffont)
pdf_new_name("Subtype"), pdf_new_name("Type1C"));
pdf_add_stream (fontfile, (void *) stream_data_ptr, offset);
pdf_release_obj(fontfile);
-
+#if !defined(LIBDPX)
+ pdf_add_dict(descriptor,
+ pdf_new_name("CharSet"),
+ pdf_new_string(pdf_stream_dataptr(pdfcharset),
+ pdf_stream_length(pdfcharset)));
+#endif /* !LIBDPX */
RELEASE(stream_data_ptr);
return offset;
@@ -478,6 +509,9 @@ int
pdf_font_load_type1 (pdf_font *font)
{
pdf_obj *fontdict;
+#if !defined(LIBDPX)
+ pdf_obj *pdfcharset; /* Actually string object */
+#endif /* !LIBDPX */
int encoding_id;
char *usedchars, *ident;
char *fontname, *uniqueTag;
@@ -580,6 +614,9 @@ pdf_font_load_type1 (pdf_font *font)
/* Create CFF encoding, charset, sort glyphs */
#define MAX_GLYPHS 1024
GIDMap = NEW(MAX_GLYPHS, card16);
+#if !defined(LIBDPX)
+ pdfcharset = pdf_new_stream(0);
+#endif /* !LIBDPX */
{
int prev, duplicate;
int gid;
@@ -652,7 +689,13 @@ pdf_font_load_type1 (pdf_font *font)
if (verbose > 2) {
MESG("/%s", glyph);
}
-
+#if !defined(LIBDPX)
+ /* CharSet is actually string object. */
+ {
+ pdf_add_stream(pdfcharset, "/", 1);
+ pdf_add_stream(pdfcharset, glyph, strlen(glyph));
+ }
+#endif /* !LIBDPX */
}
}
if (cffont->encoding->num_supps > 0) {
@@ -776,10 +819,18 @@ pdf_font_load_type1 (pdf_font *font)
add_metrics(font, cffont, enc_vec, widths, num_glyphs);
+#if defined(LIBDPX)
offset = write_fontfile(font, cffont);
+#else
+ offset = write_fontfile(font, cffont, pdfcharset);
+#endif /* LIBDPX */
if (verbose > 1)
MESG("[%u glyphs][%ld bytes]", num_glyphs, offset);
+#if !defined(LIBDPX)
+ pdf_release_obj(pdfcharset);
+#endif /* LIBDPX */
+
cff_close(cffont);
/* Cleanup */