[open-type] Allow passing an offset to to_float()
This commit is contained in:
parent
6ae35365f8
commit
f252cf80e1
|
@ -148,7 +148,7 @@ struct HBFixed : Type
|
||||||
static_assert (Type::static_size * 8 > fraction_bits, "");
|
static_assert (Type::static_size * 8 > fraction_bits, "");
|
||||||
|
|
||||||
HBFixed& operator = (typename Type::type i ) { Type::operator= (i); return *this; }
|
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); }
|
void set_float (float f) { Type::v = roundf (f * shift); }
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (Type::static_size);
|
DEFINE_SIZE_STATIC (Type::static_size);
|
||||||
|
|
Loading…
Reference in New Issue