Skip to content

Commit 31bb22f

Browse files
committed
feat: tearoff layout improvements
1 parent 83b3be4 commit 31bb22f

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

bullet/documents/generators/tearoff.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def __init__(self, problem_pdf_root: Path, primary_language: str):
3838

3939
self.statements_per_page = round(297 / statement_height)
4040
self.statement_height = 297 / self.statements_per_page
41-
print(self.statement_height, self.statements_per_page)
4241

4342
register_font("IBMPlexMono-Regular")
4443
register_font("IBMPlexMono-Bold")
@@ -168,7 +167,7 @@ def _place_stamp(
168167

169168
bar_h = 8
170169
start_x = (offset_y + 5) * mm
171-
start_y = (-210 + self.stamp_width - 2) * mm
170+
start_y = (-210 + self.stamp_width + 2) * mm
172171
max_width = (self.statement_height - 10) * mm
173172
max_height = (self.stamp_width - 2 - 5) * mm
174173

@@ -195,18 +194,6 @@ def _place_stamp(
195194
inverted = tearoff.team.venue.shortcode[-1] == "S"
196195

197196
font_size = max_height - (bar_h + 0.5) * mm
198-
# canvas.setFillGray(0)
199-
# if inverted:
200-
# canvas.rect(
201-
# start_x,
202-
# start_y,
203-
# max_width - max_height - 2 * mm,
204-
# -font_size,
205-
# fill=True,
206-
# stroke=False,
207-
# )
208-
# canvas.setFillGray(1)
209-
210197
spacing = 2 * mm if inverted else 1 * mm
211198

212199
text = canvas.beginText()
@@ -253,16 +240,14 @@ def _place_stamp(
253240
start_y - max_height,
254241
)
255242

256-
canvas.restoreState()
257-
258243
text = canvas.beginText()
259-
text.setTextOrigin(12 * mm, (offset_y + 5) * mm)
260-
text.setFont("LinLibertine-Bold", 10)
261-
text.textOut(f"{tearoff.team.code}: ")
262-
text.setFont("LinLibertine-Regular", 10)
244+
text.setTextOrigin(start_x, start_y - max_height - 8)
245+
text.setFont("IBMPlexMono-Regular", 6)
263246
text.textOut(tearoff.team.display_name_short)
264247
canvas.drawText(text)
265248

249+
canvas.restoreState()
250+
266251
def add_statements_to_page(self, page: Page, tearoffs: Iterable[Tearoff | None]):
267252
for i, tearoff in enumerate(tearoffs):
268253
if tearoff is None:

bullet/users/models/contestants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ def display_name(self):
119119
@property
120120
def display_name_short(self):
121121
if self.name:
122-
return shorten(self.name, 75)
122+
return shorten(self.name, 55)
123123
if self.in_school_symbol:
124-
return f"{shorten(str(self.school), 75)} {self.in_school_symbol}"
125-
return shorten(str(self.school), 75)
124+
return f"{shorten(str(self.school), 55)} {self.in_school_symbol}"
125+
return shorten(str(self.school), 55)
126126

127127
@property
128128
def contact_phone_pretty(self):

0 commit comments

Comments
 (0)