Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5f439d6f
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5f439d6f
编写于
5月 06, 2009
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6806822: Font.getFontName() is slow in Java5 and 6
Reviewed-by: igor, jgodinez
上级
5642ec8c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
7 deletion
+45
-7
src/share/classes/sun/font/TrueTypeFont.java
src/share/classes/sun/font/TrueTypeFont.java
+45
-7
未找到文件。
src/share/classes/sun/font/TrueTypeFont.java
浏览文件 @
5f439d6f
...
...
@@ -160,6 +160,13 @@ public class TrueTypeFont extends FileFont {
private
boolean
supportsJA
;
private
boolean
supportsCJK
;
/* These are for faster access to the name of the font as
* typically exposed via API to applications.
*/
private
Locale
nameLocale
;
private
String
localeFamilyName
;
private
String
localeFullName
;
/**
* - does basic verification of the file
* - reads the header table for this font (within a collection)
...
...
@@ -1092,6 +1099,10 @@ public class TrueTypeFont extends FileFont {
* greater than 32767, so read and store those as ints
*/
int
stringPtr
=
sbuffer
.
get
()
&
0xffff
;
nameLocale
=
sun
.
awt
.
SunToolkit
.
getStartupLocale
();
short
nameLocaleID
=
FontManager
.
getLCIDFromLocale
(
nameLocale
);
for
(
int
i
=
0
;
i
<
numRecords
;
i
++)
{
short
platformID
=
sbuffer
.
get
();
if
(
platformID
!=
MS_PLATFORM_ID
)
{
...
...
@@ -1103,15 +1114,24 @@ public class TrueTypeFont extends FileFont {
short
nameID
=
sbuffer
.
get
();
int
nameLen
=
((
int
)
sbuffer
.
get
())
&
0xffff
;
int
namePtr
=
(((
int
)
sbuffer
.
get
())
&
0xffff
)
+
stringPtr
;
String
tmpName
=
null
;
switch
(
nameID
)
{
case
FAMILY_NAME_ID:
if
(
familyName
==
null
||
langID
==
ENGLISH_LOCALE_ID
)
{
if
(
familyName
==
null
||
langID
==
ENGLISH_LOCALE_ID
||
langID
==
nameLocaleID
)
{
buffer
.
position
(
namePtr
);
buffer
.
get
(
name
,
0
,
nameLen
);
familyName
=
makeString
(
name
,
nameLen
,
encodingID
);
tmpName
=
makeString
(
name
,
nameLen
,
encodingID
);
if
(
familyName
==
null
||
langID
==
ENGLISH_LOCALE_ID
){
familyName
=
tmpName
;
}
if
(
langID
==
nameLocaleID
)
{
localeFamilyName
=
tmpName
;
}
}
/*
for (int ii=0;ii<nameLen;ii++) {
...
...
@@ -1129,15 +1149,29 @@ public class TrueTypeFont extends FileFont {
case
FULL_NAME_ID:
if
(
fullName
==
null
||
langID
==
ENGLISH_LOCALE_ID
)
{
if
(
fullName
==
null
||
langID
==
ENGLISH_LOCALE_ID
||
langID
==
nameLocaleID
)
{
buffer
.
position
(
namePtr
);
buffer
.
get
(
name
,
0
,
nameLen
);
fullName
=
makeString
(
name
,
nameLen
,
encodingID
);
tmpName
=
makeString
(
name
,
nameLen
,
encodingID
);
if
(
fullName
==
null
||
langID
==
ENGLISH_LOCALE_ID
)
{
fullName
=
tmpName
;
}
if
(
langID
==
nameLocaleID
)
{
localeFullName
=
tmpName
;
}
}
break
;
}
}
if
(
localeFamilyName
==
null
)
{
localeFamilyName
=
familyName
;
}
if
(
localeFullName
==
null
)
{
localeFullName
=
fullName
;
}
}
}
...
...
@@ -1220,6 +1254,8 @@ public class TrueTypeFont extends FileFont {
public
String
getFontName
(
Locale
locale
)
{
if
(
locale
==
null
)
{
return
fullName
;
}
else
if
(
locale
.
equals
(
nameLocale
)
&&
localeFullName
!=
null
)
{
return
localeFullName
;
}
else
{
short
localeID
=
FontManager
.
getLCIDFromLocale
(
locale
);
String
name
=
lookupName
(
localeID
,
FULL_NAME_ID
);
...
...
@@ -1234,11 +1270,13 @@ public class TrueTypeFont extends FileFont {
public
String
getFamilyName
(
Locale
locale
)
{
if
(
locale
==
null
)
{
return
familyName
;
}
else
if
(
locale
.
equals
(
nameLocale
)
&&
localeFamilyName
!=
null
)
{
return
localeFamilyName
;
}
else
{
short
localeID
=
FontManager
.
getLCIDFromLocale
(
locale
);
String
name
=
lookupName
(
localeID
,
FAMILY_NAME_ID
);
if
(
name
==
null
)
{
return
familyName
;
return
familyName
;
}
else
{
return
name
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录