/*
* %W% %G%
*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package sun.font;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.FontFormatException;
import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.plaf.FontUIResource;
import sun.awt.AppContext;
import sun.awt.FontConfiguration;
import sun.awt.SunHints;
import sun.awt.SunToolkit;
import sun.java2d.FontSupport;
import sun.java2d.HeadlessGraphicsEnvironment;
import sun.java2d.SunGraphicsEnvironment;
/*
* Interface between Java Fonts (java.awt.Font) and the underlying
* font files/native font resources and the Java and native font scalers.
*/
public final class FontManager {
public static final int FONTFORMAT_NONE = -1;
public static final int FONTFORMAT_TRUETYPE = 0;
public static final int FONTFORMAT_TYPE1 = 1;
public static final int FONTFORMAT_T2K = 2;
public static final int FONTFORMAT_TTC = 3;
public static final int FONTFORMAT_COMPOSITE = 4;
public static final int FONTFORMAT_NATIVE = 5;
public static final int NO_FALLBACK = 0;
public static final int PHYSICAL_FALLBACK = 1;
public static final int LOGICAL_FALLBACK = 2;
public static final int QUADPATHTYPE = 1;
public static final int CUBICPATHTYPE = 2;
/* Pool of 20 font file channels chosen because some UTF-8 locale
* composite fonts can use up to 16 platform fonts (including the
* Lucida fall back). This should prevent channel thrashing when
* dealing with one of these fonts.
* The pool array stores the fonts, rather than directly referencing
* the channels, as the font needs to do the open/close work.
*/
private static final int CHANNELPOOLSIZE = 20;
private static int lastPoolIndex = 0;
private static FileFont fontFileCache[] = new FileFont[CHANNELPOOLSIZE];
/* Need to implement a simple linked list scheme for fast
* traversal and lookup.
* Also want to "fast path" dialog so there's minimal overhead.
*/
/* There are at exactly 20 composite fonts: 5 faces (but some are not
* usually different), in 4 styles. The array may be auto-expanded
* later if more are needed, eg for user-defined composites or locale
* variants.
*/
private static int maxCompFont = 0;
private static CompositeFont [] compFonts = new CompositeFont[20];
private static Hashtable compositeFonts = new Hashtable();
private static Hashtable physicalFonts = new Hashtable();
private static ConcurrentHashMap<String, PhysicalFont>
registeredFontFiles = new ConcurrentHashMap<String, PhysicalFont>();
/* given a full name find the Font. Remind: there's duplication
* here in that this contains the content of compositeFonts +
* physicalFonts.
*/
private static Hashtable fullNameToFont = new Hashtable();
/* TrueType fonts have localised names. Support searching all
* of these before giving up on a name.
*/
private static HashMap localeFullNamesToFont;
private static PhysicalFont defaultPhysicalFont;
/* deprecated, unsupported hack - actually invokes a bug! */
private static boolean usePlatformFontMetrics = false;
public static Logger logger = null;
public static boolean logging;
static boolean longAddresses;
static String osName;
static boolean useT2K;
static boolean isWindows;
static boolean isSolaris;
public static boolean isSolaris8; // needed to check for JA wavedash fix.
public static boolean isSolaris9; // needed to check for songti font usage.
private static boolean loaded1dot0Fonts = false;
static SunGraphicsEnvironment sgEnv;
static boolean loadedAllFonts = false;
static boolean loadedAllFontFiles = false;
static TrueTypeFont eudcFont;
static HashMap<String,String> jreFontMap;
static HashSet<String> jreLucidaFontFiles;
static String[] jreOtherFontFiles;
static boolean noOtherJREFontFiles = false; // initial assumption.
/* Hardwire the English names and expected file names of fonts
* commonly used at start up. Avoiding until later even the small
* cost of calling platform APIs to locate these can help.
* The code that registers these fonts needs to "bail" if any
* of the files do not exist, so it will verify the existence of
* all non-null file names first.
* They are added in to a map with nominally the first
* word in the name of the family as the key. In all the cases
* we are using the the family name is a single word, and as is
* more or less required the family name is the initial sequence
* in a full name. So lookup first finds the matching description,
* then registers the whole family, returning the right font.
*/
public static class FamilyDescription {
public String familyName;
public String plainFullName;
public String boldFullName;
public String italicFullName;
public String boldItalicFullName;
public String plainFileName;
public String boldFileName;
public String italicFileName;
public String boldItalicFileName;
}
static HashMap<String, FamilyDescription> platformFontMap;
/* Used to indicate required return type from toArray(..); */
private static String[] STR_ARRAY = new String[0];
static {
if (SunGraphicsEnvironment.debugFonts) {
logger = Logger.getLogger("sun.java2d", null);
logging = logger.getLevel() != Level.OFF;
}
/* Key is familyname+style value as an int.
* Value is filename containing the font.
* If no mapping exists, it means there is no font file for the style
* If the mapping exists but the file doesn't exist in the deferred
* list then it means its not installed.
* This looks like a lot of code and strings but if it saves even
* a single file being opened at JRE start-up there's a big payoff.
* Lucida Sans is probably the only important case as the others
* are rarely used. Consider removing the other mappings if there's
* no evidence they are useful in practice.
*/
jreFontMap = new HashMap<String,String>();
/* Lucida Sans Family */
jreFontMap.put("lucida sans0", "LucidaSansRegular.ttf");
jreFontMap.put("lucida sans1", "LucidaSansDemiBold.ttf");
/* Lucida Sans full names (map Bold and DemiBold to same file) */
jreFontMap.put("lucida sans regular0", "LucidaSansRegular.ttf");
jreFontMap.put("lucida sans regular1", "LucidaSansDemiBold.ttf");
jreFontMap.put("lucida sans bold1", "LucidaSansDemiBold.ttf");
jreFontMap.put("lucida sans demibold1", "LucidaSansDemiBold.ttf");
/* Lucida Sans Typewriter Family */
jreFontMap.put("lucida sans typewriter0",
"LucidaTypewriterRegular.ttf");
jreFontMap.put("lucida sans typewriter1", "LucidaTypewriterBold.ttf");
/* Typewriter full names (map Bold and DemiBold to same file) */
jreFontMap.put("lucida sans typewriter regular0",
"LucidaTypewriter.ttf");
jreFontMap.put("lucida sans typewriter regular1",
"LucidaTypewriterBold.ttf");
jreFontMap.put("lucida sans typewriter bold1",
"LucidaTypewriterBold.ttf");
jreFontMap.put("lucida sans typewriter demibold1",
"LucidaTypewriterBold.ttf");
/* Lucida Bright Family */
jreFontMap.put("lucida bright0", "LucidaBrightRegular.ttf");
jreFontMap.put("lucida bright1", "Lu
没有合适的资源?快使用搜索试试~ 我知道了~
sem.rar_Windows编程
共54个文件
java:54个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 174 浏览量
2022-09-20
23:53:54
上传
评论
收藏 164KB RAR 举报
温馨提示
java的精美的汉字生成的系统,有使用价值
资源推荐
资源详情
资源评论
收起资源包目录
sem.rar (54个子文件)
PhysicalStrike.java 4KB
TextLineComponent.java 4KB
CompositeGlyphMapper.java 8KB
CompositeFontDescriptor.java 2KB
Underline.java 9KB
YBidiUtils.java 12KB
PhysicalFont.java 3KB
ScriptRunData.java 25KB
FontResolver.java 7KB
TrueTypeFont.java 45KB
7AAttributeValues.java 33KB
CompositeStrike.java 6KB
ScriptRun.java 11KB
CreatedFontTracker.java 833B
FontDesignMetrics.java 19KB
FontManager.java 141KB
ExtendedTextSourceLabel.java 34KB
TrueTypeGlyphMapper.java 7KB
Font2DHandle.java 2KB
DelegatingShape.java 2KB
FontStrikeDesc.java 8KB
Script.java 3KB
StandardTextSource.java 6KB
GlyphLayout.java 23KB
LayoutPathImpl.java 36KB
GraphicComponent.java 11KB
S4AttributeMap.java 2KB
Decoration.java 14KB
StrikeCache.java 12KB
TextSource.java 2KB
FontLineMetrics.java 2KB
TextSourceLabel.java 4KB
CoreMetrics.java 3KB
StrikeMetrics.java 6KB
FontRunIterator.java 5KB
FontStrike.java 2KB
Font2D.java 18KB
CharToGlyphMapper.java 2KB
StandardGlyphVector.java 67KB
CMap.java 34KB
FontFamily.java 6KB
TextLabel.java 3KB
FileFont.java 9KB
TextRecord.java 502B
ExtendedTextLabel.java 4KB
Type1GlyphMapper.java 4KB
FontStrikeDisposer.java 3KB
FileFontStrike.java 35KB
GlyphList.java 16KB
EAttribute.java 2KB
CompositeFont.java 15KB
Type1Font.java 20KB
TextLabelFactory.java 5KB
SunLayoutEngine.java 6KB
共 54 条
- 1
资源评论
APei
- 粉丝: 64
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功