mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix kneeboard notes bug
This commit is contained in:
parent
b2c38f454f
commit
06f51573e1
@ -171,14 +171,14 @@ class KneeboardPageWriter:
|
|||||||
def wrap_line_with_font(
|
def wrap_line_with_font(
|
||||||
inputstr: str, max_width: int, font: ImageFont.FreeTypeFont
|
inputstr: str, max_width: int, font: ImageFont.FreeTypeFont
|
||||||
) -> str:
|
) -> str:
|
||||||
if font.getsize(inputstr)[0] <= max_width: # type:ignore[attr-defined]
|
if font.getlength(inputstr) <= max_width:
|
||||||
return inputstr
|
return inputstr
|
||||||
tokens = inputstr.split(" ")
|
tokens = inputstr.split(" ")
|
||||||
output = ""
|
output = ""
|
||||||
segments = []
|
segments = []
|
||||||
for token in tokens:
|
for token in tokens:
|
||||||
combo = output + " " + token
|
combo = output + " " + token
|
||||||
if font.getsize(combo)[0] > max_width: # type:ignore[attr-defined]
|
if font.getlength(combo) > max_width:
|
||||||
segments.append(output + "\n")
|
segments.append(output + "\n")
|
||||||
output = token
|
output = token
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user