又考虑了下cps的问题,如果在脚本中显式使用cps标签的话,好像也可以把每个字拆出来渲染成Text组件,然后再拼回去。简单尝试了下,文字间距啥的还需要调整下,功能可以实现:
[RenPy] 纯文本查看 复制代码 style border_ is text:
color "#fff"
outlines [(5, "#000", 0, 0)]
ypos -0.2
init python:
def border_tag(tag, argument, contents):
rv = []
cps_tag = False
cps_arg = ''
for kind, text in contents:
if kind == renpy.TEXT_TAG and text[:3] == u'cps':
print (text[4:])
cps_tag = True
cps = text[4:]
if kind == renpy.TEXT_TEXT and cps_tag == True:
for i in range(0, len(text)):
rv.append((renpy.TEXT_TAG, u'cps={}'.format(cps)))
rv.append((renpy.TEXT_DISPLAYABLE, Text(text[i:(i+1)], style="border_")))
rv.append((renpy.TEXT_TAG, u'/cps'))
i+=1
elif kind == renpy.TEXT_TEXT and cps_tag == False:
rv.append((renpy.TEXT_DISPLAYABLE, Text(text, style="border_")))
return rv
config.custom_text_tags["border"] = border_tag
define gray = "#e0e0e0"
label main_menu:
return
# 游戏在此开始。
label start:
scene gray
"Yiri" "有时候需要一点{border}{cps=20}恐怖的文字{/cps}{/border}。" |