1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel colors accessors combinators ;
6 TUPLE: font name size bold? italic? foreground background ;
11 white >>background ; inline
13 : font-with-foreground ( font color -- font' )
14 [ clone ] dip >>foreground ; inline
16 : font-with-background ( font color -- font' )
17 [ clone ] dip >>background ; inline
19 : reverse-video-font ( font -- font )
21 [ foreground>> ] [ background>> ] bi
22 [ >>background ] [ >>foreground ] bi* ;
24 : derive-font ( base font -- font' )
26 [ [ name>> ] either? >>name ]
27 [ [ size>> ] either? >>size ]
28 [ [ bold?>> ] either? >>bold? ]
29 [ [ italic?>> ] either? >>italic? ]
30 [ [ foreground>> ] either? >>foreground ]
31 [ [ background>> ] either? >>background ]
34 : serif-font ( -- font )
39 : sans-serif-font ( -- font )
44 : monospace-font ( -- font )