harfbuzz recently added hb_font_get_glyph_h_advances()
and some similar functions for other cases, eg see this commit :
I hope that if we use this API we can get some performance improvement
than one call per glyph.
It will require upgrading to the latest harfbuzz, but we will do that at
some point soon anyway.