feat(wip): flavor text sample
release-tag / release-image (push) Has been cancelled

This commit is contained in:
2026-03-20 17:07:10 +01:00
parent 4da86dd40f
commit 569aa630a2
2 changed files with 62 additions and 10 deletions
+6 -1
View File
@@ -11,4 +11,9 @@ local file used to track next stuff to do
- Fix larger names
- Fix 20
- Fix 19
- Texte du Con Artist avec la bonne couleur; Pareil pour Kikuri
- Texte du Con Artist avec la bonne couleur; Pareil pour Kikuri
## Idées
- 69: demonic cloud -> darkness CSM
+56 -9
View File
@@ -583,15 +583,62 @@ def create_effects(card: Card, effects: list[Effect], height: int, width: int):
effect_types = list(grouped_effects.keys())
if len(grouped_effects) == 1:
group.append(
create_effect_row(
card=card,
effects=grouped_effects[effect_types[0]],
type=effect_types[0],
height=height,
width=width,
),
)
if False:
group.append(
create_effect_row(
card=card,
effects=grouped_effects[effect_types[0]],
type=effect_types[0],
height=height,
width=width,
),
)
else:
group.append(
dw.Line(sx=10, sy=80, ex=width - 10, ey=80, stroke="black", stroke_width=1)
)
group.append(
create_effect_row(
card=card,
effects=grouped_effects[effect_types[0]],
type=effect_types[0],
height=80,
width=width,
),
)
flavor_text = "chouette!"
font_width = 0.5
line_width = (
max(*[len(x) for x in flavor_text.split("\n")], len(flavor_text)) * font_width
)
# Take width in account
font_size = effect_text_size
font_size = min(
font_size, (font_size * 3) - line_width, font_size * width / (line_width or 1)
)
# Take height in account
font_size = min((height) / (flavor_text.count("\n") or 1), font_size)
font_size = max(font_size, 11)
group.append(
dw.Group(
[
dw.Text(
text="Funky!", # TODO: mettre en italique & gris
x=0,
y=(-font_size / 2) * flavor_text.count("\n"),
text_anchor="middle",
fill="black",
font_size=font_size,
font_family="Helvetica",
transform=f"translate({width / 2},{height - 80})"
)
],
transform=f"translate({0},{55})"
)
)
if len(grouped_effects) == 2:
group.append(
dw.Line(sx=10, sy=80, ex=width - 10, ey=80, stroke="black", stroke_width=1)