[tex-k] dvips: patch for output.c to handle embedded PFB files
David M. Jones
dmj at ams.org
Mon May 5 20:08:04 CEST 2008
I assume you've already seen the discussion about this on the tex-live
list, including my caveats:
http://tug.org/pipermail/tex-live/2008-May/015765.html
For what it's worth, we've been using this internally since August
2007. The only other thing I'd add to my comments below is that it
would probably be better to recognize PFB files inside EPS files and
convert them to PFA, but I'm not familiar enough with the code to have
any idea how hard that would be.
Cheers,
David.
===========================================================================
Index: output.c
===================================================================
*** output.c (revision 324)
--- output.c (working copy)
***************
*** 121,126 ****
--- 121,129 ----
unsigned long dosepsbegin, dosepsend = 0;
int removingBytes = 0 ;
char *scanForEnd = 0 ;
+
+ int scanningFont = 0;
+
/* end DOS EPS code */
#ifdef VMCMS
register char *lastdirsep ;
***************
*** 340,352 ****
*dscLinePointer = 0 ; /* make sure we terminate!
* might be a new empty line! */
if (strncmp(possibleDSCLine, "%%BeginBinary:", 14) == 0 ||
! strncmp(possibleDSCLine, "%%BeginData:", 12) == 0) {
integer size = 0 ;
char *p = possibleDSCLine ;
*dscLinePointer = 0 ;
*dscLineEnd = 0 ;
if (scanForEnd == 0 && removecomments)
(void)fputs(possibleDSCLine, bitfile) ;
scanForEnd = 0 ;
while (*p != ':')
p++ ;
--- 343,374 ----
*dscLinePointer = 0 ; /* make sure we terminate!
* might be a new empty line! */
if (strncmp(possibleDSCLine, "%%BeginBinary:", 14) == 0 ||
! strncmp(possibleDSCLine, "%%BeginData:", 12) == 0 ||
! strncmp(possibleDSCLine, "%%BeginFont:", 12) == 0) {
integer size = 0 ;
char *p = possibleDSCLine ;
*dscLinePointer = 0 ;
*dscLineEnd = 0 ;
if (scanForEnd == 0 && removecomments)
(void)fputs(possibleDSCLine, bitfile) ;
+
+ if (strncmp(possibleDSCLine, "%%BeginFont:", 12) == 0) {
+
+ /* Theoretically, we could wait until we see
+ the "currentfile eexec" and possibly even
+ check that the following data really looks
+ like binary before we begin verbatim
+ copying, but that would complicate the code
+ beyond our present needs. If we were going
+ to do that much work, this entire chunk of
+ code should probably be
+ rewritten. [dmj at ams.org, 2007/08/20] */
+
+ scanForEnd = "%%EndFont";
+ scanningFont = 1;
+ } else {
+ scanningFont = 0;
+
scanForEnd = 0 ;
while (*p != ':')
p++ ;
***************
*** 394,399 ****
--- 416,422 ----
else
scanForEnd = "%%EndData" ;
}
+ }
if (scanForEnd == 0) {
if (strncmp(p, "lines", 5) != 0 &&
strncmp(p, "Lines", 5) != 0) {
***************
*** 530,535 ****
--- 553,559 ----
} else if (scanForEnd && strncmp(possibleDSCLine, scanForEnd,
strlen(scanForEnd))==0) {
scanForEnd = 0 ;
+ scanningFont = 0;
}
dscLinePointer = possibleDSCLine ;
} else if (dscLinePointer < dscLineEnd) {
***************
*** 546,557 ****
}
}
#ifdef VMCMS
! if (c != 0x37 ) {
#else
#ifdef MVSXA
! if (c != 0x37 ) {
#else
! if (c != 4) {
#endif
#endif
if (!removingBytes)
--- 570,581 ----
}
}
#ifdef VMCMS
! if (c != 0x37 || scanningFont) {
#else
#ifdef MVSXA
! if (c != 0x37 || scanningFont) {
#else
! if (c != 4 || scanningFont) {
#endif
#endif
if (!removingBytes)
***************
*** 566,572 ****
dosepsend-- ;
if (c == EOF)
break ;
! else if (c == '\r') {
c = getc(f);
if (c == '\n') { /* DOS-style text file? */
if (!removingBytes) (void)putc('\r', bitfile);
--- 590,596 ----
dosepsend-- ;
if (c == EOF)
break ;
! else if (c == '\r' && ! scanningFont) {
c = getc(f);
if (c == '\n') { /* DOS-style text file? */
if (!removingBytes) (void)putc('\r', bitfile);
More information about the tex-k
mailing list