From 004cdc10f87d7259a7192706c2996f9a9d0a26ed Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 7 Jan 2023 14:27:15 -0700 Subject: [PATCH] [open-type] More tweaks to fixed types Add set_int(). --- src/hb-open-type.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 72bd09640..4c9bfebce 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -147,10 +147,10 @@ struct HBFixed : Type static constexpr float shift = (float) (1 << fraction_bits); static_assert (Type::static_size * 8 > fraction_bits, ""); - HBFixed& operator = (typename Type::type i ) { Type::operator= (i); return *this; } operator signed () const = delete; operator unsigned () const = delete; - int32_t to_int () const { return Type::v; } + typename Type::type to_int () const { return Type::v; } + void set_int (typename Type::type i ) { Type::v = i; } float to_float (float offset = 0) const { return ((int32_t) Type::v + offset) / shift; } void set_float (float f) { Type::v = roundf (f * shift); } public: