Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Member AddUnicodeProp
        /// </summary>
        /// <param name="tag">tag</param>
        /// <param name="ws">ws</param>
        /// <param name="_vwvc">_vwvc</param>
        /// ------------------------------------------------------------------------------------
        public override void AddUnicodeProp(int tag, int ws, IVwViewConstructor _vwvc)
        {
            CurrentContext ccOld = WriteFieldStartTag(tag);
            string         sText = DataAccess.get_UnicodeProp(CurrentObject(), tag);

            // Need to ensure that sText is NFC for export.
            Icu.InitIcuDataDir();
            if (!Icu.IsNormalized(sText, Icu.UNormalizationMode.UNORM_NFC))
            {
                sText = Icu.Normalize(sText, Icu.UNormalizationMode.UNORM_NFC);
            }
            string sWs = WritingSystemId(ws);

            IndentLine();
            if (String.IsNullOrEmpty(sWs))
            {
                m_writer.WriteLine("<Uni>{0}</Uni>", XmlUtils.MakeSafeXml(sText));
            }
            else
            {
                m_writer.WriteLine("<AUni ws=\"{0}\">{1}</AUni>",
                                   sWs, XmlUtils.MakeSafeXml(sText));
            }
            WriteFieldEndTag(tag, ccOld);
        }
Example #2
0
 /// <summary>
 /// Return whether the string is already in the specified normal form.
 /// Note that a string may be considered to be in NFC
 /// even though its text (the plain character sequence) is not.
 /// This is because we don't collapse otherwise collapsible pairs if they
 /// have different style properties.
 /// </summary>
 public bool get_IsNormalizedForm(FwNormalizationMode nm)
 {
     if (IsAlreadyNormalized(nm))
     {
         return(true);
     }
     if (string.IsNullOrEmpty(Text))
     {
         NoteAlreadyNormalized(nm);
         return(true);
     }
     Icu.UNormalizationMode icuMode = (nm == FwNormalizationMode.knmNFSC) ? Icu.UNormalizationMode.UNORM_NFC : (Icu.UNormalizationMode)nm;
     if (Icu.IsNormalized(Text, icuMode))
     {
         // Don't do this work a second time
         if (nm == FwNormalizationMode.knmNFSC)
         {
             NoteAlreadyNormalized(FwNormalizationMode.knmNFC);                     // NFC includes NFSC
         }
         else
         {
             NoteAlreadyNormalized(nm);
         }
         return(true);
     }
     if (nm == FwNormalizationMode.knmNFSC)
     {
         // NFSC is a special case, where we just have to normalize and compare.
         if (Equals(get_NormalizedForm(nm)))
         {
             NoteAlreadyNormalized(nm);
             return(true);
         }
     }
     return(false);
 }