CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/17 14:39:35
Modified files: . : ChangeLog server : edit_text_character.cpp edit_text_character.h Log message: * server/edit_text_character.{cpp,h} (format_text): get text alignment using a new private function, which checks for _autoSize settings too. Fixes bug #20760. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4334&r2=1.4335 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.113&r2=1.114 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.50&r2=1.51 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4334 retrieving revision 1.4335 diff -u -b -r1.4334 -r1.4335 --- ChangeLog 17 Sep 2007 14:38:33 -0000 1.4334 +++ ChangeLog 17 Sep 2007 14:39:35 -0000 1.4335 @@ -1,5 +1,8 @@ 2007-09-17 Sandro Santilli <[EMAIL PROTECTED]> + * server/edit_text_character.{cpp,h} (format_text): get text alignment + using a new private function, which checks for _autoSize settings too. + Fixes bug #20760. * server/swf/tag_loaders.cpp (define_bits_jpeg3_loader): fix compiler warning (signed vs. unsigned comparison). Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -u -b -r1.113 -r1.114 --- server/edit_text_character.cpp 16 Sep 2007 16:48:13 -0000 1.113 +++ server/edit_text_character.cpp 17 Sep 2007 14:39:35 -0000 1.114 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.113 2007/09/16 16:48:13 cmusick Exp $ */ +/* $Id: edit_text_character.cpp,v 1.114 2007/09/17 14:39:35 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1044,6 +1044,9 @@ { m_text_glyph_records.resize(0); + // Should get info from autoSize too maybe ? + edit_text_character_def::alignment textAlignment = getTextAlignment(); + // nothing more to do if text is empty if ( _text.empty() ) return; @@ -1119,7 +1122,7 @@ // Close out this stretch of glyphs. m_text_glyph_records.push_back(rec); - align_line(m_def->get_alignment(), last_line_start_record, x); + align_line(textAlignment, last_line_start_record, x); // new paragraphs get the indent. x = std::max(0, leftMargin + indent) + PADDING_TWIPS; @@ -1379,7 +1382,7 @@ last_line.m_glyphs.resize(last_space_glyph); } - align_line(m_def->get_alignment(), last_line_start_record, previous_x); + align_line(textAlignment, last_line_start_record, previous_x); last_space_glyph = -1; last_line_start_record = m_text_glyph_records.size(); @@ -1409,7 +1412,7 @@ // Add this line to our output. m_text_glyph_records.push_back(rec); - float extra_space = align_line(m_def->get_alignment(), last_line_start_record, x); + float extra_space = align_line(textAlignment, last_line_start_record, x); m_xcursor += static_cast<int>(extra_space); m_ycursor -= fontHeight + (fontLeading - fontDescent); @@ -1903,6 +1906,19 @@ format_text(); } +edit_text_character_def::alignment +edit_text_character::getTextAlignment() +{ + // TODO: use a _textAlignment private member to reduce lookups ? + // The member would be initialized to m_def->get_alignment and then update + // when _autoSize is updated. + edit_text_character_def::alignment textAlignment = m_def->get_alignment(); + if ( _autoSize == autoSizeCenter ) textAlignment = edit_text_character_def::ALIGN_CENTER; + else if ( _autoSize == autoSizeLeft ) textAlignment = edit_text_character_def::ALIGN_LEFT; + else if ( _autoSize == autoSizeRight ) textAlignment = edit_text_character_def::ALIGN_RIGHT; + return textAlignment; +} + } // namespace gnash Index: server/edit_text_character.h =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.h,v retrieving revision 1.50 retrieving revision 1.51 diff -u -b -r1.50 -r1.51 --- server/edit_text_character.h 16 Sep 2007 16:48:13 -0000 1.50 +++ server/edit_text_character.h 17 Sep 2007 14:39:35 -0000 1.51 @@ -29,6 +29,7 @@ #include "text.h" // for text_glyph_record #include "Range2d.h" #include "rect.h" // for inlines +#include "edit_text_character_def.h" // for ::alignment typedef // Forward declarations @@ -185,6 +186,9 @@ return _autoSize; } + /// Return text alignment + edit_text_character_def::alignment getTextAlignment(); + /// Set autoSize value // /// @param val _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit