mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 14:22:39 +00:00
Read IDML text wrap through shared model
This commit is contained in:
3 files changed
+18
-17
No files matched your search
Generated
+9
-9
@@ -1242,10 +1242,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-idml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=d89299fb4#d89299fb4dfc10d4ae15825138402b99db40f3dc"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=e725d39a7#e725d39a77c4613896e64b6da3a829bc8cb5b827"
|
||||
dependencies = [
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d89299fb4)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d89299fb4)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e725d39a7)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e725d39a7)",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
@@ -1683,7 +1683,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=d89299fb4#d89299fb4dfc10d4ae15825138402b99db40f3dc"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=e725d39a7#e725d39a77c4613896e64b6da3a829bc8cb5b827"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1750,7 +1750,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=d89299fb4#d89299fb4dfc10d4ae15825138402b99db40f3dc"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=e725d39a7#e725d39a77c4613896e64b6da3a829bc8cb5b827"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2021,7 +2021,7 @@ dependencies = [
|
||||
"craft-prepress",
|
||||
"craft-print",
|
||||
"craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d89299fb4)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e725d39a7)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1)",
|
||||
"designcraft-color",
|
||||
"designcraft-compose",
|
||||
@@ -2103,9 +2103,9 @@ name = "designcraft-idml"
|
||||
version = "0.20.1"
|
||||
dependencies = [
|
||||
"craft-file-formats",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d89299fb4)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e725d39a7)",
|
||||
"craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d89299fb4)",
|
||||
"craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e725d39a7)",
|
||||
"designcraft-color",
|
||||
"designcraft-compose",
|
||||
"designcraft-doc",
|
||||
@@ -2222,7 +2222,7 @@ version = "0.20.1"
|
||||
dependencies = [
|
||||
"craft-docx",
|
||||
"craft-file-formats",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d89299fb4)",
|
||||
"craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e725d39a7)",
|
||||
"craft-rtf",
|
||||
"craft-wordmodel",
|
||||
"craft-xlsx",
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4052591363
|
||||
craft-designcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "19692b6190465671e41967c75d0cd4c439d0c84c", version = "=0.1.0" }
|
||||
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
|
||||
craft-epub = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
|
||||
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "d89299fb4", version = "=0.1.0" }
|
||||
craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "e725d39a7", version = "=0.1.0" }
|
||||
craft-indd = { git = "https://github.com/storytold/craft-libs", rev = "47bf5650b0d503b97bfb5e841746c4957897d11f", version = "=0.1.0" }
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "cc23ffd4d26f3074808e2187d332564817624f8f", version = "=0.1.0", features = ["tree-render", "tree-text"] }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "d89299fb4", version = "=0.1.0" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "e725d39a7", version = "=0.1.0" }
|
||||
craft-xml-dtd = { package = "craft-xml", git = "https://github.com/storytold/craft-libs", rev = "f23b0f33f0d00b157476533a43cbbcfd901aa1f1", version = "=0.1.0" }
|
||||
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
|
||||
craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" }
|
||||
|
||||
@@ -4,15 +4,16 @@ use super::{Columns, ColumnsKind, El, Margins, TextFrameOptions, TextWrap, names
|
||||
/// Drop-shadow angle (degrees) from IDML offsets (inverse of export's mapping).
|
||||
/// A `TextWrapPreference` element (of a page item or a placed graphic).
|
||||
pub(super) fn text_wrap(w: &El) -> TextWrap {
|
||||
let model = craft_idml::model::TextWrapPreference::from_el(&crate::xml::to_craft(w));
|
||||
let mut tw = TextWrap {
|
||||
mode: names::wrap_mode_in(w.get("TextWrapMode").unwrap_or("None")),
|
||||
invert: w.get("Inverse") == Some("true"),
|
||||
side: names::wrap_side_in(w.get("TextWrapSide").unwrap_or("BothSides")),
|
||||
contour: names::contour_type_in(w.find("ContourOption").and_then(|c| c.get("ContourType")).unwrap_or("SameAsClipping")),
|
||||
mode: names::wrap_mode_in(model.mode().unwrap_or("None")),
|
||||
invert: model.inverse(),
|
||||
side: names::wrap_side_in(model.side().unwrap_or("BothSides")),
|
||||
contour: names::contour_type_in(model.contour_type().unwrap_or("SameAsClipping")),
|
||||
..TextWrap::default()
|
||||
};
|
||||
if let Some(o) = w.prop_el("TextWrapOffset") {
|
||||
tw.offsets = [o.num("Top").unwrap_or(0.0), o.num("Left").unwrap_or(0.0), o.num("Bottom").unwrap_or(0.0), o.num("Right").unwrap_or(0.0)];
|
||||
if let Some(offsets) = model.offsets() {
|
||||
tw.offsets = offsets;
|
||||
}
|
||||
tw
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user