better error handling, improved encoding detection
handle empty font