mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-10-05 19:41:40 +00:00
add class for height
This commit is contained in:
parent
bae60e96c7
commit
7ee0cc0111
@ -78,13 +78,14 @@ void HTMLRenderer::LineBuffer::flush(void)
|
|||||||
max_ascent = max(max_ascent, s.ascent * s.draw_font_size);
|
max_ascent = max(max_ascent, s.ascent * s.draw_font_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: class for height ?
|
|
||||||
ostream & out = renderer->html_fout;
|
ostream & out = renderer->html_fout;
|
||||||
out << "<div style=\"left:"
|
out << "<div style=\"left:"
|
||||||
<< _round(x) << "px;bottom:"
|
<< _round(x) << "px;bottom:"
|
||||||
<< _round(y) << "px;height:"
|
<< _round(y) << "px;"
|
||||||
<< _round(max_ascent) << "px;\" class=\"l t"
|
<< "\""
|
||||||
<< tm_id << "\">";
|
<< " class=\"l t" << tm_id
|
||||||
|
<< " h" << renderer->install_height(max_ascent)
|
||||||
|
<< "\">";
|
||||||
|
|
||||||
auto cur_state_iter = states.begin();
|
auto cur_state_iter = states.begin();
|
||||||
auto cur_offset_iter = offsets.begin();
|
auto cur_offset_iter = offsets.begin();
|
||||||
|
@ -135,4 +135,9 @@ void HTMLRenderer::export_rise (long long rise_id, double rise)
|
|||||||
css_fout << ".r" << rise_id << "{top:" << _round(-rise) << "px;}" << endl;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -293,4 +293,18 @@ long long HTMLRenderer::install_rise(double rise)
|
|||||||
return new_rise_id;
|
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
|
} // namespace pdf2htmlEX
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
* c<hex> - Color
|
* c<hex> - Color
|
||||||
* _<hex> - white space
|
* _<hex> - white space
|
||||||
* r<hex> - Rise
|
* r<hex> - Rise
|
||||||
|
* h<hex> - Height
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -148,6 +149,7 @@ class HTMLRenderer : public OutputDev
|
|||||||
long long install_color(const GfxRGB * rgb);
|
long long install_color(const GfxRGB * rgb);
|
||||||
long long install_whitespace(double ws_width, double & actual_width);
|
long long install_whitespace(double ws_width, double & actual_width);
|
||||||
long long install_rise(double rise);
|
long long install_rise(double rise);
|
||||||
|
long long install_height(double height);
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// export css styles
|
// export css styles
|
||||||
@ -167,7 +169,7 @@ class HTMLRenderer : public OutputDev
|
|||||||
void export_color(long long color_id, const GfxRGB * rgb);
|
void export_color(long long color_id, const GfxRGB * rgb);
|
||||||
void export_whitespace(long long ws_id, double ws_width);
|
void export_whitespace(long long ws_id, double ws_width);
|
||||||
void export_rise(long long rise_id, double rise);
|
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
|
// 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 ""
|
// "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<GfxRGB, long long, GfxRGB_hash, GfxRGB_equal> color_map;
|
std::unordered_map<GfxRGB, long long, GfxRGB_hash, GfxRGB_equal> color_map;
|
||||||
std::map<double, long long> whitespace_map;
|
std::map<double, long long> whitespace_map;
|
||||||
std::map<double, long long> rise_map;
|
std::map<double, long long> rise_map;
|
||||||
|
std::map<double, long long> height_map;
|
||||||
|
|
||||||
int image_count;
|
int image_count;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user