texlive[43519] Build/source/texk/web2c/pdftexdir: .enc files for

commits+karl at tug.org commits+karl at tug.org
Fri Mar 17 00:03:12 CET 2017


Revision: 43519
          http://tug.org/svn/texlive?view=revision&revision=43519
Author:   karl
Date:     2017-03-17 00:03:12 +0100 (Fri, 17 Mar 2017)
Log Message:
-----------
.enc files for bitmap fonts, pdftex r772

Revision Links:
--------------
    http://tug.org/svn/texlive?view=revision&revision=772

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
    trunk/Build/source/texk/web2c/pdftexdir/NEWS
    trunk/Build/source/texk/web2c/pdftexdir/mapfile.c
    trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h
    trunk/Build/source/texk/web2c/pdftexdir/writefont.c
    trunk/Build/source/texk/web2c/pdftexdir/writet3.c

Modified: trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2017-03-16 22:18:11 UTC (rev 43518)
+++ trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2017-03-16 23:03:12 UTC (rev 43519)
@@ -1,3 +1,16 @@
+2017-03-16  Pali Roh\'ar <pali.rohar at gmail.com>
+
+	Allow .enc files for bitmap fonts, following thread at
+	http://tug.org/pipermail/pdftex/2016-July/009064.html
+	http://tug.org/pipermail/pdftex/2016-August/009065.html:
+	* writet3.c (remove_duplicate_glyph_names): new fn.
+	(writet3): change fn to take fm_entry object, and use it to write
+	glyph names from an enc file, if specified in the map file.
+	(write_fontdictionary): 
+	* ptexlib.h (writet3): change declaration.
+	* writefont.c (dopdffont): change call to writet3.
+	* mapfile.c (check_fm_entry): also report missing enc file.
+
 2017-02-18  Heiko Oberdiek  <heiko.oberdiek at googlemail.com>
 
 	* pdftex.web (substr_of_str): move earlier.

Modified: trunk/Build/source/texk/web2c/pdftexdir/NEWS
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/NEWS	2017-03-16 22:18:11 UTC (rev 43518)
+++ trunk/Build/source/texk/web2c/pdftexdir/NEWS	2017-03-16 23:03:12 UTC (rev 43519)
@@ -1,5 +1,6 @@
 pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
 - changes:
+  - encoding files can be specified for PK bitmap fonts on font map lines.
   - rename envvar SOURCE_DATE_EPOCH_TEX_PRIMITIVES to FORCE_SOURCE_DATE;
     no changes in functionality.
   - if the \pdfpageattr token list contains the string "/MediaBox",

Modified: trunk/Build/source/texk/web2c/pdftexdir/mapfile.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/mapfile.c	2017-03-16 22:18:11 UTC (rev 43518)
+++ trunk/Build/source/texk/web2c/pdftexdir/mapfile.c	2017-03-16 23:03:12 UTC (rev 43519)
@@ -288,11 +288,11 @@
         /* do not set variable |a| as this entry will be still accepted */
     }
 
-    /* if both ps_name and font file are missing, drop this entry */
-    if (fm->ps_name == NULL && !is_fontfile(fm)) {
+    /* if ps_name, font file and enc file are missing, drop this entry */
+    if (fm->ps_name == NULL && !is_fontfile(fm) && !is_reencoded(fm)) {
         if (warn)
             pdftex_warn
-                ("invalid entry for `%s': both ps_name and font file missing",
+                ("invalid entry for `%s': ps_name, font file, enc file all missing",
                  fm->tfm_name);
         a += 1;
     }

Modified: trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h	2017-03-16 22:18:11 UTC (rev 43518)
+++ trunk/Build/source/texk/web2c/pdftexdir/ptexlib.h	2017-03-16 23:03:12 UTC (rev 43519)
@@ -307,7 +307,7 @@
 extern void t1_free(void);
 
 /* writet3.c */
-extern void writet3(int, internalfontnumber);
+extern void writet3(fm_entry *, int, internalfontnumber);
 extern scaled getpkcharwidth(internalfontnumber, scaled);
 
 /* writettf.c */

Modified: trunk/Build/source/texk/web2c/pdftexdir/writefont.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/writefont.c	2017-03-16 22:18:11 UTC (rev 43518)
+++ trunk/Build/source/texk/web2c/pdftexdir/writefont.c	2017-03-16 23:03:12 UTC (rev 43519)
@@ -667,7 +667,7 @@
     fm_entry *fm;
     fm = hasfmentry(f) ? (fm_entry *) pdffontmap[f] : NULL;
     if (fm == NULL || (fm->ps_name == NULL && fm->ff_name == NULL))
-        writet3(font_objnum, f);
+        writet3(fm, font_objnum, f);
     else
         create_fontdictionary(fm, font_objnum, f);
 }

Modified: trunk/Build/source/texk/web2c/pdftexdir/writet3.c
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/writet3.c	2017-03-16 22:18:11 UTC (rev 43518)
+++ trunk/Build/source/texk/web2c/pdftexdir/writet3.c	2017-03-16 23:03:12 UTC (rev 43519)
@@ -254,8 +254,32 @@
     return true;
 }
 
-void writet3(int objnum, internalfontnumber f)
+static void remove_duplicate_glyph_names(char **g, const char *encname)
 {
+    struct avl_table *gl_tree;
+    char *aa;
+    int i;
+    gl_tree = avl_create(comp_string_entry, NULL, &avl_xallocator);
+    assert(gl_tree != NULL);
+    for (i = 0; i < 256; i++) {
+        if (g[i] == notdef)
+            continue;
+        aa = (char *) avl_find(gl_tree, g[i]);
+        if (aa == NULL) {
+            aa = (char *) avl_probe(gl_tree, g[i]);
+            assert(aa != NULL);
+        } else {
+            pdftex_warn("%s: duplicate glyph name `%s' at position %d",
+                        encname, g[i], i);
+            xfree(g[i]);
+            g[i] = (char *) notdef;
+        }
+    }
+    avl_destroy(gl_tree, NULL);
+}
+
+void writet3(fm_entry * fm, int objnum, internalfontnumber f)
+{
     static char t3_font_scale_str[] = "\\pdffontscale";
     int i;
     integer wptr, eptr, cptr;
@@ -262,6 +286,9 @@
     int first_char, last_char;
     integer pk_font_scale;
     boolean is_notdef;
+    fe_entry *fe;
+    char **glyph_names;
+    integer tounicode_objnum;
     t3_glyph_num = 0;
     t3_image_used = false;
     for (i = 0; i < 256; i++) {
@@ -268,6 +295,10 @@
         t3_char_procs[i] = 0;
         t3_char_widths[i] = 0;
     }
+    fe = fm ? get_fe_entry(fm->encname) : NULL;
+    glyph_names = fe ? fe->glyph_names : NULL;
+    if (glyph_names)
+        remove_duplicate_glyph_names(glyph_names, fm->encname);
     packfilename(fontname[f], getnullstr(), maketexstring(".pgc"));
     cur_file_name = makecstring(makenamestring());
     is_pk_font = false;
@@ -298,6 +329,11 @@
         if (pdfcharmarked(f, i))
             break;
     last_char = i;
+    /* write ToUnicode entry if needed */
+    if (fixedgentounicode > 0 && !pdffontnobuiltintounicode[f] && fe != NULL)
+        tounicode_objnum = write_tounicode(glyph_names, fm->tfm_name,fe->name);
+    else
+        tounicode_objnum = 0;
     pdfbegindict(objnum, 1);    /* Type 3 font dictionary */
     pdf_puts("/Type /Font\n/Subtype /Type3\n");
     pdf_printf("/Name /F%i\n", (int) f);
@@ -344,7 +380,12 @@
         pdf_printf("/%s", notdef);
         is_notdef = true;
     } else {
-        pdf_printf("/a%i", first_char);
+        if (glyph_names
+            && glyph_names[first_char]
+            && glyph_names[first_char] != notdef)
+            pdf_printf("/%s", glyph_names[first_char]);
+        else
+            pdf_printf("/a%i", first_char);
         is_notdef = false;
     }
     for (i = first_char + 1; i <= last_char; i++) {
@@ -358,15 +399,25 @@
                 pdf_printf(" %i", i);
                 is_notdef = false;
             }
-            pdf_printf("/a%i", i);
+            if (glyph_names && glyph_names[i] && glyph_names[i] != notdef)
+                pdf_printf("/%s", glyph_names[i]);
+            else
+                pdf_printf("/a%i", i);
         }
     }
     pdf_puts("]\n");
+    if (tounicode_objnum != 0)
+        pdf_printf("/ToUnicode %i 0 R\n", (int) tounicode_objnum);
     pdfenddict();
     pdfbegindict(cptr, 1);      /* CharProcs dictionary */
     for (i = first_char; i <= last_char; i++)
         if (t3_char_procs[i] != 0)
-            pdf_printf("/a%i %i 0 R\n", (int) i, (int) t3_char_procs[i]);
+            if (glyph_names && glyph_names[i] && glyph_names[i] != notdef)
+                pdf_printf("/%s %i 0 R\n", glyph_names[i], 
+                           (int) t3_char_procs[i]);
+            else
+                pdf_printf("/a%i %i 0 R\n", (int) i,
+                           (int) t3_char_procs[i]);
     pdfenddict();
     t3_close();
     tex_printf(">");



More information about the tex-live-commits mailing list