forked from 1b-agent/opencadstudio-upstream
style: apply cargo fmt across workspace
This commit is contained in:
1 parent
85710e5454
commit
9cf9ff2c5c
531 files changed
+57740
-33906
No files matched your search
+334
-67
@@ -24,7 +24,10 @@ use std::sync::{Mutex, OnceLock};
|
||||
/// Every LibreCAD LFF font, keyed by its file stem (lower-case). Registered
|
||||
/// under the upper-cased stem and the font's `# Name:` header.
|
||||
const FONTS_SRC: &[(&str, &str)] = &[
|
||||
("cyrillic_ii", include_str!("../../../assets/fonts/cyrillic_ii.lff")),
|
||||
(
|
||||
"cyrillic_ii",
|
||||
include_str!("../../../assets/fonts/cyrillic_ii.lff"),
|
||||
),
|
||||
("gothgbt", include_str!("../../../assets/fonts/gothgbt.lff")),
|
||||
("gothgrt", include_str!("../../../assets/fonts/gothgrt.lff")),
|
||||
("gothitt", include_str!("../../../assets/fonts/gothitt.lff")),
|
||||
@@ -34,7 +37,10 @@ const FONTS_SRC: &[(&str, &str)] = &[
|
||||
("iso", include_str!("../../../assets/fonts/iso.lff")),
|
||||
("italicc", include_str!("../../../assets/fonts/italicc.lff")),
|
||||
("italict", include_str!("../../../assets/fonts/italict.lff")),
|
||||
("ltypeshp", include_str!("../../../assets/fonts/ltypeshp.lff")),
|
||||
(
|
||||
"ltypeshp",
|
||||
include_str!("../../../assets/fonts/ltypeshp.lff"),
|
||||
),
|
||||
("romanc", include_str!("../../../assets/fonts/romanc.lff")),
|
||||
("romand", include_str!("../../../assets/fonts/romand.lff")),
|
||||
("romans", include_str!("../../../assets/fonts/romans.lff")),
|
||||
@@ -42,7 +48,10 @@ const FONTS_SRC: &[(&str, &str)] = &[
|
||||
("scriptc", include_str!("../../../assets/fonts/scriptc.lff")),
|
||||
("scripts", include_str!("../../../assets/fonts/scripts.lff")),
|
||||
("simplex", include_str!("../../../assets/fonts/simplex.lff")),
|
||||
("standard", include_str!("../../../assets/fonts/standard.lff")),
|
||||
(
|
||||
"standard",
|
||||
include_str!("../../../assets/fonts/standard.lff"),
|
||||
),
|
||||
("syastro", include_str!("../../../assets/fonts/syastro.lff")),
|
||||
("symap", include_str!("../../../assets/fonts/symap.lff")),
|
||||
("symath", include_str!("../../../assets/fonts/symath.lff")),
|
||||
@@ -111,64 +120,295 @@ const SHX_ADVANCE: &[(&str, &[(u32, f32)])] = &[
|
||||
(
|
||||
"TXT",
|
||||
&[
|
||||
(33, 3.0000), (34, 6.0000), (35, 9.0000), (36, 9.0000), (38, 9.0000), (39, 4.5000),
|
||||
(40, 6.0000), (41, 6.0000), (42, 9.0000), (43, 9.0000), (44, 4.5000), (45, 9.0000),
|
||||
(46, 3.0000), (47, 9.0000), (48, 7.5000), (49, 6.0000), (50, 9.0000), (51, 9.0000),
|
||||
(52, 9.0000), (53, 9.0000), (54, 9.0000), (55, 9.0000), (56, 9.0000), (57, 9.0000),
|
||||
(58, 3.0000), (59, 4.5000), (60, 7.5000), (61, 9.0000), (62, 7.5000), (63, 7.5000),
|
||||
(64, 9.0000), (65, 9.0000), (66, 9.0000), (67, 9.0000), (68, 9.0000), (69, 9.0000),
|
||||
(70, 9.0000), (71, 9.0000), (72, 9.0000), (73, 6.0000), (74, 9.0000), (75, 9.0000),
|
||||
(76, 9.0000), (77, 9.0000), (78, 9.0000), (79, 9.0000), (80, 9.0000), (81, 9.0000),
|
||||
(82, 9.0000), (83, 9.0000), (84, 9.0000), (85, 9.0000), (86, 12.0000), (87, 12.0000),
|
||||
(88, 9.0000), (89, 9.0000), (90, 9.0000), (91, 6.0000), (92, 9.0000), (93, 6.0000),
|
||||
(94, 9.0000), (95, 9.0000), (96, 4.5000), (97, 9.0000), (98, 9.0000), (99, 9.0000),
|
||||
(100, 9.0000), (101, 9.0000), (102, 9.0000), (103, 9.0000), (104, 9.0000), (105, 3.0000),
|
||||
(106, 7.5000), (107, 9.0000), (108, 4.5000), (109, 9.0000), (110, 9.0000), (111, 9.0000),
|
||||
(112, 9.0000), (113, 9.0000), (114, 9.0000), (115, 9.0000), (116, 9.0000), (117, 9.0000),
|
||||
(118, 9.0000), (119, 9.0000), (120, 9.0000), (121, 9.0000), (122, 9.0000), (123, 6.0000),
|
||||
(124, 3.0000), (125, 6.0000), (126, 9.0000),
|
||||
(33, 3.0000),
|
||||
(34, 6.0000),
|
||||
(35, 9.0000),
|
||||
(36, 9.0000),
|
||||
(38, 9.0000),
|
||||
(39, 4.5000),
|
||||
(40, 6.0000),
|
||||
(41, 6.0000),
|
||||
(42, 9.0000),
|
||||
(43, 9.0000),
|
||||
(44, 4.5000),
|
||||
(45, 9.0000),
|
||||
(46, 3.0000),
|
||||
(47, 9.0000),
|
||||
(48, 7.5000),
|
||||
(49, 6.0000),
|
||||
(50, 9.0000),
|
||||
(51, 9.0000),
|
||||
(52, 9.0000),
|
||||
(53, 9.0000),
|
||||
(54, 9.0000),
|
||||
(55, 9.0000),
|
||||
(56, 9.0000),
|
||||
(57, 9.0000),
|
||||
(58, 3.0000),
|
||||
(59, 4.5000),
|
||||
(60, 7.5000),
|
||||
(61, 9.0000),
|
||||
(62, 7.5000),
|
||||
(63, 7.5000),
|
||||
(64, 9.0000),
|
||||
(65, 9.0000),
|
||||
(66, 9.0000),
|
||||
(67, 9.0000),
|
||||
(68, 9.0000),
|
||||
(69, 9.0000),
|
||||
(70, 9.0000),
|
||||
(71, 9.0000),
|
||||
(72, 9.0000),
|
||||
(73, 6.0000),
|
||||
(74, 9.0000),
|
||||
(75, 9.0000),
|
||||
(76, 9.0000),
|
||||
(77, 9.0000),
|
||||
(78, 9.0000),
|
||||
(79, 9.0000),
|
||||
(80, 9.0000),
|
||||
(81, 9.0000),
|
||||
(82, 9.0000),
|
||||
(83, 9.0000),
|
||||
(84, 9.0000),
|
||||
(85, 9.0000),
|
||||
(86, 12.0000),
|
||||
(87, 12.0000),
|
||||
(88, 9.0000),
|
||||
(89, 9.0000),
|
||||
(90, 9.0000),
|
||||
(91, 6.0000),
|
||||
(92, 9.0000),
|
||||
(93, 6.0000),
|
||||
(94, 9.0000),
|
||||
(95, 9.0000),
|
||||
(96, 4.5000),
|
||||
(97, 9.0000),
|
||||
(98, 9.0000),
|
||||
(99, 9.0000),
|
||||
(100, 9.0000),
|
||||
(101, 9.0000),
|
||||
(102, 9.0000),
|
||||
(103, 9.0000),
|
||||
(104, 9.0000),
|
||||
(105, 3.0000),
|
||||
(106, 7.5000),
|
||||
(107, 9.0000),
|
||||
(108, 4.5000),
|
||||
(109, 9.0000),
|
||||
(110, 9.0000),
|
||||
(111, 9.0000),
|
||||
(112, 9.0000),
|
||||
(113, 9.0000),
|
||||
(114, 9.0000),
|
||||
(115, 9.0000),
|
||||
(116, 9.0000),
|
||||
(117, 9.0000),
|
||||
(118, 9.0000),
|
||||
(119, 9.0000),
|
||||
(120, 9.0000),
|
||||
(121, 9.0000),
|
||||
(122, 9.0000),
|
||||
(123, 6.0000),
|
||||
(124, 3.0000),
|
||||
(125, 6.0000),
|
||||
(126, 9.0000),
|
||||
],
|
||||
),
|
||||
(
|
||||
"SIMPLEX",
|
||||
&[
|
||||
(33, 5.5714), (34, 6.4286), (35, 8.1429), (36, 8.5714), (38, 11.1429), (39, 3.8571),
|
||||
(40, 6.0000), (41, 6.0000), (42, 6.8571), (43, 11.1429), (44, 4.2857), (45, 11.1429),
|
||||
(46, 4.2857), (47, 9.4286), (48, 8.5714), (49, 6.8571), (50, 8.5714), (51, 8.5714),
|
||||
(52, 8.5714), (53, 8.5714), (54, 8.5714), (55, 8.5714), (56, 8.5714), (57, 8.5714),
|
||||
(58, 6.4286), (59, 6.0000), (60, 8.5714), (61, 11.1429), (62, 8.5714), (63, 7.7143),
|
||||
(64, 10.2857), (65, 9.4286), (66, 9.0000), (67, 9.0000), (68, 9.0000), (69, 8.1429),
|
||||
(70, 7.7143), (71, 9.0000), (72, 9.4286), (73, 3.4286), (74, 6.8571), (75, 9.0000),
|
||||
(76, 7.2857), (77, 10.2857), (78, 9.4286), (79, 9.4286), (80, 9.0000), (81, 9.4286),
|
||||
(82, 9.0000), (83, 8.5714), (84, 7.7143), (85, 9.4286), (86, 8.5714), (87, 10.2857),
|
||||
(88, 8.5714), (89, 8.5714), (90, 8.5714), (91, 6.4286), (92, 9.4286), (93, 5.1429),
|
||||
(94, 8.5714), (95, 10.2857), (96, 3.8571), (97, 8.1429), (98, 8.1429), (99, 7.7143),
|
||||
(100, 8.1429), (101, 7.7143), (102, 5.1429), (103, 8.1429), (104, 8.1429), (105, 3.4286),
|
||||
(106, 4.2857), (107, 7.2857), (108, 3.4286), (109, 12.8571), (110, 8.1429), (111, 8.1429),
|
||||
(112, 8.1429), (113, 8.1429), (114, 5.5714), (115, 7.2857), (116, 6.0000), (117, 8.1429),
|
||||
(118, 6.8571), (119, 9.4286), (120, 7.2857), (121, 6.8571), (122, 7.2857), (123, 5.1429),
|
||||
(124, 3.0000), (125, 4.7143), (126, 11.1429),
|
||||
(33, 5.5714),
|
||||
(34, 6.4286),
|
||||
(35, 8.1429),
|
||||
(36, 8.5714),
|
||||
(38, 11.1429),
|
||||
(39, 3.8571),
|
||||
(40, 6.0000),
|
||||
(41, 6.0000),
|
||||
(42, 6.8571),
|
||||
(43, 11.1429),
|
||||
(44, 4.2857),
|
||||
(45, 11.1429),
|
||||
(46, 4.2857),
|
||||
(47, 9.4286),
|
||||
(48, 8.5714),
|
||||
(49, 6.8571),
|
||||
(50, 8.5714),
|
||||
(51, 8.5714),
|
||||
(52, 8.5714),
|
||||
(53, 8.5714),
|
||||
(54, 8.5714),
|
||||
(55, 8.5714),
|
||||
(56, 8.5714),
|
||||
(57, 8.5714),
|
||||
(58, 6.4286),
|
||||
(59, 6.0000),
|
||||
(60, 8.5714),
|
||||
(61, 11.1429),
|
||||
(62, 8.5714),
|
||||
(63, 7.7143),
|
||||
(64, 10.2857),
|
||||
(65, 9.4286),
|
||||
(66, 9.0000),
|
||||
(67, 9.0000),
|
||||
(68, 9.0000),
|
||||
(69, 8.1429),
|
||||
(70, 7.7143),
|
||||
(71, 9.0000),
|
||||
(72, 9.4286),
|
||||
(73, 3.4286),
|
||||
(74, 6.8571),
|
||||
(75, 9.0000),
|
||||
(76, 7.2857),
|
||||
(77, 10.2857),
|
||||
(78, 9.4286),
|
||||
(79, 9.4286),
|
||||
(80, 9.0000),
|
||||
(81, 9.4286),
|
||||
(82, 9.0000),
|
||||
(83, 8.5714),
|
||||
(84, 7.7143),
|
||||
(85, 9.4286),
|
||||
(86, 8.5714),
|
||||
(87, 10.2857),
|
||||
(88, 8.5714),
|
||||
(89, 8.5714),
|
||||
(90, 8.5714),
|
||||
(91, 6.4286),
|
||||
(92, 9.4286),
|
||||
(93, 5.1429),
|
||||
(94, 8.5714),
|
||||
(95, 10.2857),
|
||||
(96, 3.8571),
|
||||
(97, 8.1429),
|
||||
(98, 8.1429),
|
||||
(99, 7.7143),
|
||||
(100, 8.1429),
|
||||
(101, 7.7143),
|
||||
(102, 5.1429),
|
||||
(103, 8.1429),
|
||||
(104, 8.1429),
|
||||
(105, 3.4286),
|
||||
(106, 4.2857),
|
||||
(107, 7.2857),
|
||||
(108, 3.4286),
|
||||
(109, 12.8571),
|
||||
(110, 8.1429),
|
||||
(111, 8.1429),
|
||||
(112, 8.1429),
|
||||
(113, 8.1429),
|
||||
(114, 5.5714),
|
||||
(115, 7.2857),
|
||||
(116, 6.0000),
|
||||
(117, 8.1429),
|
||||
(118, 6.8571),
|
||||
(119, 9.4286),
|
||||
(120, 7.2857),
|
||||
(121, 6.8571),
|
||||
(122, 7.2857),
|
||||
(123, 5.1429),
|
||||
(124, 3.0000),
|
||||
(125, 4.7143),
|
||||
(126, 11.1429),
|
||||
],
|
||||
),
|
||||
(
|
||||
"ROMANS",
|
||||
&[
|
||||
(33, 4.2857), (34, 6.0000), (35, 9.0000), (36, 8.5714), (38, 11.1429), (39, 4.2857),
|
||||
(40, 6.0000), (41, 6.0000), (42, 6.8571), (43, 11.1429), (44, 4.2857), (45, 11.1429),
|
||||
(46, 4.2857), (47, 9.4286), (48, 8.5714), (49, 8.5714), (50, 8.5714), (51, 8.5714),
|
||||
(52, 8.5714), (53, 8.5714), (54, 8.5714), (55, 8.5714), (56, 8.5714), (57, 8.5714),
|
||||
(58, 4.2857), (59, 4.2857), (60, 10.2857), (61, 11.1429), (62, 10.2857), (63, 7.7143),
|
||||
(64, 11.5714), (65, 7.7143), (66, 9.0000), (67, 9.0000), (68, 9.0000), (69, 8.1429),
|
||||
(70, 7.7143), (71, 9.0000), (72, 9.4286), (73, 3.4286), (74, 6.8571), (75, 9.0000),
|
||||
(76, 7.2857), (77, 10.2857), (78, 9.4286), (79, 9.4286), (80, 9.0000), (81, 9.4286),
|
||||
(82, 9.0000), (83, 8.5714), (84, 6.8571), (85, 9.4286), (86, 7.7143), (87, 10.2857),
|
||||
(88, 8.5714), (89, 7.7143), (90, 8.5714), (91, 6.0000), (92, 9.4286), (93, 5.5714),
|
||||
(94, 9.4286), (95, 10.2857), (96, 5.1429), (97, 8.1429), (98, 8.1429), (99, 7.7143),
|
||||
(100, 8.1429), (101, 7.7143), (102, 5.1429), (103, 8.1429), (104, 8.1429), (105, 3.4286),
|
||||
(106, 4.2857), (107, 7.2857), (108, 3.4286), (109, 12.8571), (110, 8.1429), (111, 8.1429),
|
||||
(112, 8.1429), (113, 8.1429), (114, 5.5714), (115, 7.2857), (116, 5.1429), (117, 8.1429),
|
||||
(118, 6.8571), (119, 9.4286), (120, 7.2857), (121, 6.8571), (122, 7.2857), (123, 6.0000),
|
||||
(124, 3.4286), (125, 6.0000), (126, 11.1429),
|
||||
(33, 4.2857),
|
||||
(34, 6.0000),
|
||||
(35, 9.0000),
|
||||
(36, 8.5714),
|
||||
(38, 11.1429),
|
||||
(39, 4.2857),
|
||||
(40, 6.0000),
|
||||
(41, 6.0000),
|
||||
(42, 6.8571),
|
||||
(43, 11.1429),
|
||||
(44, 4.2857),
|
||||
(45, 11.1429),
|
||||
(46, 4.2857),
|
||||
(47, 9.4286),
|
||||
(48, 8.5714),
|
||||
(49, 8.5714),
|
||||
(50, 8.5714),
|
||||
(51, 8.5714),
|
||||
(52, 8.5714),
|
||||
(53, 8.5714),
|
||||
(54, 8.5714),
|
||||
(55, 8.5714),
|
||||
(56, 8.5714),
|
||||
(57, 8.5714),
|
||||
(58, 4.2857),
|
||||
(59, 4.2857),
|
||||
(60, 10.2857),
|
||||
(61, 11.1429),
|
||||
(62, 10.2857),
|
||||
(63, 7.7143),
|
||||
(64, 11.5714),
|
||||
(65, 7.7143),
|
||||
(66, 9.0000),
|
||||
(67, 9.0000),
|
||||
(68, 9.0000),
|
||||
(69, 8.1429),
|
||||
(70, 7.7143),
|
||||
(71, 9.0000),
|
||||
(72, 9.4286),
|
||||
(73, 3.4286),
|
||||
(74, 6.8571),
|
||||
(75, 9.0000),
|
||||
(76, 7.2857),
|
||||
(77, 10.2857),
|
||||
(78, 9.4286),
|
||||
(79, 9.4286),
|
||||
(80, 9.0000),
|
||||
(81, 9.4286),
|
||||
(82, 9.0000),
|
||||
(83, 8.5714),
|
||||
(84, 6.8571),
|
||||
(85, 9.4286),
|
||||
(86, 7.7143),
|
||||
(87, 10.2857),
|
||||
(88, 8.5714),
|
||||
(89, 7.7143),
|
||||
(90, 8.5714),
|
||||
(91, 6.0000),
|
||||
(92, 9.4286),
|
||||
(93, 5.5714),
|
||||
(94, 9.4286),
|
||||
(95, 10.2857),
|
||||
(96, 5.1429),
|
||||
(97, 8.1429),
|
||||
(98, 8.1429),
|
||||
(99, 7.7143),
|
||||
(100, 8.1429),
|
||||
(101, 7.7143),
|
||||
(102, 5.1429),
|
||||
(103, 8.1429),
|
||||
(104, 8.1429),
|
||||
(105, 3.4286),
|
||||
(106, 4.2857),
|
||||
(107, 7.2857),
|
||||
(108, 3.4286),
|
||||
(109, 12.8571),
|
||||
(110, 8.1429),
|
||||
(111, 8.1429),
|
||||
(112, 8.1429),
|
||||
(113, 8.1429),
|
||||
(114, 5.5714),
|
||||
(115, 7.2857),
|
||||
(116, 5.1429),
|
||||
(117, 8.1429),
|
||||
(118, 6.8571),
|
||||
(119, 9.4286),
|
||||
(120, 7.2857),
|
||||
(121, 6.8571),
|
||||
(122, 7.2857),
|
||||
(123, 6.0000),
|
||||
(124, 3.4286),
|
||||
(125, 6.0000),
|
||||
(126, 11.1429),
|
||||
],
|
||||
),
|
||||
];
|
||||
@@ -241,7 +481,8 @@ fn fonts_map() -> &'static HashMap<String, Font> {
|
||||
for (stem, src) in FONTS_SRC {
|
||||
let f = parse_lff(src);
|
||||
map.insert(stem.to_ascii_uppercase(), f.clone());
|
||||
map.entry(f.name.to_ascii_uppercase()).or_insert_with(|| f.clone());
|
||||
map.entry(f.name.to_ascii_uppercase())
|
||||
.or_insert_with(|| f.clone());
|
||||
}
|
||||
// AutoCAD/DXF SHX names → the matching LFF stem.
|
||||
for (alias, stem) in ALIASES {
|
||||
@@ -426,7 +667,11 @@ pub(crate) fn tokenize_run(text: &str) -> Vec<Tok> {
|
||||
continue;
|
||||
}
|
||||
|
||||
toks.push(if ch == ' ' { Tok::Space } else { Tok::Glyph(ch) });
|
||||
toks.push(if ch == ' ' {
|
||||
Tok::Space
|
||||
} else {
|
||||
Tok::Glyph(ch)
|
||||
});
|
||||
}
|
||||
toks
|
||||
}
|
||||
@@ -527,7 +772,10 @@ pub fn tessellate_text_run(
|
||||
// Flush a buffered TTF segment: shape it, emit the positioned glyph
|
||||
// contours, and advance the pen by the shaped run width. Falls back to
|
||||
// per-glyph outlines if shaping is unavailable.
|
||||
let flush_ttf = |seg: &mut String, cursor_x: &mut f32, out: &mut Vec<Vec<[f32; 2]>>, fill_tris: &mut Vec<[f32; 2]>| {
|
||||
let flush_ttf = |seg: &mut String,
|
||||
cursor_x: &mut f32,
|
||||
out: &mut Vec<Vec<[f32; 2]>>,
|
||||
fill_tris: &mut Vec<[f32; 2]>| {
|
||||
if seg.is_empty() {
|
||||
return;
|
||||
}
|
||||
@@ -624,13 +872,22 @@ pub fn tessellate_text_run(
|
||||
}
|
||||
|
||||
if let Some(start) = underline {
|
||||
out.push(vec![xform(start, UNDER_Y, 0.0), xform(cursor_x, UNDER_Y, 0.0)]);
|
||||
out.push(vec![
|
||||
xform(start, UNDER_Y, 0.0),
|
||||
xform(cursor_x, UNDER_Y, 0.0),
|
||||
]);
|
||||
}
|
||||
if let Some(start) = overline {
|
||||
out.push(vec![xform(start, OVER_Y, 0.0), xform(cursor_x, OVER_Y, 0.0)]);
|
||||
out.push(vec![
|
||||
xform(start, OVER_Y, 0.0),
|
||||
xform(cursor_x, OVER_Y, 0.0),
|
||||
]);
|
||||
}
|
||||
if let Some(start) = strikethrough {
|
||||
out.push(vec![xform(start, STRIKE_Y, 0.0), xform(cursor_x, STRIKE_Y, 0.0)]);
|
||||
out.push(vec![
|
||||
xform(start, STRIKE_Y, 0.0),
|
||||
xform(cursor_x, STRIKE_Y, 0.0),
|
||||
]);
|
||||
}
|
||||
|
||||
(out, fill_tris)
|
||||
@@ -774,11 +1031,25 @@ fn parse_lff(src: &str) -> Font {
|
||||
};
|
||||
for (c, g) in raw {
|
||||
let advance = advance_of(&g.strokes);
|
||||
font.glyphs.insert(c, Glyph { strokes: g.strokes, advance, fill_tris: Vec::new() });
|
||||
font.glyphs.insert(
|
||||
c,
|
||||
Glyph {
|
||||
strokes: g.strokes,
|
||||
advance,
|
||||
fill_tris: Vec::new(),
|
||||
},
|
||||
);
|
||||
}
|
||||
for (n, g) in raw_shapes {
|
||||
let advance = advance_of(&g.strokes);
|
||||
font.shapes.insert(n, Glyph { strokes: g.strokes, advance, fill_tris: Vec::new() });
|
||||
font.shapes.insert(
|
||||
n,
|
||||
Glyph {
|
||||
strokes: g.strokes,
|
||||
advance,
|
||||
fill_tris: Vec::new(),
|
||||
},
|
||||
);
|
||||
}
|
||||
font
|
||||
}
|
||||
@@ -871,11 +1142,7 @@ mod tests {
|
||||
for &(t, segs, verts, sum_ref) in cases {
|
||||
let (st, _) = tessellate_text_ex([0.0, 0.0], 10.0, 0.0, 1.0, 0.0, "txt", t);
|
||||
let nv: usize = st.iter().map(|s| s.len()).sum();
|
||||
let sum: f64 = st
|
||||
.iter()
|
||||
.flatten()
|
||||
.map(|p| p[0] as f64 + p[1] as f64)
|
||||
.sum();
|
||||
let sum: f64 = st.iter().flatten().map(|p| p[0] as f64 + p[1] as f64).sum();
|
||||
assert_eq!(st.len(), segs, "segment count drift for {t:?}");
|
||||
assert_eq!(nv, verts, "vertex count drift for {t:?}");
|
||||
assert!(
|
||||
@@ -914,15 +1181,15 @@ mod tests {
|
||||
assert!(!is_builtin("amiri-regular"));
|
||||
assert!(get_font("kochigothic").glyph('A').is_some());
|
||||
// Unicode fallback covers a non-ASCII letter via the renderer path.
|
||||
let (strokes, _) = tessellate_text_run([0.0, 0.0], 2.5, 0.0, 1.0, 0.0, 1.0, "Standard", "Aб");
|
||||
let (strokes, _) =
|
||||
tessellate_text_run([0.0, 0.0], 2.5, 0.0, 1.0, 0.0, 1.0, "Standard", "Aб");
|
||||
assert!(!strokes.is_empty());
|
||||
// The bulge belongs to the segment ENDING at the vertex (LibreCAD
|
||||
// convention): the standard/iso/unicode 'O' must come out as an
|
||||
// upright oval (taller than wide), not a sideways capsule.
|
||||
for name in ["standard", "iso", "unicode", "txt"] {
|
||||
let o = get_font(name).glyph('O').expect("O glyph");
|
||||
let (mut minx, mut miny, mut maxx, mut maxy) =
|
||||
(f32::MAX, f32::MAX, f32::MIN, f32::MIN);
|
||||
let (mut minx, mut miny, mut maxx, mut maxy) = (f32::MAX, f32::MAX, f32::MIN, f32::MIN);
|
||||
for s in &o.strokes {
|
||||
for &[x, y] in s {
|
||||
minx = minx.min(x);
|
||||
|
||||
Reference in new issue
Block a user