Exemplo n.º 1
0
        private void ParseOneStyle(string key, string value)
        {
            value = value.Trim();
            switch (key.ToLower().Trim())
            {
            case "font-family":
                if (value.StartsWith("ascii"))
                {
                    int index;
                    if (int.TryParse(value.Replace("ascii", string.Empty), out index))
                    {
                        Style.Font = m_Provider.GetAsciiFont(index);
                    }
                    else
                    {
                        Tracer.Warn("Unknown font-family parameter:{0}", key);
                    }
                }
                else if (value.StartsWith("uni"))
                {
                    int index;
                    if (int.TryParse(value.Replace("uni", string.Empty), out index))
                    {
                        Style.Font = m_Provider.GetUnicodeFont(index);
                    }
                    else
                    {
                        Tracer.Warn("Unknown font-family parameter:{0}", value);
                    }
                }
                break;

            case "text-decoration":
                string[] param = value.Trim().Split(' ');
                for (int i = 0; i < param.Length; i++)
                {
                    if (param[i] == "none")
                    {
                        Style.IsUnderlined = false;
                    }
                    else if (param[i] == "underline")
                    {
                        Style.IsUnderlined = true;
                    }
                    else
                    {
                        // other possibilities? overline|line-through|initial|inherit;
                        Tracer.Warn("Unknown text-decoration parameter:{0}", param[i]);
                    }
                }
                break;

            default:
                Tracer.Warn("Unknown style parameter:{0}", key);
                break;
            }
        }