本文整理汇总了C#中Glyph.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Glyph.AddChild方法的具体用法?C# Glyph.AddChild怎么用?C# Glyph.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Glyph
的用法示例。
在下文中一共展示了Glyph.AddChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadCompositeGlyph
/// <summary>
/// Populate the <i>composites</i>IList containing all child glyphs
/// that this glyph uses.
/// </summary>
/// <remarks>
/// The <i>stream</i> parameter must be positioned 10 bytes from
/// the beginning of the glyph description, i.e. the flags field.
/// </remarks>
/// <param name="stream"></param>
private void ReadCompositeGlyph(FontFileStream stream, Glyph glyph) {
bool moreComposites = true;
while (moreComposites) {
short flags = stream.ReadShort();
long offset = stream.Position;
int subsetIndex = reader.IndexMappings.Map(stream.ReadShort());
glyph.AddChild(subsetIndex);
// While we're here, remap the child glyph index
stream.Position = stream.Position - PrimitiveSizes.Short;
stream.WriteShort(subsetIndex);
// The following code is based on the C pseudo code supplied
// in the glyf table specification.
int skipBytes = 0;
if ((flags & BitMasks.Arg1And2AreWords) > 0) {
skipBytes = PrimitiveSizes.Short*2;
}
else {
skipBytes = PrimitiveSizes.UShort;
}
if ((flags & BitMasks.WeHaveAScale) > 0) {
// Skip scale
skipBytes = PrimitiveSizes.F2DOT14;
}
else if ((flags & BitMasks.WeHaveAnXAndYScale) > 0) {
// Skip xscale and yscale
skipBytes = PrimitiveSizes.F2DOT14*2;
}
else if ((flags & BitMasks.WeHaveATwoByTwo) > 0) {
// Skip xscale, scale01, scale10 and yscale
skipBytes = PrimitiveSizes.F2DOT14*4;
}
// Glyph instructions
if ((flags & BitMasks.WeHaveInstructions) > 0) {
skipBytes = PrimitiveSizes.Byte*stream.ReadUShort();
}
if ((flags & BitMasks.MoreComponents) > 0) {
moreComposites = true;
}
else {
moreComposites = false;
}
stream.Skip(skipBytes);
}
}