Fix jalign.

This commit is contained in:
Hermann Kraus 2012-08-12 22:55:56 +02:00
parent 61ebd8ae78
commit 76c3868028

View file

@ -161,6 +161,7 @@ double placement_finder_ng::jalign_offset(double line_width) const
if (jalign_ == J_MIDDLE) return -(line_width / 2.0); if (jalign_ == J_MIDDLE) return -(line_width / 2.0);
if (jalign_ == J_LEFT) return -(layout_.width() / 2.0); if (jalign_ == J_LEFT) return -(layout_.width() / 2.0);
if (jalign_ == J_RIGHT) return (layout_.width() / 2.0) - line_width; if (jalign_ == J_RIGHT) return (layout_.width() / 2.0) - line_width;
return 0;
} }
// Output is centered around (0,0) // Output is centered around (0,0)
@ -287,12 +288,7 @@ bool placement_finder_ng::single_line_placement(vertex_cache &pp, text_upright_e
{ {
real_orientation = (fabs(normalize_angle(pp.angle())) > 0.5*M_PI) ? UPRIGHT_LEFT : UPRIGHT_RIGHT; real_orientation = (fabs(normalize_angle(pp.angle())) > 0.5*M_PI) ? UPRIGHT_LEFT : UPRIGHT_RIGHT;
} }
double sign = 1; double sign = (real_orientation == UPRIGHT_LEFT) ? -1 : 1;
if (real_orientation == UPRIGHT_LEFT)
{
sign = -1;
if (!pp.forward(layout_.width())) return false;
}
double base_offset = alignment_offset().y + info_->properties.displacement.y; double base_offset = alignment_offset().y + info_->properties.displacement.y;
glyph_positions_ptr glyphs = boost::make_shared<glyph_positions>(); glyph_positions_ptr glyphs = boost::make_shared<glyph_positions>();