         [ 2dup ] 2dip column-loc draw-text
     ] dip table-gap + 0 2array gl-translate ;
 
-: draw-row ( columns widths align font -- )
-    '[ [ _ ] 3dip draw-column ] 3each ;
-
-: each-slice-index ( from to seq quot -- )
-    [ [ <slice> ] [ drop [a,b) ] 3bi ] dip 2each ; inline
-
 : column-alignment ( table -- seq )
     dup column-alignment>>
     [ ] [ column-widths>> length 0 <repetition> ] ?if ;
+
+: draw-row ( index table -- )
+    [ [ renderer>> row-columns ] [ column-widths>> ] [ column-alignment ] tri ]
+    [ [ renderer>> row-font ] [ font>> swap derive-font ] bi ] 2bi
+    '[ [ _ ] 3dip draw-column ] 3each ;
+
+: each-slice-index ( from to seq quot -- )
+    [ [ <slice> ] [ drop [a,b) ] 3bi ] dip 2each ; inline
 
 : draw-rows ( table -- )
     {

        sans-serif-font >>font
        selection-color >>selection-color
        focus-border-color >>focus-border-color
        dark-gray >>column-line-color
        black >>mouse-color
        black >>text-color ;

<PRIVATE


! Row rendererer protocol
GENERIC: row-columns ( row renderer -- columns )
GENERIC: row-value ( row renderer -- object )
GENERIC: row-color ( row renderer -- color )
GENERIC: row-font ( row renderer -- font )

SINGLETON: trivial-renderer

M: trivial-renderer row-columns drop ;
M: object row-value drop ;
M: object row-color 2drop f ;

M: object row-font
    row-color dup [ <font> swap >>foreground ] when ;

TUPLE: table < gadget
renderer filled-column column-alignment action hook
