/// <summary>
        /// Updates the TextFormat and TextLayout.
        /// </summary>
        private void UpdateTextFormatAndLayout()
        {
            try
            {
                if (CurrentTextFormat != null)
                {
                    CurrentTextFormat.Release();
                    CurrentTextFormat = null;
                }

                if (CurrentTextLayout != null)
                {
                    CurrentTextLayout.Release();
                    CurrentTextLayout = null;
                }

                // Initialize a TextFormat
                CurrentTextFormat = new TextFormat(FactoryDWrite, FontFamilyName, FontSize) { TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Center };

                CurrentTextLayout = new TextLayout(FactoryDWrite, FontText, CurrentTextFormat, renderControl.Width, renderControl.Height);

                // Set a stylistic typography
                var typo = new Typography(FactoryDWrite);
                typo.AddFontFeature(new FontFeature(FontFeatureTag.StylisticSet7, 1));
                CurrentTextLayout.SetTypography(typo, CurrentTextRange);
                typo.Release();

                UpdateBold();
                UpdateItalic();
                UpdateUnderline();
                UpdateFontSize();
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
        /// <summary>
        /// Inits the font family names from DirectWrite
        /// </summary>
        private void InitTextFormatLayout()
        {
            FontFamilyName = "Gabriola";
            FontSize = 72;
            FontText = "Client Drawing Effect Example!";

            // Initialize a TextFormat
            CurrentTextFormat = new TextFormat(FactoryDWrite, FontFamilyName, FontSize) { TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Center };

            CurrentTextLayout = new TextLayout(FactoryDWrite, FontText, CurrentTextFormat, ClientRectangle.Width, ClientRectangle.Height);

            RedDrawingeffect = new ColorDrawingEffect(new Color4(1, 1, 0, 0));
            BlueDrawingEffect = new ColorDrawingEffect(new Color4(1, 0, 0, 1));
            GreenDrawingEffect = new ColorDrawingEffect(new Color4(1, 0, 1, 0));

            CurrentTextLayout.SetDrawingEffect(RedDrawingeffect, new TextRange(0, 14));
            CurrentTextLayout.SetDrawingEffect(BlueDrawingEffect, new TextRange(14, 7));
            CurrentTextLayout.SetDrawingEffect(GreenDrawingEffect, new TextRange(21, 8));

            // Set a stylistic typography
            var typo = new Typography(FactoryDWrite);
            typo.AddFontFeature(new FontFeature(FontFeatureTag.StylisticSet7, 1));
            CurrentTextLayout.SetTypography(typo, CurrentTextRange);
            typo.Release();
        }