📄 fontfactory.java
字号:
public static Font getFont(String fontname, String encoding, float size, int style, Color color) { return getFont(fontname, encoding, defaultEmbedding, size, style, color); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param encoding the encoding of the font * @param size the size of this font * @param style the style of this font * @return the Font constructed based on the parameters */ public static Font getFont(String fontname, String encoding, float size, int style) { return getFont(fontname, encoding, defaultEmbedding, size, style, null); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param encoding the encoding of the font * @param size the size of this font * @return the Font constructed based on the parameters */ public static Font getFont(String fontname, String encoding, float size) { return getFont(fontname, encoding, defaultEmbedding, size, Font.UNDEFINED, null); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param encoding the encoding of the font * @return the Font constructed based on the parameters */ public static Font getFont(String fontname, String encoding) { return getFont(fontname, encoding, defaultEmbedding, Font.UNDEFINED, Font.UNDEFINED, null); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param size the size of this font * @param style the style of this font * @param color the <CODE>Color</CODE> of this font. * @return the Font constructed based on the parameters */ public static Font getFont(String fontname, float size, int style, Color color) { return getFont(fontname, defaultEncoding, defaultEmbedding, size, style, color); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param size the size of this font * @param color the <CODE>Color</CODE> of this font. * @return the Font constructed based on the parameters * @since 2.1.0 */ public static Font getFont(String fontname, float size, Color color) { return getFont(fontname, defaultEncoding, defaultEmbedding, size, Font.UNDEFINED, color); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param size the size of this font * @param style the style of this font * @return the Font constructed based on the parameters */ public static Font getFont(String fontname, float size, int style) { return getFont(fontname, defaultEncoding, defaultEmbedding, size, style, null); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @param size the size of this font * @return the Font constructed based on the parameters */ public static Font getFont(String fontname, float size) { return getFont(fontname, defaultEncoding, defaultEmbedding, size, Font.UNDEFINED, null); } /** * Constructs a <CODE>Font</CODE>-object. * * @param fontname the name of the font * @return the Font constructed based on the parameters */ public static Font getFont(String fontname) { return getFont(fontname, defaultEncoding, defaultEmbedding, Font.UNDEFINED, Font.UNDEFINED, null); } /** * Register a font by giving explicitly the font family and name. * @param familyName the font family * @param fullName the font name * @param path the font path */ public void registerFamily(String familyName, String fullName, String path) { fontImp.registerFamily(familyName, fullName, path); } /** * Register a ttf- or a ttc-file. * * @param path the path to a ttf- or ttc-file */ public static void register(String path) { register(path, null); } /** * Register a font file and use an alias for the font contained in it. * * @param path the path to a font file * @param alias the alias you want to use for the font */ public static void register(String path, String alias) { fontImp.register(path, alias); } /** Register all the fonts in a directory. * @param dir the directory * @return the number of fonts registered */ public static int registerDirectory(String dir) { return fontImp.registerDirectory(dir); } /** * Register all the fonts in a directory and possibly its subdirectories. * @param dir the directory * @param scanSubdirectories recursively scan subdirectories if <code>true</true> * @return the number of fonts registered * @since 2.1.2 */ public static int registerDirectory(String dir, boolean scanSubdirectories) { return fontImp.registerDirectory(dir, scanSubdirectories); } /** Register fonts in some probable directories. It usually works in Windows, * Linux and Solaris. * @return the number of fonts registered */ public static int registerDirectories() { return fontImp.registerDirectories(); }/** * Gets a set of registered fontnames. * @return a set of registered fonts */ public static Set getRegisteredFonts() { return fontImp.getRegisteredFonts(); } /** * Gets a set of registered fontnames. * @return a set of registered font families */ public static Set getRegisteredFamilies() { return fontImp.getRegisteredFamilies(); } /** * Gets a set of registered fontnames. * @param fontname of a font that may or may not be registered * @return true if a given font is registered */ public static boolean contains(String fontname) { return fontImp.isRegistered(fontname); } /** * Checks if a certain font is registered. * * @param fontname the name of the font that has to be checked. * @return true if the font is found */ public static boolean isRegistered(String fontname) { return fontImp.isRegistered(fontname); } /** * Gets the font factory implementation. * @return the font factory implementation */ public static FontFactoryImp getFontImp() { return fontImp; } /** * Sets the font factory implementation. * @param fontImp the font factory implementation */ public static void setFontImp(FontFactoryImp fontImp) { if (fontImp == null) throw new NullPointerException("FontFactoryImp cannot be null."); FontFactory.fontImp = fontImp; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -