예제 #1
0
        private static void processFontCache(RdpPacket data, int extraFlags)
        {
            int font      = 0;
            int num2      = 0;
            int character = 0;
            int offset    = 0;
            int baseline  = 0;
            int width     = 0;
            int height    = 0;
            int count     = 0;

            byte[] buffer = null;
            int    num9   = (extraFlags >> 4) & 15;

            if ((num9 & 2) != 0)
            {
                font = extraFlags & 15;
                num2 = extraFlags >> 8;
            }
            else
            {
                font = data.ReadByte();
                num2 = data.ReadByte();
            }

            for (int i = 0; i < num2; i++)
            {
                if ((num9 & 2) != 0)
                {
                    character = data.ReadByte();
                    offset    = data.ReadEncodedSigned16();
                    baseline  = data.ReadEncodedSigned16();
                    width     = data.ReadEncodedUnsigned16();
                    height    = data.ReadEncodedUnsigned16();
                }
                else
                {
                    character = data.ReadLittleEndian16();
                    offset    = data.ReadLittleEndian16();
                    baseline  = data.ReadLittleEndian16();
                    width     = data.ReadLittleEndian16();
                    height    = data.ReadLittleEndian16();
                }

                count  = ((height * ((width + 7) / 8)) + 3) & -4;
                buffer = new byte[count];
                data.Read(buffer, 0, count);
                Glyph glyph = new Glyph(font, character, offset, baseline, width, height, buffer);
                Cache.putFont(glyph);
            }
        }