---
scribo/scribo/core/line_info.hh | 31 ++++++++++++++++---------------
scribo/scribo/core/stats.hh | 4 ++--
scribo/scribo/text/merging.hh | 3 ++-
scribo/scribo/text/paragraphs.hh | 20 +++++++++-----------
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/scribo/scribo/core/line_info.hh b/scribo/scribo/core/line_info.hh
index c683be4..949315a 100644
--- a/scribo/scribo/core/line_info.hh
+++ b/scribo/scribo/core/line_info.hh
@@ -1188,22 +1188,23 @@ namespace scribo
// incremented.
++used_comps;
+
// COMPUTE FEATURES DATA
- // if (comp_set(c).has_features())
- // {
- // // Compute boldness
- // boldness.take(comp_set(c).features().boldness);
- // sum2_boldness += mln::math::sqr<float>(comp_set(c).features().boldness);
-
- // // Compute color
- // color_red.take(comp_set(c).features().color.red());
- // color_green.take(comp_set(c).features().color.green());
- // color_blue.take(comp_set(c).features().color.blue());
-
- // sum2_red +=
mln::math::sqr<unsigned>(comp_set(c).features().color.red());
- // sum2_green +=
mln::math::sqr<unsigned>(comp_set(c).features().color.green());
- // sum2_blue +=
mln::math::sqr<unsigned>(comp_set(c).features().color.blue());
- // }
+ if (comp_set(c).has_features())
+ {
+ // Compute boldness
+ boldness.take(comp_set(c).features().boldness);
+ sum2_boldness += mln::math::sqr<float>(comp_set(c).features().boldness);
+
+ // Compute color
+ color_red.take(comp_set(c).features().color.red());
+ color_green.take(comp_set(c).features().color.green());
+ color_blue.take(comp_set(c).features().color.blue());
+
+ sum2_red += mln::math::sqr<unsigned>(comp_set(c).features().color.red());
+ sum2_green += mln::math::sqr<unsigned>(comp_set(c).features().color.green());
+ sum2_blue += mln::math::sqr<unsigned>(comp_set(c).features().color.blue());
+ }
// FIXME: we must guaranty here that the relationship is from
// right to left, otherwise, the space size computed between
diff --git a/scribo/scribo/core/stats.hh b/scribo/scribo/core/stats.hh
index 570325c..bc24044 100644
--- a/scribo/scribo/core/stats.hh
+++ b/scribo/scribo/core/stats.hh
@@ -273,14 +273,14 @@ private:
&& left_distance <= std))
++cluster_index;
- clusters[i] = cluster_index;
+ clusters.push_back(cluster_index);
}
if (nelements > 1
&& data_[i] - data_[i - 1] > std)
++cluster_index;
- clusters[i] = cluster_index;
+ clusters.push_back(cluster_index);
clusters_.clear();
clusters_.reserve(cluster_index);
diff --git a/scribo/scribo/text/merging.hh b/scribo/scribo/text/merging.hh
index 8ee349b..453c6c3 100644
--- a/scribo/scribo/text/merging.hh
+++ b/scribo/scribo/text/merging.hh
@@ -460,7 +460,8 @@ namespace scribo
if (l_cur_height < l_ted_x_height
&& l_cur_height > 0.05f * l_ted_x_height
&& float(l_cur_width) / float(l_cur.card()) < l_ted.char_width()
- && dx < l_ted_cw)
+ && dx < l_ted_cw
+ && l_cur_pmin.row() < l_ted_pmax.row())
{
l_cur.update_type(line::Punctuation);
return true;
diff --git a/scribo/scribo/text/paragraphs.hh b/scribo/scribo/text/paragraphs.hh
index a3ff802..5cb253e 100644
--- a/scribo/scribo/text/paragraphs.hh
+++ b/scribo/scribo/text/paragraphs.hh
@@ -132,18 +132,16 @@ namespace scribo
{
// ror : right neighbor of the right neighbor
const value::int_u16 ror_nbh = right(right_nbh);
- const box2d& ror_line_bbox = lines(ror_nbh).bbox();
+ // const box2d& ror_line_bbox = lines(ror_nbh).bbox();
// If the current line has a ror
if (ror_nbh != right_nbh
&& output(ror_nbh) == right_nbh)
{
// Distance between the current line and the right neighbor
- const float right_distance =
- current_line_bbox.pcenter().row() - right_line_bbox.pcenter().row();
+ const float right_distance = lines(l).meanline() - lines(right_nbh).baseline();
// Distance between the right neighbor and the ror
- const float ror_distance =
- right_line_bbox.pcenter().row() - ror_line_bbox.pcenter().row();
+ const float ror_distance = lines(right_nbh).meanline() -
lines(ror_nbh).baseline();
// ror x_height
const float ror_x_height = lines(ror_nbh).x_height();
@@ -168,7 +166,7 @@ namespace scribo
// If the distance between the two lines is greater than
// the minimum x height of the two lines then we cut the
// link between them
- if (distance > std::min(x_height, right_x_height)
+ if (distance > 2.0f * std::min(x_height, right_x_height)
&& output(right_nbh) == l)
{
output(right_nbh) = right_nbh;
@@ -207,12 +205,12 @@ namespace scribo
if (lol_nbh != left_nbh)
{
// Distance between the current line and its left neighbor
- const float left_distance =
- left_line_bbox.pcenter().row() - current_line_bbox.pcenter().row();
+ const float left_distance = lines(left_nbh).meanline() -
+ lines(l).baseline();
// Distance between the left neighbor and the left
// neighbor of its left neighbor
- const float lol_distance =
- lol_line_bbox.pcenter().row() - left_line_bbox.pcenter().row();
+ const float lol_distance = lines(lol_nbh).meanline() -
+ lines(left_nbh).baseline();
// lol x height
const float lol_x_height = lines(lol_nbh).x_height();
@@ -237,7 +235,7 @@ namespace scribo
// If the distance is greater than the min x height
// between the two lines
- if (distance > std::min(x_height, left_x_height))
+ if (distance > 2.0f * std::min(x_height, left_x_height))
{
output(l) = l;
continue;
--
1.5.6.5