diff --git a/src/HTMLTextLine.cc b/src/HTMLTextLine.cc
index 51cd2d8..5d229eb 100644
--- a/src/HTMLTextLine.cc
+++ b/src/HTMLTextLine.cc
@@ -50,7 +50,7 @@ void HTMLTextLine::append_offset(double width)
if((!offsets.empty()) && (offsets.back().start_idx == text.size()))
offsets.back().width += width;
else
- offsets.emplace_back(text.size(), width);
+ offsets.emplace_back(text.size(), width, this->width);
this->width += width;
}
@@ -472,16 +472,15 @@ void HTMLTextLine::optimize_normal(std::vector & lines)
// for optimize-text == 3
void HTMLTextLine::optimize_aggressive(std::vector & 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)
{
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
}
/*
diff --git a/src/HTMLTextLine.h b/src/HTMLTextLine.h
index 782b491..8e9b72e 100644
--- a/src/HTMLTextLine.h
+++ b/src/HTMLTextLine.h
@@ -66,11 +66,12 @@ public:
};
struct Offset {
- Offset(size_t size_idx, double width)
- :start_idx(size_idx),width(width)
+ Offset(size_t size_idx, double width, double start_width)
+ :start_idx(size_idx),width(width),start_width(start_width)
{ }
size_t start_idx; // should put this Offset right before text[start_idx];
double width;
+ double start_width; // the width of the line before this offset
};
void append_unicodes(const Unicode * u, int l, double width);