Shaper improv

Some smaller improvements to the HarfBuzz shaper code. May also improve performance because it reduces the amount of memory allocations.