本文整理汇总了C#中ITsTextProps.GetIntProp方法的典型用法代码示例。如果您正苦于以下问题:C# ITsTextProps.GetIntProp方法的具体用法?C# ITsTextProps.GetIntProp怎么用?C# ITsTextProps.GetIntProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITsTextProps
的用法示例。
在下文中一共展示了ITsTextProps.GetIntProp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClassesFromTsTextProps
public static List<string> ClassesFromTsTextProps(ITsTextProps props, int[] intPropsToSkip, int[] strPropsToSkip)
{
var classes = new List<string>();
for (int i = 0, n = props.IntPropCount; i < n; i++)
{
int propNum;
int variation;
int propValue = props.GetIntProp(i, out propNum, out variation);
if (intPropsToSkip.Contains(propNum))
continue;
string className = String.Format("propi_{0}_{1}_{2}_{3}", propNum, IntPropertyName(propNum), propValue, variation);
classes.Add(className);
}
for (int i = 0, n = props.StrPropCount; i < n; i++)
{
int propNum;
string propValue = props.GetStrProp(i, out propNum).Replace(" ", "_SPACE_");
string className = String.Format("props_{0}_{1}_{2}", propNum, StringPropertyName(propNum), propValue);
if (strPropsToSkip.Contains(propNum))
continue;
classes.Add(className);
}
return classes;
}
示例2: TextIntPropInfo
/// ------------------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the <see cref="T:TextIntPropInfo"/> class.
/// </summary>
/// ------------------------------------------------------------------------------------
public TextIntPropInfo(ITsTextProps props, int iprop, FdoCache cache)
{
int nvar;
int tpt;
Value = props.GetIntProp(iprop, out tpt, out nvar);
Type = (FwTextPropType)tpt;
Variant = (FwTextPropVar)nvar;
m_toStringValue = Value + " (" + Type + ")";
if (tpt == (int)FwTextPropType.ktptWs)
{
IWritingSystem ws = cache.ServiceLocator.WritingSystemManager.Get(Value);
m_toStringValue += " {" + ws + "}";
}
}
示例3: PropsAreEqual
/// ------------------------------------------------------------------------------------
/// <summary>
/// Compares two TsTextProps
/// </summary>
/// <param name="ttp1">expected</param>
/// <param name="ttp2">actual</param>
/// <param name="sHowDifferent">Human(geek)-readable string telling how the props are
/// different, or indicating no difference</param>
/// <returns>True if they contain the same props, false otherwise</returns>
/// ------------------------------------------------------------------------------------
public static bool PropsAreEqual(ITsTextProps ttp1, ITsTextProps ttp2,
out string sHowDifferent)
{
// check how intProps compare
int cProps1 = ttp1.IntPropCount;
int cProps2 = ttp2.IntPropCount;
int tpv1, tpv2; // prop values
int nVar1, nVar2; // variation info
int tpt; // prop type
for (int iprop = 0; iprop < cProps1; iprop++)
{
tpv1 = ttp1.GetIntProp(iprop, out tpt, out nVar1);
tpv2 = ttp2.GetIntPropValues(tpt, out nVar2);
if (tpv1 != tpv2 || nVar1 != nVar2)
{
if (tpt == (int)FwTextPropType.ktptWs)
sHowDifferent = string.Format("Props differ in ktptWs property. "
+ "Expected <{0}>, but was <{1}>.", tpv1, tpv2);
else
sHowDifferent = string.Format("Props differ in intProp type {0}. "
+ "Expected <{1},{2}>, but was <{3},{4}>.", tpt, tpv1, nVar1, tpv2, nVar2);
return false;
}
}
// if count of intProps differs, it will be difficult to report exact difference
// so just issue a simple response for now
if (cProps1 != cProps2)
{
sHowDifferent = string.Format("Props differ in count of intProps. "
+ "Expected <{0}>, but was <{1}>.", cProps1, cProps2);
return false;
}
// check for string properties differences
int s1count = ttp1.StrPropCount;
int s2count = ttp2.StrPropCount;
int strtype;
string strval1, strval2; // prop values
for (int iprop = 0; iprop < s1count; iprop++)
{
strval1 = ttp1.GetStrProp(iprop, out strtype);
strval2 = ttp2.GetStrPropValue(strtype);
if (strval1 != strval2)
{
if (strtype == (int)FwTextPropType.ktptNamedStyle)
sHowDifferent = string.Format("Props differ in ktptNamedStyle property. "
+ "Expected <{0}>, but was <{1}>.", strval1, strval2);
else if (strtype == (int)FwTextPropType.ktptObjData)
sHowDifferent = string.Format("Props differ in ktptObjData property. "
+ "Expected <{0}>, but was <{1}>.", strval1, strval2);
// we could detail the objectDataType and Guid if needed
else
sHowDifferent = string.Format("Props differ in strProp type {0}. "
+ "Expected <{1}>, but was <{2}>.", strtype, strval1, strval2);
return false;
}
}
// if count of strProps differs, it will be difficult to report exact difference
// so just issue a simple response for now
if (s1count != s2count)
{
sHowDifferent = string.Format("Props differ in count of strProps. "
+ "Expected <{0}>, but was <{1}>.", s1count, s2count);
return false;
}
// if we reach this point, no differences were found
sHowDifferent = "TextProps objects appear to contain the same properties.";
return true;
}
示例4: spyOnTextProps
private void spyOnTextProps(ITsTextProps ttp)
{
int tpt; // ??
// look at integer props
int cintProps = ttp.IntPropCount;
for (int i = 0; i < cintProps; i++)
{
int nVar;
int intProp = ttp.GetIntProp(i, out tpt, out nVar);
int Value = ttp.GetIntPropValues(tpt, out nVar);
Value = 34; // need something so Value can be looked at
}
// look at string props
int cstrProps = ttp.StrPropCount;
for (int i = 0; i < cstrProps; i++)
{
string strProp = ttp.GetStrProp(i, out tpt);
string Value = ttp.GetStrPropValue(tpt);
Value = "why?"; // need something so Value can be looked at
}
}
示例5: ApplyTextProps
/// <summary>
/// Compute the assembled styles that results from applying the properties specified in the text props to this.
/// We might start with a root assembled styles that says to use a 10-point font,
/// then apply a paragraph style which says to use a 12-point font, except for French use 14-point.
/// Then in another text props we may tell it the writing system is French, and must get 14-point as the
/// result. Or, in a single TsTextProps, we may tell it the WS is French and to apply a character
/// style which says to use 16-point, except for French 18-point; the result needs to be 18-point.
/// It's also theoretically possible that the same text props again says directly to use 20-point; that
/// should win over all the others.
/// We achieve most of this by simply looking for the ws, then the named style, then everything else
/// (and when we process a style, if we already know a ws we include the overrides for that ws).
/// However, when we process the paragraph style, we don't know what ws a run in that paragraph will have.
/// </summary>
/// <param name="props"></param>
/// <returns></returns>
public AssembledStyles ApplyTextProps(ITsTextProps props)
{
AssembledStyles result = this;
// Apply writing system, if present, first, so that it can be used to select
// a named style effect.
int ttv;
int ws = props.GetIntPropValues((int) FwTextPropType.ktptWs, out ttv);
if (ttv != -1)
result = result.WithWs(ws);
// Apply named style next, if present, so that style effects can be overridden by explicit ones.
var namedStyle = props.GetStrPropValue((int) FwTextPropType.ktptNamedStyle);
if (namedStyle != null)
result = result.WithNamedStyle(namedStyle);
int count = props.IntPropCount;
for (int i = 0; i < count; i++)
{
int tpt;
int val = props.GetIntProp(i, out tpt, out ttv);
switch (tpt)
{
case (int) FwTextPropType.ktptWs: // handled first
break;
case (int) FwTextPropType.ktptBold:
int weight;
Debug.Assert(ttv == (int) FwTextPropVar.ktpvEnum);
switch (val)
{
case (int) FwTextToggleVal.kttvForceOn:
weight = (int) VwFontWeight.kvfwBold;
break;
// todo JohnT: several others.
default:
weight = (int)VwFontWeight.kvfwNormal;
break;
}
result = result.WithFontWeight(weight);
break;
}
}
return result;
}