[open-type] Allow passing an offset to to_float()

This commit is contained in:
Behdad Esfahbod 2022-12-16 12:03:51 -07:00
parent 6ae35365f8
commit f252cf80e1
1 changed files with 1 additions and 1 deletions

View File

@ -148,7 +148,7 @@ struct HBFixed : Type
static_assert (Type::static_size * 8 > fraction_bits, "");
HBFixed& operator = (typename Type::type i ) { Type::operator= (i); return *this; }
float to_float () const { return ((int32_t) Type::v) / shift; }
float to_float (int32_t offset = 0) const { return ((int32_t) Type::v + offset) / shift; }
void set_float (float f) { Type::v = roundf (f * shift); }
public:
DEFINE_SIZE_STATIC (Type::static_size);