Move code around

This commit is contained in:
Behdad Esfahbod 2018-08-02 20:04:37 -07:00
parent 574b37e933
commit c988b11999
1 changed files with 26 additions and 15 deletions

View File

@ -41,6 +41,30 @@
struct hb_ot_font_t
{
inline void init (hb_face_t *face)
{
cmap.init (face);
h_metrics.init (face);
v_metrics.init (face, h_metrics.ascender - h_metrics.descender); /* TODO Can we do this lazily? */
this->face = face;
glyf.init ();
cbdt.init ();
post.init ();
kern.init ();
}
inline void fini (void)
{
cmap.fini ();
h_metrics.fini ();
v_metrics.fini ();
glyf.fini ();
cbdt.fini ();
post.fini ();
kern.fini ();
}
OT::cmap::accelerator_t cmap;
OT::hmtx::accelerator_t h_metrics;
OT::vmtx::accelerator_t v_metrics;
@ -61,14 +85,7 @@ _hb_ot_font_create (hb_face_t *face)
if (unlikely (!ot_font))
return nullptr;
ot_font->cmap.init (face);
ot_font->h_metrics.init (face);
ot_font->v_metrics.init (face, ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */
ot_font->face = face;
ot_font->glyf.init ();
ot_font->cbdt.init ();
ot_font->post.init ();
ot_font->kern.init ();
ot_font->init (face);
return ot_font;
}
@ -78,13 +95,7 @@ _hb_ot_font_destroy (void *data)
{
hb_ot_font_t *ot_font = (hb_ot_font_t *) data;
ot_font->cmap.fini ();
ot_font->h_metrics.fini ();
ot_font->v_metrics.fini ();
ot_font->glyf.fini ();
ot_font->cbdt.fini ();
ot_font->post.fini ();
ot_font->kern.fini ();
ot_font->fini ();
free (ot_font);
}