public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } bool auto = (value == null || value.Text == "auto" || value.Text == "anti-alias"); if (auto) { text.Alias = float.MaxValue; } else if (value.PX != 0) { text.Alias = (float)value.PX; } else { text.Alias = value.Single; } // Set width/height directly to the computed style: text.SetDimensions(); // Request a redraw: style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } // Apply the property: if (value == null) { text.FontSize = 12f; } else { if (value.Type == ValueType.Text) { if (string.IsNullOrEmpty(value.Text)) { text.FontSize = 12f; } else { text.FontSize = float.Parse(value.Text); } } else { text.FontSize = (float)value.PX; } } // Got any letter spacing that needs updating? Css.Value spacing = style["letter-spacing"]; if (spacing != null && spacing.Single != 0f) { // Apply a relative %: text.LetterSpacing = text.FontSize * (value.Single - 1f); } // Set width/height directly to the computed style: text.SetDimensions(); // Request a redraw: style.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } // Get the standard space size for this text property: float standardSize = text.StandardSpaceSize(); // Apply the property: if (value == null) { // Standard space size: text.SpaceSize = standardSize; } else if (value.Single != 0f) { // Relative, e.g. 200% text.SpaceSize = standardSize * value.Single; } else if (value.PX != 0) { // Straight pixel size: text.SpaceSize = (float)value.PX; } else { // Standard space size (will be overwritten): text.SpaceSize = standardSize; } // Prompt the renderer to recalculate the width of the words: text.SetDimensions(); // Apply: text.RequestLayout(); }
public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } if (value == null || value.Text == "normal") { text.LineGap = 0.2f; } else { text.LineGap = value.Single - 1f; } // Apply the changes: text.SetDimensions(); }
public override void Apply(ComputedStyle style, Value value) { // Get the text: TextRenderingProperty text = GetText(style); if (text == null) { return; } // Apply the property: if (value == null) { // No spacing: text.LetterSpacing = 0; } else if (value.Type == ValueType.Pixels) { // Fixed space: text.LetterSpacing = value.PX; } else if (value.Single != 0f) { // Apply a relative %: text.LetterSpacing = text.FontSize * (value.Single - 1f); } else { // Default no spacing: text.LetterSpacing = 0; } // Apply: text.RequestLayout(); // Recalc size: text.SetDimensions(); }