Skip to content

Fix Windows font selection in smoke tests - #107

Open
Saket7002 wants to merge 1 commit into
eellak:developmentfrom
Saket7002:fix/windows-unicode-font
Open

Fix Windows font selection in smoke tests#107
Saket7002 wants to merge 1 commit into
eellak:developmentfrom
Saket7002:fix/windows-unicode-font

Conversation

@Saket7002

Copy link
Copy Markdown

Summary

Fixes #106.

The smoke-test PDF helper used a Linux-only DejaVu Sans path:

/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf

On Windows, that path does not exist, causing the test helper to fall back to Helvetica, which cannot reliably render Greek Unicode text.

This change:

  • keeps the existing DejaVu Sans path for Linux
  • adds the Windows system Arial font as a fallback
  • uses the discovered Unicode-capable font for both PIL and FPDF
  • removes the deprecated uni=True FPDF usage
  • keeps the change limited to tests/test_pipeline_smoke.py

Testing

  • git diff --check passes
  • Verified the font helper selects C:\Windows\Fonts\arial.ttf on Windows
  • Verified the patched _write_pdf() helper successfully generates a PDF containing Greek text (Καλημέρα κόσμε)
  • The full smoke-test module could not be executed because docling and glossapi_rs_cleaner are not installed in the local environment

Copy link
Copy Markdown

I tested this PR on the Windows 10 environment where #106 was originally reproduced.

Environment:

  • Python 3.11.9
  • PyTorch 2.5.1+cu121
  • CUDA available on NVIDIA GeForce GTX 960M
  • docling and both Rust extensions installed

With PR #107 checked out, the original FPDF Unicode/Helvetica failures are gone. The full smoke-test module now gets further and reports 2 passed, 1 failed, 1 skipped instead of the original 1 passed, 2 failed, 1 skipped.

The remaining failure is in test_docling_math_pipeline_with_mixed_pdfs at:

assert greek_row["greek_badness_score"] > 60
E assert 55.556 > 60

That looks separate from the font-selection bug. I also tried Segoe UI Symbol (seguisym.ttf) locally because Arial warns that it is missing the subscript-zero glyph. Segoe UI Symbol removes that missing-glyph warning, but the greek_badness_score remains exactly 55.556, so changing the Windows fallback font does not resolve the remaining assertion.

So from my Windows reproduction, this PR does fix the original issue #106, while exposing a separate environment-sensitive smoke-test failure further downstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants