diff --git a/src/HTMLRenderer/LineBuffer.cc b/src/HTMLRenderer/LineBuffer.cc
index 3617fd1..6ad6eb3 100644
--- a/src/HTMLRenderer/LineBuffer.cc
+++ b/src/HTMLRenderer/LineBuffer.cc
@@ -78,13 +78,14 @@ void HTMLRenderer::LineBuffer::flush(void)
max_ascent = max(max_ascent, s.ascent * s.draw_font_size);
}
- // TODO: class for height ?
ostream & out = renderer->html_fout;
out << "
";
+ << _round(y) << "px;"
+ << "\""
+ << " class=\"l t" << tm_id
+ << " h" << renderer->install_height(max_ascent)
+ << "\">";
auto cur_state_iter = states.begin();
auto cur_offset_iter = offsets.begin();
diff --git a/src/HTMLRenderer/export.cc b/src/HTMLRenderer/export.cc
index ce1db43..4b8193f 100644
--- a/src/HTMLRenderer/export.cc
+++ b/src/HTMLRenderer/export.cc
@@ -135,4 +135,9 @@ void HTMLRenderer::export_rise (long long rise_id, double rise)
css_fout << ".r" << rise_id << "{top:" << _round(-rise) << "px;}" << endl;
}
+void HTMLRenderer::export_height (long long height_id, double height)
+{
+ css_fout << ".h" << height_id << "{height:" << _round(height) << "px;}" << endl;
+}
+
}
diff --git a/src/HTMLRenderer/install.cc b/src/HTMLRenderer/install.cc
index cb3e612..81de4bd 100644
--- a/src/HTMLRenderer/install.cc
+++ b/src/HTMLRenderer/install.cc
@@ -293,4 +293,18 @@ long long HTMLRenderer::install_rise(double rise)
return new_rise_id;
}
+long long HTMLRenderer::install_height(double height)
+{
+ auto iter = height_map.lower_bound(height - EPS);
+ if((iter != height_map.end()) && (abs(iter->first - height) < EPS))
+ {
+ return iter->second;
+ }
+
+ long long new_height_id = height_map.size();
+ height_map.insert(make_pair(height, new_height_id));
+ export_height(new_height_id, height);
+ return new_height_id;
+}
+
} // namespace pdf2htmlEX
diff --git a/src/include/HTMLRenderer.h b/src/include/HTMLRenderer.h
index dc76479..5625a9e 100644
--- a/src/include/HTMLRenderer.h
+++ b/src/include/HTMLRenderer.h
@@ -51,6 +51,7 @@
* c - Color
* _ - white space
* r - Rise
+ * h - Height
*
*/
@@ -148,6 +149,7 @@ class HTMLRenderer : public OutputDev
long long install_color(const GfxRGB * rgb);
long long install_whitespace(double ws_width, double & actual_width);
long long install_rise(double rise);
+ long long install_height(double height);
////////////////////////////////////////////////////
// export css styles
@@ -167,7 +169,7 @@ class HTMLRenderer : public OutputDev
void export_color(long long color_id, const GfxRGB * rgb);
void export_whitespace(long long ws_id, double ws_width);
void export_rise(long long rise_id, double rise);
-
+ void export_height(long long height_id, double height);
// depending on single-html, to embed the content or add a link to it
// "type": specify the file type, usually it's the suffix, in which case this parameter could be ""
@@ -360,6 +362,7 @@ class HTMLRenderer : public OutputDev
std::unordered_map color_map;
std::map whitespace_map;
std::map rise_map;
+ std::map height_map;
int image_count;