pdftex[812] branches/stable: primitive parameter \pdfincludecharset

commits+karl at tug.org commits+karl at tug.org
Sun Jan 27 18:56:21 CET 2019


Revision: 812
          http://tug.org/svn/pdftex?view=revision&revision=812
Author:   karl
Date:     2019-01-27 18:56:20 +0100 (Sun, 27 Jan 2019)
Log Message:
-----------
primitive parameter \pdfincludecharset to decided whether to output /CharSet

Modified Paths:
--------------
    branches/stable/doc/manual/pdftex-t.tex
    branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
    branches/stable/source/src/texk/web2c/pdftexdir/NEWS
    branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web
    branches/stable/source/src/texk/web2c/pdftexdir/writefont.c

Added Paths:
-----------
    branches/stable/tests/11-includecharset/
    branches/stable/tests/11-includecharset/Makefile
    branches/stable/tests/11-includecharset/test-includecharset.tex

Modified: branches/stable/doc/manual/pdftex-t.tex
===================================================================
--- branches/stable/doc/manual/pdftex-t.tex	2019-01-19 23:36:08 UTC (rev 811)
+++ branches/stable/doc/manual/pdftex-t.tex	2019-01-27 17:56:20 UTC (rev 812)
@@ -85,6 +85,7 @@
 \abbreviation [PDFLATEX]   {pdf\LaTeX}  {\TEX\ extension producing \PDF\ output (\LATEX\ format loaded)}
 \abbreviation [PDFTEX]     {pdf\TeX}    {\TEX\ extension producing \PDF\ output}
 \abbreviation [PDF]        {pdf}        {Portable Document Format}
+\abbreviation [PDFA]       {pdf/\kern-.16em a}      {PDF A/ standards}
 \abbreviation [PERL]       {Perl}       {Perl programming environment}
 \abbreviation [PFA]        {PFA}        {Adobe PostScript Font format (ASCII)}
 \abbreviation [PFB]        {PFB}        {Adobe PostScript Font format (Binary)}
@@ -2785,6 +2786,20 @@
 corresponding glyphs will be embedded into the font resources in the \PDF\
 output. Nothing is appended to the list being built.
 
+\pdftexprimitive{\Syntax{\Tex{\pdfincludecharset} \Whatever{integer}}}
+\bookmark{\tex{pdfincludecharset}}
+
+If this primitive parameter is zero (the default), the \type{/CharSet}
+entry is omitted from fonts in the \PDF\ output; if it is set to 1, then
+\type{/CharSet} is included. (Other values may have other meanings in
+the future, so do not rely on them.)
+
+Explanation: This parameter was created because the \PDFA-1 standard
+requires \type{/CharSet}, whereas \PDFA-2 and \PDFA-3 allow it to be
+omitted but have extraordinary requirements if it is included. Viewers
+in general do not care one way or the other, this is only about
+satisfying the standards. \introduced{1.40.20}
+
 \pdftexprimitive{\Syntax{\Tex{\pdfuniqueresname} \Whatever{integer}}}
 \bookmark{\tex{pdfuniqueresname}}
 

Modified: branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2019-01-19 23:36:08 UTC (rev 811)
+++ branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2019-01-27 17:56:20 UTC (rev 812)
@@ -1,3 +1,13 @@
+2014-02-14  Karl Berry  <karl at gnu.org>
+
+	* pdftex.web (pdf_include_charset_code, pdf_include_charset):
+	new primitive parameter \pdfincludecharset.
+	(print_param): print_esc it.
+	(Put each...): insert in hash table.
+	(get_pdf_include_charset): new fn to get its value.
+	* writefont.c (write_fontdescriptor): check it before outputting
+	CharSet.
+
 2019-01-19  Karl Berry  <karl at tug.org>
 
         * NEWS,
@@ -495,7 +505,7 @@
 	* pdftex.web (pdf_suppress_warning_page_group): new primitive
 	parameter \pdfsuppresswarningpagegroup.
 	(get_pdf_suppress_warning_page_group): new fn to get its value.
-	* pdftopdf.cc (write_epdf): check it before issuing warning.
+	* pdftoepdf.cc (write_epdf): check it before issuing warning.
 
 2014-01-20  Peter Breitenlohner  <peb at mppmu.mpg.de>
 

Modified: branches/stable/source/src/texk/web2c/pdftexdir/NEWS
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/NEWS	2019-01-19 23:36:08 UTC (rev 811)
+++ branches/stable/source/src/texk/web2c/pdftexdir/NEWS	2019-01-27 17:56:20 UTC (rev 812)
@@ -1,8 +1,10 @@
 pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
 - changes:
   - new primitive \expanded (from unreleased pdftex 1.50 branch + luatex).
-  - the /CharSet string is now always omitted from the PDF output, since
-    it cannot feasibly be guaranteed correct, but the standard requires this.
+  - new primitive parameter \pdfincludecharset; zero by default to omit
+    the /CharSet string from the PDF output, since it cannot feasibly be
+    guaranteed correct as the PDF/A-2 and /A-3 standards require; setting
+    to 1 includes it again, as required by PDF/A-1.
 
 pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)  (April 14, 2018)
 - changes:
@@ -10,7 +12,7 @@
     (pdftex r782).
   - allow encoding vectors for bitmap PK fonts (r790).
   - when a non-PDF special is ignored, output a (leading substring of the)
-  special, preceded by "<special> ".
+    special, preceded by "<special> ".
 
 - bugfixes:
   - \pdfprimitive does nothing, rather than give an error, when given a

Modified: branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web	2019-01-19 23:36:08 UTC (rev 811)
+++ branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web	2019-01-27 17:56:20 UTC (rev 812)
@@ -5692,7 +5692,8 @@
 @d pdf_suppress_warning_page_group_code  = pdftex_first_integer_code + 29 {suppress warning about multiple pdfs with page group}
 @d pdf_info_omit_date_code  = pdftex_first_integer_code + 30 {omit generating CreationDate and ModDate}
 @d pdf_suppress_ptex_info_code = pdftex_first_integer_code + 31 {suppress /PTEX.* entries in PDF dictionaries}
- at d pdf_int_pars=pdftex_first_integer_code + 32 {total number of \pdfTeX's integer parameters}
+ at d pdf_include_charset_code = pdftex_first_integer_code + 32 {suppress /PTEX.* entries in PDF dictionaries}
+ at d pdf_int_pars=pdftex_first_integer_code + 33 {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}
@@ -5803,6 +5804,7 @@
 @d pdf_suppress_warning_page_group == int_par(pdf_suppress_warning_page_group_code)
 @d pdf_info_omit_date == int_par(pdf_info_omit_date_code)
 @d pdf_suppress_ptex_info == int_par(pdf_suppress_ptex_info_code)
+ at d pdf_include_charset == int_par(pdf_include_charset_code)
 @#
 @d tracing_assigns==int_par(tracing_assigns_code)
 @d tracing_groups==int_par(tracing_groups_code)
@@ -5910,6 +5912,7 @@
 pdf_suppress_warning_page_group_code:print_esc("pdfsuppresswarningpagegroup");
 pdf_info_omit_date_code:print_esc("pdfinfoomitdate");
 pdf_suppress_ptex_info_code: print_esc("pdfsuppressptexinfo");
+pdf_include_charset_code: print_esc("pdfincludecharset");
 @/@<Cases for |print_param|@>@/
 othercases print("[unknown integer parameter!]")
 endcases;
@@ -6096,11 +6099,16 @@
 
 primitive("pdfsuppresswarningpagegroup",assign_int,int_base+pdf_suppress_warning_page_group_code);@/
 @!@:pdf_suppress_warning_page_group_}{\.{\\pdfsuppresswarningpagegroup} primitive@>
+
 primitive("pdfinfoomitdate",assign_int,int_base+pdf_info_omit_date_code);@/
 @!@:pdf_info_omit_date_}{\.{\\pdfinfoomitdate} primitive@>
+
 primitive("pdfsuppressptexinfo",assign_int,int_base+pdf_suppress_ptex_info_code);@/
 @!@:pdf_suppress_ptex_info_}{\.{\\pdfsuppressptexinfo} primitive@>
 
+primitive("pdfincludecharset",assign_int,int_base+pdf_include_charset_code);@/
+@!@:pdf_include_charset}{\.{\\pdfincludecharset} primitive@>
+
 @ @<Cases of |print_cmd_chr|...@>=
 assign_int: if chr_code<count_base then print_param(chr_code-int_base)
   else  begin print_esc("count"); print_int(chr_code-count_base);
@@ -15104,6 +15112,11 @@
     get_pdf_suppress_ptex_info := pdf_suppress_ptex_info;
 end;
 
+function get_pdf_include_charset: integer;
+begin
+    get_pdf_include_charset := pdf_include_charset;
+end;
+
 function get_nullfont: internal_font_number;
 begin
     get_nullfont := null_font;

Modified: branches/stable/source/src/texk/web2c/pdftexdir/writefont.c
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/writefont.c	2019-01-19 23:36:08 UTC (rev 811)
+++ branches/stable/source/src/texk/web2c/pdftexdir/writefont.c	2019-01-27 17:56:20 UTC (rev 812)
@@ -484,16 +484,22 @@
     pdf_printf("/Flags %i\n", fd_flags);
     write_fontmetrics(fd);
     if (fd->ff_found) {
-#ifdef ENABLE_PDF_CHARSET /* just in case a builder wants it */
-        if (is_subsetted(fd->fm) && is_type1(fd->fm)) {
-            /* CharSet is optional, but if it appears, it must be
-               correct. Unfortunately, there is no practical way we can
-               guarantee correctness with precomposed accent characters
-               in our usual fonts (EC, TX, etc.):
+        if (getpdfincludecharset() > 0 && is_subsetted(fd->fm) && is_type1(fd->fm)) {
+            /* We don't get CharSet right. For some PDF standards,
+               CharSet is optional, but if it appears, it must be
+               correct. Unfortunately, there seems to be no practical
+               way we can guarantee correctness with precomposed accent
+               characters in our usual fonts (EC, TX, etc.):
               https://mailman.ntg.nl/pipermail/ntg-pdftex/2018-June/004251.html
-               Therefore, we disable its output. The code is left in
-               just in case it turns out that something important was
-               relying on the (incorrect) CharSet. */
+              
+               But for PDF/A-1, apparently it is required, regardless:
+              https://mailman.ntg.nl/pipermail/ntg-pdftex/2019-January/004264.html
+               
+               Whereas for PDF/A-2 and PDF/A-3, it can be omitted:
+              https://github.com/veraPDF/veraPDF-validation-profiles/wiki/PDFA-Parts-2-and-3-rules#rule-62114-3
+
+               Therefore, whether it is output can be controlled by the
+               user at runtime via \pdfincludecharset. */
             assert(fd->gl_tree != NULL);
             avl_t_init(&t, fd->gl_tree);
             /* Names may appear in any order. */
@@ -503,7 +509,7 @@
                 pdf_printf("/%s", glyph);
             pdf_puts(")\n");
         }
-#endif /* ENABLE_PDF_CHARSET */
+
         if (is_type1(fd->fm))
             pdf_printf("/FontFile %i 0 R\n", (int) fd->ff_objnum);
         else if (is_truetype(fd->fm))

Index: branches/stable/tests/11-includecharset
===================================================================
--- branches/stable/tests/11-includecharset	2019-01-19 23:36:08 UTC (rev 811)
+++ branches/stable/tests/11-includecharset	2019-01-27 17:56:20 UTC (rev 812)

Property changes on: branches/stable/tests/11-includecharset
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+test-includecharset.pdf
Added: branches/stable/tests/11-includecharset/Makefile
===================================================================
--- branches/stable/tests/11-includecharset/Makefile	                        (rev 0)
+++ branches/stable/tests/11-includecharset/Makefile	2019-01-27 17:56:20 UTC (rev 812)
@@ -0,0 +1,18 @@
+# $Id: Makefile 808 2018-11-13 18:39:00Z karl $
+# Public domain.
+
+include ../Common.mak
+
+default: test-includecharset
+
+test-includecharset:
+	# by default, no CharSet
+	$(prog) test-includecharset.tex
+	! grep "/CharSet" test-includecharset.pdf >/dev/null
+	#
+	# force CharSet to be included
+	$(prog) '\pdfincludecharset=1 \input test-includecharset.tex'
+	grep "/CharSet" test-includecharset.pdf >/dev/null
+
+clean:
+	$(clean)


Property changes on: branches/stable/tests/11-includecharset/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: branches/stable/tests/11-includecharset/test-includecharset.tex
===================================================================
--- branches/stable/tests/11-includecharset/test-includecharset.tex	                        (rev 0)
+++ branches/stable/tests/11-includecharset/test-includecharset.tex	2019-01-27 17:56:20 UTC (rev 812)
@@ -0,0 +1,10 @@
+% $Id: abc.tex 737 2016-03-21 22:54:16Z karl $
+% Public domain.
+\input plain.tex
+\input pdftexconfig.tex
+\input pdftexmagfix.tex
+\pdfcompresslevel=0 % get greppable output
+\pdfobjcompresslevel=0
+
+abc
+\bye


Property changes on: branches/stable/tests/11-includecharset/test-includecharset.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the pdftex-commits mailing list