pub struct TextCode {
pub content: String,
pub x: Option<f64>,
pub y: Option<f64>,
pub delta_x: Vec<f64>,
pub delta_y: Vec<f64>,
}Expand description
对应 Java: org.ofdrw.core.text.TextCode
文字定位信息,使用严格的定位数据来确定文字在页面上的位置。 文字对象使用 TextCode 列表来存储文字内容和每个字符的精确定位。 对应 GB/T 33190-2016 第 11.3 节图 61 表 46。
Fields§
§content: String文本内容(字形编码序列)。
x: Option<f64>文本起始 X 坐标(mm)。None 表示使用上一个 TextCode 的结束位置。
y: Option<f64>文本起始 Y 坐标(mm)。None 表示使用上一个 TextCode 的 Y 坐标。
delta_x: Vec<f64>X 方向偏移量列表(每个字形的增量偏移,单位 mm)。
delta_y: Vec<f64>Y 方向偏移量列表(每个字形的增量偏移,单位 mm)。
Implementations§
Source§impl TextCode
impl TextCode
Sourcepub fn with_content(content: impl Into<String>) -> Self
pub fn with_content(content: impl Into<String>) -> Self
使用内容创建文字定位。
Sourcepub fn coordinate(self, x: f64, y: f64) -> Self
pub fn coordinate(self, x: f64, y: f64) -> Self
设置坐标。
Sourcepub fn get_content(&self) -> &str
pub fn get_content(&self) -> &str
获取内容。
Sourcepub fn to_xml_string(&self) -> String
pub fn to_xml_string(&self) -> String
序列化为 OFD XML 字符串。
Trait Implementations§
Source§impl XmlElement for TextCode
impl XmlElement for TextCode
Source§fn element_name(&self) -> &'static str
fn element_name(&self) -> &'static str
对应 Java: org.ofdrw.core.text.TextCode
Source§fn text_content(&self) -> Option<&str>
fn text_content(&self) -> Option<&str>
文本内容(简单文本元素)。
Source§fn from_xml(node: &XmlNode) -> Result<Self, XmlElementError>
fn from_xml(node: &XmlNode) -> Result<Self, XmlElementError>
从节点树解析(对应 ofdrw 解析侧;quick-xml 产物)。 Read more
Source§fn child_nodes(&self) -> Vec<XmlNode>
fn child_nodes(&self) -> Vec<XmlNode>
子元素(作为
XmlNode 提供,便于嵌套序列化)。Auto Trait Implementations§
impl Freeze for TextCode
impl RefUnwindSafe for TextCode
impl Send for TextCode
impl Sync for TextCode
impl Unpin for TextCode
impl UnsafeUnpin for TextCode
impl UnwindSafe for TextCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more