public static Font getFont(IGraphicalPart part, IStyleSelector ss, String key) { if (part != null && ss != null) { String value = ss.getStyleValue(part, key); if (value != null) { Font f = FontUtils.getFont(value); if (f != null) return f; } } return null; }
public void activate(IGraphicalPart part, IFigure figure) { super.activate(part, figure); if (figure instanceof ITextFigure) { ITextFigure fig = (ITextFigure) figure; fig.setText(MindMapMessages.Legend); fig.setFont(FontUtils.getBold(JFaceResources.DEFAULT_FONT)); fig.setForegroundColor(ColorConstants.black); } // if (figure instanceof RotatableWrapLabel) { // ((RotatableWrapLabel) figure) // .setRenderStyle(RotatableWrapLabel.NORMAL); // } }
private Font getFont(String fontKey) { Font font = null; String fontValue = settings.get(fontKey); if (fontValue != null) { FontData[] fontData = FontUtils.toFontData(fontValue); if (fontData != null) { for (FontData fd : fontData) { fd.setHeight(fd.getHeight() * dpi.y / UnitConvertor.getScreenDpi().y); } font = new Font(Display.getCurrent(), fontData); } } if (font == null) { FontData[] defaultFontData = JFaceResources.getDefaultFontDescriptor().getFontData(); int defaultHeight = defaultFontData[0].getHeight(); font = new Font( Display.getCurrent(), FontUtils.newHeight( defaultFontData, defaultHeight * dpi.y / UnitConvertor.getScreenDpi().y)); } return font; }