Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a3be12f7
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,发现更多精彩内容 >>
提交
a3be12f7
编写于
12月 03, 2011
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7117199: Fix javac warnings in src/share/classes/java/awt/font
Reviewed-by: jgodinez, bae
上级
09e73b9e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
28 deletion
+55
-28
src/share/classes/java/awt/font/StyledParagraph.java
src/share/classes/java/awt/font/StyledParagraph.java
+19
-12
src/share/classes/java/awt/font/TextAttribute.java
src/share/classes/java/awt/font/TextAttribute.java
+3
-2
src/share/classes/java/awt/font/TextLayout.java
src/share/classes/java/awt/font/TextLayout.java
+16
-7
src/share/classes/java/awt/font/TextLine.java
src/share/classes/java/awt/font/TextLine.java
+8
-3
src/share/classes/java/awt/font/TextMeasurer.java
src/share/classes/java/awt/font/TextMeasurer.java
+9
-4
未找到文件。
src/share/classes/java/awt/font/StyledParagraph.java
浏览文件 @
a3be12f7
...
...
@@ -34,6 +34,7 @@ import java.awt.Toolkit;
import
java.awt.im.InputMethodHighlight
;
import
java.text.Annotation
;
import
java.text.AttributedCharacterIterator
;
import
java.text.AttributedCharacterIterator.Attribute
;
import
java.util.Vector
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -65,7 +66,7 @@ final class StyledParagraph {
// If there are multiple Decorations in the paragraph, they are
// stored in this Vector, in order. Otherwise this vector and
// the decorationStarts array are null.
private
Vector
decorations
;
private
Vector
<
Decoration
>
decorations
;
// If there are multiple Decorations in the paragraph,
// decorationStarts[i] contains the index where decoration i
// starts. For convenience, there is an extra entry at the
...
...
@@ -76,7 +77,7 @@ final class StyledParagraph {
// they are
// stored in this Vector, in order. Otherwise this vector and
// the fontStarts array are null.
private
Vector
fonts
;
private
Vector
<
Object
>
fonts
;
// If there are multiple Fonts/GraphicAttributes in the paragraph,
// fontStarts[i] contains the index where decoration i
// starts. For convenience, there is an extra entry at the
...
...
@@ -104,7 +105,7 @@ final class StyledParagraph {
final
int
nextRunStart
=
aci
.
getRunLimit
();
final
int
localIndex
=
index
-
start
;
Map
attributes
=
aci
.
getAttributes
();
Map
<?
extends
Attribute
,
?>
attributes
=
aci
.
getAttributes
();
attributes
=
addInputMethodAttrs
(
attributes
);
Decoration
d
=
Decoration
.
getDecoration
(
attributes
);
addDecoration
(
d
,
localIndex
);
...
...
@@ -168,7 +169,8 @@ final class StyledParagraph {
char
ch
=
aci
.
setIndex
(
insertPos
);
int
relativePos
=
Math
.
max
(
insertPos
-
aci
.
getBeginIndex
()
-
1
,
0
);
Map
attributes
=
addInputMethodAttrs
(
aci
.
getAttributes
());
Map
<?
extends
Attribute
,
?>
attributes
=
addInputMethodAttrs
(
aci
.
getAttributes
());
Decoration
d
=
Decoration
.
getDecoration
(
attributes
);
if
(!
oldParagraph
.
getDecorationAt
(
relativePos
).
equals
(
d
))
{
return
new
StyledParagraph
(
aci
,
chars
);
...
...
@@ -297,7 +299,7 @@ final class StyledParagraph {
return
decoration
;
}
int
run
=
findRunContaining
(
index
,
decorationStarts
);
return
(
Decoration
)
decorations
.
elementAt
(
run
);
return
decorations
.
elementAt
(
run
);
}
/**
...
...
@@ -339,6 +341,7 @@ final class StyledParagraph {
* starts array does not have room for the index, a
* new array is created and returned.
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
private
static
int
[]
addToVector
(
Object
obj
,
int
index
,
Vector
v
,
...
...
@@ -374,7 +377,7 @@ final class StyledParagraph {
}
else
{
if
(!
decoration
.
equals
(
d
))
{
decorations
=
new
Vector
(
INITIAL_SIZE
);
decorations
=
new
Vector
<
Decoration
>
(
INITIAL_SIZE
);
decorations
.
addElement
(
decoration
);
decorations
.
addElement
(
d
);
decorationStarts
=
new
int
[
INITIAL_SIZE
];
...
...
@@ -398,7 +401,7 @@ final class StyledParagraph {
}
else
{
if
(!
font
.
equals
(
f
))
{
fonts
=
new
Vector
(
INITIAL_SIZE
);
fonts
=
new
Vector
<
Object
>
(
INITIAL_SIZE
);
fonts
.
addElement
(
font
);
fonts
.
addElement
(
f
);
fontStarts
=
new
int
[
INITIAL_SIZE
];
...
...
@@ -412,7 +415,8 @@ final class StyledParagraph {
* Resolve the given chars into Fonts using FontResolver, then add
* font runs for each.
*/
private
void
addFonts
(
char
[]
chars
,
Map
attributes
,
int
start
,
int
limit
)
{
private
void
addFonts
(
char
[]
chars
,
Map
<?
extends
Attribute
,
?>
attributes
,
int
start
,
int
limit
)
{
FontResolver
resolver
=
FontResolver
.
getInstance
();
CodePointIterator
iter
=
CodePointIterator
.
create
(
chars
,
start
,
limit
);
...
...
@@ -426,7 +430,8 @@ final class StyledParagraph {
* Return a Map with entries from oldStyles, as well as input
* method entries, if any.
*/
static
Map
addInputMethodAttrs
(
Map
oldStyles
)
{
static
Map
<?
extends
Attribute
,
?>
addInputMethodAttrs
(
Map
<?
extends
Attribute
,
?>
oldStyles
)
{
Object
value
=
oldStyles
.
get
(
TextAttribute
.
INPUT_METHOD_HIGHLIGHT
);
...
...
@@ -439,7 +444,7 @@ final class StyledParagraph {
InputMethodHighlight
hl
;
hl
=
(
InputMethodHighlight
)
value
;
Map
imStyles
=
null
;
Map
<?
extends
Attribute
,
?>
imStyles
=
null
;
try
{
imStyles
=
hl
.
getStyle
();
}
catch
(
NoSuchMethodError
e
)
{
...
...
@@ -451,7 +456,8 @@ final class StyledParagraph {
}
if
(
imStyles
!=
null
)
{
HashMap
newStyles
=
new
HashMap
(
5
,
(
float
)
0.9
);
HashMap
<
Attribute
,
Object
>
newStyles
=
new
HashMap
<>(
5
,
(
float
)
0.9
);
newStyles
.
putAll
(
oldStyles
);
newStyles
.
putAll
(
imStyles
);
...
...
@@ -471,7 +477,8 @@ final class StyledParagraph {
* If attributes does not contain a GraphicAttribute, Font, or
* Font family entry this method returns null.
*/
private
static
Object
getGraphicOrFont
(
Map
attributes
)
{
private
static
Object
getGraphicOrFont
(
Map
<?
extends
Attribute
,
?>
attributes
)
{
Object
value
=
attributes
.
get
(
TextAttribute
.
CHAR_REPLACEMENT
);
if
(
value
!=
null
)
{
...
...
src/share/classes/java/awt/font/TextAttribute.java
浏览文件 @
a3be12f7
...
...
@@ -257,7 +257,8 @@ import java.util.HashMap;
public
final
class
TextAttribute
extends
Attribute
{
// table of all instances in this class, used by readResolve
private
static
final
Map
instanceMap
=
new
HashMap
(
29
);
private
static
final
Map
<
String
,
TextAttribute
>
instanceMap
=
new
HashMap
<
String
,
TextAttribute
>(
29
);
/**
* Constructs a <code>TextAttribute</code> with the specified name.
...
...
@@ -280,7 +281,7 @@ public final class TextAttribute extends Attribute {
"subclass didn't correctly implement readResolve"
);
}
TextAttribute
instance
=
(
TextAttribute
)
instanceMap
.
get
(
getName
());
TextAttribute
instance
=
instanceMap
.
get
(
getName
());
if
(
instance
!=
null
)
{
return
instance
;
}
else
{
...
...
src/share/classes/java/awt/font/TextLayout.java
浏览文件 @
a3be12f7
...
...
@@ -55,6 +55,7 @@ import java.awt.geom.Rectangle2D;
import
java.text.AttributedString
;
import
java.text.AttributedCharacterIterator
;
import
java.text.AttributedCharacterIterator.Attribute
;
import
java.text.CharacterIterator
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.util.Hashtable
;
...
...
@@ -382,7 +383,7 @@ public final class TextLayout implements Cloneable {
throw
new
IllegalArgumentException
(
"Zero length string passed to TextLayout constructor."
);
}
Map
attributes
=
null
;
Map
<?
extends
Attribute
,
?>
attributes
=
null
;
if
(
font
.
hasLayoutAttributes
())
{
attributes
=
font
.
getAttributes
();
}
...
...
@@ -451,7 +452,7 @@ public final class TextLayout implements Cloneable {
private
static
Font
singleFont
(
char
[]
text
,
int
start
,
int
limit
,
Map
attributes
)
{
Map
<?
extends
Attribute
,
?>
attributes
)
{
if
(
attributes
.
get
(
TextAttribute
.
CHAR_REPLACEMENT
)
!=
null
)
{
return
null
;
...
...
@@ -516,14 +517,17 @@ public final class TextLayout implements Cloneable {
text
.
first
();
char
[]
chars
=
new
char
[
len
];
int
n
=
0
;
for
(
char
c
=
text
.
first
();
c
!=
text
.
DONE
;
c
=
text
.
next
())
{
for
(
char
c
=
text
.
first
();
c
!=
CharacterIterator
.
DONE
;
c
=
text
.
next
())
{
chars
[
n
++]
=
c
;
}
text
.
first
();
if
(
text
.
getRunLimit
()
==
limit
)
{
Map
attributes
=
text
.
getAttributes
();
Map
<?
extends
Attribute
,
?>
attributes
=
text
.
getAttributes
();
Font
font
=
singleFont
(
chars
,
0
,
len
,
attributes
);
if
(
font
!=
null
)
{
fastInit
(
chars
,
font
,
attributes
,
frc
);
...
...
@@ -561,7 +565,9 @@ public final class TextLayout implements Cloneable {
/**
* Initialize the paragraph-specific data.
*/
private
void
paragraphInit
(
byte
aBaseline
,
CoreMetrics
lm
,
Map
paragraphAttrs
,
char
[]
text
)
{
private
void
paragraphInit
(
byte
aBaseline
,
CoreMetrics
lm
,
Map
<?
extends
Attribute
,
?>
paragraphAttrs
,
char
[]
text
)
{
baseline
=
aBaseline
;
...
...
@@ -581,7 +587,10 @@ public final class TextLayout implements Cloneable {
* all renderable by one font (ie no embedded graphics)
* all on one baseline
*/
private
void
fastInit
(
char
[]
chars
,
Font
font
,
Map
attrs
,
FontRenderContext
frc
)
{
private
void
fastInit
(
char
[]
chars
,
Font
font
,
Map
<?
extends
Attribute
,
?>
attrs
,
FontRenderContext
frc
)
{
// Object vf = attrs.get(TextAttribute.ORIENTATION);
// isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf);
isVerticalLine
=
false
;
...
...
@@ -619,7 +628,7 @@ public final class TextLayout implements Cloneable {
// and use it and its font to initialize the paragraph.
// If not, use the first graphic to initialize.
Map
paragraphAttrs
=
text
.
getAttributes
();
Map
<?
extends
Attribute
,
?>
paragraphAttrs
=
text
.
getAttributes
();
boolean
haveFont
=
TextLine
.
advanceToFirstFont
(
text
);
...
...
src/share/classes/java/awt/font/TextLine.java
浏览文件 @
a3be12f7
...
...
@@ -43,6 +43,7 @@ import java.awt.im.InputMethodHighlight;
import
java.awt.image.BufferedImage
;
import
java.text.Annotation
;
import
java.text.AttributedCharacterIterator
;
import
java.text.AttributedCharacterIterator.Attribute
;
import
java.text.Bidi
;
import
java.text.CharacterIterator
;
import
java.util.Hashtable
;
...
...
@@ -318,7 +319,8 @@ final class TextLine {
for
(
int
i
=
0
,
n
=
0
;
i
<
fComponents
.
length
;
++
i
,
n
+=
2
)
{
tlc
=
fComponents
[
getComponentLogicalIndex
(
i
)];
AffineTransform
at
=
tlc
.
getBaselineTransform
();
if
(
at
!=
null
&&
((
at
.
getType
()
&
at
.
TYPE_TRANSLATION
)
!=
0
))
{
if
(
at
!=
null
&&
((
at
.
getType
()
&
AffineTransform
.
TYPE_TRANSLATION
)
!=
0
))
{
double
dx
=
at
.
getTranslateX
();
double
dy
=
at
.
getTranslateY
();
builder
.
moveTo
(
tx
+=
dx
,
ty
+=
dy
);
...
...
@@ -903,7 +905,7 @@ final class TextLine {
char
[]
chars
,
Font
font
,
CoreMetrics
lm
,
Map
attributes
)
{
Map
<?
extends
Attribute
,
?>
attributes
)
{
boolean
isDirectionLTR
=
true
;
byte
[]
levels
=
null
;
...
...
@@ -1250,7 +1252,10 @@ final class TextLine {
*/
static
boolean
advanceToFirstFont
(
AttributedCharacterIterator
aci
)
{
for
(
char
ch
=
aci
.
first
();
ch
!=
aci
.
DONE
;
ch
=
aci
.
setIndex
(
aci
.
getRunLimit
()))
{
for
(
char
ch
=
aci
.
first
();
ch
!=
CharacterIterator
.
DONE
;
ch
=
aci
.
setIndex
(
aci
.
getRunLimit
()))
{
if
(
aci
.
getAttribute
(
TextAttribute
.
CHAR_REPLACEMENT
)
==
null
)
{
return
true
;
...
...
src/share/classes/java/awt/font/TextMeasurer.java
浏览文件 @
a3be12f7
...
...
@@ -43,6 +43,7 @@ package java.awt.font;
import
java.awt.Font
;
import
java.text.AttributedCharacterIterator
;
import
java.text.AttributedCharacterIterator.Attribute
;
import
java.text.AttributedString
;
import
java.text.Bidi
;
import
java.text.BreakIterator
;
...
...
@@ -176,7 +177,7 @@ public final class TextMeasurer implements Cloneable {
throw
new
Error
();
}
if
(
fComponents
!=
null
)
{
other
.
fComponents
=
(
TextLineComponent
[])
fComponents
.
clone
();
other
.
fComponents
=
fComponents
.
clone
();
}
return
other
;
}
...
...
@@ -199,7 +200,10 @@ public final class TextMeasurer implements Cloneable {
fChars
=
new
char
[
text
.
getEndIndex
()
-
fStart
];
int
n
=
0
;
for
(
char
c
=
text
.
first
();
c
!=
text
.
DONE
;
c
=
text
.
next
())
{
for
(
char
c
=
text
.
first
();
c
!=
CharacterIterator
.
DONE
;
c
=
text
.
next
())
{
fChars
[
n
++]
=
c
;
}
...
...
@@ -211,7 +215,7 @@ public final class TextMeasurer implements Cloneable {
}
text
.
first
();
Map
paragraphAttrs
=
text
.
getAttributes
();
Map
<?
extends
Attribute
,
?>
paragraphAttrs
=
text
.
getAttributes
();
NumericShaper
shaper
=
AttributeValues
.
getNumericShaping
(
paragraphAttrs
);
if
(
shaper
!=
null
)
{
shaper
.
shape
(
fChars
,
0
,
fChars
.
length
);
...
...
@@ -243,7 +247,8 @@ public final class TextMeasurer implements Cloneable {
GraphicAttribute
graphic
=
(
GraphicAttribute
)
paragraphAttrs
.
get
(
TextAttribute
.
CHAR_REPLACEMENT
);
fBaseline
=
TextLayout
.
getBaselineFromGraphic
(
graphic
);
Font
dummyFont
=
new
Font
(
new
Hashtable
(
5
,
(
float
)
0.9
));
Hashtable
<
Attribute
,
?>
fmap
=
new
Hashtable
<>(
5
,
(
float
)
0.9
);
Font
dummyFont
=
new
Font
(
fmap
);
LineMetrics
lm
=
dummyFont
.
getLineMetrics
(
" "
,
0
,
1
,
fFrc
);
fBaselineOffsets
=
lm
.
getBaselineOffsets
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录