[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] A question so stupid . . .
From: |
Tom Kacvinsky |
Subject: |
Re: [Freetype] A question so stupid . . . |
Date: |
Tue, 17 Apr 2001 09:34:01 -0400 (EDT) |
Yes, you are correct sir! The answer is right. An easier method, since you
decided to use doubles:
result = (double) fixed / 65536.0 ;
Regards,
Tom
On Tue, 17 Apr 2001, Ian Pilcher wrote:
> . . . that no one seems to have ever asked it before!
>
> I'm trying to interpret some of the information in the PostScript table,
> specifically the italicAngle member. I'm trying to convert the 16.16
> "fixed float" to a C double, and I can't get my results to match those
> produced by any of the TrueType->PostScript conversion utilities out
> there. Of course, I don't really know that these utilities are doing
> it right, so could someone take a look at the following and tell me if
> I'm doing anything wrong?
>
> inline double Double_From_TT_Fixed(TT_Fixed fixed)
> {
> short mantissa;
> unsigned short fraction;
> double result;
>
> mantissa = (short) ((fixed & 0xffff0000) / 65536);
> fraction = (short) (fixed & 0x0000ffff);
>
> result = ((double) mantissa) + ((double) fraction) / 65536.0;
>
> return result;
> }
>
> When passed 0xffefaac1, for example, this function computes a
> mantissa = -17, fraction = 43713, and result = -16.332993. Is this
> correct?
>
> Thanks!
>
>