Example #1
0
        /// <summary>
        /// Registers some internal fonts places in theme/fonts folder.
        /// </summary>
        /// <param name="engine">ui engine</param>
        /// <param name="theme">theme object</param>
        private void Init(UIEngine engine, Theme theme)
        {
            lock (this)
            {
                if (null != this.addedFonts)
                {
                    engine.Logger.WriteLine(LogLevel.Info, "WinFontCreator init");

                    this.addedFonts = new List <Object>();

                    if (null != theme)
                    {
                        List <String> fontFiles = new List <String>();

                        String fontsFolder = theme.ThemeFolder + "fonts/";

                        engine.GetFiles(fontsFolder, fontFiles);

                        engine.Logger.WriteLine(LogLevel.Info, "Enumerating fonts (in " + fontsFolder + "):");

                        foreach (String fontFile in fontFiles)
                        {
                            String fullPath = fontsFolder + fontFile;

                            byte[] fileBytes = null;
                            uint   fileSize  = 0;
                            Object file      = null;

                            if (true == engine.OpenFile(fullPath, out fileBytes, out fileSize, out file))
                            {
                                Object fontHandle = FileUtils.Platform.AddFontResource(fileBytes);

                                if (null != fontHandle)
                                {
                                    this.addedFonts.Add(fontHandle);

                                    engine.Logger.WriteLine(LogLevel.Info, "Adding font " + fullPath);
                                }

                                engine.CloseFile(ref file);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public BitmapFontCreator(UIEngine engine)
        {
            this.engine = engine;

            List <String> files = new List <String>();

            engine.GetFiles(fontsFolder, files);

            foreach (String fileName in files)
            {
                if (true == fileName.EndsWith(".font.xml"))
                {
                    String fontName = GetFontName(fontsFolder + fileName, engine);

                    if (null != fontName)
                    {
                        this.availableFonts[fontName.ToLower()] = fileName;
                    }
                }
            }
        }
Example #3
0
        public BitmapFontCreator(UIEngine engine)
        {
            this.engine = engine;

            List<String> files = new List<String>();

            engine.GetFiles(fontsFolder, files);

            foreach (String fileName in files)
            {
                if (true == fileName.EndsWith(".font.xml"))
                {
                    String fontName = GetFontName(fontsFolder + fileName, engine);

                    if (null != fontName)
                    {
                        this.availableFonts[fontName.ToLower()] = fileName;
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// Registers some internal fonts places in theme/fonts folder.
        /// </summary>
        /// <param name="engine">ui engine</param>
        /// <param name="theme">theme object</param>
        private void Init(UIEngine engine, Theme theme)
        {
            lock (this)
            {
                if (null != this.addedFonts)
                {
                    engine.Logger.WriteLine(LogLevel.Info, "WinFontCreator init");

                    this.addedFonts = new List<Object>();

                    if (null != theme)
                    {
                        List<String> fontFiles = new List<String>();

                        String fontsFolder = theme.ThemeFolder + "fonts/";

                        engine.GetFiles(fontsFolder, fontFiles);

                        engine.Logger.WriteLine(LogLevel.Info, "Enumerating fonts (in " + fontsFolder + "):");

                        foreach (String fontFile in fontFiles)
                        {
                            String fullPath = fontsFolder + fontFile;

                            byte[] fileBytes = null;
                            uint fileSize = 0;
                            Object file = null;

                            if (true == engine.OpenFile(fullPath, out fileBytes, out fileSize, out file))
                            {
                                Object fontHandle = FileUtils.Platform.AddFontResource(fileBytes);

                                if (null != fontHandle)
                                {
                                    this.addedFonts.Add(fontHandle);

                                    engine.Logger.WriteLine(LogLevel.Info, "Adding font " + fullPath);
                                }

                                engine.CloseFile(ref file);
                            }
                        }
                    }
                }
            }
        }