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: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
Date: Sat, 19 Apr 2008 22:45:52 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/19 22:45:52

Modified files:
        .              : ChangeLog 
        server         : edit_text_character.cpp fontlib.cpp fontlib.h 

Log message:
        Use fontlib services to reuse existing fonts.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6333&r2=1.6334
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.174&r2=1.175
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fontlib.cpp?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fontlib.h?cvsroot=gnash&r1=1.15&r2=1.16

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6333
retrieving revision 1.6334
diff -u -b -r1.6333 -r1.6334
--- ChangeLog   19 Apr 2008 21:46:28 -0000      1.6333
+++ ChangeLog   19 Apr 2008 22:45:51 -0000      1.6334
@@ -1,5 +1,12 @@
 2008-04-19 Sandro Santilli <address@hidden>
 
+       * server/edit_text_character.cpp (textfield_setTextFormat): use
+         the fontlib to reuse existing fonts.
+       * server/fontlib.{cpp,h}: have fontlib::get_font(name, bold, italic)
+         create a new font if none was found.
+
+2008-04-19 Sandro Santilli <address@hidden>
+
        * server/button_character_instance.cpp (on_button_event):
          Push all events to the global queue. Tested this locally, no
          automated test.

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- server/edit_text_character.cpp      17 Apr 2008 16:24:07 -0000      1.174
+++ server/edit_text_character.cpp      19 Apr 2008 22:45:51 -0000      1.175
@@ -34,6 +34,7 @@
 #include "VM.h"
 #include "builtin_function.h" // for getter/setter properties
 #include "font.h" // for using the _font member
+#include "fontlib.h" // for searching or adding fonts the _font member
 #include "Object.h" // for getObjectInterface
 #include "namedStrings.h"
 #include "array.h" // for _listeners construction
@@ -251,10 +252,7 @@
                        bool bold = tf->bold();
                        bool italic = tf->italiced();
 
-                       // TODO: reuse an existing font with this name if known 
!
-                       //       Would need cleanups in the fontlib package
-                       //       for proper thread-safety
-                       boost::intrusive_ptr<font> f ( new font(fontName, bold, 
italic) );
+                       font* f = fontlib::get_font(fontName, bold, italic);
                        text->setFont( f );
                }
        }

Index: server/fontlib.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fontlib.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/fontlib.cpp  5 Mar 2008 03:55:59 -0000       1.41
+++ server/fontlib.cpp  19 Apr 2008 22:45:52 -0000      1.42
@@ -66,8 +66,7 @@
        }
 
 
-       font*   get_font(const std::string& name)
-       // Return the named font.
+       font*   get_font(const std::string& name, bool bold, bool italic)
        {
                // Dumb linear search.
                for (unsigned int i = 0; i < s_fonts.size(); i++)
@@ -77,11 +76,15 @@
                        {
                                if (f->get_name() == name)
                                {
+                                       if ( bold && ! f->isBold() ) continue;
+                                       if ( italic && ! f->isItalic() ) 
continue;
                                        return f;
                                }
                        }
                }
-               return NULL;
+               font* f = new font(name, bold, italic);
+               s_fonts.push_back(f);
+               return f;
        }
 
        void    add_font(font* f)

Index: server/fontlib.h
===================================================================
RCS file: /sources/gnash/gnash/server/fontlib.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/fontlib.h    27 Mar 2008 10:50:14 -0000      1.15
+++ server/fontlib.h    19 Apr 2008 22:45:52 -0000      1.16
@@ -55,7 +55,7 @@
 
        font*   get_font(int index);
 
-       font*   get_font(const char* name);
+       font*   get_font(const std::string& name, bool bold, bool italic);
 
        /// Return a default device font.
        boost::intrusive_ptr<font> get_default_font();




reply via email to

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