mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-14 17:13:40 +00:00
Revert "[cff] Use float instead of double"
This reverts commit c8f67ac28e
.
Tests failing.
This commit is contained in:
parent
c8f67ac28e
commit
cb320d2222
4 changed files with 16 additions and 16 deletions
|
@ -222,14 +222,14 @@ struct number_t
|
|||
void set_int (int v) { value = v; }
|
||||
int to_int () const { return value; }
|
||||
|
||||
void set_fixed (int32_t v) { value = v / 65536.0f; }
|
||||
int32_t to_fixed () const { return value * 65536.0f; }
|
||||
void set_fixed (int32_t v) { value = v / 65536.0; }
|
||||
int32_t to_fixed () const { return value * 65536.0; }
|
||||
|
||||
void set_real (float v) { value = v; }
|
||||
float to_real () const { return value; }
|
||||
void set_real (double v) { value = v; }
|
||||
double to_real () const { return value; }
|
||||
|
||||
bool in_int_range () const
|
||||
{ return ((float) (int16_t) to_int () == value); }
|
||||
{ return ((double) (int16_t) to_int () == value); }
|
||||
|
||||
bool operator > (const number_t &n) const { return value > n.to_real (); }
|
||||
bool operator < (const number_t &n) const { return n > *this; }
|
||||
|
@ -244,7 +244,7 @@ struct number_t
|
|||
}
|
||||
|
||||
protected:
|
||||
float value = 0.;
|
||||
double value = 0.;
|
||||
};
|
||||
|
||||
/* byte string */
|
||||
|
@ -439,7 +439,7 @@ struct arg_stack_t : cff_stack_t<ARG, 513>
|
|||
n.set_fixed (v);
|
||||
}
|
||||
|
||||
void push_real (float v)
|
||||
void push_real (double v)
|
||||
{
|
||||
ARG &n = S::push ();
|
||||
n.set_real (v);
|
||||
|
|
|
@ -78,7 +78,7 @@ struct dict_opset_t : opset_t<number_t>
|
|||
}
|
||||
|
||||
/* Turns CFF's BCD format into strtod understandable string */
|
||||
static float parse_bcd (byte_str_ref_t& str_ref)
|
||||
static double parse_bcd (byte_str_ref_t& str_ref)
|
||||
{
|
||||
if (unlikely (str_ref.in_error ())) return .0;
|
||||
|
||||
|
@ -107,7 +107,7 @@ struct dict_opset_t : opset_t<number_t>
|
|||
double pv;
|
||||
if (unlikely (!hb_parse_double (&p, p + count, &pv, true/* whole buffer */)))
|
||||
break;
|
||||
return (float) pv;
|
||||
return pv;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ struct blend_arg_t : number_t
|
|||
{
|
||||
void set_int (int v) { reset_blends (); number_t::set_int (v); }
|
||||
void set_fixed (int32_t v) { reset_blends (); number_t::set_fixed (v); }
|
||||
void set_real (float v) { reset_blends (); number_t::set_real (v); }
|
||||
void set_real (double v) { reset_blends (); number_t::set_real (v); }
|
||||
|
||||
void set_blends (unsigned int numValues_, unsigned int valueIndex_,
|
||||
hb_array_t<const blend_arg_t> blends_)
|
||||
|
@ -148,16 +148,16 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<ELEM, CFF2Subrs>
|
|||
void set_ivs (unsigned int ivs_) { ivs = ivs_; }
|
||||
bool seen_vsindex () const { return seen_vsindex_; }
|
||||
|
||||
float blend_deltas (hb_array_t<const ELEM> deltas) const
|
||||
double blend_deltas (hb_array_t<const ELEM> deltas) const
|
||||
{
|
||||
float v = 0;
|
||||
double v = 0;
|
||||
if (do_blend)
|
||||
{
|
||||
if (likely (scalars.length == deltas.length))
|
||||
{
|
||||
unsigned count = scalars.length;
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
v += (float) scalars.arrayZ[i] * deltas.arrayZ[i].to_real ();
|
||||
v += (double) scalars.arrayZ[i] * deltas.arrayZ[i].to_real ();
|
||||
}
|
||||
}
|
||||
return v;
|
||||
|
|
|
@ -266,14 +266,14 @@ struct cff2_private_blend_encoder_param_t
|
|||
}
|
||||
}
|
||||
|
||||
float blend_deltas (hb_array_t<const number_t> deltas) const
|
||||
double blend_deltas (hb_array_t<const number_t> deltas) const
|
||||
{
|
||||
float v = 0;
|
||||
double v = 0;
|
||||
if (likely (scalars.length == deltas.length))
|
||||
{
|
||||
unsigned count = scalars.length;
|
||||
for (unsigned i = 0; i < count; i++)
|
||||
v += (float) scalars.arrayZ[i] * deltas.arrayZ[i].to_real ();
|
||||
v += (double) scalars.arrayZ[i] * deltas.arrayZ[i].to_real ();
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue