Ejemplo n.º 1
0
        /// <summary>
        /// Load information about all fonts found in the cache's directories.
        /// </summary>
        public void Load()
        {
            _fonts     = new List <Font>();
            _fontFiles = new List <FontInfo>();

            //	Open all *.ttf and *.afm files in each of our font directories
            //	and test whether it's a font file. If it is a font file then read
            //	it and get its info. This doesn't load the font, it just
            //	reads some metadata.
            foreach (string dir in _fontDirectories)
            {
                //	True Type fonts
                string[] filenames = Directory.GetFiles(dir, "*.ttf");
                foreach (string filename in filenames)
                {
                    FontInfo info = TrueTypeFont.GetFontInfo(filename);
                    _fontFiles.Add(info);
                }

                //	Type 1 fonts
                filenames = Directory.GetFiles(dir, "*.afm");
                foreach (string filename in filenames)
                {
                    FontInfo info = Type1Font.GetFontInfo(filename);
                    _fontFiles.Add(info);
                }
            }
        }