mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
Rename class CoveredTextHandler to CoveredTextDetector
This commit is contained in:
parent
9bd1eb2c2a
commit
d0348b3974
@ -11,19 +11,19 @@
|
||||
|
||||
namespace pdf2htmlEX {
|
||||
|
||||
void CoveredTextHandler::reset()
|
||||
void CoveredTextDetector::reset()
|
||||
{
|
||||
char_bboxes.clear();
|
||||
chars_covered.clear();
|
||||
}
|
||||
|
||||
void CoveredTextHandler::add_char_bbox(double * bbox)
|
||||
void CoveredTextDetector::add_char_bbox(double * bbox)
|
||||
{
|
||||
char_bboxes.insert(char_bboxes.end(), bbox, bbox + 4);
|
||||
chars_covered.push_back(false);
|
||||
}
|
||||
|
||||
void CoveredTextHandler::add_char_bbox_clipped(double * bbox, bool patially)
|
||||
void CoveredTextDetector::add_char_bbox_clipped(double * bbox, bool patially)
|
||||
{
|
||||
char_bboxes.insert(char_bboxes.end(), bbox, bbox + 4);
|
||||
chars_covered.push_back(true);
|
||||
@ -31,7 +31,7 @@ void CoveredTextHandler::add_char_bbox_clipped(double * bbox, bool patially)
|
||||
add_non_char_bbox(bbox, chars_covered.size() - 1);
|
||||
}
|
||||
|
||||
void CoveredTextHandler::add_non_char_bbox(double * bbox, int index)
|
||||
void CoveredTextDetector::add_non_char_bbox(double * bbox, int index)
|
||||
{
|
||||
if (index < 0)
|
||||
index = chars_covered.size();
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Author: duanyao
|
||||
*/
|
||||
|
||||
#ifndef COVEREDTEXTHANDLER_H__
|
||||
#define COVEREDTEXTHANDLER_H__
|
||||
#ifndef COVEREDTEXTDETECTOR_H__
|
||||
#define COVEREDTEXTDETECTOR_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -15,7 +15,7 @@ namespace pdf2htmlEX {
|
||||
/**
|
||||
* Detect characters that are covered by non-char graphics on a page.
|
||||
*/
|
||||
class CoveredTextHandler
|
||||
class CoveredTextDetector
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
// Does not fail on out-of-bound conditions, but return false.
|
||||
bool is_char_covered(int index);
|
||||
// Currently drawn char (glyph) count in current page.
|
||||
int get_char_count() { return (int)covered_text_handler.get_chars_covered().size(); }
|
||||
int get_char_count() { return (int)covered_text_detecor.get_chars_covered().size(); }
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////
|
||||
@ -364,7 +364,7 @@ protected:
|
||||
|
||||
static const std::string MANIFEST_FILENAME;
|
||||
|
||||
CoveredTextHandler covered_text_handler;
|
||||
CoveredTextDetector covered_text_detecor;
|
||||
DrawingTracer tracer;
|
||||
};
|
||||
|
||||
|
@ -80,11 +80,11 @@ HTMLRenderer::HTMLRenderer(const Param & param)
|
||||
all_manager.bottom .set_eps(EPS);
|
||||
|
||||
tracer.on_char_drawn =
|
||||
[this](double * box) { covered_text_handler.add_char_bbox(box); };
|
||||
[this](double * box) { covered_text_detecor.add_char_bbox(box); };
|
||||
tracer.on_char_clipped =
|
||||
[this](double * box, bool partial) { covered_text_handler.add_char_bbox_clipped(box, partial); };
|
||||
[this](double * box, bool partial) { covered_text_detecor.add_char_bbox_clipped(box, partial); };
|
||||
tracer.on_non_char_drawn =
|
||||
[this](double * box) { covered_text_handler.add_non_char_bbox(box); };
|
||||
[this](double * box) { covered_text_detecor.add_non_char_bbox(box); };
|
||||
}
|
||||
|
||||
HTMLRenderer::~HTMLRenderer()
|
||||
@ -192,7 +192,7 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state)
|
||||
void HTMLRenderer::startPage(int pageNum, GfxState *state, XRef * xref)
|
||||
#endif
|
||||
{
|
||||
covered_text_handler.reset();
|
||||
covered_text_detecor.reset();
|
||||
tracer.reset(state);
|
||||
|
||||
this->pageNum = pageNum;
|
||||
|
@ -153,7 +153,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
|
||||
|
||||
bool HTMLRenderer::is_char_covered(int index)
|
||||
{
|
||||
auto covered = covered_text_handler.get_chars_covered();
|
||||
auto covered = covered_text_detecor.get_chars_covered();
|
||||
if (index < 0 || index >= (int)covered.size())
|
||||
{
|
||||
std::cerr << "Warning: HTMLRenderer::is_char_covered: index out of bound: "
|
||||
|
Loading…
Reference in New Issue
Block a user