from pathlib import Path
PAGE_W, PAGE_H = 2480, 3508 # A4相当(300dpi)の目安。必要なら変更
# 縦書き写植(そのまま)
narr1 = "リモコンスイッチを握るソーナの指に力がこもる。"
dia1 = "「わたくし自身が、《彼らの一部》となって」"
narr2 = "一連の動作がスローモーションのコマ送りに変わった。"
dia2 = "「《《自ら解体される》》しか、方法が」"
# ざっくり:ページ+2つの吹き出し+2つのナレ枠
# 位置は後で編集しやすいようにIDを付けてあります(Inkscape等で調整推奨)
svg = f'''<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="
http://www.w3.org/2000/svg" width="{PAGE_W}" height="{PAGE_H}" viewBox="0 0 {PAGE_W} {PAGE_H}">
<defs>
<style>
/* 縦書き */
.tategaki {{
writing-mode: vertical-rl;
text-orientation: upright;
font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
font-size: 64px;
letter-spacing: 0.02em;
fill: #000;
}}
.tategakiSmall {{
writing-mode: vertical-rl;
text-orientation: upright;
font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
font-size: 56px;
letter-spacing: 0.02em;
fill: #000;
}}
.box {{
fill: #fff;
stroke: #000;
stroke-width: 6;
}}
.bubble {{
fill: #fff;
stroke: #000;
stroke-width: 8;
}}
</style>
</defs>
<!-- ページ外枠(必要なければ削除) -->
<rect x="60" y="60" width="{PAGE_W-120}" height="{PAGE_H-120}" fill="#fff" stroke="#000" stroke-width="8"/>
<!-- ナレーション枠1 -->
<g id="narration_1">
<rect class="box" x="1650" y="250" width="650" height="520" rx="20" ry="20"/>
<!-- 縦書きは x,y が「右上」基準っぽくなるので、枠の右側に置く -->
<text class="tategakiSmall" x="2240" y="310">{narr1}</text>
</g>
<!-- 吹き出し1 -->
<g id="bubble_1">
<!-- 楕円っぽい吹き出し -->
<ellipse class="bubble" cx="1770" cy="1220" rx="520" ry="360"/>
<!-- しっぽ(適当な位置。後で調整) -->
<path class="bubble" d="M1450,1480 C1360,1580 1260,1610 1160,1600 C1290,1500 1360,1420 1450,1480 Z"/>
<text class="tategaki" x="1970" y="980">{dia1}</text>
</g>
<!-- ナレーション枠2(コマ送り演出) -->
<g id="narration_2">
<rect class="box" x="200" y="1900" width="720" height="560" rx="20" ry="20"/>
<text class="tategakiSmall" x="860" y="1960">{narr2}</text>
</g>
<!-- 吹き出し2 -->
<g id="bubble_2">
<ellipse class="bubble" cx="1680" cy="2460" rx="560" ry="400"/>
<path class="bubble" d="M1400,2800 C1320,2920 1200,2980 1060,3000 C1240,2860 1320,2700 1400,2800 Z"/>
<text class="tategaki" x="1900" y="2180">{dia2}</text>
</g>
</svg>
'''
Path("page.svg").write_text(svg, encoding="utf-8")
print("Wrote: page.svg")