mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
- Makes errors fatal, so that a phase is only reached when all previous phases were error-free - Parsing still recovers and can produce multiple errors - Evaluation fails fast and can thus produce only a single error (except for parse errors due to an import) - The single error that could occur during execution is removed for now - Removes Value::Error variant
41 lines
909 B
XML
41 lines
909 B
XML
// Test the `image` function.
|
|
|
|
---
|
|
// Test loading different image formats.
|
|
|
|
// Load an RGBA PNG image.
|
|
#image("../../res/rhino.png")
|
|
#pagebreak()
|
|
|
|
// Load an RGB JPEG image.
|
|
#image("../../res/tiger.jpg")
|
|
|
|
---
|
|
// Test configuring the size and fitting behaviour of images.
|
|
|
|
// Fit to width of page.
|
|
#image("../../res/rhino.png")
|
|
|
|
// Fit to height of page.
|
|
#page(height: 40pt, image("../../res/rhino.png"))
|
|
|
|
// Set width explicitly.
|
|
#image("../../res/rhino.png", width: 50pt)
|
|
|
|
// Set height explicitly.
|
|
#image("../../res/rhino.png", height: 50pt)
|
|
|
|
// Set width and height explicitly and force stretching.
|
|
#image("../../res/rhino.png", width: 25pt, height: 50pt)
|
|
|
|
// Make sure the bounding-box of the image is correct.
|
|
#align(bottom, right, image("../../res/tiger.jpg", width: 60pt))
|
|
|
|
---
|
|
// Error: 8-29 file not found
|
|
#image("path/does/not/exist")
|
|
|
|
---
|
|
// Error: 8-21 failed to load image
|
|
#image("./image.typ")
|