combine-metrics ( graphics-height ascent descent cap-height -- ascent' descent' )


Vocabulary
ui.baseline-alignment.private

Inputs
graphics-heightan object
ascentan object
descentan object
cap-heightan object


Outputs
ascent'an object
descent'an object


Definition


:: combine-metrics
( graphics-height ascent descent cap-height -- ascent' descent' )
ascent [
cap-height 0 or 2 / :> mid-line graphics-height 2 /
[ ascent mid-line - max mid-line + floor >integer ]
[ descent mid-line + max mid-line - ceiling >integer ]
bi
] [ f f ] if ;