summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/text/decorations.pngbin0 -> 10184 bytes
-rw-r--r--tests/typ/text/decorations.typ19
-rw-r--r--tests/typeset.rs13
3 files changed, 31 insertions, 1 deletions
diff --git a/tests/ref/text/decorations.png b/tests/ref/text/decorations.png
new file mode 100644
index 00000000..1bde2dd4
--- /dev/null
+++ b/tests/ref/text/decorations.png
Binary files differ
diff --git a/tests/typ/text/decorations.typ b/tests/typ/text/decorations.typ
new file mode 100644
index 00000000..3e298ece
--- /dev/null
+++ b/tests/typ/text/decorations.typ
@@ -0,0 +1,19 @@
+// Test text decorations.
+
+---
+#strike[Statements dreamt up by the utterly deranged.]
+
+Sometimes, we work #strike(extent: 5%, strength: 10pt)[in secret].
+There might be #strike(extent: 5%, strength: 10pt, color: #abcdef88)[redacted]
+things.
+
+---
+#underline(color: #fc0030)[Critical information is conveyed here.]
+#underline[
+ Still important, but not #underline(strength: 0pt)[mission ]critical.
+]
+
+#font(color: #fc0030, underline[Change with the wind.])
+
+---
+#overline(underline[Running amongst the wolves.])
diff --git a/tests/typeset.rs b/tests/typeset.rs
index 604a8275..90fc6005 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -8,7 +8,7 @@ use std::rc::Rc;
use image::{GenericImageView, Rgba};
use tiny_skia::{
Color, ColorU8, FillRule, FilterQuality, Paint, Pattern, Pixmap, Rect, SpreadMode,
- Transform,
+ Stroke, Transform,
};
use ttf_parser::{GlyphId, OutlineBuilder};
use walkdir::WalkDir;
@@ -474,6 +474,17 @@ fn draw_geometry(canvas: &mut Pixmap, ts: Transform, shape: &Shape, fill: Fill)
let path = convert_typst_path(&geom::Path::ellipse(size));
canvas.fill_path(&path, &paint, rule, ts, None);
}
+ Shape::Line(target, thickness) => {
+ let path = {
+ let mut builder = tiny_skia::PathBuilder::new();
+ builder.line_to(target.x.to_pt() as f32, target.y.to_pt() as f32);
+ builder.finish().unwrap()
+ };
+
+ let mut stroke = Stroke::default();
+ stroke.width = thickness.to_pt() as f32;
+ canvas.stroke_path(&path, &paint, &stroke, ts, None);
+ }
Shape::Path(ref path) => {
let path = convert_typst_path(path);
canvas.fill_path(&path, &paint, rule, ts, None);