0

i found this link from some forum, so i thought the source code must have been useful to some: font2openvg.cpp.txt

The question is, why divide 4096 to convert a fixed to float?

float convFTFixed( const FT_Pos &x )
{
    return (float)x / 4096.0f;
}
noypi
  • 103

1 Answers1

0

The type FT_Pos is an integer type intended to be $2^{12}$ times the real value being represented (thus the precision is a bit better than three decimal places, and the absolute precision is invariant as the number grows).

With today's hardware, this is really not a useful thing to do, but in the past, when memory might have been tight or double precision operations hugely expensive, it is conceivable that representing potentially large numbers in this way would have let you avoid using doubles and yet still get more than 23 bits of precision.

Mark Fischler
  • 42,297