Removed text shadow support

db4
Keith Lazuka 2009-09-08 14:22:27 -04:00
parent 3fb75247b2
commit 9c7d45e08a
6 changed files with 11 additions and 40 deletions

View File

@ -9,8 +9,7 @@ size
bold? bold?
italic? italic?
{ foreground initial: COLOR: black } { foreground initial: COLOR: black }
{ background initial: COLOR: white } { background initial: COLOR: white } ;
shadow ;
: <font> ( -- font ) : <font> ( -- font )
font new ; inline font new ; inline
@ -38,7 +37,6 @@ shadow ;
[ [ italic?>> ] either? >>italic? ] [ [ italic?>> ] either? >>italic? ]
[ [ foreground>> ] either? >>foreground ] [ [ foreground>> ] either? >>foreground ]
[ [ background>> ] either? >>background ] [ [ background>> ] either? >>background ]
[ [ shadow>> ] either? >>shadow ]
} 2cleave } 2cleave
] when* ; ] when* ;
@ -58,7 +56,7 @@ shadow ;
12 >>size ; 12 >>size ;
: strip-font-colors ( font -- font' ) : strip-font-colors ( font -- font' )
clone f >>background f >>foreground f >>shadow ; clone f >>background f >>foreground ;
TUPLE: metrics width ascent descent height leading cap-height x-height ; TUPLE: metrics width ascent descent height leading cap-height x-height ;

View File

@ -34,13 +34,12 @@ H{
{ font-style bold } { font-style bold }
{ wrap-margin 500 } { wrap-margin 500 }
{ foreground T{ rgba f 0.216 0.243 0.282 1.0 } } { foreground T{ rgba f 0.216 0.243 0.282 1.0 } }
{ shadow COLOR: white }
{ page-color T{ rgba f 0.94 0.94 0.91 1.0 } } { page-color T{ rgba f 0.94 0.94 0.91 1.0 } }
{ border-width 5 } { border-width 5 }
} title-style set-global } title-style set-global
SYMBOL: help-path-style SYMBOL: help-path-style
H{ { font-size 10 } { shadow f } } help-path-style set-global H{ { font-size 10 } } help-path-style set-global
SYMBOL: heading-style SYMBOL: heading-style
H{ H{

View File

@ -121,7 +121,6 @@ ARTICLE: "character-styles" "Character styles"
"Character styles for " { $link stream-format } " and " { $link with-style } ":" "Character styles for " { $link stream-format } " and " { $link with-style } ":"
{ $subsection foreground } { $subsection foreground }
{ $subsection background } { $subsection background }
{ $subsection shadow }
{ $subsection font-name } { $subsection font-name }
{ $subsection font-size } { $subsection font-size }
{ $subsection font-style } { $subsection font-style }
@ -206,18 +205,6 @@ HELP: background
} }
} ; } ;
HELP: shadow
{ $description "Character style. An instance of " { $link color } ". See " { $link "colors" } "." }
{ $examples
{ $code
"\"Hello world\\n\""
"H{ { background COLOR: gray }"
" { shadow COLOR: white }"
" { font-size 72 }"
"} format"
}
} ;
HELP: font-name HELP: font-name
{ $description "Character style. Font family named by a string." } { $description "Character style. Font family named by a string." }
{ $examples { $examples

View File

@ -116,7 +116,6 @@ SYMBOL: bold-italic
! Character styles ! Character styles
SYMBOL: foreground SYMBOL: foreground
SYMBOL: background SYMBOL: background
SYMBOL: shadow
SYMBOL: font-name SYMBOL: font-name
SYMBOL: font-size SYMBOL: font-size
SYMBOL: font-style SYMBOL: font-style

View File

@ -65,24 +65,13 @@ M: label baseline
M: label cap-height M: label cap-height
label-metrics cap-height>> round ; label-metrics cap-height>> round ;
: draw-text* ( font text fg bg -- )
[ rot ] dip
[ font-with-background ] when* swap
[ font-with-foreground ] when* swap
draw-text ;
: draw-shadowed-text ( font text -- )
[
{ 0 1 } [ over shadow>> background get draw-text* ]
with-translation
] [ foreground get transparent draw-text* ] 2bi ;
: draw-normal-text ( font text -- )
foreground get background get draw-text* ;
M: label draw-gadget* M: label draw-gadget*
>label< over shadow>> >label<
[ draw-shadowed-text ] [ draw-normal-text ] if ; [
background get [ font-with-background ] when*
foreground get [ font-with-foreground ] when*
] dip
draw-text ;
M: label gadget-text* string>> % ; M: label gadget-text* string>> % ;

View File

@ -11,7 +11,7 @@ ui.gadgets.menus ui.clipboards ui.gestures ui.traverse ui.render
ui.text ui.gadgets.presentations ui.gadgets.grids ui.gadgets.tracks ui.text ui.gadgets.presentations ui.gadgets.grids ui.gadgets.tracks
ui.gadgets.icons ui.gadgets.grid-lines ui.baseline-alignment ui.gadgets.icons ui.gadgets.grid-lines ui.baseline-alignment
colors io.styles ; colors io.styles ;
FROM: io.styles => foreground background shadow ; FROM: io.styles => foreground background ;
IN: ui.gadgets.panes IN: ui.gadgets.panes
TUPLE: pane < track TUPLE: pane < track
@ -199,12 +199,11 @@ MEMO: specified-font ( assoc -- font )
[ font-size swap at >>size ] [ font-size swap at >>size ]
[ foreground swap at >>foreground ] [ foreground swap at >>foreground ]
[ background swap at >>background ] [ background swap at >>background ]
[ shadow swap at >>shadow ]
} cleave } cleave
derive-font ; derive-font ;
: apply-font-style ( style gadget -- style gadget ) : apply-font-style ( style gadget -- style gadget )
{ font-name font-style font-size foreground background shadow } { font-name font-style font-size foreground background }
pick extract-keys specified-font >>font ; pick extract-keys specified-font >>font ;
: apply-style ( style gadget key quot -- style gadget ) : apply-style ( style gadget key quot -- style gadget )