fixedTools¶
fontTools.misc.fixedTools.py – tools for working with fixed numbers.
-
fontTools.misc.fixedTools.
fixedToFloat
(value, precisionBits)[source]¶ Converts a fixed-point number to a float, choosing the float that has the shortest decimal reprentation. Eg. to convert a fixed number in a 2.14 format, use precisionBits=14. This is pretty slow compared to a simple division. Use sporadically.
precisionBits is only supported up to 16.
-
fontTools.misc.fixedTools.
floatToFixed
(value, precisionBits)[source]¶ Converts a float to a fixed-point number given the number of precisionBits. Ie. int(round(value * (1<<precisionBits))).