/// <summary> /// Creates a new writing system. /// </summary> /// <returns></returns> public IWritingSystem Create(string identifier) { lock (m_syncRoot) { if (m_globalStore != null) { IWritingSystemDefinition globalWs; if (m_globalStore.TryGet(identifier, out globalWs)) { return((PalasoWritingSystem)m_globalStore.MakeDuplicate(globalWs)); } } } LanguageSubtag languageSubtag; ScriptSubtag scriptSubtag; RegionSubtag regionSubtag; VariantSubtag variantSubtag; if (!LangTagUtils.GetSubtags(identifier, out languageSubtag, out scriptSubtag, out regionSubtag, out variantSubtag)) { throw new ArgumentException(identifier + " is not a valid RFC5646 language tag."); } var result = Create(languageSubtag, scriptSubtag, regionSubtag, variantSubtag); if (TemplateFolder != null) { // try in our master template file // Todo: have property TemplateFolderPath, initialize in FdoBackendProvider.InitializeWritingSystemManager var template = Path.Combine(TemplateFolder, Path.ChangeExtension(identifier, "ldml")); if (File.Exists(template)) { var loader = new FwLdmlAdaptor(); loader.Read(template, (WritingSystemDefinition)result); } } return(result); }
/// <summary> /// Creates a copy of the specified writing system. /// </summary> /// <param name="ws">The writing system.</param> /// <returns></returns> public IWritingSystem CreateFrom(IWritingSystem ws) { lock (m_syncRoot) return((PalasoWritingSystem)m_localStore.MakeDuplicate((PalasoWritingSystem)ws)); }