gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp
Date: Thu, 07 Jun 2007 11:59:56 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/06/07 11:59:56

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp 

Log message:
        server/edit_text_character.cpp: better version of previous patch; gets 
rid of WIDTH_FUDGE too

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3478&r2=1.3479
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.63&r2=1.64

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.3478
retrieving revision 1.3479
diff -u -b -r1.3478 -r1.3479
--- ChangeLog   7 Jun 2007 09:20:44 -0000       1.3478
+++ ChangeLog   7 Jun 2007 11:59:55 -0000       1.3479
@@ -1,5 +1,10 @@
 2007-06-07 Udo Giacomozzi <address@hidden>
 
+       * server/edit_text_character.cpp: better version of previous patch;
+         gets rid of WIDTH_FUDGE too   
+
+2007-06-07 Udo Giacomozzi <address@hidden>
+
        * server/edit_text_character.cpp: shift text by 2 pixels, 
          fixes bug #17954
 

Index: server/edit_text_character.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- server/edit_text_character.cpp      7 Jun 2007 09:20:44 -0000       1.63
+++ server/edit_text_character.cpp      7 Jun 2007 11:59:56 -0000       1.64
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: edit_text_character.cpp,v 1.63 2007/06/07 09:20:44 udog Exp $ */
+/* $Id: edit_text_character.cpp,v 1.64 2007/06/07 11:59:56 udog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -42,6 +42,10 @@
 #include <string>
 #include <boost/algorithm/string/case_conv.hpp>
 
+// Text fields have a fixed 2 pixel padding for each side (regardless of 
border)
+#define PADDING_TWIPS 40.0f
+
+
 namespace gnash {
 
 // Forward declarations
@@ -457,12 +461,6 @@
                m.concatenate_translation(def_bounds.get_x_min(), 
def_bounds.get_y_min());
        }
        
-       // Shift by two additional pixels. I absolutely dislike this hack 
because
-       // it's based on empirical tests. I checked with various files 
(including
-       // various text format styles) and it seems to be work fine, though.
-       // Maybe it's really some hard-coded border in Flash.
-       // See bug #17954 for more info.
-       m.concatenate_translation(2*20.0, 2*20.0);
        
        display_glyph_records(m, this, m_text_glyph_records,
                              m_def->get_root_def());
@@ -837,10 +835,6 @@
        return get_member_default(name, val);
 }
        
-// @@ WIDTH_FUDGE is a total fudge to make it match the Flash player!  Maybe
-// we have a bug?
-#define WIDTH_FUDGE 80.0f
-
 
 float
 edit_text_character::align_line(
@@ -851,7 +845,7 @@
        assert(m_def);
 
        float   extra_space = (m_def->width() -
-                       m_def->get_right_margin()) - x - WIDTH_FUDGE;
+                       m_def->get_right_margin()) - x - PADDING_TWIPS;
 
        //assert(extra_space >= 0.0f);
        if (extra_space <= 0.0f)
@@ -965,8 +959,8 @@
        text_glyph_record       rec;    // one to work on
        rec.m_style.m_font = _font;
        rec.m_style.m_color = m_def->get_text_color();
-       rec.m_style.m_x_offset = std::max(0, m_def->get_left_margin() + 
m_def->get_indent());
-       rec.m_style.m_y_offset = m_def->get_font_height()
+       rec.m_style.m_x_offset = PADDING_TWIPS + std::max(0, 
m_def->get_left_margin() + m_def->get_indent());
+       rec.m_style.m_y_offset = PADDING_TWIPS + m_def->get_font_height()
                + (_font->get_leading() - _font->get_descent()) * scale;
        rec.m_style.m_text_height = m_def->get_font_height();
        rec.m_style.m_has_x_offset = true;
@@ -1027,7 +1021,8 @@
                        align_line(m_def->get_alignment(), 
last_line_start_record, x);
 
                        // new paragraphs get the indent.
-                       x = std::max(0, m_def->get_left_margin() + 
m_def->get_indent());
+                       x = std::max(0, m_def->get_left_margin() + 
m_def->get_indent()) + 
+                         PADDING_TWIPS;
                        y += m_def->get_font_height() + leading;
 
                        // Start a new record on the next line.
@@ -1141,7 +1136,7 @@
                
 after_x_advance:
 
-               if (x >= m_def->width() - m_def->get_right_margin() - 
WIDTH_FUDGE)
+               if (x >= m_def->width() - m_def->get_right_margin() - 
PADDING_TWIPS)
                {
                        // Whoops, we just exceeded the box width. 
                        // Do word-wrap if requested to do so.
@@ -1161,8 +1156,7 @@
                        // Close out this stretch of glyphs.
                        m_text_glyph_records.push_back(rec);
                        float   previous_x = x;
-
-                       x = m_def->get_left_margin();
+                       x = m_def->get_left_margin() + PADDING_TWIPS;
                        y += m_def->get_font_height() + leading;
 
                        // Start a new record on the next line.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]