|
|
|
@ -71,9 +71,9 @@ impl From<&DynamicText> for XMLElement {
|
|
|
|
let left_x = txt.x;
|
|
|
|
let left_x = txt.x;
|
|
|
|
// align_x 是对齐点的x坐标,后面加的数字是考虑到QET中boundingRect的没有完全贴合文本内容
|
|
|
|
// align_x 是对齐点的x坐标,后面加的数字是考虑到QET中boundingRect的没有完全贴合文本内容
|
|
|
|
let mut align_x = match txt.h_alignment {
|
|
|
|
let mut align_x = match txt.h_alignment {
|
|
|
|
HAlignment::Left => txt.align_x - 0.5,
|
|
|
|
HAlignment::Left => txt.align_x,
|
|
|
|
HAlignment::Center => txt.align_x - 1.0,
|
|
|
|
HAlignment::Center => txt.align_x,
|
|
|
|
HAlignment::Right => txt.align_x - 2.0
|
|
|
|
HAlignment::Right => txt.align_x
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 根据垂直对齐方式计算顶部的y坐标
|
|
|
|
// 根据垂直对齐方式计算顶部的y坐标
|
|
|
|
@ -85,14 +85,14 @@ impl From<&DynamicText> for XMLElement {
|
|
|
|
|
|
|
|
|
|
|
|
// align_y 是对齐点的y坐标,后面加的数字是考虑到QET中boundingRect的没有完全贴合文本内容
|
|
|
|
// align_y 是对齐点的y坐标,后面加的数字是考虑到QET中boundingRect的没有完全贴合文本内容
|
|
|
|
let mut align_y = match txt.v_alignment {
|
|
|
|
let mut align_y = match txt.v_alignment {
|
|
|
|
VAlignment::Top => txt.align_y - 0.5,
|
|
|
|
VAlignment::Top => txt.align_y,
|
|
|
|
VAlignment::Center => txt.align_y + 0.5,
|
|
|
|
VAlignment::Center => txt.align_y,
|
|
|
|
VAlignment::Bottom => txt.align_y + 1.0
|
|
|
|
VAlignment::Bottom => txt.align_y
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if txt.h_alignment == HAlignment::Left && txt.v_alignment==VAlignment::Bottom {
|
|
|
|
if txt.h_alignment == HAlignment::Left && txt.v_alignment==VAlignment::Bottom {
|
|
|
|
align_x = txt.x-0.5;
|
|
|
|
align_x = txt.x;
|
|
|
|
align_y = txt.y+1.0;
|
|
|
|
align_y = txt.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -259,7 +259,7 @@ impl<'a> DTextBuilder<'a> {
|
|
|
|
txt.text_height,
|
|
|
|
txt.text_height,
|
|
|
|
txt.value.clone(),
|
|
|
|
txt.value.clone(),
|
|
|
|
HAlignment::from(txt.horizontal_text_justification),
|
|
|
|
HAlignment::from(txt.horizontal_text_justification),
|
|
|
|
VAlignment::from_text_entity(txt.vertical_text_justification, false),
|
|
|
|
VAlignment::from_text_entity(txt.vertical_text_justification, true),
|
|
|
|
0.0, // as Placeholder: no "reference_rectangle_width" with Text!!!
|
|
|
|
0.0, // as Placeholder: no "reference_rectangle_width" with Text!!!
|
|
|
|
txt.second_alignment_point.x,
|
|
|
|
txt.second_alignment_point.x,
|
|
|
|
-txt.second_alignment_point.y,
|
|
|
|
-txt.second_alignment_point.y,
|
|
|
|
|