本文整理汇总了C#中ILgWritingSystemFactory.get_Engine方法的典型用法代码示例。如果您正苦于以下问题:C# ILgWritingSystemFactory.get_Engine方法的具体用法?C# ILgWritingSystemFactory.get_Engine怎么用?C# ILgWritingSystemFactory.get_Engine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILgWritingSystemFactory
的用法示例。
在下文中一共展示了ILgWritingSystemFactory.get_Engine方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupStyles
public void SetupStyles()
{
m_stylesheet = new TestFwStylesheet();
m_wsf = LgWritingSystemFactoryClass.Create();
m_wsf.BypassInstall = true;
// German
IWritingSystem wsGerman = m_wsf.get_Engine("de");
m_hvoGermanWs = wsGerman.WritingSystem;
Assert.IsTrue(m_hvoGermanWs > 0, "Should have gotten an hvo for the German WS");
// English
IWritingSystem wsEnglish = m_wsf.get_Engine("en");
m_hvoEnglishWs = wsEnglish.WritingSystem;
Assert.IsTrue(m_hvoEnglishWs > 0, "Should have gotten an hvo for the English WS");
Assert.IsTrue(m_hvoEnglishWs != m_hvoGermanWs, "Writing systems should have different IDs");
// Create a couple of styles
int hvoStyle = m_stylesheet.MakeNewStyle();
ITsPropsBldr propsBldr = TsPropsBldrClass.Create();
propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Arial");
m_stylesheet.PutStyle("StyleA", "bla", hvoStyle, 0, hvoStyle, 1, false, false,
propsBldr.GetTextProps());
hvoStyle = m_stylesheet.MakeNewStyle();
propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Times New Roman");
m_stylesheet.PutStyle("StyleB", "bla", hvoStyle, 0, hvoStyle, 1, false, false,
propsBldr.GetTextProps());
// Override the font size for each writing system and each style.
List<FontOverride> fontOverrides = new List<FontOverride>(2);
FontOverride fo;
fo.writingSystem = m_hvoGermanWs;
fo.fontSize = 13;
fontOverrides.Add(fo);
fo.writingSystem = m_hvoEnglishWs;
fo.fontSize = 21;
fontOverrides.Add(fo);
m_stylesheet.OverrideFontsForWritingSystems("StyleA", fontOverrides);
fontOverrides.Clear();
fo.writingSystem = m_hvoGermanWs;
fo.fontSize = 56;
fontOverrides.Add(fo);
fo.writingSystem = m_hvoEnglishWs;
fo.fontSize = 20;
fontOverrides.Add(fo);
m_stylesheet.OverrideFontsForWritingSystems("StyleB", fontOverrides);
}
示例2: Setup
public void Setup()
{
m_wsf = LgWritingSystemFactoryClass.Create();
// This is typically run during the build process before InstallLanguage.exe has
// been built, so we want to disable InstallLanguage for this test.
m_wsf.BypassInstall = true;
m_wsEn = m_wsf.get_Engine("en");
m_wsIdEn = m_wsf.GetWsFromStr("en");
m_wsEn.set_Name(m_wsIdEn, "English");
m_wsEn.set_Abbr(m_wsIdEn, "ENG");
}
示例3: GetWsForId
/// ------------------------------------------------------------------------------------
/// <summary>
/// Gets the ws handle for specified writing system identifier.
/// </summary>
/// <param name="wsId">The writing system identifier.</param>
/// <param name="lgwsf">The writing system factory.</param>
/// ------------------------------------------------------------------------------------
internal static int GetWsForId(string wsId, ILgWritingSystemFactory lgwsf)
{
try
{
ILgWritingSystem ws = lgwsf.get_Engine(wsId);
return ws.Handle;
}
catch (ArgumentException e)
{
throw new XmlSchemaException("Unable to create writing system: " + wsId, e);
}
}
示例4: TryGetWsEngine
private static bool TryGetWsEngine(ILgWritingSystemFactory wsFact, string langCode, out ILgWritingSystem wsEngine)
{
wsEngine = null;
try
{
wsEngine = wsFact.get_Engine(langCode);
}
catch (ArgumentException e)
{
Debug.Assert(false, "We hit the non-existant ws in AdjustPunctStringForCharacter().");
return false;
}
return true;
}
示例5: GetWsFromStr
/// <summary>
/// Translate the ICU locale string into the writing system id for the given
/// writing system factory, adding it to the factory as needed.
/// </summary>
/// <param name="icuLocale"></param>
/// <param name="wsf"></param>
/// <returns></returns>
static public int GetWsFromStr(string icuLocale, ILgWritingSystemFactory wsf)
{
int ws = wsf.GetWsFromStr(icuLocale);
if (ws == 0)
{
// This adds the icuLocale as a new writing system to the factory.
IWritingSystem lws = wsf.get_Engine(icuLocale);
ws = lws.WritingSystem;
lws = null;
}
return ws;
}
示例6: FindWordFormInString
bool FindWordFormInString(string wordForm, string source,
ILgWritingSystemFactory wsf, out int ichMin, out int ichLim)
{
var ws = wsf.get_Engine("en").Handle;
var tssWordForm = TsStringUtils.MakeTss(wordForm, ws);
var tssSource = TsStringUtils.MakeTss(source, ws);
return TsStringUtils.FindWordFormInString(tssWordForm, tssSource, wsf, out ichMin, out ichLim);
}
示例7: TrimNonWordFormingChars
string TrimNonWordFormingChars(string test, ILgWritingSystemFactory wsf, bool atStart, bool atEnd)
{
return TsStringUtils.TrimNonWordFormingChars(TsStringUtils.MakeTss(test, wsf.get_Engine("en").Handle), wsf, atStart, atEnd).Text;
}
示例8: SafelyGetWritingSystem
private static ILgWritingSystem SafelyGetWritingSystem(FdoCache cache, ILgWritingSystemFactory wsFactory,
Language lang, out bool fIsVernacular)
{
fIsVernacular = lang.vernacularSpecified && lang.vernacular;
ILgWritingSystem writingSystem = null;
try
{
writingSystem = wsFactory.get_Engine(lang.lang);
}
catch (ArgumentException e)
{
IWritingSystem ws;
WritingSystemServices.FindOrCreateSomeWritingSystem(cache, FwDirectoryFinder.TemplateDirectory, lang.lang,
!fIsVernacular, fIsVernacular, out ws);
writingSystem = ws;
s_wsMapper.Add(lang.lang, writingSystem); // old id string -> new langWs mapping
}
return writingSystem;
}
示例9: GetWsEngine
private static ILgWritingSystem GetWsEngine(ILgWritingSystemFactory wsFactory, string langCode)
{
ILgWritingSystem result;
if (s_wsMapper.TryGetValue(langCode, out result))
return result;
return wsFactory.get_Engine(langCode);
}
示例10: FindWordFormInString
bool FindWordFormInString(string wordForm, string source,
ILgWritingSystemFactory wsf, out int ichMin, out int ichLim)
{
int ws = wsf.get_Engine("en").WritingSystem;
ITsString tssWordForm = StringUtils.MakeTss(wordForm, ws);
ITsString tssSource = StringUtils.MakeTss(source, ws);
return StringUtils.FindWordFormInString(tssWordForm, tssSource, wsf, out ichMin, out ichLim);
}
示例11: TrimNonWordFormingChars
string TrimNonWordFormingChars(string test, ILgWritingSystemFactory wsf)
{
return StringUtils.TrimNonWordFormingChars(StringUtils.MakeTss(test, wsf.get_Engine("en").WritingSystem), wsf).Text;
}