From 7277bf33dc3d97fc317643042f7ef36f7018232f Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Tue, 6 Oct 2026 17:51:18 +0300 Subject: [PATCH] Table cells: read own overrides from either layout Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/entities/table.rs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13a98594f..74135788b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4206,7 +4206,7 @@ dependencies = [ [[package]] name = "opencadcodec" version = "0.5.5" -source = "git+https://github.com/ramox81/cadcodec.git?rev=435c736#435c736b79c3c62133ea34bd221263e58313b09f" +source = "git+https://github.com/ramox81/cadcodec.git?rev=22b3d1a#22b3d1a1afe9c799185eb6acac41b80db35a7989" dependencies = [ "ahash 0.8.12", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index ac1594b99..3e8b73226 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ iced_core = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aa iced_widget = { git = "https://github.com/iced-rs/iced.git", rev = "23604ff22ab0aad9e00b9327cb7b8546ed84db39" } [patch."https://github.com/HakanSeven12/opencadcodec.git"] -opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "435c736" } +opencadcodec = { git = "https://github.com/ramox81/cadcodec.git", rev = "22b3d1a" } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] getrandom = "0.3" diff --git a/src/entities/table.rs b/src/entities/table.rs index 81b154042..e4ebca599 100644 --- a/src/entities/table.rs +++ b/src/entities/table.rs @@ -101,12 +101,15 @@ pub(crate) fn style_for_property<'a>( cell: &'a codec::entities::table::TableCell, property: codec::entities::table::CellStylePropertyFlags, ) -> Option<&'a codec::entities::table::CellStyle> { + // The cell's own overrides, as either layout (DXF or binary) states them. + if let Some(style) = cell.style.as_ref().filter(|style| style.sets(property)) { + return Some(style); + } let column_style = table .columns .get(column) .and_then(|column| column.style.as_ref()); for style in [ - cell.style.as_ref(), row.style.as_ref(), column_style, table.base_style.as_ref(), @@ -132,7 +135,7 @@ fn cell_text_height( content: &codec::entities::table::CellContent, ) -> Option { use codec::entities::table::CellStylePropertyFlags as P; - let own = content.format_property_flags & P::TEXT_HEIGHT.bits() as i32 != 0; + let own = content.sets(P::TEXT_HEIGHT); own.then_some(content.text_height) .or_else(|| style_for_property(table, row, column, cell, P::TEXT_HEIGHT).map(|s| s.text_height)) .or(Some(content.text_height))