When substituting fonts, there is one important questions we need to solve…
What happens if we do not recognise the font?
There are 3 alternatives we have for handling fonts we do not have setup for substitution:-
a. Ignore the fact and use the font name. (HTMLFontMapper.IGNORE)
b. Use a default. (HTMLFontMapper.DEFAULT_ON_UNMAPPED)
c. Fail (forcing the user to fix the issue by setting up a mapping (HTMLFontMapper.FAIL_ON_UNMAPPED)
It is set by a single call when we setup HTML extraction
HTMLDisplay.setValue(HTMLDisplay.FontMode, HTMLFontMapper.DEFAULT_ON_UNMAPPED);
If you look at the code you will also see THREE currently unused options (EMBED_UNKNOWN_AS_IMAGE, EMBED_UNKNOWN_WITH_FONT, EMBED_ALL) which might whet your appetite for some possible future enhancements…
Click here to see all the articles in the PDF to HTML5 conversion series.
This post is part of our “Fonts Articles Index” in these articles we explore Fonts.