ui.baseline-alignment: allow floats in alignment.

master
John Benediktsson 2020-05-18 20:53:14 -07:00
parent c0ab4beb0c
commit c37e9551ad
1 changed files with 4 additions and 4 deletions

View File

@ -63,8 +63,8 @@ TUPLE: gadget-metrics height ascent descent cap-height ;
ascent [ ascent [
cap-height 0 or 2 / :> mid-line cap-height 0 or 2 / :> mid-line
graphics-height 2 / graphics-height 2 /
[ ascent mid-line - max mid-line + floor >integer ] [ ascent mid-line - max mid-line + ]
[ descent mid-line + max mid-line - ceiling >integer ] bi [ descent mid-line + max mid-line - ] bi
] [ f f ] if ; ] [ f f ] if ;
: (measure-metrics) ( children sizes -- graphics-height ascent descent cap-height ) : (measure-metrics) ( children sizes -- graphics-height ascent descent cap-height )
@ -84,14 +84,14 @@ PRIVATE>
dup max-cap-height 0 or :> max-cap-height dup max-cap-height 0 or :> max-cap-height
dup max-graphics-height :> max-graphics-height dup max-graphics-height :> max-graphics-height
max-cap-height max-graphics-height + 2 /i :> critical-line max-cap-height max-graphics-height + 2 / :> critical-line
critical-line max-ascent [-] :> text-leading critical-line max-ascent [-] :> text-leading
max-ascent critical-line [-] :> graphics-leading max-ascent critical-line [-] :> graphics-leading
[ [
dup ascent>> dup ascent>>
[ ascent>> max-ascent swap - text-leading ] [ ascent>> max-ascent swap - text-leading ]
[ height>> max-graphics-height swap - 2 /i graphics-leading ] if + [ height>> max-graphics-height swap - 2 / graphics-leading ] if +
] map ; ] map ;
: measure-metrics ( children sizes -- ascent descent ) : measure-metrics ( children sizes -- ascent descent )