MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / check_length

Function check_length

utils/wei_utils.py:1255–1266  ·  view source on GitHub ↗
(text, target, width, height)

Source from the content-addressed store, hash-verified

1253 suggestion_flag = False
1254 new_section_outline = copy.deepcopy(result_json)
1255 def check_length(text, target, width, height):
1256 text_length = equivalent_length_with_forced_breaks(
1257 text,
1258 width,
1259 font_size_points=60,
1260 )
1261 if text_length - target > 100:
1262 return f'Text too long, shrink by {text_length - target} characters.'
1263 elif target - text_length > 100:
1264 return f'Text too short, expand by {target - text_length} characters.'
1265 else:
1266 return NOT_CHANGE
1267
1268 if 'num_chars' in original_section_outline:
1269 new_section_outline['suggestions'] = check_length(

Callers 1

Tested by

no test coverage detected