Last modified on 31 October 2012, at 13:58

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 CODEEdit

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
]