diff --git a/tests/test_pixel_full_search.py b/tests/test_pixel_full_search.py index b58785a..2f74e90 100644 --- a/tests/test_pixel_full_search.py +++ b/tests/test_pixel_full_search.py @@ -2,7 +2,7 @@ import numpy as np from PIL import Image, ImageDraw, ImageFont -from unredact.pipeline.font_detect import _find_font_path, _full_search, _fine_search +from unredact.pipeline.font_detect import _find_font_path, _full_search from unredact.pipeline.ocr import OcrChar, OcrLine diff --git a/unredact/pipeline/font_detect.py b/unredact/pipeline/font_detect.py index 63526d7..a5dc561 100644 --- a/unredact/pipeline/font_detect.py +++ b/unredact/pipeline/font_detect.py @@ -19,9 +19,6 @@ CANDIDATE_FONTS: list[str] = [ "DejaVu Sans", ] -# Size range to search (in pixels at rendering DPI) -SIZE_RANGE = range(20, 80, 2) - # If the prior's score is within this factor of the best possible score, # keep the prior. This avoids flipping fonts on noisy lines. PRIOR_BIAS = 1.15 @@ -48,7 +45,7 @@ class FontMatch: font_name: str font_path: Path font_size: int # in pixels - score: float # lower is better (mean absolute error in px) + score: float # higher is better (pixel overlap, 0.0-1.0) def to_pil_font(self) -> ImageFont.FreeTypeFont: return ImageFont.truetype(str(self.font_path), self.font_size)