From 75c85903bc8c35bd0f6fcd667d68e2cea812fee6 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sat, 22 Sep 2012 12:41:53 +0800 Subject: [PATCH] rename fontpreprocessor to preprocessor --- CMakeLists.txt | 4 ++-- src/HTMLRenderer/general.cc | 2 +- src/HTMLRenderer/text.cc | 2 +- src/{FontPreprocessor.cc => Preprocessor.cc} | 15 ++++++++------- src/include/HTMLRenderer.h | 4 ++-- .../{FontPreprocessor.h => Preprocessor.h} | 16 +++++++++------- 6 files changed, 23 insertions(+), 20 deletions(-) rename src/{FontPreprocessor.cc => Preprocessor.cc} (79%) rename src/include/{FontPreprocessor.h => Preprocessor.h} (75%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8b64f3..10698e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,8 +125,8 @@ add_executable(pdf2htmlEX src/ffw.c src/include/BackgroundRenderer.h src/BackgroundRenderer.cc - src/include/FontPreprocessor.h - src/FontPreprocessor.cc + src/include/Preprocessor.h + src/Preprocessor.cc src/include/util.h src/util.cc src/include/ArgParser.h diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc index 683da65..0b129c0 100644 --- a/src/HTMLRenderer/general.cc +++ b/src/HTMLRenderer/general.cc @@ -69,7 +69,7 @@ void HTMLRenderer::process(PDFDoc *doc) cerr << "Preprocessing: "; for(int i = param->first_page; i <= param->last_page ; ++i) { - doc->displayPage(&font_preprocessor, i, param->h_dpi, param->v_dpi, + doc->displayPage(&preprocessor, i, param->h_dpi, param->v_dpi, 0, true, false, false, nullptr, nullptr, nullptr, nullptr); cerr << "." << flush; diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc index be07a54..eb9522c 100644 --- a/src/HTMLRenderer/text.cc +++ b/src/HTMLRenderer/text.cc @@ -195,7 +195,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo if(get_metric_only) return; - used_map = font_preprocessor.get_code_map(hash_ref(font->getID())); + used_map = preprocessor.get_code_map(hash_ref(font->getID())); /* * Step 1 diff --git a/src/FontPreprocessor.cc b/src/Preprocessor.cc similarity index 79% rename from src/FontPreprocessor.cc rename to src/Preprocessor.cc index b5ffc1b..b984b1d 100644 --- a/src/FontPreprocessor.cc +++ b/src/Preprocessor.cc @@ -1,5 +1,5 @@ /* - * FontPreprocessor.h + * Preprocessor.cc * * Check used codes for each font * @@ -12,23 +12,24 @@ #include #include -#include "FontPreprocessor.h" +#include "Preprocessor.h" #include "util.h" namespace pdf2htmlEX { -FontPreprocessor::FontPreprocessor(void) - : cur_font_id(0) +Preprocessor::Preprocessor(void) + : OutputDev() + , cur_font_id(0) , cur_code_map(nullptr) { } -FontPreprocessor::~FontPreprocessor(void) +Preprocessor::~Preprocessor(void) { for(auto iter = code_maps.begin(); iter != code_maps.end(); ++iter) delete [] iter->second; } -void FontPreprocessor::drawChar(GfxState *state, double x, double y, +void Preprocessor::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen) @@ -56,7 +57,7 @@ void FontPreprocessor::drawChar(GfxState *state, double x, double y, cur_code_map[code] = 1; } -const char * FontPreprocessor::get_code_map (long long font_id) const +const char * Preprocessor::get_code_map (long long font_id) const { auto iter = code_maps.find(font_id); return (iter == code_maps.end()) ? nullptr : (iter->second); diff --git a/src/include/HTMLRenderer.h b/src/include/HTMLRenderer.h index 8d97b11..7e0e5ad 100644 --- a/src/include/HTMLRenderer.h +++ b/src/include/HTMLRenderer.h @@ -26,7 +26,7 @@ #include "Param.h" #include "util.h" -#include "FontPreprocessor.h" +#include "Preprocessor.h" /* * Naming Convention @@ -358,7 +358,7 @@ class HTMLRenderer : public OutputDev int32_t * cur_mapping; char ** cur_mapping2; int * width_list; - FontPreprocessor font_preprocessor; + Preprocessor preprocessor; // for string formatting string_formatter str_fmt; diff --git a/src/include/FontPreprocessor.h b/src/include/Preprocessor.h similarity index 75% rename from src/include/FontPreprocessor.h rename to src/include/Preprocessor.h index bfdf4fd..0a51186 100644 --- a/src/include/FontPreprocessor.h +++ b/src/include/Preprocessor.h @@ -1,5 +1,7 @@ /* - * FontPreprocessor.h + * Preprocessor.h + * + * PDF is so complicated that we have to scan twice * * Check used codes for each font * @@ -8,8 +10,8 @@ */ -#ifndef FONTPREPROCESSOR_H__ -#define FONTPREPROCESSOR_H__ +#ifndef PREPROCESSOR_H__ +#define PREPROCESSOR_H__ #include @@ -17,10 +19,10 @@ namespace pdf2htmlEX { -class FontPreprocessor : public OutputDev { +class Preprocessor : public OutputDev { public: - FontPreprocessor(void); - virtual ~FontPreprocessor(void); + Preprocessor(void); + virtual ~Preprocessor(void); virtual GBool upsideDown() { return gFalse; } virtual GBool useDrawChar() { return gTrue; } @@ -42,4 +44,4 @@ protected: } // namespace pdf2htmlEX -#endif //FONTPREPROCESSOR_H__ +#endif //PREPROCESSOR_H__