Beispiel #1
0
        protected override void CreateResources()
        {
            string text = "Hello World From ... DirectWrite!";

            _blackBrush = RenderTarget.CreateSolidColorBrush(Color.Black);
            _textLayout = DirectWriteFactory.CreateTextLayout(text, _textFormat, RenderTarget.GetSize());

            // (21, 12) is the range around "DirectWrite!"
            _textLayout.SetFontSize(100, (21, 12));
            _typography = DirectWriteFactory.CreateTypography();
            _typography.AddFontFeature(new FontFeature(FontFeatureTag.StylisticSet7, 1));
            _textLayout.SetTypography(_typography, (0, text.Length));
            _textLayout.SetUnderline(true, (21, 12));
            _textLayout.SetFontWeight(FontWeight.Bold, (21, 12));
        }
Beispiel #2
0
        private static void ExportToJson(ITypography typography, string fileName)
        {
            var json = JsonConvert.SerializeObject(
                typography,
                Formatting.Indented,
                new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            });

            //json = Encrypt(json);

            var sw11 = new StreamWriter(fileName, false, Encoding.UTF8);

            sw11.WriteLine(json);
            sw11.Close();
        }
Beispiel #3
0
 public void SetTypography(TextRange textRange, ITypography typography)
 {
     base.innerRefT.SetTypography(textRange, typography);
 }
 public static ITypography CreateRef(this ITypography objectRef) =>
 ((ITypography)objectRef.CreateRef(typeof(ITypography)));