Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
002947d
SHX fonts and big fonts for text, Hebrew SHX, non-zero glyph fill
claude Oct 27, 2026
de73d8c
Text formulas and fields: =... in text, dimensions and leaders; UPDAT…
claude Oct 27, 2026
ef9c473
Merge branch 'split/shx-fonts' into split/text-editor
claude Oct 27, 2026
76b1b16
In-place text editor for new and existing text, dimensions, leaders, …
claude Oct 27, 2026
43087b5
Register the CADCRAFTFORMULA xdata application in the APPID table
claude Oct 27, 2026
cd10baa
Merge branch 'split/text-formulas' into split/text-editor
claude Oct 27, 2026
1280841
SHX: big fonts bounded and not read by Unicode, no folder links follo…
claude Oct 27, 2026
8675424
Text formulas: review fixes
claude Oct 27, 2026
94466c2
Merge the text-formula and SHX review fixes
claude Oct 27, 2026
76bf204
In-place editor: review fixes
claude Oct 27, 2026
3bcfb17
Text formulas: ^ left to right; a replaced AutoCAD field is not writt…
claude Oct 27, 2026
dcd60dd
Merge the text-formula review fixes
claude Oct 27, 2026
064310a
In-place editor: an unchanged multiline text keeps its formula
claude Oct 27, 2026
eba4e10
Double-click: an external reference named in other letter case is lef…
claude Oct 27, 2026
6c3e3c2
Merge upstream main (release 0.14.0)
claude Oct 28, 2026
f20306e
Merge upstream main (release 0.14.0)
claude Oct 28, 2026
e0f9985
Merge the text-formula part (with upstream main 0.14.0)
claude Oct 28, 2026
e79503c
Merge the SHX part (with upstream main 0.14.0)
claude Oct 28, 2026
ec32ad2
Keep DXF finishing within upstream's complexity limit
claude Oct 28, 2026
2fc041b
CLI perf drawing: the text formula field
claude Oct 28, 2026
3e517bb
Merge the review fixes of split/text-formulas
claude Oct 28, 2026
a12a614
Session: the in-place editor's type after upstream's explicit imports
claude Oct 28, 2026
5f9d69d
In-place editor: within upstream's lint limits
claude Oct 28, 2026
5bffe09
Fonts: an unreadable user font file does not end the family search
claude Oct 31, 2026
0a45648
Merge upstream main (0.15.1) into the SHX font part
claude Oct 31, 2026
ae9e57f
Merge upstream main (0.15.1) into the text formula part
claude Oct 31, 2026
41645f6
Merge split/shx-fonts (with upstream main 0.15.1)
claude Oct 31, 2026
750e994
Merge split/text-formulas (with upstream main 0.15.1)
claude Oct 31, 2026
9ac8697
Fonts: SHX text sits a third of its height below a bottom alignment p…
claude Oct 31, 2026
98139c3
Text formulas: the formula field in upstream 0.15's new objects and r…
claude Oct 31, 2026
e2299cd
Merge split/shx-fonts (with upstream main 0.15.1)
claude Oct 31, 2026
8443f64
Merge split/text-formulas (with upstream main 0.15.1)
claude Oct 31, 2026
90c9d06
Text formulas: an AutoCAD field the reader declines is kept on save
claude Oct 31, 2026
780f469
Merge upstream main into split/text-formulas
claude Oct 31, 2026
08f2741
Merge split/text-formulas into split/text-editor
claude Oct 31, 2026
466fe69
Merge upstream main into split/text-formulas
claude Nov 2, 2026
5c965ba
Merge split/text-formulas into split/text-editor
claude Nov 2, 2026
ffa7310
Text formulas: Chinese labels for Text Formulas and Update Fields
claude Nov 2, 2026
eb87356
Fit upstream 0.15.1: the new fields in its added objects and tests
claude Nov 2, 2026
64adbbe
Merge split/text-formulas into split/text-editor
claude Nov 2, 2026
0eddb92
Text editor: Chinese labels for Edit Table Cells and Edit Text
claude Nov 2, 2026
bbf5631
Text editor: a dimension formula keeps its braces through the editor
claude Nov 2, 2026
60709f6
Text formulas: an AutoCAD field's text is saved as read while the fie…
claude Nov 2, 2026
b444f5a
Merge split/text-formulas into split/text-editor
claude Nov 2, 2026
5fe9571
Merge upstream main into split/text-formulas
claude Nov 4, 2026
cd81110
Merge split/shx-fonts (rebuilt on main with #1944) into split/text-ed…
claude Nov 4, 2026
fca338a
Merge split/text-formulas into split/text-editor
claude Nov 4, 2026
1f6e3c8
Fonts: drop the old SHX reader, which #1944's crates/fonts/src/shx/ r…
claude Nov 4, 2026
3bf07c1
Fit main: the new fields in its added tests
claude Nov 4, 2026
748d920
Text formulas: a block reference's attribute formulas are worked out …
claude Nov 4, 2026
748888f
Tables: a formula typed with formatting in the in-place editor stays …
claude Nov 4, 2026
a85bb33
Merge split/text-formulas into split/text-editor
claude Nov 4, 2026
35d956d
Text editor: fonts resolved as #1944 resolves them; SHX font changes …
claude Nov 4, 2026
2144528
Merge upstream main into split/text-formulas
claude Nov 4, 2026
f22ff80
Fit main: the new fields in its added code and tests
claude Nov 4, 2026
e8ecfee
Merge split/shx-fonts into split/text-editor
claude Nov 4, 2026
57d41d2
Merge split/text-formulas into split/text-editor
claude Nov 4, 2026
c86bca5
Fit main: the new fields in its added code and tests
claude Nov 4, 2026
a14ae3c
Merge upstream main into split/shx-fonts
FredApps Nov 5, 2026
0c0d027
Merge upstream main into split/text-formulas
claude Nov 5, 2026
6b4c98d
Merge split/shx-fonts into split/text-editor
claude Nov 5, 2026
91b9212
Merge split/text-formulas into split/text-editor
claude Nov 5, 2026
3829c8a
Merge upstream main into split/shx-fonts
claude Nov 13, 2026
420d851
Merge remote-tracking branch 'upstream/main' into split/text-formulas
claude Nov 13, 2026
682bf1d
Merge branch 'split/shx-fonts' into split/text-editor
claude Nov 13, 2026
970ee44
Merge branch 'split/text-formulas' into split/text-editor
claude Nov 13, 2026
2cf6415
Fonts: a font without the diameter sign draws a stand-in it has
claude Nov 17, 2026
6107496
Merge upstream main into split/shx-fonts
claude Nov 17, 2026
57783dc
Merge upstream main into split/text-formulas
claude Nov 17, 2026
d8abe2b
Merge split/shx-fonts into split/text-editor
claude Nov 17, 2026
1f1478a
Merge split/text-formulas into split/text-editor
claude Nov 17, 2026
95b0aa1
Merge upstream/main into split/shx-fonts
claude Nov 20, 2026
4c6774c
Merge upstream/main into split/text-formulas
claude Nov 20, 2026
7825737
Merge shx-fonts into split/text-editor
claude Nov 20, 2026
aea1a77
Merge text-formulas into split/text-editor
claude Nov 20, 2026
49fe34d
Font lists name every installed font by its family, read from the fon…
claude Nov 20, 2026
9205745
Merge shx-fonts into split/text-editor
claude Nov 20, 2026
ba6d190
Text editor: the font list holds every installed font, and typing nar…
claude Nov 20, 2026
f90cf50
Merge upstream/main into split/shx-fonts
claude Nov 20, 2026
d48d599
Merge upstream/main into split/text-formulas (with FredApps's fixes f…
claude Nov 20, 2026
7210b1f
Merge shx-fonts into split/text-editor
claude Nov 20, 2026
2611352
Merge text-formulas into split/text-editor
claude Nov 20, 2026
ad91c71
Edit Text on a picked object is a drawing-only command for automation…
claude Nov 20, 2026
2e943c5
Table cell editing is a drawing-only command for automation roots
claude Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/cadcraft-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ fn synthetic(n: usize, side: f64) -> Result<cadcraft_engine::doc::Drawing, Strin
plinegen: false,
}),
_ => EntityKind::Text(d::Text {
formula: None,
insert: v3(x, y),
align_pt: None,
height: s * 0.2,
Expand Down
1 change: 1 addition & 0 deletions crates/constraints/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ fn invalid_references_and_purge() {
let t = add_e(
&mut d,
EntityKind::Text(cadcraft_doc::Text {
formula: None,
insert: v(0.0, 0.0),
align_pt: None,
height: 1.0,
Expand Down
4 changes: 4 additions & 0 deletions crates/doc/src/entity/dim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ pub struct DimMarks {
/// Inspection frame, label and rate (DIMINSPECT).
#[serde(skip_serializing_if = "Option::is_none")]
pub inspect: Option<Inspection>,
/// A formula for the dimension text (`=<>/2`, `=TEXT(<>,"0.0")&" mm"`; `<>` is the
/// measurement); `Dimension::text` holds the last result.
#[serde(skip_serializing_if = "Option::is_none")]
pub formula: Option<String>,
}

impl DimMarks {
Expand Down
8 changes: 8 additions & 0 deletions crates/doc/src/entity/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ pub struct Text {
pub halign: HAlign,
#[serde(default)]
pub valign: VAlign,
/// The formula the text shows the result of: `=...` (CADCraft text formulas) or an AutoCAD
/// field code (`%<\AcVar date \f "dd.MM.yyyy">%`). `value` holds the last result.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub formula: Option<String>,
}

impl Text {
Expand Down Expand Up @@ -83,6 +87,10 @@ pub struct MText {
/// one column.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub columns: Option<MTextColumns>,
/// The formula the text shows the result of (see [`Text::formula`]); `contents` holds the
/// last result.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub formula: Option<String>,
}

fn attach_tl() -> u8 {
Expand Down
2 changes: 2 additions & 0 deletions crates/doc/src/extents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ mod tests {

fn text(halign: HAlign, valign: VAlign) -> Text {
Text {
formula: None,
insert: Vec3::new(0.0, 0.0, 0.0),
align_pt: Some(Vec3::new(0.0, 0.0, 0.0)),
height: 1.0,
Expand Down Expand Up @@ -346,6 +347,7 @@ mod tests {
#[test]
fn multileader_text_is_inside_its_bounds() {
let mtext = crate::MText {
formula: None,
insert: Vec3::new(25.45, 0.0, 0.0),
height: 5.0,
width: 0.0,
Expand Down
29 changes: 29 additions & 0 deletions crates/doc/src/tables/tablebreak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,25 @@ impl Table {
b
}

/// The top-left corner, width and height of cell (`row`, `col`) — over its merged span — in
/// the part that holds the row.
pub fn cell_rect(&self, row: usize, col: usize) -> Option<(Vec2, f64, f64)> {
if col >= self.col_widths.len() || row >= self.row_heights.len() {
return None;
}
let (rs, cs) =
self.cells.get(row).and_then(|r| r.get(col)).and_then(|c| c.merged).map_or((1, 1), |(a, b)| (a.max(1) as usize, b.max(1) as usize));
let x: f64 = self.col_widths.iter().take(col).map(|w| size(*w)).sum();
let w: f64 = self.col_widths.iter().skip(col).take(cs).map(|w| size(*w)).sum();
for part in self.parts() {
let Some(at) = part.rows.iter().position(|r| *r == row) else { continue };
let y: f64 = part.rows.iter().take(at).map(|r| size(self.row_heights.get(*r).copied().unwrap_or(0.0))).sum();
let h: f64 = part.rows.iter().skip(at).take(rs).map(|r| size(self.row_heights.get(*r).copied().unwrap_or(0.0))).sum();
return Some((part.origin + Vec2::new(x, -y), w, h));
}
None
}

/// The cell (row, col) under `p`, in any part.
pub fn cell_at_point(&self, p: Vec2) -> Option<(usize, usize)> {
for part in self.parts() {
Expand Down Expand Up @@ -216,6 +235,16 @@ mod tests {
}
}

#[test]
fn cell_rect_covers_the_merged_span_and_hostile_indices_are_none() {
let mut t = table(3);
assert_eq!(t.cell_rect(1, 1), Some((Vec2::new(2.0, -1.0), 3.0, 1.0)));
t.cells[0][0].merged = Some((1, 2));
assert_eq!(t.cell_rect(0, 0), Some((Vec2::ZERO, 5.0, 1.0)));
assert_eq!(t.cell_rect(9, 0), None);
assert_eq!(t.cell_rect(0, usize::MAX), None);
}

#[test]
fn unbroken_is_one_part() {
let t = table(5);
Expand Down
4 changes: 4 additions & 0 deletions crates/doc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn visible_attributes_of_a_missing_block_still_count() {
let attrib = |invisible: bool| Attrib {
tag: "TAG".into(),
text: Text {
formula: None,
insert: Vec3::new(1000.0, 1000.0, 0.0),
align_pt: None,
height: 10.0,
Expand Down Expand Up @@ -441,6 +442,7 @@ fn attdef_in_block_is_ignored_in_insert_extents() {
EntityKind::AttDef(Attrib {
tag: "TAG".into(),
text: Text {
formula: None,
insert: Vec3::new(5000.0, 5000.0, 0.0),
align_pt: None,
height: 1.0,
Expand All @@ -466,6 +468,7 @@ fn attdef_in_block_is_ignored_in_insert_extents() {

fn text_kind(value: &str) -> EntityKind {
EntityKind::Text(Text {
formula: None,
insert: Vec3::new(10.0, 10.0, 0.0),
align_pt: None,
height: 2.0,
Expand All @@ -481,6 +484,7 @@ fn text_kind(value: &str) -> EntityKind {

fn mtext_kind(contents: &str) -> EntityKind {
EntityKind::MText(MText {
formula: None,
insert: Vec3::new(10.0, 10.0, 0.0),
height: 2.0,
width: 0.0,
Expand Down
51 changes: 41 additions & 10 deletions crates/engine/src/cmd/annotate/mleader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fn mleader_kind(s: &Session, pts: &[Vec2], text: &str, landing: bool) -> Option<
landing: v3(*landing_pt),
dogleg,
text: (!text.is_empty()).then(|| MText {
formula: None,
insert: v3(tpos),
height: th,
width: 0.0,
Expand Down Expand Up @@ -66,6 +67,7 @@ pub(super) fn run_leader(s: &mut Session, p: &Value) -> Result<Value> {
let th = s.doc()?.dim_style(&style(s)).map(|d| d.text_height).unwrap_or(0.18);
out.push(
s.add_entity(EntityKind::MText(MText {
formula: None,
insert: v3(*last + Vec2::new(th * 0.5, th * 0.5)),
height: th,
width: 0.0,
Expand Down Expand Up @@ -119,6 +121,8 @@ pub(super) struct MLeaderM {
block: bool,
block_name: String,
block_center: bool,
/// The in-place editor's box while the text is asked for.
editor: Option<MText>,
}

impl MLeaderM {
Expand All @@ -141,8 +145,21 @@ impl MLeaderM {
block: o.block && s.doc().is_ok_and(|d| d.block(&s.last_used.mleader_block).is_some()),
block_name: s.last_used.mleader_block.clone(),
block_center: o.block_center,
editor: None,
}
}
/// Where the text goes while it is asked for: next to the landing, as the multileader will
/// place it.
fn refresh_editor(&mut self, s: &Session) {
self.editor = if self.wants_text() && self.opt.is_none() {
mleader_kind(s, &self.leader(None), "X", self.landing).and_then(|k| match k {
EntityKind::MLeader(m) => m.text.map(|t| MText { contents: String::new(), ..t }),
_ => None,
})
} else {
None
};
}
/// Keep the order and Options for the next MLEADER.
fn remember(&self, s: &mut Session) {
s.last_used.mleader = MLeaderOptions {
Expand Down Expand Up @@ -342,6 +359,30 @@ impl Interactive for MLeaderM {
}
}
fn input(&mut self, s: &mut Session, i: Input) -> Result<Step> {
let step = self.answer(s, i);
self.refresh_editor(s);
step
}
fn editing_mtext(&self) -> Option<MText> {
self.editor.clone()
}
fn preview(&self, s: &Session, c: Vec2) -> Vec<EntityKind> {
if self.opt.is_some() || self.wants_text() || self.leader_done || self.pts.is_empty() {
return Vec::new();
}
let text = self.text.as_deref().unwrap_or("");
let next = self.constrained(c);
let shape = mleader_kind(s, &self.leader(Some(next)), text, self.landing)
.and_then(|k| crate::cmd::mleader_content::apply(s, k, &self.content_spec()).ok());
// The segment being placed, drawn as well in case the multileader preview hides it.
let mut out = vec![EntityKind::Line(cadcraft_doc::Line { a: v3(*self.pts.last().unwrap_or(&next)), b: v3(next) })];
out.extend(shape);
out
}
}

impl MLeaderM {
fn answer(&mut self, s: &mut Session, i: Input) -> Result<Step> {
if let Some(o) = self.opt {
self.opt = self.option(s, o, i);
self.remember(s);
Expand Down Expand Up @@ -376,14 +417,4 @@ impl Interactive for MLeaderM {
}
if self.leader_done && !self.wants_text() { self.finish(s) } else { Ok(Step::Continue) }
}
fn preview(&self, s: &Session, c: Vec2) -> Vec<EntityKind> {
if self.opt.is_some() || self.wants_text() || self.leader_done || self.pts.is_empty() {
return Vec::new();
}
let text = self.text.as_deref().unwrap_or("");
mleader_kind(s, &self.leader(Some(self.constrained(c))), text, self.landing)
.and_then(|k| crate::cmd::mleader_content::apply(s, k, &self.content_spec()).ok())
.into_iter()
.collect()
}
}
1 change: 1 addition & 0 deletions crates/engine/src/cmd/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ fn attdef_kind(s: &Session, tag: &str, prompt: &str, default: &str, at: Vec2, he
EntityKind::AttDef(Attrib {
tag: tag.to_ascii_uppercase(),
text: Text {
formula: None,
insert: v3(at),
align_pt: None,
height,
Expand Down
Loading