AddAll() public method

public AddAll ( Properties col ) : void
col Properties
return void
Exemplo n.º 1
0
 /// <summary>
 /// Constructs a Font-object.
 /// </summary>
 /// <param name="attributes">the attributes of a Font object</param>
 /// <returns>a Font object</returns>
 public virtual Font GetFont(Properties attributes) {
     string fontname = null;
     string encoding = defaultEncoding;
     bool embedded = defaultEmbedding;
     float size = Font.UNDEFINED;
     int style = Font.NORMAL;
     BaseColor color = null;
     string value = attributes[Markup.HTML_ATTR_STYLE];
     if (value != null && value.Length > 0) {
         Properties styleAttributes = Markup.ParseAttributes(value);
         if (styleAttributes.Count == 0) {
             attributes.Add(Markup.HTML_ATTR_STYLE, value);
         }
         else {
             fontname = styleAttributes[Markup.CSS_KEY_FONTFAMILY];
             if (fontname != null) {
                 string tmp;
                 while (fontname.IndexOf(',') != -1) {
                     tmp = fontname.Substring(0, fontname.IndexOf(','));
                     if (IsRegistered(tmp)) {
                         fontname = tmp;
                     }
                     else {
                         fontname = fontname.Substring(fontname.IndexOf(',') + 1);
                     }
                 }
             }
             if ((value = styleAttributes[Markup.CSS_KEY_FONTSIZE]) != null) {
                 size = Markup.ParseLength(value);
             }
             if ((value = styleAttributes[Markup.CSS_KEY_FONTWEIGHT]) != null) {
                 style |= Font.GetStyleValue(value);
             }
             if ((value = styleAttributes[Markup.CSS_KEY_FONTSTYLE]) != null) {
                 style |= Font.GetStyleValue(value);
             }
             if ((value = styleAttributes[Markup.CSS_KEY_COLOR]) != null) {
                 color = Markup.DecodeColor(value);
             }
             attributes.AddAll(styleAttributes);
         }
     }
     if ((value = attributes[ElementTags.ENCODING]) != null) {
         encoding = value;
     }
     if ("true".Equals(attributes[ElementTags.EMBEDDED])) {
         embedded = true;
     }
     if ((value = attributes[ElementTags.FONT]) != null) {
         fontname = value;
     }
     if ((value = attributes[ElementTags.SIZE]) != null) {
         size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
     }
     if ((value = attributes[Markup.HTML_ATTR_STYLE]) != null) {
         style |= Font.GetStyleValue(value);
     }
     if ((value = attributes[ElementTags.STYLE]) != null) {
         style |= Font.GetStyleValue(value);
     }
     string r = attributes[ElementTags.RED];
     string g = attributes[ElementTags.GREEN];
     string b = attributes[ElementTags.BLUE];
     if (r != null || g != null || b != null) {
         int red = 0;
         int green = 0;
         int blue = 0;
         if (r != null) red = int.Parse(r);
         if (g != null) green = int.Parse(g);
         if (b != null) blue = int.Parse(b);
         color = new BaseColor(red, green, blue);
     }
     else if ((value = attributes[ElementTags.COLOR]) != null) {
         color = Markup.DecodeColor(value);
     }
     if (fontname == null) {
         return GetFont(null, encoding, embedded, size, style, color);
     }
     return GetFont(fontname, encoding, embedded, size, style, color);
 }
Exemplo n.º 2
0
 /**
 * @see com.lowagie.text.xml.XmlPeer#getAttributes(org.xml.sax.Attributes)
 */
 public override Properties GetAttributes(Hashtable attrs)
 {
     Properties attributes = new Properties();
     attributes.AddAll(attributeValues);
     if (defaultContent != null) {
         attributes[ElementTags.ITEXT] = defaultContent;
     }
     if (attrs != null) {
         foreach (string key in attrs.Keys) {
             attributes.Add(GetName(key).ToLower(CultureInfo.InvariantCulture), (string)attrs[key]);
         }
     }
     return attributes;
 }
Exemplo n.º 3
0
 /// <summary> Gets the list of attributes of the peer. </summary>
 public virtual Properties GetAttributes(Hashtable attrs)
 {
     Properties attributes = new Properties();
     attributes.AddAll(attributeValues);
     if (defaultContent != null) {
         attributes.Add(ElementTags.ITEXT, defaultContent);
     }
     if (attrs != null) {
         foreach (string key in attrs.Keys) {
             attributes.Add(GetName(key), (string)attrs[key]);
         }
     }
     return attributes;
 }