当前位置: 首页>>代码示例>>C#>>正文


C# Glyph.AddChild方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:nholik,项目名称:Fo.Net,代码行数:60,代码来源:GlyphReader.cs


注:本文中的Glyph.AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。