From 8bccdb4d27ab05c44c37bfa7ccdfad234423f356 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sat, 1 Apr 2017 07:29:32 +0000 Subject: pdftexdir: Always embed each bitmap font, even if it has an entry in a font-map file, with different size separately (Pali Roh\'ar) git-svn-id: svn://tug.org/texlive/trunk@43667 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/pdftexdir/ChangeLog | 10 ++++++++-- Build/source/texk/web2c/pdftexdir/mapfile.c | 17 +++++++++++++---- Build/source/texk/web2c/pdftexdir/pdftex.defines | 1 + Build/source/texk/web2c/pdftexdir/pdftex.web | 8 ++++---- Build/source/texk/web2c/pdftexdir/ptexlib.h | 1 + Build/source/texk/web2c/pdftexdir/ptexmac.h | 4 ++++ Build/source/texk/web2c/pdftexdir/writefont.c | 2 +- 7 files changed, 32 insertions(+), 11 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index abfcf2aba78..dbdcd6ee8f3 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,10 +1,16 @@ +2017-04-01 Pali Roh\'ar + + * mapfile.c, ptexlib.h, ptexmac.h, writefont.c, pdftex.defines, + pdftex.web: Always embed each bitmap font, even if it has an entry + in a font-map file, with different size separately instead of + scaling geometrically. + 2017-03-30 Pali Roh\'ar * ptexmac.h: remove duplicate macros. * writet3.c (writet3): ensure fm is non-NULL before dereferencing. * mapfile.c (check_fm_entry): omit check for is_reencoded, i.e., - an .enc file. This way, each bitmap font is embedded separately, - thus rasterized by MF instead of geometrically scaling up. + an .enc file. https://mailman.ntg.nl/pipermail/ntg-pdftex/2017-March/004125.html 2017-03-29 Akira Kakuto diff --git a/Build/source/texk/web2c/pdftexdir/mapfile.c b/Build/source/texk/web2c/pdftexdir/mapfile.c index 8b2e270b643..ab665164a29 100644 --- a/Build/source/texk/web2c/pdftexdir/mapfile.c +++ b/Build/source/texk/web2c/pdftexdir/mapfile.c @@ -290,8 +290,7 @@ static int check_fm_entry(fm_entry * fm, boolean warn) /* if for non-Type3 font both ps_name and font file are missing, drop this entry */ - if ((is_type1(fm) || is_truetype(fm) || is_opentype(fm)) - && fm->ps_name == NULL && !is_fontfile(fm)) { + if (!is_type3(fm) && fm->ps_name == NULL && !is_fontfile(fm)) { if (warn) pdftex_warn ("invalid entry for `%s': both ps_name and font file missing", @@ -539,8 +538,13 @@ static void fm_scan_line(void) set_opentype(fm); else set_type1(fm); - } else if (is_std_t1font(fm)) - set_type1(fm); /* assume a builtin font is Type1 */ + } else { + if (is_std_t1font(fm)) { + set_type1(fm); /* assume a builtin font is Type1 */ + } else { + set_type3(fm); /* otherwise font is Type3 */ + } + } if (check_fm_entry(fm, true) != 0) goto bad_line; /* @@ -624,6 +628,11 @@ boolean hasfmentry(internalfontnumber f) return pdffontmap[f] != (fmentryptr) dummy_fm_entry(); } +boolean isscalable(internalfontnumber f) +{ + return hasfmentry(f) && (!is_type3((fm_entry *)pdffontmap[f])); +} + /* check whether a map entry is valid for font replacement */ static boolean fm_valid_for_font_replacement(fm_entry * fm) diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.defines b/Build/source/texk/web2c/pdftexdir/pdftex.defines index 766a80e65fe..012d0edd194 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftex.defines +++ b/Build/source/texk/web2c/pdftexdir/pdftex.defines @@ -38,6 +38,7 @@ with this program. If not, see . { functions from mapfile.c } @define function hasfmentry(); +@define function isscalable(); @define procedure checkextfm(); @define procedure pdfmapfile(); @define procedure pdfmapline(); diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web index a00d8d408ac..b74cc416237 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftex.web +++ b/Build/source/texk/web2c/pdftexdir/pdftex.web @@ -15731,7 +15731,7 @@ var w, s_out: scaled; s: integer; begin w := char_width(f)(char_info(f)(c)); - if hasfmentry(f) then begin + if isscalable(f) then begin if pdf_cur_Tm_a = 0 then begin call_func(divide_scaled(w, pdf_font_size[f], 4)); pdf_delta_h := pdf_delta_h + scaled_out; @@ -15942,7 +15942,7 @@ begin {if |f| is auto expanded then ensure the base font is initialized} if pdf_font_auto_expand[f] and (pdf_font_blink[f] <> null_font) then begin b := pdf_font_blink[f]; - if not hasfmentry(b) then + if not isscalable(b) then pdf_error("font expansion", "auto expansion is only possible with scalable fonts"); if not font_used[b] then pdf_init_font(b); @@ -15953,11 +15953,11 @@ begin here: 1) |f| and |k| have the same tfm name (so they have been loaded at different sizes, eg 'cmr10' and 'cmr10 at 11pt'); 2) |f| has been auto expanded from |k|} - if hasfmentry(f) then begin + if isscalable(f) then begin i := head_tab[obj_type_font]; while i <> 0 do begin k := obj_info(i); - if hasfmentry(k) and + if isscalable(k) and (pdf_font_map[k] = pdf_font_map[f]) and (str_eq_str(font_name[k], font_name[f]) or (pdf_font_auto_expand[f] and diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h index 5db7f5a74b8..791af1f4b5a 100644 --- a/Build/source/texk/web2c/pdftexdir/ptexlib.h +++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h @@ -168,6 +168,7 @@ extern const char *ptexbanner; /* mapfile.c */ extern boolean hasfmentry(internalfontnumber); +extern boolean isscalable(internalfontnumber); extern void fm_free(void); extern void fm_read_info(void); extern ff_entry *check_ff_exist(char *, boolean); diff --git a/Build/source/texk/web2c/pdftexdir/ptexmac.h b/Build/source/texk/web2c/pdftexdir/ptexmac.h index b8af84c238d..1f7b7ae70bf 100644 --- a/Build/source/texk/web2c/pdftexdir/ptexmac.h +++ b/Build/source/texk/web2c/pdftexdir/ptexmac.h @@ -155,6 +155,7 @@ size_t T##_limit # define F_TYPE1 0x10 # define F_TRUETYPE 0x20 # define F_OTF 0x40 +# define F_TYPE3 0x80 # define set_included(fm) ((fm)->type |= F_INCLUDED) # define set_subsetted(fm) ((fm)->type |= F_SUBSETTED) @@ -163,6 +164,7 @@ size_t T##_limit # define set_type1(fm) ((fm)->type |= F_TYPE1) # define set_truetype(fm) ((fm)->type |= F_TRUETYPE) # define set_opentype(fm) ((fm)->type |= F_OTF) +# define set_type3(fm) ((fm)->type |= F_TYPE3) # define unset_included(fm) ((fm)->type &= ~F_INCLUDED) # define unset_subsetted(fm) ((fm)->type &= ~F_SUBSETTED) @@ -171,6 +173,7 @@ size_t T##_limit # define unset_type1(fm) ((fm)->type &= ~F_TYPE1) # define unset_truetype(fm) ((fm)->type &= ~F_TRUETYPE) # define unset_opentype(fm) ((fm)->type &= ~F_OTF) +# define unset_type3(fm) ((fm)->type &= ~F_TYPE3) # define is_included(fm) (((fm)->type & F_INCLUDED) != 0) # define is_subsetted(fm) (((fm)->type & F_SUBSETTED) != 0) @@ -179,6 +182,7 @@ size_t T##_limit # define is_type1(fm) (((fm)->type & F_TYPE1) != 0) # define is_truetype(fm) (((fm)->type & F_TRUETYPE) != 0) # define is_opentype(fm) (((fm)->type & F_OTF) != 0) +# define is_type3(fm) (((fm)->type & F_TYPE3) != 0) # define fm_slant(fm) (fm)->slant # define fm_extend(fm) (fm)->extend diff --git a/Build/source/texk/web2c/pdftexdir/writefont.c b/Build/source/texk/web2c/pdftexdir/writefont.c index 13d40decb97..82d18b751cf 100644 --- a/Build/source/texk/web2c/pdftexdir/writefont.c +++ b/Build/source/texk/web2c/pdftexdir/writefont.c @@ -666,7 +666,7 @@ void dopdffont(integer font_objnum, internalfontnumber f) { fm_entry *fm; fm = hasfmentry(f) ? (fm_entry *) pdffontmap[f] : NULL; - if (fm == NULL || (fm->ps_name == NULL && fm->ff_name == NULL)) + if (fm == NULL || is_type3(fm) || (fm->ps_name == NULL && fm->ff_name == NULL)) writet3(fm, font_objnum, f); else create_fontdictionary(fm, font_objnum, f); -- cgit v1.2.3