Skip to main content

Module set

Module set 

Source
Expand description

Lower #set directives and coerce directive values.

Functionsยง

coerce_positive_length ๐Ÿ”’
Coerce a #image(width|height: ...) argument to a strictly positive length in points. Bare numerics resolve as pt for ergonomics.
coerce_value ๐Ÿ”’
Coerce a parser literal to the type required by the target slot. Length values are resolved to PDF points using em_pt for em literals.
describe_value ๐Ÿ”’
int_to_f64 ๐Ÿ”’
#set literals only accept i64 values that fit comfortably in f64โ€™s mantissa; cap at ยฑ2^53 so the cast is exact.
length_to_pt ๐Ÿ”’
lower_set_arg ๐Ÿ”’
Convert one parser-level SetArg into an attribute on the Raw node representing this #set directive. Emits semantic diagnostics (MOS0015 unknown key, MOS0020 type mismatch, MOS0027 sanity floor) and updates metadata / current_text_size_pt as a side effect.
lower_set_directive ๐Ÿ”’
Lower a #set name(...) directive into a Raw node carrying the resolved attribute payload. The split exists so the dispatch in Evaluator::evaluate only has to thread state through three directive-shaped helpers instead of one large match arm.
sanity_floor_warning ๐Ÿ”’
set_node ๐Ÿ”’