fix rendering and size calculations for custom fonts. close #490. close #489. close #407. close #347. credit @ghazel
fix unit tests