예제 #1
0
 public ComplexFontSelectorStrategy(String text, FontSelector selector, FontProvider provider, FontSet tempFonts
                                    )
     : base(text, provider, tempFonts)
 {
     this.font     = null;
     this.selector = selector;
 }
예제 #2
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);
        }
예제 #3
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);
     }
 }
예제 #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);
 }