Fields: table cells keep stored values, UPDATEFIELD reaches blocks and tables, measured shading box

Table cell fields show their stored value; only formula cells evaluate
live. UPDATEFIELD on a block reference also updates the fields of its
block definition, and on a table the fields of its cells; a changed
table cell text redraws the table. The FIELDDISPLAY box is placed from
the text layout (MTEXT layout cells, TEXT / attribute pen advances) and
spans 0.345 text heights below the baseline to 1.19 above it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-06 12:25:24 +03:00
1 parent 1c242eb489
commit 383eba14e5
8 files changed
+134 -95

No files matched your search

+21 -10
View File
@@ -488,18 +488,29 @@ fn font_stem(name: &str) -> String {
.to_string()
}
/// How many inked glyphs (non-blank characters, stacked parts included) an
/// MTEXT string draws, in drawing order: the index of the first glyph of
/// what follows `s` in a longer string.
pub fn mtext_glyph_count(s: &str) -> usize {
let ink = |t: &str| t.chars().filter(|c| !c.is_whitespace()).count();
/// The visible-character offset that follows the MTEXT string `s` — the
/// `vis` index [`layout_mtext`]'s glyph boxes give the first character of
/// whatever comes after `s` in a longer string: every laid-out character,
/// a tab or stack slot, and one per paragraph break.
pub fn mtext_visible_count(s: &str) -> usize {
adapt_mtext_paragraphs(s, 1.0, false)
.iter()
.flat_map(|line| &line.runs)
.map(|run| match &run.kind {
MTextRunKind::Glyphs(text) => ink(text),
MTextRunKind::Tab => 0,
MTextRunKind::Stack { numerator, denominator, .. } => ink(numerator) + ink(denominator),
.enumerate()
.map(|(i, para)| {
usize::from(i > 0)
+ para
.runs
.iter()
.map(|run| match &run.kind {
MTextRunKind::Glyphs(text) => text.chars().count(),
MTextRunKind::Tab => 1,
MTextRunKind::Stack { numerator, denominator, .. } => {
numerator.chars().count()
+ denominator.chars().count()
+ usize::from(!denominator.is_empty())
}
})
.sum::<usize>()
})
.sum()
}