1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00
This commit is contained in:
Lu Wang 2013-12-26 19:52:03 +08:00
parent f61d447129
commit 2c5ccccf59
2 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ void HTMLTextLine::append_offset(double width)
if((!offsets.empty()) && (offsets.back().start_idx == text.size())) if((!offsets.empty()) && (offsets.back().start_idx == text.size()))
offsets.back().width += width; offsets.back().width += width;
else else
offsets.emplace_back(text.size(), width); offsets.emplace_back(text.size(), width, this->width);
this->width += width; this->width += width;
} }
@ -472,16 +472,15 @@ void HTMLTextLine::optimize_normal(std::vector<HTMLTextLine*> & lines)
// for optimize-text == 3 // for optimize-text == 3
void HTMLTextLine::optimize_aggressive(std::vector<HTMLTextLine*> & lines) void HTMLTextLine::optimize_aggressive(std::vector<HTMLTextLine*> & lines)
{ {
HTMLTextLine *cur_line = this; HTMLLineState original_line_state = line_state;
// break the line if there are a large (positive or negative) shift
// letter space / word space are not taken into consideration (yet)
while(true) while(true)
{ {
lines.push_back(cur_line); lines.push_back(cur_line);
// break the line if there are a large (positive or negative) shift
// letter space / word space are not taken into consideration (yet)
// TODO
} }
/* /*

View File

@ -66,11 +66,12 @@ public:
}; };
struct Offset { struct Offset {
Offset(size_t size_idx, double width) Offset(size_t size_idx, double width, double start_width)
:start_idx(size_idx),width(width) :start_idx(size_idx),width(width),start_width(start_width)
{ } { }
size_t start_idx; // should put this Offset right before text[start_idx]; size_t start_idx; // should put this Offset right before text[start_idx];
double width; double width;
double start_width; // the width of the line before this offset
}; };
void append_unicodes(const Unicode * u, int l, double width); void append_unicodes(const Unicode * u, int l, double width);