Ejemplo n.º 1
0
        public void AddProjectFont(string fontItemPath)
        {
            string directoryName = Path.GetDirectoryName(fontItemPath);
            Dictionary <string, List <KeyValuePair <Typeface, string> > > cache;

            if (!this.projectFontFamilyLookup.TryGetValue(directoryName, out cache))
            {
                cache = new Dictionary <string, List <KeyValuePair <Typeface, string> > >();
                this.projectFontFamilyLookup[directoryName] = cache;
            }
            FontResolver.AddFontFileToCache(this.GetCachedFont(fontItemPath), cache, this.useGdiFontNames, this.gdiToWpfProjectFontNameMap, this.wpfToGdiProjectFontNameMap);
        }
Ejemplo n.º 2
0
        private static void StoreFontLookup(Dictionary <string, List <KeyValuePair <Typeface, string> > > fontFamilyLookup, Dictionary <string, List <string> > fontFamilyToFontFileMap, string fontSource, bool useGdiFontNames)
        {
            if (fontFamilyLookup.ContainsKey(fontSource))
            {
                return;
            }
            string        serializeFontFamilyName = FontEmbedder.GetSerializeFontFamilyName(new FontFamily(fontSource), useGdiFontNames);
            List <string> list;

            if (!fontFamilyToFontFileMap.TryGetValue(serializeFontFamilyName, out list))
            {
                return;
            }
            foreach (string fontFile in list)
            {
                FontResolver.AddFontFileToCache(fontFile, fontFamilyLookup, useGdiFontNames, (Dictionary <string, string>)null, (Dictionary <string, string>)null);
            }
        }