use of org.apache.poi.sl.draw.DrawFontManager in project poi by apache.
the class HwmfGraphics method addAttributes.
private void addAttributes(AttributedString as, HwmfFont font) {
DrawFontManager fontHandler = (DrawFontManager) graphicsCtx.getRenderingHint(Drawable.FONT_HANDLER);
String fontFamily = null;
@SuppressWarnings("unchecked") Map<String, String> fontMap = (Map<String, String>) graphicsCtx.getRenderingHint(Drawable.FONT_MAP);
if (fontMap != null && fontMap.containsKey(font.getFacename())) {
fontFamily = fontMap.get(font.getFacename());
}
if (fontHandler != null) {
fontFamily = fontHandler.getRendererableFont(font.getFacename(), font.getPitchAndFamily());
}
if (fontFamily == null) {
fontFamily = font.getFacename();
}
as.addAttribute(TextAttribute.FAMILY, fontFamily);
as.addAttribute(TextAttribute.SIZE, getFontHeight(font));
as.addAttribute(TextAttribute.STRIKETHROUGH, font.isStrikeOut());
if (font.isUnderline()) {
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
}
if (font.isItalic()) {
as.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
}
as.addAttribute(TextAttribute.WEIGHT, font.getWeight());
}
Aggregations