freetype
[Top][All Lists]
Advanced

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

[Freetype] Compiling on the Texas DSP


From: bytesoftware
Subject: [Freetype] Compiling on the Texas DSP
Date: Sat, 10 Apr 2004 10:51:57 +0100
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Hello,

  I am using the freetype engine on a Texas DSP - 55xx.

After changing enumerations FT_IMAGE_TAG and FT_ENC_TAG to their 16 bit equivalents the project does compile. Some warnings were issued regarding shift counts being too large (e.g <long variable> = <char variable> << 24).Fixed by casting.

I try to run the sample (copied from the tutorial), and I get a error returned "bad format" when trying to open arial.ttf
The function that returns the error is

" error = FT_New_Face( library,"c:\\winnt\\fonts\\arial.ttf",0,&face);
if ( error == FT_Err_Unknown_File_Format )"

The same code project compiled on Borland Builder, compiles and runs fine no errors.

  Tracing through the code I believe I have found where the problem lies,

The smallest types on this Texas unit are 16 bits in size. Chars are 16 bits in size.
  Sizeof a char is returned as 1, size of a long is returned as 2.
In the function FT_Stream_ReadFields in FTStream.c the following code does not work as intended.

 /* finally, store the value in the object */
    p = (FT_Byte*)structure + fields->offset;
    switch ( fields->size )
    {
    case 1:
      *(FT_Byte*)p = (FT_Byte)value;
      break;
    case 2:
      *(FT_UShort*)p = (FT_UShort)value;
      break;
    case 4:
      *(FT_UInt32*)p = (FT_UInt32)value;
      break;
    default:  /* for 64-bit systems */
      *(FT_ULong*)p = (FT_ULong)value;
    }

case 4: here is used to store UInt32 values into the structure.
On a DSP the sizeof a long is returned as 2 and hence long values are stored using case 2: .
Data is lost and the font header is assumed corrupt.

I can fix this problem but would like to know if anyone has tried to compile to the Texas DSP compilers before. I would like to know how many problems I am likely to encounter because of this Sizeof peculiarity.
Is there any easy work around ?

Any help is much appreciated.

Thankyou.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]