public class Font extends Object
| 构造器和说明 |
|---|
Font(String name,
Path fontFile) |
Font(String name,
String familyName) |
Font(String name,
String familyName,
Path fontFile) |
Font(String name,
String familyName,
Path fontFile,
double[] printableAsciiWidthMap)
创建字体并指定 可打印字符宽度缩放倍数
|
| 限定符和类型 | 方法和说明 |
|---|---|
double |
getCharWidthScale(char txt)
获取字符占比
|
String |
getCompleteFontName()
获取字体全名
|
static Font |
getDefault() |
String |
getFamilyName() |
Path |
getFontFile() |
String |
getFontFileName()
获取字体文件名称
|
Font |
getFontObj()
获取AWT字体对象,该对象可能为空(当前没有提供字体路径时为空)
|
String |
getName() |
boolean |
hasWidthMath()
字体是否存在预设的字符宽度映射表
|
boolean |
isEmbeddable()
获取字体嵌入标识
|
Font |
setEmbeddable(boolean embeddable)
是否可嵌入OFD文件包。
|
Font |
setFamilyName(String familyName) |
Font |
setFontFile(Path fontFile)
设置字体文件
|
Font |
setName(String name) |
Font |
setPrintableAsciiWidthMap(double[] map)
设置可打印字符宽度映射表
在使用操作系统字体时,默认采用ACSII 0.5 其余1的比例计算宽度,因此可能需要手动设置宽度比例才可以达到相应的效果
|
public static Font getDefault()
public boolean hasWidthMath()
public double getCharWidthScale(char txt)
txt - 字符public Font setPrintableAsciiWidthMap(double[] map)
在使用操作系统字体时,默认采用ACSII 0.5 其余1的比例计算宽度,因此可能需要手动设置宽度比例才可以达到相应的效果
map - 映射比例表public String getCompleteFontName()
public String getName()
public String getFamilyName()
public Path getFontFile()
public String getFontFileName()
public Font getFontObj()
public boolean isEmbeddable()
public Font setEmbeddable(boolean embeddable)
embeddable - true-嵌入,false-不嵌入Copyright © 2024. All rights reserved.