gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1677-ge584b4c
Date: Sat, 20 Jul 2013 22:45:24 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  e584b4c8978bcf0c06a9c54d22c7a1624995dce1 (commit)
       via  a9f9fb9fd39542d9b77f62437182d330b8b5b8b4 (commit)
       via  e67cc6a5cb84a57ed3ab340c3145d718b87bbf52 (commit)
      from  a8f0352302b74e64636461be3991b32215e4e9c0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=e584b4c8978bcf0c06a9c54d22c7a1624995dce1


commit e584b4c8978bcf0c06a9c54d22c7a1624995dce1
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jul 21 00:43:08 2013 +0200

    Savannah #39540: Enable the use of imported and embedded fonts for 
TextFormat.getTextExtents.

diff --git a/libcore/asobj/TextFormat_as.cpp b/libcore/asobj/TextFormat_as.cpp
index d00a1e7..ce94ef6 100644
--- a/libcore/asobj/TextFormat_as.cpp
+++ b/libcore/asobj/TextFormat_as.cpp
@@ -34,6 +34,8 @@
 #include "Array_as.h"
 #include "fontlib.h"
 #include "Font.h"
+#include "movie_definition.h"
+#include "movie_root.h"
 
 
 namespace gnash {
@@ -582,12 +584,30 @@ textformat_getTextExtent(const fn_call& fn)
     // getTextExtent currently only takes account of device fonts we don't
     // need it.
 
-    Font* f = relay->font() ?
-        fontlib::get_font(*relay->font(), bold, italic) :
-        fontlib::get_default_font().get();
-    
+    Font* f = 0;
+    if (relay->font()) {
+        const std::string& name = *relay->font();
+        const movie_definition* md = getRoot(fn).getRootMovie().definition();
+
+        // Option 1. Name refers to an imported font ('asset') symbol.
+        boost::uint16_t fontId = md->exportID(name);
+        if (fontId != 0) {
+            f = md->get_font(fontId);
+        }
+
+        if (!f) {
+            // Option 2. Name refers to an embedded font.
+            f = md->get_font(name, bold, italic);
+            if (!f) {
+                 // Option 3. Name refers to a device font.
+                 f = fontlib::get_font(name, bold, italic);
+            }
+        }
+    } else {
+        f = fontlib::get_default_font().get();
+    }
     // Whether to use embedded fonts if required.
-    const bool em = false;
+    const bool em = true;
 
     /// Advance, descent, ascent given according to square of 1024.
     //
@@ -600,7 +620,7 @@ textformat_getTextExtent(const fn_call& fn)
     double height = s.empty() ? 0 : size;
     double width = 0;
     double curr = 0;
-    
+
     const double ascent = f->ascent(em) * scale;
     const double descent = f->descent(em) * scale;
 
diff --git a/libcore/asobj/TextFormat_as.h b/libcore/asobj/TextFormat_as.h
index f0f7fed..9acbd5d 100644
--- a/libcore/asobj/TextFormat_as.h
+++ b/libcore/asobj/TextFormat_as.h
@@ -186,7 +186,11 @@ private:
         /// 0xFF0000 is red, 0x00FF00 is green.
     boost::optional<rgba> _color;    
 
-    // The name of a font for text as a string.
+    /// a) The name of an imported font asset (not the font's name), or
+    /// b) the name of an embedded font, or
+    /// c) the name of a device font
+    ///
+    /// If no font is set, a default font will be used instead.
     boost::optional<std::string> _font;    
 
     /// An integer that indicates the indentation from the left

http://git.savannah.gnu.org/cgit//commit/?id=a9f9fb9fd39542d9b77f62437182d330b8b5b8b4


commit a9f9fb9fd39542d9b77f62437182d330b8b5b8b4
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jul 21 00:40:16 2013 +0200

    Import dejafont so that tests referring to it can actually use it!

diff --git a/testsuite/actionscript.all/Makefile.am 
b/testsuite/actionscript.all/Makefile.am
index a9205b4..94ef849 100644
--- a/testsuite/actionscript.all/Makefile.am
+++ b/testsuite/actionscript.all/Makefile.am
@@ -268,6 +268,7 @@ $(ASTESTS_OUT) $(ASTESTS_VERSIONED_OUT) $(ONLINETEST_RULES) 
$(ALLTESTS_VERSIONED
 .as.swf: 
        $(MAKESWF) \
                -i$(DEJAGNU_SO_URL):dejagnu \
+               -i$(DEJAGNU_SO_URL):dejafont \
                -DUSE_DEJAGNU_MODULE \
                -DOUTPUT_VERSION=$(SWFVERSION) -v$(SWFVERSION) \
                $(DEF_MAKESWF_FLAGS) \

http://git.savannah.gnu.org/cgit//commit/?id=e67cc6a5cb84a57ed3ab340c3145d718b87bbf52


commit e67cc6a5cb84a57ed3ab340c3145d718b87bbf52
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jul 18 14:04:56 2013 +0200

    Fix spacing.

diff --git a/libbase/GnashNumeric.h b/libbase/GnashNumeric.h
index efbd0ff..c92a2bd 100644
--- a/libbase/GnashNumeric.h
+++ b/libbase/GnashNumeric.h
@@ -62,7 +62,7 @@ inline
 typename boost::enable_if<boost::is_floating_point<T>, bool>::type
 isNaN(const T& num)
 {
-        return num != num;
+    return num != num;
 }
 
 inline double
@@ -75,8 +75,8 @@ template <typename T>
 inline T
 clamp(T i, T min, T max)
 {
-       assert(min <= max);
-       return std::max<T>(min, std::min<T>(i, max));
+    assert(min <= max);
+    return std::max<T>(min, std::min<T>(i, max));
 }
 
 template<typename T>

-----------------------------------------------------------------------

Summary of changes:
 libbase/GnashNumeric.h                 |    6 +++---
 libcore/asobj/TextFormat_as.cpp        |   32 ++++++++++++++++++++++++++------
 libcore/asobj/TextFormat_as.h          |    6 +++++-
 testsuite/actionscript.all/Makefile.am |    1 +
 4 files changed, 35 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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