Skip to content

Commit

Permalink
feat(formula-detection): improve formula font detection and adjust el…
Browse files Browse the repository at this point in the history
…ement order

- Add GlosaMath font pattern to formula font detection\n- Reorder paragraph types in paragraph_finder for better processing priority\n- Improve detection of mathematical content in documents
  • Loading branch information
awwaawwa committed Mar 9, 2025
1 parent 1d6b06b commit 96d7a93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions babeldoc/document_il/midend/paragraph_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ def _get_layout(
"formula_caption",
"isolate_formula",
"table_footnote",
"table",
"figure",
"table_caption",
"figure_caption",
"table",
"figure",
"abandon",
"plain text",
"tiny text",
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/styles_and_formulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def is_translatable_formula(self, formula: PdfFormula) -> bool:
return bool(re.match(r"^[0-9, ]+$", text))

def is_formulas_font(self, font_name: str) -> bool:
pattern2 = r"^(Cambria|Cambria-BoldItalic|Cambria-Bold|Cambria-Italic|EUAlbertina.+|NimbusRomNo9L.+)$"
pattern2 = r"^(Cambria|Cambria-BoldItalic|Cambria-Bold|Cambria-Italic|EUAlbertina.+|NimbusRomNo9L.+|GlosaMath.+)$"
if self.translation_config.formular_font_pattern:
pattern = self.translation_config.formular_font_pattern
else:
Expand Down

0 comments on commit 96d7a93

Please sign in to comment.