跳转到内容

Rebol 编程/make-face

来自维基教科书,开放世界中的开放书籍
MAKE-FACE style /styles ss /clone /size wh /spec blk /offset xy /keep 

从给定的样式名称或示例面部创建面部。

MAKE-FACE 是一个函数值。

  • style -- 名称或面部 (类型:单词对象)
  • /styles
    • ss -- 样式表 (类型:任何)
  • /clone -- 复制所有主要方面
  • /size
    • wh -- 面部的尺寸 (类型:对)
  • /spec
    • blk -- 规范块 (类型:块)
  • /offset
    • xy -- 面部的偏移量 (类型:对)
  • /keep -- 保留与样式相关的數據

源代码

[编辑 | 编辑源代码]
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
]
华夏公益教科书