texlive[53979] Build/source/texk/dvipsk: %%ViewingOrientation comment

commits+karl at tug.org commits+karl at tug.org
Sun Mar 1 00:30:47 CET 2020


Revision: 53979
          http://tug.org/svn/texlive?view=revision&revision=53979
Author:   karl
Date:     2020-03-01 00:30:47 +0100 (Sun, 01 Mar 2020)
Log Message:
-----------
%%ViewingOrientation comment to cope with wrong Distiller autorotation, if the bitmap font encoding is enabled and at least one bitmap font is used

Modified Paths:
--------------
    trunk/Build/source/texk/dvipsk/ChangeLog
    trunk/Build/source/texk/dvipsk/loadfont.c
    trunk/Build/source/texk/dvipsk/output.c
    trunk/Build/source/texk/dvipsk/protos.h

Modified: trunk/Build/source/texk/dvipsk/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipsk/ChangeLog	2020-02-29 23:22:05 UTC (rev 53978)
+++ trunk/Build/source/texk/dvipsk/ChangeLog	2020-02-29 23:30:47 UTC (rev 53979)
@@ -1,3 +1,12 @@
+2020-02-29  Tomas Rokicki  <rokicki at gmail.com>
+
+	* loadfont.c (bitmapfontseen): define new global.
+	(loadfont): set it, if a bitmap font is seen.
+	* protos.h (bitmapfontseen): declare it.
+	* output.c (initprinter): If bitmapfontseen, emit
+	%%ViewingOrientation comment to try to cope with Distiller's
+        auto-orientation (page rotation).
+
 2020-01-30  Karl Berry  <karl at freefriends.org>
 
 	* Makefile.am (enc_DATA): new variable, for new file dvips-all.enc.

Modified: trunk/Build/source/texk/dvipsk/loadfont.c
===================================================================
--- trunk/Build/source/texk/dvipsk/loadfont.c	2020-02-29 23:22:05 UTC (rev 53978)
+++ trunk/Build/source/texk/dvipsk/loadfont.c	2020-02-29 23:30:47 UTC (rev 53979)
@@ -29,6 +29,7 @@
 
 char errbuf[1500];
 int lastresortsizes[40];
+int bitmapfontseen = 0 ;
 /*
  *   Now we have some routines to get stuff from the PK file.
  *   Subroutine pkbyte returns the next byte.
@@ -341,6 +342,7 @@
       tfmload(curfnt);
       return;
    }
+   bitmapfontseen = 1 ;
    curfnt->dir = 0;
    if (!quiet) {
       if (strlen(realnameoffile) + prettycolumn > STDOUTSIZE) {

Modified: trunk/Build/source/texk/dvipsk/output.c
===================================================================
--- trunk/Build/source/texk/dvipsk/output.c	2020-02-29 23:22:05 UTC (rev 53978)
+++ trunk/Build/source/texk/dvipsk/output.c	2020-02-29 23:30:47 UTC (rev 53979)
@@ -1468,6 +1468,25 @@
       tell_needed_fonts();
       paperspec(finpapsiz->specdat, 1);
       fprintf(bitfile, "%%%%EndComments\n");
+/*
+ *   If we encode Type 3 fonts with an encoding vector, this can cause
+ *   Distiller's autoorientation to get confused.  We remedy this by
+ *   emitting underdocumented ViewingOrientation comments right after
+ *   EndComments.  Known defect: if a user "flips" the landscape to be
+ *   180 degrees using one of the \special{} commands available, the
+ *   document will be rendered in the viewer upside down.  (But only
+ *   with bitmap font encoding enabled and bitmapped fonts actually used.)
+ *   --tgr, 29 February 2020.
+ */
+      if (encodetype3 && bitmapfontseen) {
+         fprintf(bitfile, "%%%%BeginDefaults\n") ;
+         if (landscape) {
+            fprintf(bitfile, "%%%%ViewingOrientation: 0 -1 1 0\n") ;
+         } else {
+            fprintf(bitfile, "%%%%ViewingOrientation: 1 0 0 1\n") ;
+         }
+         fprintf(bitfile, "%%%%EndDefaults\n") ;
+      }
    }
    {
       int i, len;

Modified: trunk/Build/source/texk/dvipsk/protos.h
===================================================================
--- trunk/Build/source/texk/dvipsk/protos.h	2020-02-29 23:22:05 UTC (rev 53978)
+++ trunk/Build/source/texk/dvipsk/protos.h	2020-02-29 23:30:47 UTC (rev 53979)
@@ -423,4 +423,7 @@
 /* global variables from tfmload.c */
 extern FILE *tfmfile;
 
+/* global variables from loadfont.c */
+extern int bitmapfontseen ;
+
 #endif



More information about the tex-live-commits mailing list.