diff --git a/crates/texrra-tex-core/src/lib.rs b/crates/texrra-tex-core/src/lib.rs
index fb7c6e8..00936dd 100644
--- a/crates/texrra-tex-core/src/lib.rs
+++ b/crates/texrra-tex-core/src/lib.rs
@@ -1615,6 +1615,33 @@ mod tests {
assert!(text.contains("/F2 4 0 R"));
assert!(text.contains("BT /F2"));
}
+
+ #[test]
+ fn svg_reflects_display_font_faces() {
+ let mut list = crate::render::DisplayList::default();
+ for (index, font) in [
+ crate::render::FontFace::Roman,
+ crate::render::FontFace::Bold,
+ crate::render::FontFace::Italic,
+ crate::render::FontFace::Mono,
+ ]
+ .into_iter()
+ .enumerate()
+ {
+ list.push(crate::render::DisplayItem::Text {
+ x: 10,
+ y: 20 + index as i64 * 20,
+ size: 10 * 65_536,
+ text: format!("face{index}"),
+ font,
+ });
+ }
+ let svg = list.to_svg();
+ assert!(svg.contains("font-family=\"serif\">face0"));
+ assert!(svg.contains("font-weight=\"bold\">face1"));
+ assert!(svg.contains("font-style=\"italic\">face2"));
+ assert!(svg.contains("font-family=\"monospace\">face3"));
+ }
#[test]
fn math_display_list_paints_symbols_and_fraction_rule() {
let atom = crate::math::parse_math("x + \\frac{a}{b}");
diff --git a/crates/texrra-tex-core/src/render.rs b/crates/texrra-tex-core/src/render.rs
index efa569c..2c6668c 100755
--- a/crates/texrra-tex-core/src/render.rs
+++ b/crates/texrra-tex-core/src/render.rs
@@ -123,13 +123,32 @@ impl DisplayList {
for item in &self.items {
match item {
DisplayItem::Text {
- x, y, size, text, ..
+ x,
+ y,
+ size,
+ text,
+ font,
} => {
let x = *x as f64 / 65_536.0;
let y = *y as f64 / 65_536.0;
let size = *size as f64 / 65_536.0;
+ let family = if matches!(font, FontFace::Mono) {
+ "monospace"
+ } else {
+ "serif"
+ };
+ let weight = if matches!(font, FontFace::Bold | FontFace::BoldItalic) {
+ " font-weight=\"bold\""
+ } else {
+ ""
+ };
+ let style = if matches!(font, FontFace::Italic | FontFace::BoldItalic) {
+ " font-style=\"italic\""
+ } else {
+ ""
+ };
out.push_str(&format!(
- "{}\n",
+ "{}\n",
escape(text)
));
}
diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md
index 29932f6..7d75022 100755
--- a/docs/TEX_CORE.md
+++ b/docs/TEX_CORE.md
@@ -228,7 +228,7 @@ for a later overlaid slash.
| M2 vertical/page builder | partial | vsize, topskip, insertions, marks, output hook, top/bottom floats, rules, vskip, penalties; interpreted `\output` and float pages absent |
| M3 halign | partial | natural columns, spans, omit, hline rows, templates, noalign skip, rules; no PDF painter |
| M4 math | partial | atoms, scripts, fractions, roots, delimiters, accents, operators, classes, braces, boxed, negated; no math painter/shrink wrapping |
-| M5 NFSS/TFM | partial | CMR10 widths and per-face Base-14 resources (Roman/Bold/Italic/BoldItalic/Mono); TFM loading and font embedding absent |
+| M5 NFSS/TFM | partial | CMR10 widths, per-face Base-14 PDF resources, and SVG font-family/weight/style for Roman/Bold/Italic/Mono; TFM loading and font embedding absent |
| M6 specials/XObject | partial | raw specials, RGB image XObjects, URI link annotations; class/package execution absent |
| M7 incremental integration | partial | edit replay + page hashes, not wired into v1 preview |