[open-type] More tweaks to fixed types

Add set_int().
pull/4017/head
Behdad Esfahbod 2 years ago
parent c8486b6301
commit 004cdc10f8
  1. 4
      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:

Loading…
Cancel
Save