应为中文显示一直有问题,搞了两天没有结果。郁闷了两天。
最后终于发现,是因为服务器是纯英文的lunix,因此,不默认支持中文字体。所以中文都显示为小方框。
解决的办法是Font类有一个静态方法。
static Font
|
createFont(int fontFormat,
File fontFile) 返回一个使用指定字体类型和指定字体文件的新 Font 。
|
static Font
|
createFont(int fontFormat,
InputStream fontStream) 返回一个使用指定字体类型和输入数据的新 Font 。
|
Font
|
deriveFont(AffineTransform trans) 通过复制当前 Font 对象并应用新的变换,创建一个新 Font 对象。
|
Font
|
deriveFont(float size) 通过复制当前 Font 对象并应用新的大小,创建一个新 Font 对象。
|
Font
|
deriveFont(int style) 通过复制当前的 Font 对象,并应用新的样式,创建一个新 Font 对象。
|
Font
|
deriveFont(int style,
AffineTransform trans) 通过复制此 Font 对象并应用新样式和变换,创建一个新 Font 对象。
|
Font
|
deriveFont(int style,
float size) 通过复制此 Font 对象并应用新样式和大小,创建一个新 Font 对象。
|
Font
|
deriveFont(Map<? extends AttributedCharacterIterator.Attribute,?> attributes) 通过复制当前 Font 对象并应用新的字体属性集,创建一个新 Font 对象。
|
需要设置font的地方参考:http://www.softhouse.com.cn/news/show/85463.html
至于这个Font文件如何设置为linux内置字体,各位可以研究讨论一下。
XP的字体文件在C:/Windows/Fonts下。
0 评论 :
发表评论