loca table fixes and added RLE encoding

can you add a description of the intent of this function?