         '[ [ 0 2array ] [ _ 2array ] bi gl-line ] each
     ] bi ;
 
-: column-loc ( font column width align -- loc )
-    [ [ cell-width ] dip swap - ] dip
-    * >integer 0 2array ;
+:: column-loc ( font column width align -- loc )
+    font column cell-width width swap - align * column cell-padding 2 / 1 align - * +
+    font column cell-height \ line-height get swap - 2 /
+    [ >integer ] bi@ 2array ;
 
 : translate-column ( width gap -- )
     + 0 2array gl-translate ;


M: table draw-gadget*
    dup control-value empty? [ drop ] [
        {
            [ draw-selected-row ]
            [ draw-lines ]
            [ draw-column-lines ]
            [ draw-focused-row ]
            [ draw-moused-row ]
        } cleave
    ] if ;

M: table line-height ( table -- y )
    [ font>> ] [ renderer>> prototype-row ] bi
    [ cell-height ] with [ max ] map-reduce ;

M: table pref-dim*
    [ compute-column-widths drop ] keep

        column-title-background <solid> >>interior ;

: draw-column-titles ( table -- )
    dup font>> font-metrics height>> \ line-height [
        {
            [ renderer>> column-titles ]
            [ column-widths>> ]
            [ table-column-alignment ]
            [ font>> column-title-font ]
            [ gap>> ]
        } cleave
        draw-columns
    ] with-variable ;

M: column-headers draw-gadget*
    table>> draw-column-titles ;
