Harfbuzz apparently requires the offset array to be initialized to zero, otherwise it can report corrupt glyph positions. This change also contains a small amount of refactoring to avoid code duplication. Change-Id: I2553974f40bc8e0549876c7d31243960ca92a8a2