summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TFont.php
diff options
context:
space:
mode:
authorxue <>2006-01-15 00:37:31 +0000
committerxue <>2006-01-15 00:37:31 +0000
commit0a40bca6deb8ee25fe9380c071d49b8234da76f2 (patch)
tree186298905b213a30a45a2edfefb04496d5160346 /framework/Web/UI/WebControls/TFont.php
parent4f16184b10420304bd8c48a45001d849fa605557 (diff)
Fixed style merging problem.
Diffstat (limited to 'framework/Web/UI/WebControls/TFont.php')
-rw-r--r--framework/Web/UI/WebControls/TFont.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/framework/Web/UI/WebControls/TFont.php b/framework/Web/UI/WebControls/TFont.php
index 37a08546..61b43b27 100644
--- a/framework/Web/UI/WebControls/TFont.php
+++ b/framework/Web/UI/WebControls/TFont.php
@@ -209,26 +209,27 @@ class TFont extends TComponent
/**
* Merges the font with a new one.
- * The fields in the new font will overwrite the current ones.
+ * If a style field is not set in the current style but set in the new style
+ * it will take the value from the new style.
* @param TFont the new font
*/
public function mergeWith($font)
{
if($font===null || $font->_flags===0)
return;
- if($font->_flags & self::IS_SET_BOLD)
+ if(($font->_flags & self::IS_SET_BOLD) && !($this->_flags & self::IS_SET_BOLD))
$this->setBold($font->getBold());
- if($font->_flags & self::IS_SET_ITALIC)
+ if(($font->_flags & self::IS_SET_ITALIC) && !($font->_flags & self::IS_SET_ITALIC))
$this->setItalic($font->getItalic());
- if($font->_flags & self::IS_SET_OVERLINE)
+ if(($font->_flags & self::IS_SET_OVERLINE) && !($font->_flags & self::IS_SET_OVERLINE))
$this->setOverline($font->getOverline());
- if($font->_flags & self::IS_SET_STRIKEOUT)
+ if(($font->_flags & self::IS_SET_STRIKEOUT) && !($font->_flags & self::IS_SET_STRIKEOUT))
$this->setStrikeout($font->getStrikeout());
- if($font->_flags & self::IS_SET_UNDERLINE)
+ if(($font->_flags & self::IS_SET_UNDERLINE) && !($font->_flags & self::IS_SET_UNDERLINE))
$this->setUnderline($font->getUnderline());
- if($font->_flags & self::IS_SET_SIZE)
+ if(($font->_flags & self::IS_SET_SIZE) && !($this->_flags & self::IS_SET_SIZE))
$this->setSize($font->getSize());
- if($font->_flags & self::IS_SET_NAME)
+ if(($font->_flags & self::IS_SET_NAME) && !($this->_flags & self::IS_SET_NAME))
$this->setName($font->getName());
}
@@ -239,8 +240,9 @@ class TFont extends TComponent
*/
public function copyFrom($font)
{
- $this->reset();
- $this->mergeWith($font);
+ $this->_flags=$font->_flags;
+ $this->_name=$font->_name;
+ $this->_size=$font->_size;
}
/**