Esempio n. 1
0
        public static void Load(NVGcontext ctx, string fontName, string fileName)
        {
            string filePath   = RESOURCES_PATH + fileName;
            int    fontHandle = NanoVG.nvgCreateFont(ctx, fontName, filePath);

            s_FontMap[fontName] = fontHandle;
        }
Esempio n. 2
0
        private static void SetupOpenGl()
        {
            // Set up caps
            GL.Disable(EnableCap.DepthTest);
            GL.Enable(EnableCap.RescaleNormal);

            // Set up blending
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

            // Set background color
            GL.ClearColor(Color.White);

            GlNanoVG.nvgCreateGL(ref Nvg, (int)NvgCreateFlags.AntiAlias | (int)NvgCreateFlags.StencilStrokes);
            var rSans = NanoVG.nvgCreateFont(Nvg, "sans",
                                             $"Resources{Path.DirectorySeparatorChar}Fonts{Path.DirectorySeparatorChar}latosemi.ttf");

            if (rSans == -1)
            {
                Lumberjack.Error("Unable to load sans");
            }
        }