Fix font metrics and item size calculations, add hack for 1.5.1 recognition