Class Span
java.lang.Object
org.ofdrw.layout.element.Span
- All Implemented Interfaces:
TextFontInfo
- Direct Known Subclasses:
PlaceholderSpan
字体基础单元
用来设置字体样式等
- Since:
- 2020-02-03 02:01:53
- Author:
- 权观宇
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()int[]getColor()Double[]获取字符X坐标偏移值队列getFont()获取字体对象获取文字字号获取字间距getText()double获取下划线与文字的偏移量double获取下划线宽度org.ofdrw.core.text.text.Weight获取字体粗细获取字体图形列表boolean是否是一个占满剩余行空间的SpanbooleanisBold()isFill()元素是否可以拆分booleanisItalic()booleanintlength()setBold(boolean bold) 设置是否加粗setColor(int[] rgb) 设置字体颜色setColor(int r, int g, int b) 设置字体颜色设置 文字颜色setFill(boolean fill) setFontSize(Double fontSize) setIntegrity(Boolean integrity) setItalic(boolean italic) setLetterSpacing(Double letterSpacing) setLinebreak(boolean linebreak) 设置Span为占满剩下行空间的元素setUnderline(boolean underline) 设置 下划线setUnderline(boolean underline, double offset, double width) 设置下划线setWeight(org.ofdrw.core.text.text.Weight weight) 设置字体粗细Span[]split(int index) 切分元素获取经过行内换行处理之后的Span列表
-
Constructor Details
-
Span
protected Span() -
Span
-
Span
-
-
Method Details
-
getColor
public int[] getColor() -
setColor
-
setColor
-
setColor
-
length
public int length()- Returns:
- 字符数量
-
getFont
Description copied from interface:TextFontInfo获取字体对象- Specified by:
getFontin interfaceTextFontInfo- Returns:
- 字体对象
-
setFont
-
getFontSize
Description copied from interface:TextFontInfo获取文字字号- Specified by:
getFontSizein interfaceTextFontInfo- Returns:
- 字号,单位毫米mm
-
setFontSize
-
getLetterSpacing
Description copied from interface:TextFontInfo获取字间距- Specified by:
getLetterSpacingin interfaceTextFontInfo- Returns:
- 字间距,单位毫米mm
-
setLetterSpacing
-
isBold
public boolean isBold() -
setBold
设置是否加粗若需要更加细致的控制,可以使用
setWeight(Weight)- Parameters:
bold- 是否加粗- Returns:
- this
-
getWeight
public org.ofdrw.core.text.text.Weight getWeight()获取字体粗细- Returns:
- 字体粗细,可能为null。
-
setWeight
设置字体粗细- Parameters:
weight- 字体粗细- Returns:
- this
-
isItalic
public boolean isItalic() -
setItalic
-
isUnderline
public boolean isUnderline() -
setUnderline
-
setUnderline
设置下划线- Parameters:
underline- 是否启用下划线offset- 下划线与文字的偏移量,可以为负值,默认值为1.2,单位毫米。width- 下划线线宽,默认为0,为0时默认为字体大小的0.05倍。- Returns:
- this
-
isFill
-
setFill
-
getText
-
setText
-
isIntegrity
元素是否可以拆分特殊的: 如果没有或只有一个文字,那么无论如何设置integrity都为不可拆分
- Returns:
- true 可以拆分;false 不能拆分
-
setIntegrity
-
glyphList
-
getDeltaX
-
blockSize
- Returns:
- 不拆分情况下都放在一行内占用的大小
-
split
-
setLinebreak
设置Span为占满剩下行空间的元素等价于在字符串末尾增加\n,当字符串末尾存在\n 时该参数无效。
- Parameters:
linebreak- 是否占满剩下行空间 true 标识占满;false标识不占满- Returns:
- this
-
hasLinebreak
public boolean hasLinebreak()是否是一个占满剩余行空间的Span- Returns:
- true 标识span会占满剩余的行空间; false 不占满
-
splitLineBreak
-
getUnderlineOffset
public double getUnderlineOffset()获取下划线与文字的偏移量- Returns:
- 下划线与文字的偏移量,单位毫米
-
getUnderlineWidth
public double getUnderlineWidth()获取下划线宽度- Returns:
- 下划线宽度, 0表示保持默认,默认为字体大小的0.05倍,单位毫米
-
clone
-