CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/07/24 17:41:34
Modified files: . : ChangeLog server : edit_text_character.cpp edit_text_character.h server/parser : edit_text_character_def.h testsuite/actionscript.all: TextField.as testsuite/misc-ming.all: DefineEditTextTest.c Log message: * server/parser/edit_text_character_def.h: initialize m_use_outlines to true (so dynamically-created textfields will use device fonts by default), provide a getUseEmbeddedGlyphs() public method. * server/edit_text_character.{cpp,h}: add an _embedFonts member initialized using edit_text_character_def::getUseEmbeddedGlyphs(), provide the "embedFonts" getter-setter for it. * testsuite/: actionscript.all/TextField.as, misc-ming.all/DefineEditTextTest.c: less failures. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3810&r2=1.3811 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.89&r2=1.90 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.40&r2=1.41 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/edit_text_character_def.h?cvsroot=gnash&r1=1.17&r2=1.18 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.10&r2=1.11 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextTest.c?cvsroot=gnash&r1=1.23&r2=1.24 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3810 retrieving revision 1.3811 diff -u -b -r1.3810 -r1.3811 --- ChangeLog 24 Jul 2007 16:22:01 -0000 1.3810 +++ ChangeLog 24 Jul 2007 17:41:33 -0000 1.3811 @@ -1,5 +1,17 @@ 2007-07-24 Sandro Santilli <[EMAIL PROTECTED]> + * server/parser/edit_text_character_def.h: + initialize m_use_outlines to true (so dynamically-created + textfields will use device fonts by default), provide + a getUseEmbeddedGlyphs() public method. + * server/edit_text_character.{cpp,h}: add an _embedFonts member + initialized using edit_text_character_def::getUseEmbeddedGlyphs(), + provide the "embedFonts" getter-setter for it. + * testsuite/: actionscript.all/TextField.as, + misc-ming.all/DefineEditTextTest.c: less failures. + +2007-07-24 Sandro Santilli <[EMAIL PROTECTED]> + * testsuite/misc-ming.all/: DefineEditTextTest.c, DefineEditTextTest-Runner.cpp: a small additional test for runtime-changing the .embedFont member of a TextField. Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -u -b -r1.89 -r1.90 --- server/edit_text_character.cpp 23 Jul 2007 14:02:55 -0000 1.89 +++ server/edit_text_character.cpp 24 Jul 2007 17:41:34 -0000 1.90 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.89 2007/07/23 14:02:55 udog Exp $ */ +/* $Id: edit_text_character.cpp,v 1.90 2007/07/24 17:41:34 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -68,6 +68,7 @@ static as_value textfield_backgroundColor_getset(const fn_call& fn); static as_value textfield_borderColor_getset(const fn_call& fn); static as_value textfield_textColor_getset(const fn_call& fn); +static as_value textfield_embedFonts_getset(const fn_call& fn); namespace { @@ -325,6 +326,8 @@ o.init_property("borderColor", *getset, *getset); getset = new builtin_function(textfield_textColor_getset); o.init_property("textColor", *getset, *getset); + getset = new builtin_function(textfield_embedFonts_getset); + o.init_property("embedFonts", *getset, *getset); if ( target_version < 7 ) return; @@ -385,7 +388,8 @@ _backgroundColor(255,255,255,255), _drawBorder(m_def->has_border()), _borderColor(0,0,0,255), - _textColor(m_def->get_text_color()) + _textColor(m_def->get_text_color()), + _embedFont(m_def->getUseEmbeddedGlyphs()) { assert(parent); assert(m_def); @@ -1428,6 +1432,17 @@ } } +void +edit_text_character::setEmbedFonts(bool use) +{ + if ( _embedFont != use ) + { + set_invalidated(); + format_text(); + _embedFont=use; + } +} + cxform edit_text_character::get_world_cxform() const { @@ -1537,6 +1552,23 @@ return as_value(); } +static as_value +textfield_embedFonts_getset(const fn_call& fn) +{ + boost::intrusive_ptr<edit_text_character> ptr = ensureType<edit_text_character>(fn.this_ptr); + + if ( fn.nargs == 0 ) // getter + { + return as_value(ptr->getEmbedFonts()); + } + else // setter + { + ptr->setEmbedFonts( fn.arg(0).to_bool() ); + } + + return as_value(); +} + } // namespace gnash Index: server/edit_text_character.h =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -b -r1.40 -r1.41 --- server/edit_text_character.h 22 Jul 2007 12:27:53 -0000 1.40 +++ server/edit_text_character.h 24 Jul 2007 17:41:34 -0000 1.41 @@ -144,6 +144,19 @@ /// Set color of the text void setTextColor(const rgba& col); + /// \brief + /// Return true if this TextField should use embedded font glyphs, + /// false if it should use device font glyphs + bool getEmbedFonts() const { + return _embedFont; + } + + /// \brief + /// Set whether this TextField should use embedded font glyphs, + /// or use device font glyphs + // + /// @param use + void setEmbedFonts(bool use); private: @@ -250,6 +263,8 @@ rgba _textColor; + bool _embedFont; + protected: #ifdef GNASH_USE_GC Index: server/parser/edit_text_character_def.h =================================================================== RCS file: /sources/gnash/gnash/server/parser/edit_text_character_def.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -b -r1.17 -r1.18 --- server/parser/edit_text_character_def.h 22 Jul 2007 03:29:25 -0000 1.17 +++ server/parser/edit_text_character_def.h 24 Jul 2007 17:41:34 -0000 1.18 @@ -62,10 +62,14 @@ m_no_select(false), m_border(false), m_html(false), - m_use_outlines(false), + m_use_outlines(true), // For an SWF-defined textfield we'll read + // this from the tag. Dynamic textfields should + // use device fonts by default. m_font_id(-1), m_font(NULL), - m_text_height(1), + m_text_height(1), // TODO: initialize to a meaningful value (see sprite_instance::add_textfield) + // and make sure get_font_height is not called for rendering purposes + // (instead call a method of edit_text_character_def) m_max_length(0), m_alignment(ALIGN_LEFT), m_left_margin(0), @@ -237,6 +241,15 @@ /// Return true if HTML was allowed by definition bool htmlAllowed() const { return m_html; } + /// Return true if this character definition requested use of device fonts + // + /// Used by edit_text_character constructor to set it's default. + /// + bool getUseEmbeddedGlyphs() const + { + return m_use_outlines; + } + protected: #ifdef GNASH_USE_GC @@ -299,8 +312,11 @@ /// \brief - /// When true, use specified SWF internal font. - /// Otherwise, renderer picks a default font + /// When true, use specified SWF internal font (embed fonts) + /// Otherwise, use specified device font (or a default one if m_font_id is -1) + /// + /// Also known as USE_GLYPH (from Ming) + /// bool m_use_outlines; int m_font_id; Index: testsuite/actionscript.all/TextField.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v retrieving revision 1.10 retrieving revision 1.11 diff -u -b -r1.10 -r1.11 --- testsuite/actionscript.all/TextField.as 24 Jul 2007 16:14:13 -0000 1.10 +++ testsuite/actionscript.all/TextField.as 24 Jul 2007 17:41:34 -0000 1.11 @@ -20,7 +20,7 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: TextField.as,v 1.10 2007/07/24 16:14:13 strk Exp $"; +rcsid="$Id: TextField.as,v 1.11 2007/07/24 17:41:34 strk Exp $"; #include "check.as" @@ -45,7 +45,7 @@ xcheck( !TextField.prototype.hasOwnProperty('border') ); xcheck( !TextField.prototype.hasOwnProperty('borderColor') ); check( !TextField.prototype.hasOwnProperty('bottomScroll') ); -check( !TextField.prototype.hasOwnProperty('embedFonts') ); +xcheck( !TextField.prototype.hasOwnProperty('embedFonts') ); check( !TextField.prototype.hasOwnProperty('hscroll') ); check( !TextField.prototype.hasOwnProperty('html') ); check( !TextField.prototype.hasOwnProperty('htmlText') ); @@ -114,7 +114,7 @@ check( TextField.prototype.hasOwnProperty('border') ); check( TextField.prototype.hasOwnProperty('borderColor') ); xcheck( TextField.prototype.hasOwnProperty('bottomScroll') ); -xcheck( TextField.prototype.hasOwnProperty('embedFonts') ); +check( TextField.prototype.hasOwnProperty('embedFonts') ); xcheck( TextField.prototype.hasOwnProperty('hscroll') ); xcheck( TextField.prototype.hasOwnProperty('html') ); xcheck( TextField.prototype.hasOwnProperty('htmlText') ); @@ -177,17 +177,17 @@ // Check TextField.embedFonts -xcheck_equals(typeof(tf.embedFonts), 'boolean'); +check_equals(typeof(tf.embedFonts), 'boolean'); check(!tf.hasOwnProperty('embedFonts')); xcheck_equals(tf.embedFonts, false); tf.embedFonts = true; check_equals(tf.embedFonts, true); tf.embedFonts = new Number(0); // will be converted to bool (true) -xcheck_equals(typeof(tf.embedFonts), 'boolean'); -xcheck_equals(tf.embedFonts, true); +check_equals(typeof(tf.embedFonts), 'boolean'); +check_equals(tf.embedFonts, true); tf.embedFonts = ""; // will be converted to bool (false); -xcheck_equals(typeof(tf.embedFonts), 'boolean'); -xcheck_equals(tf.embedFonts, false); +check_equals(typeof(tf.embedFonts), 'boolean'); +check_equals(tf.embedFonts, false); // TODO: do this test with really embedded fonts, in misc-ming.all/DefineEditTextTest.c // Check TextField._highquality Index: testsuite/misc-ming.all/DefineEditTextTest.c =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextTest.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- testsuite/misc-ming.all/DefineEditTextTest.c 24 Jul 2007 16:22:02 -0000 1.23 +++ testsuite/misc-ming.all/DefineEditTextTest.c 24 Jul 2007 17:41:34 -0000 1.24 @@ -157,8 +157,8 @@ } SWFMovie_nextFrame(mo); - xcheck_equals(mo, "dtext1.embedFonts", "false"); - xcheck_equals(mo, "etext1.embedFonts", "true"); + check_equals(mo, "dtext1.embedFonts", "false"); + check_equals(mo, "etext1.embedFonts", "true"); check_equals(mo, "dtext1.__proto__", "TextField.prototype"); // checks after placing some swf defined TextField _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit