private void SetFontWeightAndStyleToStyleDefinitionToApply(StyleDefinition result) { if (this.fontStyleListBox.SelectedValue != null && (DialogFontStyle)this.fontStyleListBox.SelectedValue != this.initialDialogFontStyle) { DialogFontStyle dialogFontStyle = (DialogFontStyle)this.fontStyleListBox.SelectedValue; switch (dialogFontStyle) { case DialogFontStyle.Regular: result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Normal); result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Normal); break; case DialogFontStyle.Italic: result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Italic); result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Normal); break; case DialogFontStyle.Bold: result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Normal); result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Bold); break; case DialogFontStyle.BoldItalic: result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Italic); result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Bold); break; default: break; } } }
private void ResetInitialValues() { this.initialForeColor = null; this.initialHighlightColor = null; this.initialBaselineAlignment = null; this.initialDialogFontStyle = DialogFontStyle.Empty; this.initialFontSize = null; this.initialFontFamily = null; this.initialUnderline = null; this.currentUnderline = null; this.currentForeColor = null; this.currentHighlightColor = null; }
private void SetInitialValues(FontFamily family, double?fontSize, Color?foreColor, Color?highlightColor, Tuples.Windows.FontWeight?fontWeight, Tuples.Windows.FontStyle?fontStyle, IUnderlineUIDecorationProvider underline, bool?strikeThrough, BaselineAlignment?alignment) { this.initialFontFamily = family; if (fontSize.HasValue) { this.initialFontSize = Math.Round(Unit.DipToPoint(fontSize.Value), 2); } this.initialForeColor = foreColor; this.initialHighlightColor = highlightColor; if (fontWeight.HasValue && fontWeight.HasValue) { if (fontWeight.Value == FontWeights.Bold) { if (fontStyle.Value == FontStyles.Italic) { this.initialDialogFontStyle = DialogFontStyle.BoldItalic; } else { this.initialDialogFontStyle = DialogFontStyle.Bold; } } else { if (fontStyle.Value == FontStyles.Italic) { this.initialDialogFontStyle = DialogFontStyle.Italic; } else { this.initialDialogFontStyle = DialogFontStyle.Regular; } } } else { this.initialDialogFontStyle = DialogFontStyle.Empty; } this.initialUnderline = underline; this.initialStrikeThrough = strikeThrough; this.initialBaselineAlignment = alignment; }
public DialogFont(string FamilyName, float Size, DialogFontStyle FontStyle) { this.FamilyName = FamilyName; this.Size = Size; this.FontStyle = FontStyle; }