Rename weave -> graft

This commit is contained in:
James R. Barlow
2019-06-13 01:16:56 -07:00
parent 5ee45411c9
commit 51ed381bfc
4 changed files with 6 additions and 7 deletions
@@ -90,7 +90,7 @@ def strip_invisible_text(pdf, page):
page.Contents = pikepdf.Stream(pdf, content_stream)
def _weave_layers_graft(
def _graft_text_layer(
*, pdf_base, page_num, text, font, font_key, procset, rotation, strip_old_text, log
):
"""Insert the text layer from text page 0 on to pdf_base at page_num"""
@@ -186,7 +186,7 @@ class OcrGrafter:
self.font, self.font_key = None, None
self.pdfinfo = context.pdfinfo
self.output_file = context.get_path('weave_layers.pdf')
self.output_file = context.get_path('graft_layers.pdf')
self.procset = self.pdf_base.make_indirect(
pikepdf.Object.parse(b'[ /PDF /Text /ImageB /ImageC /ImageI ]')
@@ -228,7 +228,7 @@ class OcrGrafter:
if text and self.font:
# Graft the text layer onto this page, whether new or old
strip_old = self.context.options.redo_ocr
_weave_layers_graft(
_graft_text_layer(
pdf_base=self.pdf_base,
page_num=pageno + 1,
text=text,
+1 -1
View File
@@ -348,7 +348,7 @@ def get_orientation_correction(preview, page_context):
correction to rotation.
When we draw the real page for OCR, we rotate it by the CCW correction,
which points it (hopefully) upright. _weave.py takes care of the orienting
which points it (hopefully) upright. _graft.py takes care of the orienting
the image and text layers.
"""
+1 -2
View File
@@ -59,7 +59,7 @@ from ._validation import (
create_input_file,
report_output_file_size,
)
from ._weave import OcrGrafter
from ._graft import OcrGrafter
from .exceptions import ExitCode, ExitCodeException
from .exec import qpdf
from .helpers import available_cpu_count
@@ -289,7 +289,6 @@ def exec_concurrent(context):
copy_final(text, context.options.sidecar, context)
# Merge layers to one single pdf
# pdf = weave_layers(layers, context)
pdf = ocrgraft.finalize()
# PDF/A and metadata
+1 -1
View File
@@ -25,7 +25,7 @@ import pikepdf
os_environ = pytest.helpers.os_environ
def test_no_glyphless_weave(resources, outdir):
def test_no_glyphless_graft(resources, outdir):
pdf = pikepdf.open(resources / 'francais.pdf')
pdf_aspect = pikepdf.open(resources / 'aspect.pdf')
pdf_cmyk = pikepdf.open(resources / 'cmyk.pdf')