Class FontSetting
java.lang.Object
org.ofdrw.layout.element.canvas.FontSetting
- All Implemented Interfaces:
Cloneable, TextFontInfo
字体设置
- Since:
- 2020-05-06 18:21:02
- Author:
- 权观宇
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbox(char c) 返回文字所占空间charWidth(char c) 字符宽度clone()int获取字符方向getFont()获取文字对象获取文字字号获取字体宽度static FontSetting简化构造提供默认的字体配置static FontSettinggetInstance(double fontSize) 简化构造提供可选的字体配置获取字间距int获取阅读方向获取文本对齐方式booleanisItalic()字体是否为斜体setBold()设置字体为加粗格式setCharDirection(int charDirection) 设置字符方向设置文字对象setFontSize(double fontSize) 设置文字字号setFontWeight(Integer fontWeight) 设置字体宽度setItalic(boolean italic) 设置字体是否为斜体setLetterSpacing(double letterSpacing) 设置字间距setReadDirection(int readDirection) 设置阅读方向setTextAlign(TextAlign textAlign) 设置文本对齐方式
-
Constructor Details
-
FontSetting
-
-
Method Details
-
getInstance
-
getInstance
简化构造提供可选的字体配置字体类型为宋体
- Parameters:
fontSize- 字体大小,单位:毫米(mm)- Returns:
- 字体配置
-
getTextAlign
-
setTextAlign
设置文本对齐方式- Parameters:
textAlign- 文本对齐方式- Returns:
- this
-
getFont
-
setFont
-
getFontSize
获取文字字号- Specified by:
getFontSizein interfaceTextFontInfo- Returns:
- 字号(单位毫米)
-
setFontSize
设置文字字号- Parameters:
fontSize- 字号(单位毫米)- Returns:
- this
-
isItalic
public boolean isItalic()字体是否为斜体- Returns:
- true - 斜体
-
setItalic
设置字体是否为斜体- Parameters:
italic- true - 斜体;false - 非斜体- Returns:
- this
-
setBold
-
getFontWeight
-
getCharDirection
public int getCharDirection()获取字符方向- Returns:
- 字符方向
-
setCharDirection
设置字符方向- Parameters:
charDirection- 字符方向(charDirection) 允许值:0、90、180、270- Returns:
- this
-
getReadDirection
public int getReadDirection()获取阅读方向- Returns:
- 阅读方向
-
getLetterSpacing
获取字间距- Specified by:
getLetterSpacingin interfaceTextFontInfo- Returns:
- 字间距,单位毫米mm,默认值0
-
setLetterSpacing
设置字间距如果字间距小于0,那么将会自动修正为0
- Parameters:
letterSpacing- 字间距,单位毫米mm- Returns:
- this
-
setReadDirection
设置阅读方向- Parameters:
readDirection- 设置阅读方向(charDirection) 允许值:0、90、180、270- Returns:
- this
-
setFontWeight
设置字体宽度- Parameters:
fontWeight- 字体宽度,可选值:100、200、300、400、500、600、700、800、900- Returns:
- this
-
charWidth
-
box
-
clone
-