+ linewrap-patch-r3362.patch from dimka (#189)
This commit is contained in:
parent
a88a49960d
commit
3d6ea00c66
3 changed files with 27 additions and 3 deletions
|
@ -56,11 +56,13 @@ protected:
|
|||
UnicodeString const& text_;
|
||||
double width_;
|
||||
double height_;
|
||||
bool is_rtl;
|
||||
public:
|
||||
string_info(UnicodeString const& text)
|
||||
: text_(text),
|
||||
width_(0),
|
||||
height_(0) {}
|
||||
height_(0),
|
||||
is_rtl(false) {}
|
||||
|
||||
void add_info(int c, double width, double height)
|
||||
{
|
||||
|
@ -71,6 +73,9 @@ public:
|
|||
{
|
||||
return characters_.size();
|
||||
}
|
||||
|
||||
void set_rtl(bool value) {is_rtl = value;}
|
||||
bool get_rtl() const {return is_rtl;}
|
||||
|
||||
character_info at(unsigned i) const
|
||||
{
|
||||
|
|
|
@ -262,6 +262,11 @@ void font_face_set::get_string_info(string_info & info)
|
|||
}
|
||||
}
|
||||
|
||||
if (ubidi_getBaseDirection(ustr.getBuffer(), length) == UBIDI_RTL)
|
||||
{
|
||||
info.set_rtl(true);
|
||||
}
|
||||
|
||||
ubidi_close(bidi);
|
||||
info.set_dimensions(width, height);
|
||||
}
|
||||
|
|
|
@ -379,7 +379,14 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
|
|||
|
||||
// set for upper left corner of text envelope for the first line, bottom left of first character
|
||||
x = -(line_width / 2.0);
|
||||
y = (0.5 * (string_height + (line_spacing * (total_lines-1)))) - max_character_height;
|
||||
if (p.info.get_rtl()==false)
|
||||
{
|
||||
y = (0.5 * (string_height + (line_spacing * (total_lines-1)))) - max_character_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = -(0.5 * (string_height + (line_spacing * (total_lines-1)))) + max_character_height;
|
||||
}
|
||||
|
||||
// if needed, adjust for desired justification (J_MIDDLE is the default)
|
||||
if( po->jalign == J_LEFT )
|
||||
|
@ -404,7 +411,14 @@ void placement_finder<DetectorT>::find_point_placement(placement & p,
|
|||
index_to_wrap_at = line_breaks[++line_number];
|
||||
line_width = line_widths[line_number];
|
||||
|
||||
y -= (max_character_height + line_spacing); // move position down to line start
|
||||
if (p.info.get_rtl()==false)
|
||||
{
|
||||
y -= (max_character_height + line_spacing); // move position down to line start
|
||||
}
|
||||
else
|
||||
{
|
||||
y += (max_character_height + line_spacing); // move position up to line start
|
||||
}
|
||||
|
||||
// reset to begining of line position
|
||||
x = ((po->jalign == J_LEFT)? -(string_width / 2.0): ((po->jalign == J_RIGHT)? ((string_width /2.0) - line_width): -(line_width / 2.0)));
|
||||
|
|
Loading…
Reference in a new issue