Skip to content

Commit

Permalink
Prevented calcSuppFontInfo from running with offscreen text
Browse files Browse the repository at this point in the history
  • Loading branch information
Balearica committed Oct 28, 2024
1 parent 1c5eed4 commit 0f16bb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/fontSupp.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export const calcSuppFontInfo = async (ocrArr) => {
if (word.font) {
if (skipFonts.has(word.font)) {
continue;
// Printing words off screen is a common method of hiding text in PDFs.
} else if (word.bbox.left < 0 || word.bbox.top < 0 || word.bbox.right > page.dims.width || word.bbox.bottom > page.dims.height) {
continue;
} else if (!calcFonts.has(word.font)) {
const sansSerifUnknown = determineSansSerif(word.font) === 'Default';
if (sansSerifUnknown || !word.visualCoords) {
Expand Down

0 comments on commit 0f16bb5

Please sign in to comment.