Fix incorrect font size kwarg

This commit is contained in:
Matthias Bisping 2023-01-24 10:12:44 +01:00
parent d823ebf7c6
commit c4eeb956ca

View File

@ -779,7 +779,6 @@ class RandomFontPicker:
self.test_image = Image.new("RGB", (200, 200), (255, 255, 255))
self.draw = ImageDraw.Draw(self.test_image)
self.size = size or 11
def looks_foreign(self, font):
# This filters out foreign fonts (e.g. 'Noto Serif Malayalam')
@ -967,10 +966,10 @@ def generate_random_text_block(rectangle: Rectangle, n_sentences=3000) -> Conten
block = TextBlock(
*rectangle.coords,
font=pick_random_font_available_on_system(
size=30, # TODO: De-hardcode font size... Seems to have no effect on top of that
includes=("serif", "sans-serif"),
excludes=("bold", "mono", "italic", "oblique", "cursive"),
),
font_size=30, # TODO: De-hardcode font size... Seems to have no effect on top of that
)
block.content = rectangle.content if isinstance(rectangle, ContentRectangle) else None # TODO: Refactor
block.generate_random_text(rectangle, n_sentences)
@ -990,11 +989,10 @@ def generate_random_caption(rectangle: Rectangle, caption_start, n_sentences=100
*rectangle.coords,
text_generator=CaptionGenerator(caption_start=caption_start),
font=pick_random_font_available_on_system(
size=8,
includes=("italic",),
excludes=("bold", "mono"),
),
font_size=5, # TODO: De-hardcode font size... Seems to have no effect on top of that
font_size=100, # TODO: De-hardcode font size... Seems to have no effect on top of that
)
block.content = rectangle.content if isinstance(rectangle, ContentRectangle) else None # TODO: Refactor
block.generate_random_text(rectangle, n_sentences)
@ -1005,10 +1003,10 @@ def generate_text_block(rectangle: Rectangle, text) -> ContentRectangle:
block = TextBlock(
*rectangle.coords,
font=pick_random_font_available_on_system(
size=30, # TODO: De-hardcode font size... Seems to have no effect on top of that
includes=("serif", "sans-serif", "bold"),
excludes=("mono", "italic", "oblique", "cursive"),
),
font_size=30, # TODO: De-hardcode font size... Seems to have no effect on top of that
)
block.content = rectangle.content if isinstance(rectangle, ContentRectangle) else None # TODO: Refactor
block.put_text(text, rectangle)