fix: Docx segmented font title recognition (#2949)

This commit is contained in:
shaohuzhang1 2025-04-22 14:51:45 +08:00 committed by GitHub
parent f1d043f67b
commit 0c14306889
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,11 +112,7 @@ def get_image_id_func():
title_font_list = [
[36, 100],
[26, 36],
[24, 26],
[22, 24],
[18, 22],
[16, 18]
[30, 36]
]
@ -130,7 +126,7 @@ def get_title_level(paragraph: Paragraph):
if len(paragraph.runs) == 1:
font_size = paragraph.runs[0].font.size
pt = font_size.pt
if pt >= 16:
if pt >= 30:
for _value, index in zip(title_font_list, range(len(title_font_list))):
if pt >= _value[0] and pt < _value[1]:
return index + 1