示例#1
0
        private static bool StartNewSpan(StringBuilder html,
                                         String writingSystemId,
                                         bool boldText,
                                         bool underline,
                                         int fontSizeBoost)
        {
            if (!WritingSystems.Contains(writingSystemId))
            {
                return(false);
                //that ws isn't actually part of our configuration, so can't get a special font for it
            }
            IWritingSystemDefinition ws = (IWritingSystemDefinition)WritingSystems.Get(writingSystemId);
            Font   font          = WritingSystemInfo.CreateFont(ws);
            float  fontSize      = font.Size + fontSizeBoost;
            String lang          = ws.Bcp47Tag.IndexOf('-') == -1 ? ws.Bcp47Tag : ws.Bcp47Tag.Substring(0, ws.Bcp47Tag.IndexOf('-'));
            var    formattedSpan = string.Format(
                "<span lang='{5}' style='font-family:{0}; font-size:{1}pt;font-weight:{2};font-style:{3};text-decoration:{4}'>",
                font.Name,
                fontSize.ToString(),
                boldText ? "bold": "normal",
                italicsOn ? "italic" : "normal",
                underline ? "underline" : "none",
                lang);

            html.Append(formattedSpan);
            AddFontFamily(font.Name);
            return(true);
        }
 private IEnumerable <T> WritingSystemsNewerInGlobalRepository()
 {
     foreach (T ws in GlobalWritingSystemRepository.AllWritingSystems)
     {
         if (WritingSystems.ContainsKey(ws.Id))
         {
             if ((!_writingSystemsToIgnore.TryGetValue(ws.Id, out var lastDateModified) || ws.DateModified > lastDateModified) &&
                 (ws.DateModified > WritingSystems[ws.Id].DateModified))
             {
                 yield return(WritingSystemFactory.Create(ws));
             }
         }
     }
 }
 private IEnumerable <T> WritingSystemsNewerInGlobalRepository()
 {
     foreach (T ws in _globalRepository.AllWritingSystems)
     {
         if (WritingSystems.ContainsKey(ws.LanguageTag))
         {
             DateTime lastDateModified;
             if ((!_writingSystemsToIgnore.TryGetValue(ws.LanguageTag, out lastDateModified) || ws.DateModified > lastDateModified) &&
                 (ws.DateModified > WritingSystems[ws.LanguageTag].DateModified))
             {
                 yield return(WritingSystemFactory.Create(ws));
             }
         }
     }
 }
示例#4
0
        public IEnumerable <string> GetHeadwordWritingSystemIds()
        {
            Field fieldControllingHeadwordOutput =
                GetField(LexEntry.WellKnownProperties.Citation);

            if (fieldControllingHeadwordOutput == null || !fieldControllingHeadwordOutput.Enabled)
            {
                fieldControllingHeadwordOutput =
                    GetField(LexEntry.WellKnownProperties.LexicalUnit);
                if (fieldControllingHeadwordOutput == null)
                {
                    throw new ArgumentException("Expected to find LexicalUnit in the view Template");
                }
            }
            return(WritingSystems.FilterForTextIds(fieldControllingHeadwordOutput.WritingSystemIds));
        }