summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-04-12 16:48:24 +0000
committerKarl Berry <karl@freefriends.org>2012-04-12 16:48:24 +0000
commit9b41efe5379edf34e5f9cb992c97ed57be3bab5d (patch)
tree9a100652b62922837c9b91ade033a17c4478d218 /Build/source/texk/web2c
parent1932fa55c545fffe9fdd79df0459f384028a39d2 (diff)
changes from thanh for two new warning-suppression primitives and unicode glyph-name scanning; import from pdftex
git-svn-id: svn://tug.org/texlive/trunk@25938 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog16
-rw-r--r--Build/source/texk/web2c/pdftexdir/mapfile.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web26
-rw-r--r--Build/source/texk/web2c/pdftexdir/ttf2afm.c18
-rw-r--r--Build/source/texk/web2c/pdftexdir/writettf.c47
5 files changed, 84 insertions, 33 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index fc5aa84049d..8ef4b0425ca 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,19 @@
+2012-04-12 Thanh Han The <thanh@river-valley.org>
+
+ * ttf2afm.c (print_str): new macro, replacing function.
+ (escape_eol): new fn, replacing print_str, now returning a string.
+
+ * writettf.c (ttf_reindex_glyphs): use %n to sscanf forms
+ uniABCD and index123.
+
+ * mapfile.c (suppress_warn): way to avoid dup warnings.
+
+ * pdftex.web (pdf_suppress_warning_dup_dest_code,
+ pdf_suppress_warning_dup_dest_code): new primitives
+ \pdfsuppresswarningdupdest and \pdfsuppresswarningdupmap.
+ (get_pdf_suppress_warning_dup_map): new fn.
+ (warn_dest_dup): check pdf_suppress_warning_dup_dest.
+
2012-01-18 Peter Breitenlohner <peb@mppmu.mpg.de>
* writejbig2.c (getstreamlen): Change type to `off_t'.
diff --git a/Build/source/texk/web2c/pdftexdir/mapfile.c b/Build/source/texk/web2c/pdftexdir/mapfile.c
index 1528f330603..6345c575a04 100644
--- a/Build/source/texk/web2c/pdftexdir/mapfile.c
+++ b/Build/source/texk/web2c/pdftexdir/mapfile.c
@@ -1,5 +1,5 @@
/* mapfile.c: handling of map files/lines
-Copyright 1996-2011 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2012 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -179,6 +179,7 @@ int avl_do_entry(fm_entry * fm, int mode)
fm_entry *p;
void *a;
void **aa;
+ boolean suppress_warn = (getpdfsuppresswarningdupmap() > 0);
/* handle tfm_name link */
@@ -187,9 +188,10 @@ int avl_do_entry(fm_entry * fm, int mode)
if (p != NULL) {
switch (mode) {
case FM_DUPIGNORE:
- pdftex_warn
- ("fontmap entry for `%s' already exists, duplicates ignored",
- fm->tfm_name);
+ if (!suppress_warn)
+ pdftex_warn
+ ("fontmap entry for `%s' already exists, duplicates ignored",
+ fm->tfm_name);
goto exit;
break;
case FM_REPLACE:
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index 96d2455012d..95bd88d75cb 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -1,4 +1,4 @@
-% Copyright (c) 1996-2011 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh,
+% Copyright (c) 1996-2012 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh,
% <thanh@@pdftex.org>
% This file is part of pdfTeX.
@@ -5674,8 +5674,10 @@ that will be defined later.
@d pdf_append_kern_code = pdftex_first_integer_code + 23 {append kern before certain characters?}
@d pdf_gen_tounicode_code = pdftex_first_integer_code + 24 {generate ToUnicode for fonts?}
@d pdf_draftmode_code = pdftex_first_integer_code + 25 {switch on draftmode if positive}
-@d pdf_inclusion_copy_font_code = pdftex_first_integer_code + 26 {generate ToUnicode for fonts?}
-@d pdf_int_pars=pdftex_first_integer_code + 27 {total number of \pdfTeX's integer parameters}
+@d pdf_inclusion_copy_font_code = pdftex_first_integer_code + 26 {generate ToUnicode for fonts?}
+@d pdf_suppress_warning_dup_dest_code = pdftex_first_integer_code + 27 {suppress warning about duplicated destinations}
+@d pdf_suppress_warning_dup_map_code = pdftex_first_integer_code + 28 {suppress warning about duplicated map lines}
+@d pdf_int_pars=pdftex_first_integer_code + 29 {total number of \pdfTeX's integer parameters}
@#
@d etex_int_base=pdf_int_pars {base for \eTeX's integer parameters}
@d tracing_assigns_code=etex_int_base {show assignments}
@@ -5781,6 +5783,8 @@ that will be defined later.
@d pdf_image_apply_gamma == int_par(pdf_image_apply_gamma_code)
@d pdf_draftmode == int_par(pdf_draftmode_code)
@d pdf_inclusion_copy_font == int_par(pdf_inclusion_copy_font_code)
+@d pdf_suppress_warning_dup_dest == int_par(pdf_suppress_warning_dup_dest_code)
+@d pdf_suppress_warning_dup_map == int_par(pdf_suppress_warning_dup_map_code)
@#
@d tracing_assigns==int_par(tracing_assigns_code)
@d tracing_groups==int_par(tracing_groups_code)
@@ -5882,7 +5886,9 @@ pdf_prepend_kern_code: print_esc("pdfprependkern");
pdf_append_kern_code: print_esc("pdfappendkern");
pdf_gen_tounicode_code: print_esc("pdfgentounicode");
pdf_draftmode_code: print_esc("pdfdraftmode");
-pdf_inclusion_copy_font_code: print_esc("pdfinclusioncopyfonts");
+pdf_inclusion_copy_font_code: print_esc("pdfinclusioncopyfonts");
+pdf_suppress_warning_dup_dest_code: print_esc("pdfsuppresswarningdupdest");
+pdf_suppress_warning_dup_map_code: print_esc("pdfsuppresswarningdupmap");
@/@<Cases for |print_param|@>@/
othercases print("[unknown integer parameter!]")
endcases;
@@ -6060,6 +6066,10 @@ primitive("pdfdraftmode",assign_int,int_base+pdf_draftmode_code);@/
@!@:pdf_draftmode_}{\.{\\pdfdraftmode} primitive@>
primitive("pdfinclusioncopyfonts",assign_int,int_base+pdf_inclusion_copy_font_code);@/
@!@:pdf_inclusion_copy_font_}{\.{\\pdfinclusioncopyfonts} primitive@>
+primitive("pdfsuppresswarningdupdest",assign_int,int_base+pdf_suppress_warning_dup_dest_code);@/
+@!@:pdf_suppress_warning_dup_dest_}{\.{\\pdfsuppresswarningdupdest} primitive@>
+primitive("pdfsuppresswarningdupmap",assign_int,int_base+pdf_suppress_warning_dup_map_code);@/
+@!@:pdf_suppress_warning_dup_map_}{\.{\\pdfsuppresswarningdupmap} primitive@>
@ @<Cases of |print_cmd_chr|...@>=
assign_int: if chr_code<count_base then print_param(chr_code-int_base)
@@ -14977,6 +14987,12 @@ begin
get_pdf_compress_level := pdf_compress_level;
end;
+function get_pdf_suppress_warning_dup_map: integer;
+begin
+ get_pdf_suppress_warning_dup_map := pdf_suppress_warning_dup_map;
+end;
+
+
function get_nullfont: internal_font_number;
begin
get_nullfont := null_font;
@@ -34417,6 +34433,8 @@ with the same identifier already exists and give a warning if needed.
@<Declare procedures needed in |pdf_hlist_out|, |pdf_vlist_out|@>=
procedure warn_dest_dup(id: integer; byname: small_number; s1, s2: str_number);
begin
+ if pdf_suppress_warning_dup_dest > 0 then
+ return;
pdf_warning(s1, "destination with the same identifier (", false, false);
if byname > 0 then begin
print("name");
diff --git a/Build/source/texk/web2c/pdftexdir/ttf2afm.c b/Build/source/texk/web2c/pdftexdir/ttf2afm.c
index 1da6acde57c..3fdabf564d0 100644
--- a/Build/source/texk/web2c/pdftexdir/ttf2afm.c
+++ b/Build/source/texk/web2c/pdftexdir/ttf2afm.c
@@ -48,6 +48,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define enc_eof() feof(encfile)
#define pdftex_fail ttf_fail
+#define print_str(S) if (S != NULL) fprintf(outfile, #S " %s\n", escape_eol(S))
#define print_dimen(N) if (N != 0) fprintf(outfile, #N " %i\n", (int)get_ttf_funit(N))
#define get_ttf_funit(n) \
@@ -748,21 +749,26 @@ static void print_char_metric(FILE * f, int charcode, long glyph_index)
(int) get_ttf_funit(mtx_tab[glyph_index].bbox[3]));
}
-static void print_str(char *s)
+static char * escape_eol(char *s)
{
char *p, *e;
+ char *dest, *d;
if (s == NULL)
- return;
+ return NULL;
+ dest = d = xtalloc(2*strlen(s), char);
e = strend(s);
for (p = s; p < e; p++) {
- if (*p == 10 || *p == 13)
- fputs("\\n", outfile);
+ if (*p == 10 || *p == 13) {
+ *d++ = '\\';
+ *d++ = 'n';
+ }
else
- fputc(*p, outfile);
+ *d++ = *p;
}
- fputs("\n", outfile);
+ *d = 0;
+ return dest;
}
static void print_afm(char *date, char *fontname)
diff --git a/Build/source/texk/web2c/pdftexdir/writettf.c b/Build/source/texk/web2c/pdftexdir/writettf.c
index 1d5cd6497dc..f92b453d7d3 100644
--- a/Build/source/texk/web2c/pdftexdir/writettf.c
+++ b/Build/source/texk/web2c/pdftexdir/writettf.c
@@ -1,5 +1,5 @@
/*
-Copyright 1996-2011 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2012 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -1020,6 +1020,7 @@ static void ttf_reindex_glyphs(void)
ttfenc_entry *e;
glyph_entry *glyph;
int index;
+ int n;
long *t;
ttf_cmap_entry *cmap = NULL;
boolean cmap_not_found = false;
@@ -1063,18 +1064,16 @@ static void ttf_reindex_glyphs(void)
/* handle case of reencoded fonts */
if (e->name == notdef)
continue;
- /* scan form `index123' */
- if (sscanf(e->name, GLYPH_PREFIX_INDEX "%i", &index) == 1) {
- if (index >= glyphs_count) {
- pdftex_warn("`%s' out of valid range [0..%i)",
- e->name, glyphs_count);
- continue;
- }
- glyph = glyph_tab + index;
- goto append_new_glyph;
- }
+
+ /* look up by name first */
+ for (glyph = glyph_tab; glyph - glyph_tab < glyphs_count; glyph++)
+ if (glyph->name != notdef && strcmp(glyph->name, e->name) == 0)
+ goto append_new_glyph;
+
/* scan form `uniABCD' */
- if (sscanf(e->name, GLYPH_PREFIX_UNICODE "%X", &index) == 1) {
+ n = -1;
+ sscanf(e->name, GLYPH_PREFIX_UNICODE "%X%n", &index, &n);
+ if (n == strlen(e->name)) {
if (cmap == NULL && !cmap_not_found) {
/* need to read the unicode mapping, ie (pid,eid) = (3,1) or (0,3) */
cmap = ttf_read_cmap(fd_cur->fm->ff_name, 3, 1, false);
@@ -1105,14 +1104,24 @@ static void ttf_reindex_glyphs(void)
continue;
}
}
- /* look up by name */
- for (glyph = glyph_tab; glyph - glyph_tab < glyphs_count; glyph++)
- if (glyph->name != notdef && strcmp(glyph->name, e->name) == 0)
- break;
- if (!(glyph - glyph_tab < glyphs_count)) {
- pdftex_warn("glyph `%s' not found", e->name);
- continue;
+
+ /* scan form `index123' */
+ n = -1;
+ sscanf(e->name, GLYPH_PREFIX_INDEX "%i%n", &index, &n);
+ if (n == strlen(e->name)) {
+ if (index >= glyphs_count) {
+ pdftex_warn("`%s' out of valid range [0..%i)",
+ e->name, glyphs_count);
+ continue;
+ }
+ glyph = glyph_tab + index;
+ goto append_new_glyph;
}
+
+ /* not found */
+ pdftex_warn("glyph `%s' not found", e->name);
+ continue;
+
append_new_glyph:
assert(glyph > glyph_tab && glyph - glyph_tab < glyphs_count);
if (glyph->newindex < 0) {