2024/12/04 追記
ルビ(ふりがな)をオンオフできるようにする
引用・参考
https://www.reddit.com/r/RenPy/comments/1gthq3l/enablingdisabling_text_tags/
https://ja.renpy.org/doc/html/text.html#ruby-text
https://ja.renpy.org/doc/html/custom_text_tags.html
ルビの設定
screens.rpy
style ruby_style is default: size 30 yoffset -50 color None style say_dialogue: ruby_style style.ruby_style
永続変数の設定
options.rpy
default persistent.ruby_pref = False
設定画面を作る
screens.rpy
if preferences.language == None: vbox: style_prefix "radio" label _("ふりがなの有無") null height 30 hbox: textbutton _("あり") action SetVariable("persistent.ruby_pref", True), Function(gui.rebuild) null width 10 textbutton _("なし") action SetVariable("persistent.ruby_pref", False), Function(gui.rebuild)
ルビの設定
options.rpy
def ruby_tag1(tag, argument, contents): if persistent.ruby_pref: return [ (renpy.TEXT_TAG, u"rt"), ] + contents + [ (renpy.TEXT_TAG, u"/rt"), ] else: return "" def ruby_tag2(tag, argument, contents): if persistent.ruby_pref: return [ (renpy.TEXT_TAG, u"rb"), ] + contents + [ (renpy.TEXT_TAG, u"/rb"), ] else: return contents config.custom_text_tags["r1"] = ruby_tag1 config.custom_text_tags["r2"] = ruby_tag2
バックログでスルーされないよう設定
screens.rpy
define gui.history_allow_tags = ("r1", "r2", "rb","rt","alt","noalt","i", "k")
テスト
script.rpy
”{r2}傘{/r2}{r1}かさ{/r1}”