Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion slip39/layout/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def layout_card(
).square( justify='BR' )

card_top.add_region_proportional(
Text( 'card-title', x1=0, y1=0, x2=1, y2=40/100, bold=True )
Text( 'card-title', x1=0, y1=0, x2=1, y2=40/100, bold=True, align='C' )
)
card_top.add_region_proportional(
Text( 'card-requires', x1=0, y1=40/100, x2=1, y2=66/100, align='C', italic=True )
Expand Down
8 changes: 8 additions & 0 deletions slip39/output_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from fpdf import FPDF, FlexTemplate

from .layout import Region, Text, Image, Box, Coordinate
from .layout.components import layout_card
from .defaults import MM_IN


Expand Down Expand Up @@ -73,3 +74,10 @@ def test_Region():
tpl.render( offsetx = card_size.x * MM_IN, offsety = card_size.y * MM_IN )

#pdf.output( "test.pdf" ) # To view results in test.pdf, uncomment


def test_card_title_centered():
"""The card title is horizontally centered (it is also used, unchanged, on the back of the card)."""
card = layout_card( Coordinate( y=2+1/4, x=3+3/8 ), 1/8, 20 )
title = next( e for e in card.elements() if e['name'] == 'card-title' )
assert title['align'] == 'C'
Loading