Ejemplo n.º 1
0
 public Cwdh(NitroFile file, WidthRegion firstReg)
     : base(file)
 {
     WidthRegion.ResetCount();
     this.firstRegion = firstReg;
     this.Size = 0x08 + this.firstRegion.GetTotalSize();
 }
Ejemplo n.º 2
0
 protected override void ReadData(Stream strIn)
 {
     this.firstRegion = WidthRegion.FromStream(
         strIn,
         this.File.Blocks.GetByType<Finf>(0).DefaultWidth);
 }
Ejemplo n.º 3
0
            public static WidthRegion FromStream(Stream strIn, GlyphWidth defaultWidth)
            {
                BinaryReader br = new BinaryReader(strIn);
                long startPosition = strIn.Position;

                WidthRegion wr = new WidthRegion(defaultWidth);
                wr.FirstChar = br.ReadUInt16();
                wr.LastChar = br.ReadUInt16();
                uint nextRegion = br.ReadUInt32();

                // Read widths
                int numWidths = wr.LastChar - wr.FirstChar + 1;
                wr.Widths = new GlyphWidth[numWidths];

                for (int i = 0; i < numWidths; i++) {
                    wr.Widths[i] = GlyphWidth.FromStream(strIn, wr.Id);
                }

                br = null;

                // Get other regions
                if (nextRegion != 0) {
                    strIn.Position = startPosition + nextRegion;
                    wr.NextRegion = WidthRegion.FromStream(strIn, defaultWidth);
                } else {
                    wr.NextRegion = null;
                }

                return wr;
            }