CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/07/11 16:52:47
Modified files: . : ChangeLog server : edit_text_character.cpp sprite_instance.cpp text.cpp server/parser : edit_text_character_def.cpp edit_text_character_def.h Log message: * server/edit_text_character.cpp (remove the "default" font logic, leave that to edit_text_character_def instead). * server/sprite_instance.cpp (add_textfield): finish implementation, use an hard-coded 10 pixel of font height. * server/text.cpp: more debugging (when activated) * server/parser/edit_text_character_def.{cpp,h}: add set_bounds and set_font_height for dynamic textfields, use a default font when none is specified or the one specified is not found. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3716&r2=1.3717 http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.73&r2=1.74 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.295&r2=1.296 http://cvs.savannah.gnu.org/viewcvs/gnash/server/text.cpp?cvsroot=gnash&r1=1.32&r2=1.33 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/edit_text_character_def.cpp?cvsroot=gnash&r1=1.11&r2=1.12 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/edit_text_character_def.h?cvsroot=gnash&r1=1.15&r2=1.16 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3716 retrieving revision 1.3717 diff -u -b -r1.3716 -r1.3717 --- ChangeLog 11 Jul 2007 16:16:50 -0000 1.3716 +++ ChangeLog 11 Jul 2007 16:52:46 -0000 1.3717 @@ -1,5 +1,16 @@ 2007-07-11 Sandro Santilli <[EMAIL PROTECTED]> + * server/edit_text_character.cpp (remove the "default" font logic, + leave that to edit_text_character_def instead). + * server/sprite_instance.cpp (add_textfield): finish implementation, + use an hard-coded 10 pixel of font height. + * server/text.cpp: more debugging (when activated) + * server/parser/edit_text_character_def.{cpp,h}: add set_bounds + and set_font_height for dynamic textfields, use a default font + when none is specified or the one specified is not found. + +2007-07-11 Sandro Santilli <[EMAIL PROTECTED]> + * server/font.{cpp,h}: Store name by std::string rather then by char*, Provide a constructor for device-only font. Index: server/edit_text_character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -u -b -r1.73 -r1.74 --- server/edit_text_character.cpp 11 Jul 2007 16:16:51 -0000 1.73 +++ server/edit_text_character.cpp 11 Jul 2007 16:52:47 -0000 1.74 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character.cpp,v 1.73 2007/07/11 16:16:51 strk Exp $ */ +/* $Id: edit_text_character.cpp,v 1.74 2007/07/11 16:52:47 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -352,9 +352,7 @@ set_prototype(getTextFieldInterface()); // WARNING! remember to set the font *before* setting text value! - const font* definedFont = m_def->get_font(); - if ( definedFont ) set_font( m_def->get_font() ); - else set_font( fontlib::get_default_font().get() ); + set_font( m_def->get_font() ); // set default text *before* calling registerTextVariable // (if the textvariable already exist and has a value @@ -398,7 +396,7 @@ void edit_text_character::display() { -// GNASH_REPORT_FUNCTION; + //GNASH_REPORT_FUNCTION; registerTextVariable(); Index: server/sprite_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.295 retrieving revision 1.296 diff -u -b -r1.295 -r1.296 --- server/sprite_instance.cpp 11 Jul 2007 00:16:38 -0000 1.295 +++ server/sprite_instance.cpp 11 Jul 2007 16:52:47 -0000 1.296 @@ -2043,13 +2043,19 @@ { matrix txt_matrix; - // Do I need the smart_ptr.here ? + // Create a definition (TODO: cleanup this thing, definitions should be immutable!) boost::intrusive_ptr<edit_text_character_def> txt = new edit_text_character_def(get_movie_definition()); - boost::intrusive_ptr<character> txt_char = txt->create_character_instance(this, 0); - // TODO: where to write width and height info ? - UNUSED(width); - UNUSED(height); + // Set textfield bounds + txt->set_bounds(rect(0, 0, PIXELS_TO_TWIPS(width), PIXELS_TO_TWIPS(height))); + + // Set font height (shouldn't be dependent on font ?) + // TODO: 10 pixels is an arbitrary number here... + txt->set_font_height(10*20); + + + // Create an instance + boost::intrusive_ptr<character> txt_char = txt->create_character_instance(this, 0); // Give name and mark as dynamic txt_char->set_name(name.c_str()); @@ -2069,13 +2075,6 @@ 0, character::noClipDepthValue); - static bool warned = false; - if ( ! warned ) - { - log_unimpl("%s unfinished", __PRETTY_FUNCTION__); - warned = true; - } - return txt_char; } Index: server/text.cpp =================================================================== RCS file: /sources/gnash/gnash/server/text.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -b -r1.32 -r1.33 --- server/text.cpp 1 Jul 2007 10:54:25 -0000 1.32 +++ server/text.cpp 11 Jul 2007 16:52:47 -0000 1.33 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: text.cpp,v 1.32 2007/07/01 10:54:25 bjacques Exp $ */ +/* $Id: text.cpp,v 1.33 2007/07/11 16:52:47 strk Exp $ */ // Based on the public domain work of Thatcher Ulrich <[EMAIL PROTECTED]> 2003 @@ -76,7 +76,7 @@ // root_def was used to resove fonts, now done at parse time movie_definition* /*root_def*/) { -// GNASH_REPORT_FUNCTION; + //GNASH_REPORT_FUNCTION; static std::vector<fill_style> s_dummy_style; // used to pass a color on to shape_character::display() static std::vector<line_style> s_dummy_line_style; @@ -110,6 +110,9 @@ const font* fnt = rec.m_style.m_font; if (fnt == NULL) { +#ifdef GNASH_DEBUG_TEXT_RENDERING + log_debug("No font in style of record %u", i); +#endif continue; } @@ -120,6 +123,10 @@ / 20.0f * pixel_scale; +#ifdef GNASH_DEBUG_TEXT_RENDERING + log_debug("text_screen_height for record %u == %g", i, text_screen_height); +#endif + int nominal_glyph_height = fnt->get_texture_glyph_nominal_size(); float max_glyph_height = fontlib::get_texture_glyph_max_height(fnt); #ifdef GNASH_ALWAYS_USE_TEXTURES_FOR_TEXT_WHEN_POSSIBLE Index: server/parser/edit_text_character_def.cpp =================================================================== RCS file: /sources/gnash/gnash/server/parser/edit_text_character_def.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -b -r1.11 -r1.12 --- server/parser/edit_text_character_def.cpp 11 Jul 2007 16:16:51 -0000 1.11 +++ server/parser/edit_text_character_def.cpp 11 Jul 2007 16:52:47 -0000 1.12 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: edit_text_character_def.cpp,v 1.11 2007/07/11 16:16:51 strk Exp $ */ +/* $Id: edit_text_character_def.cpp,v 1.12 2007/07/11 16:52:47 strk Exp $ */ // Based on the public domain text.cpp of Thatcher Ulrich <[EMAIL PROTECTED]> 2003 @@ -119,7 +119,8 @@ if (m_font == NULL) { // this is fine, the textfield would use a default device font - log_debug(_("text style with undefined font; font_id = %d"), m_font_id); + log_debug(_("text style with undefined font; font_id = %d; using a default font"), m_font_id); + m_font = fontlib::get_default_font().get(); } } Index: server/parser/edit_text_character_def.h =================================================================== RCS file: /sources/gnash/gnash/server/parser/edit_text_character_def.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -b -r1.15 -r1.16 --- server/parser/edit_text_character_def.h 3 Jul 2007 01:12:45 -0000 1.15 +++ server/parser/edit_text_character_def.h 11 Jul 2007 16:52:47 -0000 1.16 @@ -133,6 +133,16 @@ return m_rect; } + /// Set boundaries of this textfield + // + /// This method is used for dynamic textfields + /// (actionscript created) + /// + void set_bounds(const rect& bounds) + { + m_rect = bounds; + } + /// Get right margin in twips uint16_t get_right_margin() const { return m_right_margin; @@ -154,6 +164,14 @@ return m_text_height; } + /// Set height of font in twips. + // + /// Used by dynamically created textfields. + /// + void set_font_height(uint16_t h) { + m_text_height = h; + } + /// Get font. // /// Note: use add_ref() on the return if you need to keep _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit