a900e823325cfa5848ef100781e020f3d1a683e5,trdg/computer_text_generator.py,,_generate_horizontal_text,#,19
Before Change
def _generate_horizontal_text(text, font, text_color, font_size, space_width, fit):
image_font = ImageFont.truetype(font=font, size=font_size)
words = text.split(" ")
space_width = image_font.getsize(" ")[0] * space_width
words_width = [image_font.getsize(w)[0] for w in words]
text_width = sum(words_width) + int(space_width) * (len(words) - 1)
After Change
def _generate_horizontal_text(text, font, text_color, font_size, space_width, character_spacing, fit):
image_font = ImageFont.truetype(font=font, size=font_size)
space_width = int(image_font.getsize(" ")[0] * space_width)
char_widths = [
image_font.getsize(c)[0] if c != " " else space_width for c in text
]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 2
Instances
Project Name: Belval/TextRecognitionDataGenerator
Commit Name: a900e823325cfa5848ef100781e020f3d1a683e5
Time: 2019-11-24
Author: edouard@belval.org
File Name: trdg/computer_text_generator.py
Class Name:
Method Name: _generate_horizontal_text
Project Name: PyThaiNLP/pythainlp
Commit Name: dff9fec2881dfb43222ad1c84aa95fd8c42715c8
Time: 2019-07-25
Author: wannaphong@yahoo.com
File Name: pythainlp/corpus/__init__.py
Class Name:
Method Name: _download
Project Name: 10XGenomics/cellranger
Commit Name: 8b9ffbfdec1a9b6daf7b47f63fc2656e3e267c25
Time: 2019-02-20
Author: nlhepler@gmail.com
File Name: mro/stages/aggregator/check_molecule_info_version/__init__.py
Class Name:
Method Name: split