mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-07-05 17:48:38 +00:00
rename fontpreprocessor to preprocessor
This commit is contained in:
parent
a5fc093542
commit
75c85903bc
|
@ -125,8 +125,8 @@ add_executable(pdf2htmlEX
|
||||||
src/ffw.c
|
src/ffw.c
|
||||||
src/include/BackgroundRenderer.h
|
src/include/BackgroundRenderer.h
|
||||||
src/BackgroundRenderer.cc
|
src/BackgroundRenderer.cc
|
||||||
src/include/FontPreprocessor.h
|
src/include/Preprocessor.h
|
||||||
src/FontPreprocessor.cc
|
src/Preprocessor.cc
|
||||||
src/include/util.h
|
src/include/util.h
|
||||||
src/util.cc
|
src/util.cc
|
||||||
src/include/ArgParser.h
|
src/include/ArgParser.h
|
||||||
|
|
|
@ -69,7 +69,7 @@ void HTMLRenderer::process(PDFDoc *doc)
|
||||||
cerr << "Preprocessing: ";
|
cerr << "Preprocessing: ";
|
||||||
for(int i = param->first_page; i <= param->last_page ; ++i)
|
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,
|
0, true, false, false,
|
||||||
nullptr, nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr, nullptr);
|
||||||
cerr << "." << flush;
|
cerr << "." << flush;
|
||||||
|
|
|
@ -195,7 +195,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||||
if(get_metric_only)
|
if(get_metric_only)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
used_map = font_preprocessor.get_code_map(hash_ref(font->getID()));
|
used_map = preprocessor.get_code_map(hash_ref(font->getID()));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 1
|
* Step 1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* FontPreprocessor.h
|
* Preprocessor.cc
|
||||||
*
|
*
|
||||||
* Check used codes for each font
|
* Check used codes for each font
|
||||||
*
|
*
|
||||||
|
@ -12,23 +12,24 @@
|
||||||
#include <GfxState.h>
|
#include <GfxState.h>
|
||||||
#include <GfxFont.h>
|
#include <GfxFont.h>
|
||||||
|
|
||||||
#include "FontPreprocessor.h"
|
#include "Preprocessor.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace pdf2htmlEX {
|
namespace pdf2htmlEX {
|
||||||
|
|
||||||
FontPreprocessor::FontPreprocessor(void)
|
Preprocessor::Preprocessor(void)
|
||||||
: cur_font_id(0)
|
: OutputDev()
|
||||||
|
, cur_font_id(0)
|
||||||
, cur_code_map(nullptr)
|
, cur_code_map(nullptr)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
FontPreprocessor::~FontPreprocessor(void)
|
Preprocessor::~Preprocessor(void)
|
||||||
{
|
{
|
||||||
for(auto iter = code_maps.begin(); iter != code_maps.end(); ++iter)
|
for(auto iter = code_maps.begin(); iter != code_maps.end(); ++iter)
|
||||||
delete [] iter->second;
|
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 dx, double dy,
|
||||||
double originX, double originY,
|
double originX, double originY,
|
||||||
CharCode code, int nBytes, Unicode *u, int uLen)
|
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;
|
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);
|
auto iter = code_maps.find(font_id);
|
||||||
return (iter == code_maps.end()) ? nullptr : (iter->second);
|
return (iter == code_maps.end()) ? nullptr : (iter->second);
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "Param.h"
|
#include "Param.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "FontPreprocessor.h"
|
#include "Preprocessor.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Naming Convention
|
* Naming Convention
|
||||||
|
@ -358,7 +358,7 @@ class HTMLRenderer : public OutputDev
|
||||||
int32_t * cur_mapping;
|
int32_t * cur_mapping;
|
||||||
char ** cur_mapping2;
|
char ** cur_mapping2;
|
||||||
int * width_list;
|
int * width_list;
|
||||||
FontPreprocessor font_preprocessor;
|
Preprocessor preprocessor;
|
||||||
|
|
||||||
// for string formatting
|
// for string formatting
|
||||||
string_formatter str_fmt;
|
string_formatter str_fmt;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* FontPreprocessor.h
|
* Preprocessor.h
|
||||||
|
*
|
||||||
|
* PDF is so complicated that we have to scan twice
|
||||||
*
|
*
|
||||||
* Check used codes for each font
|
* Check used codes for each font
|
||||||
*
|
*
|
||||||
|
@ -8,8 +10,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FONTPREPROCESSOR_H__
|
#ifndef PREPROCESSOR_H__
|
||||||
#define FONTPREPROCESSOR_H__
|
#define PREPROCESSOR_H__
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
@ -17,10 +19,10 @@
|
||||||
|
|
||||||
namespace pdf2htmlEX {
|
namespace pdf2htmlEX {
|
||||||
|
|
||||||
class FontPreprocessor : public OutputDev {
|
class Preprocessor : public OutputDev {
|
||||||
public:
|
public:
|
||||||
FontPreprocessor(void);
|
Preprocessor(void);
|
||||||
virtual ~FontPreprocessor(void);
|
virtual ~Preprocessor(void);
|
||||||
|
|
||||||
virtual GBool upsideDown() { return gFalse; }
|
virtual GBool upsideDown() { return gFalse; }
|
||||||
virtual GBool useDrawChar() { return gTrue; }
|
virtual GBool useDrawChar() { return gTrue; }
|
||||||
|
@ -42,4 +44,4 @@ protected:
|
||||||
|
|
||||||
} // namespace pdf2htmlEX
|
} // namespace pdf2htmlEX
|
||||||
|
|
||||||
#endif //FONTPREPROCESSOR_H__
|
#endif //PREPROCESSOR_H__
|
Loading…
Reference in New Issue
Block a user