freetype
[Top][All Lists]
Advanced

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

Re: Freetype Linux problem with 64 bit program.


From: Werner LEMBERG
Subject: Re: Freetype Linux problem with 64 bit program.
Date: Fri, 14 Jul 2023 05:18:32 +0000 (UTC)

> I am running the attached program in linux as 64 bit program.

Ouch!  You are accessing internal structures of FreeType, which makes
your code bound to a particular FreeType version and thus highly
unportable.  We basically can't give user support for that, sorry.

Note also that 2.10.0 is four years old; the current version of
FreeType is 2.13.1.

> After running I am not getting the correct value for HoriHeader
> version value. It display as 5692055178828579072(should be 256 if it
> reads 4 bytes).

There is a fundamental flaw in your code: You are reading an SFNT
table byte-wise into a buffer, then trying to cast it to a structure.
This will *never* work because the layout of the table as defined in
the OpenType specification is not the same as the structure layout in
your computer.  The latter depends both on the architecture and the
compiler – for example, if you ask for a 32bit integer, the computer
most likely aligns it to a 64bit location (i.e., a location that is a
multiple of 8).

You must read the table and assign it to the structure element by
element; there is no shortcut to that.


    Werner

reply via email to

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