コード例 #1
0
        /// <summary>
        /// Create
        /// <see cref="FontSelector"/>
        /// or get from cache.
        /// </summary>
        /// <param name="fontFamilies">target font families</param>
        /// <param name="fc">
        /// instance of
        /// <see cref="FontCharacteristics"/>
        /// .
        /// </param>
        /// <param name="tempFonts">set of temporary fonts.</param>
        /// <returns>
        /// an instance of
        /// <see cref="FontSelector"/>
        /// .
        /// </returns>
        /// <seealso cref="CreateFontSelector(System.Collections.Generic.ICollection{E}, System.Collections.Generic.IList{E}, FontCharacteristics)
        ///     ">}</seealso>
        public FontSelector GetFontSelector(IList <String> fontFamilies, FontCharacteristics fc, FontSet tempFonts)
        {
            FontSelectorKey key          = new FontSelectorKey(fontFamilies, fc);
            FontSelector    fontSelector = fontSelectorCache.Get(key, tempFonts);

            if (fontSelector == null)
            {
                fontSelector = CreateFontSelector(fontSet.GetFonts(tempFonts), fontFamilies, fc);
                fontSelectorCache.Put(key, fontSelector, tempFonts);
            }
            return(fontSelector);
        }
コード例 #2
0
 internal virtual void Put(FontSelectorKey key, FontSelector fontSelector, FontSet fontSet)
 {
     if (fontSet == null)
     {
         Put(key, fontSelector);
     }
     else
     {
         FontSelectorCache.FontSetSelectors selectors = caches.Get(fontSet.GetId());
         if (selectors == null)
         {
             caches.Put(fontSet.GetId(), selectors = new FontSelectorCache.FontSetSelectors());
         }
         //update selectors and defaultSelectors to reset counter before pushing if needed.
         Update(selectors, fontSet);
         selectors.map.Put(key, fontSelector);
     }
 }
コード例 #3
0
 internal virtual FontSelector Get(FontSelectorKey key, FontSet fontSet)
 {
     if (fontSet == null)
     {
         return(Get(key));
     }
     else
     {
         FontSelectorCache.FontSetSelectors selectors = caches.Get(fontSet.GetId());
         if (selectors == null)
         {
             caches.Put(fontSet.GetId(), selectors = new FontSelectorCache.FontSetSelectors());
         }
         if (Update(selectors, fontSet))
         {
             return(null);
         }
         else
         {
             return(selectors.map.Get(key));
         }
     }
 }
コード例 #4
0
 internal virtual void Put(FontSelectorKey key, FontSelector fontSelector)
 {
     //update defaultSelectors to reset counter before pushing if needed.
     Update(null, null);
     defaultSelectors.map.Put(key, fontSelector);
 }