-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
So, right now, when you have something like 100% + 2em + 2pt
, internally that's somewhat divided between a relative part (100%
) and an absolute part (2em + 2pt
). Likewise, for strokes, you have something like 2pt + blue
, which is divided between thickness (2pt
) and color (blue
). Right now, to perform this separation in typst, using regex with repr and eval is necessary. I think this indicates to me that this should definitely be a built-in feature to avoid that hassle. Maybe we could use some notation like stroke.thickness(2em + blue)
, which returns 2em
; or stroke.thickness(2pt)
which will return 2pt; or stroke.color(2pt + red)
which will return red; and so on. Same for relative lengths - something (maybe?) like length.relative(50% + 2pt)
returning 50%; length.absolute(60% + 4pt)
returning 4pt, and so on. Of course, that notation can vary (personally, I think the stroke one is fine, but the length
one could be made better, perhaps). I could perhaps attempt to eventually PR this depending on what is suggested here. Thoughts?