working on --optimize-text 3

This commit is contained in:
Lu Wang 2013-12-21 22:47:54 +08:00
parent abf5ad99aa
commit 11b488e236
3 changed files with 22 additions and 9 deletions

2
TODO
View File

@ -1,3 +1,5 @@
save width in Textline, create new <div> in the middle
add async to <script>
link in outline: dest-detail vs hashtag

View File

@ -380,7 +380,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
}
//else no solution
}
// else force new line
// else: different rotation: force new line
if(merged)
{

View File

@ -188,17 +188,28 @@ void HTMLTextLine::dump_text(ostream & out)
// finally, just dump it
if(!done)
{
long long wid = all_manager.whitespace.install(target, &actual_offset);
if(!equal(actual_offset, 0))
if(param.optimize_text < 3)
{
if(is_positive(-actual_offset))
last_text_pos_with_negative_offset = cur_text_idx;
long long wid = all_manager.whitespace.install(target, &actual_offset);
if(!equal(actual_offset, 0))
{
if(is_positive(-actual_offset))
last_text_pos_with_negative_offset = cur_text_idx;
double threshold = state_iter1->em_size() * (param.space_threshold);
out << "<span class=\"" << CSS::WHITESPACE_CN
<< ' ' << CSS::WHITESPACE_CN << wid << "\">" << (target > (threshold - EPS) ? " " : "") << "</span>";
}
}
else
{
// aggressive optimization
double threshold = state_iter1->em_size() * (param.space_threshold);
out << "<span class=\"" << CSS::WHITESPACE_CN
<< ' ' << CSS::WHITESPACE_CN << wid << "\">" << (target > (threshold - EPS) ? " " : "") << "</span>";
if(target > threshold)
out << ' ';
actual_offset = target;
}
}
}