Пример #1
0
        public static void Initialize()
        {
            // When debugging or when in a app package, our paths are a bit different.
            string[] pathsToSearch =
            {
                "./Resources/",
                "../../Resources/",
                "../Resources/Fonts/",
                "."
            };

            string[] fontsToLoad =
            {
                "Quicksand-Regular.ttf",
                "Quicksand-Bold.ttf"
            };

            var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            foreach (var path in pathsToSearch)
            {
                var absPath = Path.Combine(appPath, path);

                if (File.Exists(Path.Combine(absPath, fontsToLoad[0])))
                {
                    foreach (var font in fontsToLoad)
                    {
                        var fullpath = Path.Combine(absPath, font);
#if FAMISTUDIO_MACOS
                        MacUtils.CoreTextRegisterFont(fullpath);
#else
                        try
                        {
                            FcConfigAppFontAddFile(IntPtr.Zero, fullpath);
                        }
                        catch
                        {
                            try { FcConfigAppFontAddFile1(IntPtr.Zero, fullpath); } catch { }
                        }
#endif
                    }
                    break;
                }
            }

#if FAMISTUDIO_LINUX
            Toolkit.Init(new ToolkitOptions
            {
                Backend = PlatformBackend.PreferX11,
                EnableHighResolution = false
            });
#endif

            InitializeGtk();
        }
Пример #2
0
        public static void Initialize()
        {
            // When debugging or when in a app package, our paths are a bit different.
            string[] pathsToSearch =
            {
                "../../Resources/",
                "../Resources/Fonts/"
            };

            string[] fontsToLoad =
            {
                "Quicksand-Regular.ttf",
                "Quicksand-Bold.ttf"
            };

            var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            foreach (var path in pathsToSearch)
            {
                var absPath = Path.Combine(appPath, path);

                if (File.Exists(Path.Combine(absPath, fontsToLoad[0])))
                {
                    foreach (var font in fontsToLoad)
                    {
                        var fullpath = Path.Combine(absPath, font);
                        MacUtils.CoreTextRegisterFont(fullpath);
                    }
                    break;
                }
            }

            Gtk.Application.Init();

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FamiStudio.Resources.gtk.rc"))
                using (var reader = new StreamReader(stream))
                {
                    string gtkrc = reader.ReadToEnd();
                    Gtk.Rc.ParseString(gtkrc);
                }
        }
Пример #3
0
        public static void Initialize()
        {
            mainThread = Thread.CurrentThread;

            // When debugging or when in a app package, our paths are a bit different.
            string[] pathsToSearch =
            {
                "./Resources/",
                "../../Resources/",
                "../Resources/Fonts/",
                "."
            };

            string[] fontsToLoad =
            {
                "Quicksand-Regular.ttf",
                "Quicksand-Bold.ttf"
            };

            var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            foreach (var path in pathsToSearch)
            {
                var absPath = Path.Combine(appPath, path);

                if (File.Exists(Path.Combine(absPath, fontsToLoad[0])))
                {
                    foreach (var font in fontsToLoad)
                    {
                        MacUtils.CoreTextRegisterFont(Path.Combine(absPath, font));
                    }
                    break;
                }
            }

            InitializeGtk();
        }