mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-07 06:25:03 +00:00
[subset/cff] Simplify some allocation embedding
This commit is contained in:
parent
99db06b4d2
commit
6129702eb8
1 changed files with 5 additions and 13 deletions
|
@ -173,11 +173,7 @@ struct Encoding
|
|||
bool serialize (hb_serialize_context_t *c, const Encoding &src)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
unsigned int size = src.get_size ();
|
||||
Encoding *dest = c->allocate_size<Encoding> (size);
|
||||
if (unlikely (!dest)) return_trace (false);
|
||||
hb_memcpy (dest, &src, size);
|
||||
return_trace (true);
|
||||
return_trace (c->embed (src));
|
||||
}
|
||||
|
||||
/* serialize a subset Encoding */
|
||||
|
@ -502,11 +498,7 @@ struct Charset
|
|||
bool serialize (hb_serialize_context_t *c, const Charset &src, unsigned int num_glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
unsigned int size = src.get_size (num_glyphs);
|
||||
Charset *dest = c->allocate_size<Charset> (size);
|
||||
if (unlikely (!dest)) return_trace (false);
|
||||
hb_memcpy (dest, &src, size);
|
||||
return_trace (true);
|
||||
return_trace (c->embed ((const char *) &src, src.get_size (num_glyphs)));
|
||||
}
|
||||
|
||||
/* serialize a subset Charset */
|
||||
|
@ -523,7 +515,7 @@ struct Charset
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
Charset0 *fmt0 = c->allocate_size<Charset0> (Charset0::get_size (num_glyphs));
|
||||
Charset0 *fmt0 = c->allocate_size<Charset0> (Charset0::get_size (num_glyphs), false);
|
||||
if (unlikely (!fmt0)) return_trace (false);
|
||||
unsigned int glyph = 0;
|
||||
for (unsigned int i = 0; i < sid_ranges.length; i++)
|
||||
|
@ -537,7 +529,7 @@ struct Charset
|
|||
|
||||
case 1:
|
||||
{
|
||||
Charset1 *fmt1 = c->allocate_size<Charset1> (Charset1::min_size + Charset1_Range::static_size * sid_ranges.length);
|
||||
Charset1 *fmt1 = c->allocate_size<Charset1> (Charset1::min_size + Charset1_Range::static_size * sid_ranges.length, false);
|
||||
if (unlikely (!fmt1)) return_trace (false);
|
||||
for (unsigned int i = 0; i < sid_ranges.length; i++)
|
||||
{
|
||||
|
@ -551,7 +543,7 @@ struct Charset
|
|||
|
||||
case 2:
|
||||
{
|
||||
Charset2 *fmt2 = c->allocate_size<Charset2> (Charset2::min_size + Charset2_Range::static_size * sid_ranges.length);
|
||||
Charset2 *fmt2 = c->allocate_size<Charset2> (Charset2::min_size + Charset2_Range::static_size * sid_ranges.length, false);
|
||||
if (unlikely (!fmt2)) return_trace (false);
|
||||
for (unsigned int i = 0; i < sid_ranges.length; i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue