public void LoadFont()
        {
            Styles.Clear();

            var a = Assembly.GetExecutingAssembly();

            var document = XDocument.Load(a.GetManifestResourceStream("MathematicsTypesetting.Fonts.LatinModern.font.xml"));
            var root     = document.Root;

            foreach (var s in root.Elements())
            {
                var style = new Style();

                style.Weight   = s.Attribute(XName.Get("weight", "")).Value;
                style.Emphasis = s.Attribute(XName.Get("emphasis", "")).Value;

                foreach (var g in s.Elements())
                {
                    var glyph = new Glyph();

                    glyph.Character = g.Attribute(XName.Get("character", "")).Value;
                    glyph.Path      = g.Attribute(XName.Get("path", "")).Value;

                    glyph.PathCommands = PathConverter.ParsePath(glyph.Path).Commands;
                    SetGlyphWidth(glyph);

                    style.Glyphs.Add(glyph);
                }

                Styles.Add(style);
            }
        }
Example #2
0
        public static GraphicsPath GetSquareRootPath(Length innerHeight, Length innerWidth)
        {
            // True LaTeX square-root shape
            var svg = "M 9.64216 21.1929 L 5.27964 11.5508 C 5.10613 11.1542 4.9822 11.1542 4.90784 11.1542 C 4.88305 11.1542 4.75911 11.1542 4.48646 11.3525 L 2.13169 13.1371 C 1.80945 13.385 1.80945 13.4594 1.80945 13.5337 C 1.80945 13.6577 1.88382 13.8064 2.05733 13.8064 C 2.20605 13.8064 2.62743 13.4594 2.90009 13.2611 C 3.04881 13.1371 3.42061 12.8645 3.69327 12.6662 L 8.57632 23.399 C 8.74983 23.7956 8.87377 23.7956 9.09685 23.7956 C 9.46865 23.7956 9.54302 23.6468 9.71652 23.2998 L 20.9698 0 C 21.1434 -0.347019 21.1434 -0.446167 21.1434 -0.495741 C 21.1434 -0.743612 20.9451 -0.991482 20.6476 -0.991482 C 20.4493 -0.991482 20.2758 -0.867547 20.0775 -0.470954 L 9.64216 21.1929 Z";

            var p = PathConverter.ConvertPath(PathConverter.ParsePath(svg));

            return(p);
        }