Rebol Programming/make-face

USAGE:

edit
MAKE-FACE style /styles ss /clone /size wh /spec blk /offset xy /keep 

DESCRIPTION:

edit

Make a face from a given style name or example face.

MAKE-FACE is a function value.

ARGUMENTS:

edit
  • style -- A name or a face (Type: word object)

REFINEMENTS:

edit
  • /styles
    • ss -- Stylesheet (Type: any)
  • /clone -- Copy all primary facets
  • /size
    • wh -- Size of face (Type: pair)
  • /spec
    • blk -- Spec block (Type: block)
  • /offset
    • xy -- Offset of face (Type: pair)
  • /keep -- Keep style related data

SOURCE CODE

edit
make-face: func [
    {Make a face from a given style name or example face.} 
    style [word! object!] "A name or a face" 
    /styles ss "Stylesheet" 
    /clone "Copy all primary facets" 
    /size wh [pair!] "Size of face" 
    /spec blk [block!] "Spec block" 
    /offset xy [pair!] "Offset of face" 
    /keep "Keep style related data"
][
    if word? style [style: either styles [select ss style] [get-style style]] 
    if none? style [return none] 
    spec: [parent-face: saved-area: line-list: old-offset: old-size: none] 
    if blk [spec: append copy spec blk] 
    style: make style spec 
    if size [style/size: wh] 
    if offset [style/offset: xy] 
    style/flags: exclude style/flags state-flags 
    if clone [
        foreach word [text effect colors texts font para edge] [
            if style/:word [
                set in style word either series? style/:word [copy style/:word] [
                    make style/:word []
                ]
            ]
        ]
    ] 
    do bind style/init in style 'init 
    if not keep [
        style/init: copy [] 
        style/facets: none
    ] 
    style
]