[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: gfont problem with PS fonts on big-endian platforms (patch included)



Dave Plonka wrote:
> 
> On big-endian architectures, gfont failed :)

Great patch, thanks. It works well now :)

> I'm gathering that the rest of the user-base is on Intel hence they didn't 
> bump into this issue.

My system is Solaris and I noticed this bug but I didn't find (and even try
to find) how to solve :)

I also have a little configuration problem with the perl detection. I modify
a bit your patch to take that into account.

Regards, Fred.

-- 
Frédéric Le Mouël, Ph.D. Student        | Email: Frederic.LeMouel@irisa.fr
IRISA/INRIA, Solidor Group, Office E307 | Phone: (+33|0)2 99 84 73 04
Campus Universitaire de Beaulieu        | Fax  : (+33|0)2 99 84 25 29
35042 Rennes Cedex, France              | http://www.irisa.fr/prive/flemouel
*** configure.in.orig	Fri Sep  5 21:28:19 1997
--- configure.in	Wed Jul 21 14:31:10 1999
***************
*** 27,32 ****
--- 27,33 ----
  AC_CONFIGURE_PART(CHECK: C Compiler and Perl Interpreter)
  AC_PROG_CC
  AC_PROG_CPP
+ AC_C_BIGENDIAN
  AC_MSG_CHECKING([for Perl language])
  TMPFILE=/tmp/ac.$$
  rm -f $TMPFILE
***************
*** 34,45 ****
  c=0
  for dir in `echo $PATH | sed -e 's/:/ /g'` /tmp; do
      for perl in perl5 perl miniperl; do
!          if test -x "$dir/$perl"; then
!              perl="$dir/$perl"
!              version=`$perl -v | grep version | sed -e 's/.* version //' -e 's/ with.*//'`
!              versionnum="`echo $version | sed -e 's/\.//g' -e 's/_//g'`"
!              versionnum=`expr $versionnum - $c`
!              echo "$versionnum $version $perl" >>$TMPFILE
           fi
      done
      c=`expr $c + 1`
--- 35,48 ----
  c=0
  for dir in `echo $PATH | sed -e 's/:/ /g'` /tmp; do
      for perl in perl5 perl miniperl; do
!          if test -f "$dir/$perl"; then
!              if test -x "$dir/$perl"; then
!                  perl="$dir/$perl"
!                  version=`$perl -v | grep version | sed -e 's/.* version //' -e 's/ built.*//' -e 's/ with.*//'`
!                  versionnum="`echo $version | sed -e 's/\.//g' -e 's/_//g'`"
!                  versionnum=`expr $versionnum - $c`
!                  echo "$versionnum $version $perl" >>$TMPFILE
!              fi
           fi
      done
      c=`expr $c + 1`
*** gfont_pxtogdf.c.orig	Fri Sep  5 13:51:38 1997
--- gfont_pxtogdf.c	Mon Jul 19 11:35:23 1999
***************
*** 239,244 ****
--- 239,250 ----
  
  void Put32(FILE *fp, int i)
  {
+ #ifndef WORDS_BIGENDIAN /* { */
+     i = (((i & 0xff000000L) >> 24) | 
+          ((i & 0x00ff0000L) >>  8) |
+          ((i & 0x0000ff00L) <<  8) |
+          ((i & 0x000000ffL) << 24));
+ #endif /* } */
      fwrite(&i, sizeof(int), 1, fp);
      return;
  }
*** gfont_gd.c.orig	Fri Sep  5 13:32:51 1997
--- gfont_gd.c	Mon Jul 19 10:54:14 1999
***************
*** 2674,2713 ****
  /*****************/
  
  /*
!  *  Byte Conversion -- Hilfsroutinen fuer das alte
!  *  Problem High-Endian vs. Little-Endian !!
   */
- unsigned short gdIntern_convert_short(unsigned short z)
- {
-     char *teststring;
-     short t;
- 
-     t = 0x4142;
- 
-     teststring = (char *)&t;
- 
-     if(teststring[0] == 'B' && teststring[1] == 'A')
-         return(z);
-     else
-         return(((z & 0xff00U) >> 8) | ((z & 0x00ffU) << 8));
- }
  unsigned long gdIntern_convert_long(unsigned long z)
  {
!     char *teststring;
!     unsigned long t;
! 
!     t = 0x41424344;
! 
!     teststring = (char *)&t;
! 
!     if(teststring[0] == 'D' && teststring[1] == 'C' &&
!        teststring[2] == 'B' && teststring[3] == 'A')
!         return(z);
!     else
!         return(((z & 0xff000000L) >> 24) | 
!                ((z & 0x00ff0000L) >>  8) |
!                ((z & 0x0000ff00L) <<  8) |
!                ((z & 0x000000ffL) << 24));
  }
  
  gdFontPtr gdFontCreateFromGdf(FILE *in)
--- 2674,2691 ----
  /*****************/
  
  /*
!  *  Byte Conversion
   */
  unsigned long gdIntern_convert_long(unsigned long z)
  {
! #ifdef WORDS_BIGENDIAN /* { */
!     return(z);
! #else /* }{ */
!     return(((z & 0xff000000L) >> 24) | 
!            ((z & 0x00ff0000L) >>  8) |
!            ((z & 0x0000ff00L) <<  8) |
!            ((z & 0x000000ffL) << 24));
! #endif /* } */
  }
  
  gdFontPtr gdFontCreateFromGdf(FILE *in)