summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/type1.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvipdfm-x/type1.c')
-rw-r--r--Build/source/texk/dvipdfm-x/type1.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/Build/source/texk/dvipdfm-x/type1.c b/Build/source/texk/dvipdfm-x/type1.c
index b74030c986f..008c97d4ee1 100644
--- a/Build/source/texk/dvipdfm-x/type1.c
+++ b/Build/source/texk/dvipdfm-x/type1.c
@@ -324,14 +324,28 @@ add_metrics (pdf_font *font, cff_font *cffont, char **enc_vec, double *widths, i
pdf_release_obj(tmp_array);
return;
}
+ /* PLEASE FIX THIS
+ * It's wrong to use TFM width here... We should warn if TFM width
+ * and actual glyph width are different.
+ */
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])];
- else
+ else {
+ double diff;
width = 1000. * tfm_get_width(tfm_id, code);
+ diff = width -
+ scaling * widths[cff_glyph_lookup(cffont, enc_vec[code])];
+ if (fabs(diff) > 1.) {
+ 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])]);
+ }
+ }
pdf_add_array(tmp_array,
pdf_new_number(ROUND(width, 0.1)));
} else {
@@ -356,7 +370,7 @@ add_metrics (pdf_font *font, cff_font *cffont, char **enc_vec, double *widths, i
static int
-write_fontfile (pdf_font *font, cff_font *cffont)
+write_fontfile (pdf_font *font, cff_font *cffont, pdf_obj *pdfcharset)
{
pdf_obj *descriptor;
pdf_obj *fontfile, *stream_dict;
@@ -467,7 +481,10 @@ 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);
-
+ pdf_add_dict(descriptor,
+ pdf_new_name("CharSet"),
+ pdf_new_string(pdf_stream_dataptr(pdfcharset),
+ pdf_stream_length(pdfcharset)));
RELEASE(stream_data_ptr);
return offset;
@@ -478,6 +495,7 @@ int
pdf_font_load_type1 (pdf_font *font)
{
pdf_obj *fontdict;
+ pdf_obj *pdfcharset; /* Actually string object */
int encoding_id;
char *usedchars, *ident;
char *fontname, *uniqueTag;
@@ -580,6 +598,7 @@ pdf_font_load_type1 (pdf_font *font)
/* Create CFF encoding, charset, sort glyphs */
#define MAX_GLYPHS 1024
GIDMap = NEW(MAX_GLYPHS, card16);
+ pdfcharset = pdf_new_stream(0);
{
int prev, duplicate;
int gid;
@@ -652,7 +671,11 @@ pdf_font_load_type1 (pdf_font *font)
if (verbose > 2) {
MESG("/%s", glyph);
}
-
+ /* CharSet is actually string object. */
+ {
+ pdf_add_stream(pdfcharset, "/", 1);
+ pdf_add_stream(pdfcharset, glyph, strlen(glyph));
+ }
}
}
if (cffont->encoding->num_supps > 0) {
@@ -776,10 +799,12 @@ pdf_font_load_type1 (pdf_font *font)
add_metrics(font, cffont, enc_vec, widths, num_glyphs);
- offset = write_fontfile(font, cffont);
+ offset = write_fontfile(font, cffont, pdfcharset);
if (verbose > 1)
MESG("[%u glyphs][%ld bytes]", num_glyphs, offset);
+ pdf_release_obj(pdfcharset);
+
cff_close(cffont);
/* Cleanup */