Skip to content

Commit

Permalink
Merge pull request Byaidu#257 from charles7668/fix/text-too-large
Browse files Browse the repository at this point in the history
Fix bug where the font size could become too large.
  • Loading branch information
Byaidu authored Dec 17, 2024
2 parents 4db6ca8 + fb3b70a commit 72cab51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pdf2zh/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def vflag(font: str, char: str): # 匹配公式(和角标)字体
if ( # 根据当前字符修正段落属性
child.size > pstk[-1].size / 0.79 # 1. 当前字符显著比段落字体大
or len(sstk[-1].strip()) == 1 # 2. 当前字符为段落第二个文字(考虑首字母放大的情况)
):
) and child.get_text() != " ": # 3. 当前字符不是空格
pstk[-1].y -= child.size - pstk[-1].size # 修正段落初始纵坐标,假设两个不同大小字符的上边界对齐
pstk[-1].size = child.size
sstk[-1] += child.get_text()
Expand Down

0 comments on commit 72cab51

Please sign in to comment.