mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix kneeboard generation following Pillow update.
We don't have tests for this, so dependabot broke it and we didn't notice.
This commit is contained in:
parent
32b3793082
commit
dfb74cfd48
@ -73,18 +73,10 @@ class KneeboardPageWriter:
|
|||||||
# more information in the comm ladder (the latter of which we should
|
# more information in the comm ladder (the latter of which we should
|
||||||
# probably do), we'll need to split some of this information off into a
|
# probably do), we'll need to split some of this information off into a
|
||||||
# second page.
|
# second page.
|
||||||
self.title_font = ImageFont.truetype(
|
self.title_font = ImageFont.truetype("arial.ttf", 32)
|
||||||
"arial.ttf", 32, layout_engine=ImageFont.LAYOUT_BASIC
|
self.heading_font = ImageFont.truetype("arial.ttf", 24)
|
||||||
)
|
self.content_font = ImageFont.truetype("arial.ttf", 16)
|
||||||
self.heading_font = ImageFont.truetype(
|
self.table_font = ImageFont.truetype("resources/fonts/Inconsolata.otf", 20)
|
||||||
"arial.ttf", 24, layout_engine=ImageFont.LAYOUT_BASIC
|
|
||||||
)
|
|
||||||
self.content_font = ImageFont.truetype(
|
|
||||||
"arial.ttf", 16, layout_engine=ImageFont.LAYOUT_BASIC
|
|
||||||
)
|
|
||||||
self.table_font = ImageFont.truetype(
|
|
||||||
"resources/fonts/Inconsolata.otf", 20, layout_engine=ImageFont.LAYOUT_BASIC
|
|
||||||
)
|
|
||||||
self.draw = ImageDraw.Draw(self.image)
|
self.draw = ImageDraw.Draw(self.image)
|
||||||
self.page_margin = page_margin
|
self.page_margin = page_margin
|
||||||
self.x = page_margin
|
self.x = page_margin
|
||||||
@ -116,7 +108,8 @@ class KneeboardPageWriter:
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.draw.text(self.position, text, font=font, fill=fill)
|
self.draw.text(self.position, text, font=font, fill=fill)
|
||||||
width, height = self.draw.textsize(text, font=font)
|
left, top, right, bottom = self.draw.textbbox((0, 0), text, font=font)
|
||||||
|
height = bottom - top
|
||||||
self.y += height + self.line_spacing
|
self.y += height + self.line_spacing
|
||||||
|
|
||||||
def title(self, title: str) -> None:
|
def title(self, title: str) -> None:
|
||||||
@ -330,9 +323,7 @@ class BriefingPage(KneeboardPage):
|
|||||||
self.start_time = start_time
|
self.start_time = start_time
|
||||||
self.dark_kneeboard = dark_kneeboard
|
self.dark_kneeboard = dark_kneeboard
|
||||||
self.flight_plan_font = ImageFont.truetype(
|
self.flight_plan_font = ImageFont.truetype(
|
||||||
"resources/fonts/Inconsolata.otf",
|
"resources/fonts/Inconsolata.otf", 16
|
||||||
16,
|
|
||||||
layout_engine=ImageFont.LAYOUT_BASIC,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def write(self, path: Path) -> None:
|
def write(self, path: Path) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user