本文整理汇总了Java中java.awt.Font.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Font.decode方法的具体用法?Java Font.decode怎么用?Java Font.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Font
的用法示例。
在下文中一共展示了Font.decode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MockingGenerationContext
import java.awt.Font; //导入方法依赖的package包/类
/**
* Instantiates a new Mocking generation context.
*
* @param locale the locale
* @param preview the preview
* @param release the release
* @param enableServiceBrokerFake the enable service broker fake
* @param supportedEnvironments the supported environments
*/
public MockingGenerationContext(final Locale locale, final boolean preview, final boolean release, final boolean enableServiceBrokerFake,
final Env supportedEnvironments) {
super(locale, preview, release, enableServiceBrokerFake, supportedEnvironments);
this.locale = locale;
scheduleContext = new MockingScheduleContext(locale, supportedEnvironments);
fileHandles = new HashMap<>();
printable = Mockito.mock(Printable.class);
stack = new LinkedList<>();
contextStack = new LinkedList<>();
pageContext = Mockito.mock(Context.class);
dataSet = Mockito.mock(Dataset.class);
pageParams = Mockito.mock(PageParams.class);
closeables = new LinkedList<>();
context = Mockito.mock(Context.class);
urlCreator = Mockito.mock(UrlCreator.class);
urlCreatorProvider = Mockito.mock(UrlCreatorProvider.class);
node = Mockito.mock(ContentProducer.class);
navigationContext = Mockito.mock(IDProvider.class);
encoding = Charset.forName("UTF-8").name();
font = Font.decode(Font.MONOSPACED);
evaluator = Mockito.mock(Evaluator.class);
characterReplacer = Mockito.mock(CharacterReplacer.class);
}
示例2: setLabelFont
import java.awt.Font; //导入方法依赖的package包/类
/**
* Set the label font, which is used for axis labels and legend labels.
* The font names understood are those understood by
* java.awt.Font.decode().
*
* @param name A font name.
*/
public synchronized void setLabelFont(String name) {
// Changing legend means we need to repaint the offscreen buffer.
_plotImage = null;
_labelFont = Font.decode(name);
_labelFontMetrics = getFontMetrics(_labelFont);
}
示例3: setTitleFont
import java.awt.Font; //导入方法依赖的package包/类
/**
* Set the title font.
* The font names understood are those understood by
* java.awt.Font.decode().
*
* @param name A font name.
*/
public synchronized void setTitleFont(String name) {
// Changing legend means we need to repaint the offscreen buffer.
_plotImage = null;
_titleFont = Font.decode(name);
_titleFontMetrics = getFontMetrics(_titleFont);
}
示例4: getDefaultFont
import java.awt.Font; //导入方法依赖的package包/类
public static Font getDefaultFont() {
Font f = UIManager.getDefaults().getFont("TextField.font");
if (f == null) {
f = Font.decode(null);
}
return new Font(f.getName(), Font.BOLD, f.getSize());
}
示例5: createMainFont
import java.awt.Font; //导入方法依赖的package包/类
/**
* Create a default {@code Font} set on initialization of the GUI.
*
* @param fontName Can be used to choose a different font from a
* user-provided name.
* @param scaleFactor The applied scale factor.
* @return The new {@code Font}.
*/
static Font createMainFont(String fontName, float scaleFactor) {
final float defaultSize = 12f * scaleFactor;
mainFont = null;
if (fontName != null) {
Font font = Font.decode(fontName);
mainFont = font = font.deriveFont(defaultSize);
return font;
}
return ResourceManager.getFont("font.normal").deriveFont(defaultSize);
}
示例6: FontResource
import java.awt.Font; //导入方法依赖的package包/类
/**
* Do not use directly.
*
* @param resourceLocator The {@code URI} used when loading this
* resource.
* @exception IOException if unable to read the font.
*/
public FontResource(URI resourceLocator) throws IOException {
super(resourceLocator);
font = null;
try {
if (resourceLocator.getPath() != null
&& resourceLocator.getPath().endsWith(".ttf")) {
URL url = resourceLocator.toURL();
font = Font.createFont(Font.TRUETYPE_FONT, url.openStream());
} else {
String name = resourceLocator.getSchemeSpecificPart();
font = Font.decode(name.substring(SCHEME.length()));
}
if (font != null) {
GraphicsEnvironment.getLocalGraphicsEnvironment()
.registerFont(font);
}
logger.info("Loaded font: " + font.getFontName()
+ " from: " + resourceLocator);
} catch (FontFormatException|IOException ex) {
logger.log(Level.WARNING,
"Failed loading font from: " + resourceLocator, ex);
throw new IOException(ex.getMessage());
}
}
示例7: PPMonospacedLabel
import java.awt.Font; //导入方法依赖的package包/类
public PPMonospacedLabel(String text, String str, String unit) {
this(text, Font.decode(str), unit);
}
示例8: parse
import java.awt.Font; //导入方法依赖的package包/类
@Override
public Font parse(String value) {
return Font.decode(value);
}
示例9: getEmergencyFont
import java.awt.Font; //导入方法依赖的package包/类
/**
* Gets a font of last resort, as finding fonts must not fail!
* Currently using the default Java font, not matter how ugly.
*
* @return The default Java font.
*/
public static Font getEmergencyFont() {
logger.warning("Using emergency font");
return Font.decode(null);
}