Re: Type 1 postscript font support questions...


Subject: Re: Type 1 postscript font support questions...
From: Mike Meyer (mwm@mired.org)
Date: Sat Jun 03 2000 - 04:49:46 CDT


sam th writes:
> On Fri, 2 Jun 2000, Mike Meyer wrote:
> > After working through xap_UnixPSParseAFM.c, I decided that the problem
> > was the DOS origins of the AFM files. The CR in the files was
> > confusing the tokenizer. Changing the parsing code to use the isspace
> > library routine solved that problem - it no longer died trying to
> > parse the AFM file. That's why this is going to the developer list -
> > is there some portability reason that isspace wasn't used? If not, I
> > can create a patch file pretty trivially. If so - well, another patch
> > is needed.
> Well, my isspace() man page says that it's in ANSI C, so there shouldn't
> be much of a problems. And I suspect that all the systems that we build
> the Unix build on will have it available. So, unless other people object,
> I think we would be happy to take your patch. Just remember to add to the
> changelog at the top of the file (since it's adobe code).

Ok, the patch for this is at the end of this message. I've also
included a simple patch to prevent fonts that have a slant other than
"r" or "i" from clobbering the normal font style for that font. It
would be nice if slant "o" (oblique) fonts could be detected and used
if there wasn't an italic slant, but that's a bit more painful. Since
these are simple one-file patches in the same directory, apply them in
the abi/src/af/xap/unix directory.

The next thing on my list is adding the pfb->pfa conversion code to
the print facility. Both the "church secretary" rule and my instincts
say to just do this conversion, as anything that can handle pfb should
handle pfa. Before starting on it, I just wanted to check to see if
the fix should go some place other than xap_UnixPSGraphics.cpp for the
Windows build.

        Thanx,
        <mike

--- xap_UnixPSParseAFM.c-orig Thu Dec 2 19:22:01 1999
+++ xap_UnixPSParseAFM.c Sat Jun 3 03:53:49 2000
@@ -58,6 +58,8 @@
  * - if 0'd initializeArray()
  * modified: AbiSource, Inc. Jun 14 1999
  * - introduced initializeArray() back to metric parsing
+ * modified: mwm@mired.org Jun 01, 2000
+ * - Changed whitespace tests to use isspace
  */
 #ifdef WIN32
 #pragma warning (disable : 4244) /* conversion from 'double' to 'float', possible loss of data */
@@ -70,6 +72,7 @@
 #include <malloc.h>
 #include <stdlib.h>
 #include <math.h>
+#include <ctype.h>
 #include "xap_UnixPSParseAFM.h"
  
 #define lineterm EOL /* line terminating character */
@@ -157,12 +160,10 @@
     int ch, idx;
 
     /* skip over white space */
- while ((ch = fgetc(stream)) == ' ' || ch == lineterm ||
- ch == ',' || ch == '\t' || ch == ';');
+ while (isspace((ch = fgetc(stream))) || ch == ',' || ch == ';');
     
     idx = 0;
- while (ch != EOF && ch != ' ' && ch != lineterm
- && ch != '\t' && ch != ':' && ch != ';')
+ while (ch != EOF && !isspace(ch) && ch != ':' && ch != ';')
     {
         ident[idx++] = ch;
         ch = fgetc(stream);
@@ -190,7 +191,7 @@
 {
     int ch, idx;
 
- while ((ch = fgetc(stream)) == ' ' || ch == '\t' );
+ while (isspace(ch = fgetc(stream)));
     
     idx = 0;
     while (ch != EOF && ch != lineterm)

--- xap_UnixFontManager.cpp-orig Thu Apr 20 15:36:32 2000
+++ xap_UnixFontManager.cpp Sat Jun 3 04:28:18 2000
@@ -386,7 +386,14 @@
        {
                s = XAP_UnixFont::STYLE_BOLD_ITALIC;
        }
-
+ else
+ {
+ UT_DEBUGMSG(("XAP_UnixFontManager::_allocateThisFont() - can't guess "
+ "font style from XLFD.\n"));
+ FREEP(linedup);
+ return;
+ }
+
        // do some voodoo to get the AFM file from the file name
        char * dot = strrchr(fontfile, '.');
        if (!dot)



This archive was generated by hypermail 2b25 : Sat Jun 03 2000 - 04:50:26 CDT