Ejemplo n.º 1
0
        public FontFamilyUnit(ReflowDocument doc, Css.Value names)
        {
            // Names is a list of strings.
            int length = (names == null || names.IsType(typeof(Css.Keywords.None))) ? 0 : names.Count;

            Fonts = new DynamicFont[length + 1];

            // For each font name..
            for (int i = 0; i < length; i++)
            {
                // Get as text:
                string fontName = names[i].Text;

                // Trim the name:
                fontName = fontName.Trim();

                // Get the font from the doc:
                DynamicFont font = doc.GetOrCreateFont(fontName);

                // Add to list:
                Fonts[i] = font;
            }

            // Push the default:
            Fonts[length] = DynamicFont.GetDefaultFamily();
        }
Ejemplo n.º 2
0
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the text:
            TextRenderingProperty text = GetText(style);

            if (text == null)
            {
                return;
            }

            // Apply the property:

            string fontName = value.Text;

            if (fontName == null)
            {
                return;
            }

            Find(fontName, text);

            if (text.FontToDraw == null)
            {
                // No fonts at all.
                // We're going to load and use the default one:
                text.FontToDraw = DynamicFont.GetDefaultFamily();
            }

            // Apply the changes:
            text.SetText();
        }