// hmm there does not seem to be a clear definition for StemV,
// this is close enough and I am told it doesn't usually get used.
fd.setStemV(fd.getFontBoundingBox().getWidth() * .13f);
CmapTable cmapTable = ttf.getCmap();
CmapSubtable uniMap = cmapTable.getSubtable(CmapTable.PLATFORM_UNICODE,
CmapTable.ENCODING_UNICODE_2_0_FULL);
if (uniMap == null)
{
uniMap = cmapTable.getSubtable(CmapTable.PLATFORM_UNICODE,
CmapTable.ENCODING_UNICODE_2_0_BMP);
}
if (uniMap == null)
{
uniMap = cmapTable.getSubtable(CmapTable.PLATFORM_WINDOWS,
CmapTable.ENCODING_WIN_UNICODE);
}
if (uniMap == null)
{
// Microsoft's "Recommendations for OpenType Fonts" says that "Symbol" encoding
// actually means "Unicode, non-standard character set"
uniMap = cmapTable.getSubtable(CmapTable.PLATFORM_WINDOWS,
CmapTable.ENCODING_WIN_SYMBOL);
}
if (uniMap == null)
{
// there should always be a usable cmap, if this happens we haven't tried hard enough
// to find one. Furthermore, if we loaded the font from disk then we should've checked
// first to see that it had a suitable cmap before calling createFontDescriptor
throw new IllegalArgumentException("ttf: no suitable cmap for font '" +
ttf.getNaming().getFontFamily() + "', found: " +
Arrays.toString(cmapTable.getCmaps()));
}
if (this.getFontEncoding() == null)
{
// todo: calling this.getFontEncoding() doesn't work if the font is loaded