Paint monospace paragraphs with the embedded mono face
This commit is contained in:
1 parent
6dd4f6bf83
commit
1633e441de
4 files changed
+19
-2
No files matched your search
@@ -1939,6 +1939,21 @@ mod tests {
|
||||
assert!(text.trim_end().ends_with("%%EOF"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mono_paragraph_paints_with_a_mono_face() {
|
||||
let unit = Unit::paragraph_with_face(1, "code 123", ParagraphFont::Mono);
|
||||
let page = Page {
|
||||
items: unit.items,
|
||||
insertions: Vec::new(),
|
||||
marks: Vec::new(),
|
||||
floats: Vec::new(),
|
||||
sources: Vec::new(),
|
||||
hash: 0,
|
||||
};
|
||||
let svg = page.display_list().to_svg();
|
||||
assert!(svg.contains("font-family=\"monospace\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bold_paragraph_paints_with_a_bold_face() {
|
||||
let document = Document::new(
|
||||
|
||||
@@ -72,6 +72,7 @@ pub enum ParagraphFont {
|
||||
Roman,
|
||||
Bold,
|
||||
Italic,
|
||||
Mono,
|
||||
}
|
||||
|
||||
impl Default for ParagraphFont {
|
||||
|
||||
@@ -367,6 +367,7 @@ impl Page {
|
||||
ParagraphFont::Roman => FontFace::Roman,
|
||||
ParagraphFont::Bold => FontFace::Bold,
|
||||
ParagraphFont::Italic => FontFace::Italic,
|
||||
ParagraphFont::Mono => FontFace::Mono,
|
||||
};
|
||||
let lines = paragraph.lines.len().max(1) as i64;
|
||||
let line_height = (paragraph.height / lines).max(1);
|
||||
|
||||
+2
-2
@@ -252,7 +252,7 @@ M3 painter: `Page::display_list()` and `Halign::display_list()` produce absolute
|
||||
|
||||
PDF writer: `crates/texrra-tex-core/src/pdf.rs` writes multi-page PDF 1.4 with five embedded Liberation Type0/CID faces (Identity-H + ToUnicode + `/W` arrays), filled rectangles, diagonal rules, raw-RGB `/XObject` images, `/Annots` URI links and arbitrary `/special` operators. Ligature substitution and line-end italic correction are implemented; full NFSS family switching remains open.
|
||||
|
||||
M5 (partial): display-list text carries `FontFace::{Roman,Bold,Italic,BoldItalic,Mono}`. Roman/Bold/Italic/BoldItalic/Mono text are painted with embedded Liberation Type0/CID fonts, each with a ToUnicode CMap and `/W` width array. `cmr10.tfm` is parsed at runtime for widths, heights/depths, kern pairs and ff/fi/fl/ffi/ffl ligatures; line-end and math-script italic corrections are applied; true NFSS family switching remains open.
|
||||
M5 (partial): display-list text carries `FontFace::{Roman,Bold,Italic,BoldItalic,Mono}`. Roman/Bold/Italic/BoldItalic/Mono text are painted with embedded Liberation Type0/CID fonts, each with a ToUnicode CMap and `/W` width array. `cmr10.tfm` is parsed at runtime for widths, heights/depths, kern pairs and ff/fi/fl/ffi/ffl ligatures; line-end and math-script italic corrections and a monospace paragraph face are applied; true NFSS family switching remains open.
|
||||
|
||||
M6 (partial): `DisplayItem::Image` becomes a PDF XObject; `DisplayItem::Link` becomes `/Annots /Subtype /Link /URI`; `DisplayItem::Special` injects raw content-stream operators. SVG previews show images as grey rectangles and specials as comments.
|
||||
|
||||
@@ -262,7 +262,7 @@ M3 (partial): `Unit::halign` normalizes column widths, intercolumn gaps, row hei
|
||||
|
||||
Math coverage includes fractions/roots, scripts, `\left...\right` with body-scaled delimiters, `\middle`, `\big`/`\Big`/`\bigg`/`\Bigg` and their `l`/`r` forms, control-sequence delimiters, accents (dot/check/breve/acute/grave/ring), `\text`/`\mathrm`, `\overbrace`/`\underbrace`, `\overset`/`\underset`, `\binom`, `\cancel`/`\bcancel`/`\xcancel`, `\bmod`/`\pmod`, fence symbols, `\operatorname*` and `\mathop` limits.
|
||||
|
||||
The crate currently has 135 unit tests plus one route-D integration test. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 218 tests (135 route-D unit, 1 route-D integration, 71 v1 integration, 6 server, 4 v1 unit, 1 doctest). v1 remains the live server path.
|
||||
The crate currently has 136 unit tests plus one route-D integration test. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 219 tests (136 route-D unit, 1 route-D integration, 71 v1 integration, 6 server, 4 v1 unit, 1 doctest). v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
|
||||
Reference in new issue
Block a user