font syntax for gadgets
parent
92cc62de85
commit
6de5f0964b
|
@ -0,0 +1 @@
|
||||||
|
Sam Anklesaria
|
|
@ -0,0 +1 @@
|
||||||
|
Syntax for modifying gadget fonts
|
|
@ -0,0 +1,6 @@
|
||||||
|
USING: help.syntax help.markup ;
|
||||||
|
IN: fonts.syntax
|
||||||
|
|
||||||
|
HELP: FONT:
|
||||||
|
{ $syntax "\"testing\" <label> FONT: 18 serif bold ... ;" }
|
||||||
|
{ $description "Used after a gadget to change font settings. Attributes can be in any order: the first number is set as the size, the style attributes like bold and italic will set the bold? and italic? slots, and font-names like serif or monospace will set the name slot." } ;
|
|
@ -0,0 +1,16 @@
|
||||||
|
USING: accessors arrays classes.algebraic combinators io.styles
|
||||||
|
kernel math parser sequences fry ;
|
||||||
|
IN: fonts.syntax
|
||||||
|
|
||||||
|
DATA: fontname serif | monospace ;
|
||||||
|
|
||||||
|
: install ( object quot -- quot/? ) over [ curry ] [ 2drop [ ] ] if ;
|
||||||
|
|
||||||
|
: >>name* ( object fontname -- object ) name>> >>name ;
|
||||||
|
|
||||||
|
SYNTAX: FONT: \ ; parse-until {
|
||||||
|
[ [ number? ] find nip [ >>size ] install ]
|
||||||
|
[ [ italic = ] find nip [ >>italic? ] install ]
|
||||||
|
[ [ bold = ] find nip [ >>bold? ] install ]
|
||||||
|
[ [ fontname? ] find nip [ >>name* ] install ]
|
||||||
|
} cleave 4array concat '[ dup font>> @ drop ] over push-all ;
|
Loading…
Reference in New Issue