From 61fb3cbfe9b9c59f1258d778873e328e08658cb0 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 10 Jan 2021 13:00:16 +0100 Subject: text: Validate font-weight and font-style. --- pict.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pict.scm b/pict.scm index 7ea2905..916d527 100644 --- a/pict.scm +++ b/pict.scm @@ -801,6 +801,12 @@ filled with black." "Render the provided string TXT. The keywords COLOR (a string), FONT-FAMILY (a string), FONT-SIZE (an integer), FONT-STYLE (a symbol), and FONT-WEIGHT (also a symbol) can be used to change the appearance." + (define validate-weight + (or (member font-weight '(normal bold bolder lighter)) + (error "font-weight must be one of: normal, bold, bolder, lighter."))) + (define validate-style + (or (member font-style '(normal italic oblique)) + (error "font-style must be one of: normal, italic, oblique."))) ;; Return ascent, descent, height, max_x_advance, max_y_advance (define (font-extents) (call-with-values -- cgit v1.2.3