From 810eb77b962e31dc585406153dbd26b1730fca99 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 29 Feb 2020 23:30:47 +0000 Subject: %%ViewingOrientation comment to cope with wrong Distiller autorotation, if the bitmap font encoding is enabled and at least one bitmap font is used git-svn-id: svn://tug.org/texlive/trunk@53979 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipsk/ChangeLog | 9 +++++++++ Build/source/texk/dvipsk/loadfont.c | 2 ++ Build/source/texk/dvipsk/output.c | 19 +++++++++++++++++++ Build/source/texk/dvipsk/protos.h | 3 +++ 4 files changed, 33 insertions(+) (limited to 'Build') diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index c032c1ef3d1..fab019a62f5 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,12 @@ +2020-02-29 Tomas Rokicki + + * 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 * Makefile.am (enc_DATA): new variable, for new file dvips-all.enc. diff --git a/Build/source/texk/dvipsk/loadfont.c b/Build/source/texk/dvipsk/loadfont.c index 6647a2f71b1..a9e1b14260d 100644 --- a/Build/source/texk/dvipsk/loadfont.c +++ b/Build/source/texk/dvipsk/loadfont.c @@ -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 @@ loadfont(register fontdesctype *curfnt) tfmload(curfnt); return; } + bitmapfontseen = 1 ; curfnt->dir = 0; if (!quiet) { if (strlen(realnameoffile) + prettycolumn > STDOUTSIZE) { diff --git a/Build/source/texk/dvipsk/output.c b/Build/source/texk/dvipsk/output.c index 1d7a7288ec3..8a72696cb7c 100644 --- a/Build/source/texk/dvipsk/output.c +++ b/Build/source/texk/dvipsk/output.c @@ -1468,6 +1468,25 @@ initprinter(sectiontype *sect) 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; diff --git a/Build/source/texk/dvipsk/protos.h b/Build/source/texk/dvipsk/protos.h index 3de2aedd139..9264626c22f 100644 --- a/Build/source/texk/dvipsk/protos.h +++ b/Build/source/texk/dvipsk/protos.h @@ -423,4 +423,7 @@ extern char realnameoffile[]; /* global variables from tfmload.c */ extern FILE *tfmfile; +/* global variables from loadfont.c */ +extern int bitmapfontseen ; + #endif -- cgit v1.2.3