Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small caps case #322

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pdf2zh/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def vflag(font: str, char: str): # 匹配公式(和角标)字体
pstk.append(Paragraph(child.y0, child.x0, child.x0, child.x0, child.size, False))
if not cur_v: # 文字入栈
if ( # 根据当前字符修正段落属性
child.size > pstk[-1].size / 0.79 # 1. 当前字符显著比段落字体大
child.size > pstk[-1].size # 1. 当前字符显著比段落字体大
or len(sstk[-1].strip()) == 1 # 2. 当前字符为段落第二个文字(考虑首字母放大的情况)
) and child.get_text() != " ": # 3. 当前字符不是空格
pstk[-1].y -= child.size - pstk[-1].size # 修正段落初始纵坐标,假设两个不同大小字符的上边界对齐
Expand Down
Loading