Esempio n. 1
0
        private void Window_Loaded(object sender, EventArgs e)
        {
            _pixelsPerDip = VisualTreeHelper.GetDpi(this).PixelsPerDip;
            // Enumerate the fonts and add them to the font family combobox.
            foreach (System.Windows.Media.FontFamily fontFamily in Fonts.SystemFontFamilies)
            {
                fontFamilyCB.Items.Add(fontFamily.Source);
            }
            fontFamilyCB.SelectedIndex = 7;

            // Load the font size combo box with common font sizes.
            for (int i = 0; i < CommonFontSizes.Length; i++)
            {
                fontSizeCB.Items.Add(CommonFontSizes[i]);
            }
            fontSizeCB.SelectedIndex = 21;

            //Load capitals combo box
            typographyMenuBar.Visibility = Visibility.Collapsed;

            //Set up the initial render state of the drawn text.
            if (_currentRendering == null)
            {
                _currentRendering = new FontRendering(
                    (double)fontSizeCB.SelectedItem,
                    TextAlignment.Left,
                    null,
                    System.Windows.Media.Brushes.Black,
                    new Typeface("Arial"));
            }

            _UILoaded = true;    //All UI is loaded, can handle events now
            UpdateFormattedText(_pixelsPerDip);
        }
        private void Window_Loaded(object sender, EventArgs e)
        {
            _pixelsPerDip = VisualTreeHelper.GetDpi(this).PixelsPerDip;
            // Enumerate the fonts and add them to the font family combobox.
            foreach (System.Windows.Media.FontFamily fontFamily in Fonts.SystemFontFamilies)
            {
                fontFamilyCB.Items.Add(fontFamily.Source);
            }
            fontFamilyCB.SelectedIndex = 7;

            // Load the font size combo box with common font sizes.
            for (int i = 0; i < CommonFontSizes.Length; i++)
            {
                fontSizeCB.Items.Add(CommonFontSizes[i]);
            }
            fontSizeCB.SelectedIndex = 21;

            //Load capitals combo box
            typographyMenuBar.Visibility = Visibility.Collapsed;

            //Set up the initial render state of the drawn text.
            if (_currentRendering == null)
            {
                _currentRendering = new FontRendering(
                   (double)fontSizeCB.SelectedItem,
                   TextAlignment.Left,
                   null,
                   System.Windows.Media.Brushes.Black,
                   new Typeface("Arial"));
            }
            
            _UILoaded = true;    //All UI is loaded, can handle events now
            UpdateFormattedText(_pixelsPerDip);
        }
Esempio n. 3
0
 public GenericTextRunProperties(FontRendering newRender, double pixelsPerDip)
 {
     _typeface          = newRender.Typeface;
     _emSize            = newRender.FontSize;
     _emHintingSize     = newRender.FontSize;
     _textDecorations   = newRender.TextDecorations;
     _foregroundBrush   = newRender.TextColor;
     _backgroundBrush   = null;
     _baselineAlignment = BaselineAlignment.Baseline;
     _culture           = CultureInfo.CurrentUICulture;
     PixelsPerDip       = pixelsPerDip;
 }
 public GenericTextParagraphProperties(FontRendering newRendering, double pixelsPerDip)
 {
     _flowDirection = FlowDirection.LeftToRight;
     _textAlignment = newRendering.TextAlignment;
     _firstLineInParagraph = false;
     _alwaysCollapsible = false;
     _defaultTextRunProperties = new GenericTextRunProperties(
        newRendering.Typeface, pixelsPerDip, newRendering.FontSize, newRendering.FontSize,
        newRendering.TextDecorations, newRendering.TextColor, null,
        BaselineAlignment.Baseline, CultureInfo.CurrentUICulture);
     _textWrap = TextWrapping.Wrap;
     _lineHeight = 0;
     _indent = 0;
     _paragraphIndent = 0;
 }
Esempio n. 5
0
 public GenericTextParagraphProperties(FontRendering newRendering, double pixelsPerDip)
 {
     _flowDirection            = FlowDirection.LeftToRight;
     _textAlignment            = newRendering.TextAlignment;
     _firstLineInParagraph     = false;
     _alwaysCollapsible        = false;
     _defaultTextRunProperties = new GenericTextRunProperties(
         newRendering.Typeface, pixelsPerDip, newRendering.FontSize, newRendering.FontSize,
         newRendering.TextDecorations, newRendering.TextColor, null,
         BaselineAlignment.Baseline, CultureInfo.CurrentUICulture);
     _textWrap        = TextWrapping.Wrap;
     _lineHeight      = 0;
     _indent          = 0;
     _paragraphIndent = 0;
 }
 public GenericTextRunProperties(FontRendering newRender, double pixelsPerDip)
 {
     _typeface = newRender.Typeface;
     _emSize = newRender.FontSize;
     _emHintingSize = newRender.FontSize;
     _textDecorations = newRender.TextDecorations;
     _foregroundBrush = newRender.TextColor;
     _backgroundBrush = null;
     _baselineAlignment = BaselineAlignment.Baseline;
     _culture = CultureInfo.CurrentUICulture;
     PixelsPerDip = pixelsPerDip;
 }