/// <summary>
        /// Read the font resource.
        /// </summary>
        /// <param name="hModule">Handle to a module.</param>
        /// <param name="lpRes">Pointer to the beginning of the font structure.</param>
        /// <returns>Address of the end of the font structure.</returns>
        internal override IntPtr Read(IntPtr hModule, IntPtr lpRes)
        {
            IntPtr lpHead = lpRes;

            UInt16 count = (UInt16)Marshal.ReadInt16(lpRes);
            lpRes = new IntPtr(lpRes.ToInt64() + 2);

            for (int i = 0; i < count; i++)
            {
                FontDirectoryEntry fontEntry = new FontDirectoryEntry();
                lpRes = fontEntry.Read(lpRes);
                _fonts.Add(fontEntry);
            }

            int reservedLen = _size - (lpRes.ToInt32() - lpHead.ToInt32() - 1);
            _reserved = new byte[reservedLen];
            Marshal.Copy(lpRes, _reserved, 0, reservedLen);

            return lpRes;
        }
Esempio n. 2
0
        /// <summary>
        /// Read the font resource.
        /// </summary>
        /// <param name="hModule">Handle to a module.</param>
        /// <param name="lpRes">Pointer to the beginning of the font structure.</param>
        /// <returns>Address of the end of the font structure.</returns>
        internal override IntPtr Read(IntPtr hModule, IntPtr lpRes)
        {
            IntPtr lpHead = lpRes;

            UInt16 count = (UInt16)Marshal.ReadInt16(lpRes);

            lpRes = new IntPtr(lpRes.ToInt64() + 2);

            for (int i = 0; i < count; i++)
            {
                FontDirectoryEntry fontEntry = new FontDirectoryEntry();
                lpRes = fontEntry.Read(lpRes);
                _fonts.Add(fontEntry);
            }

            int reservedLen = _size - (lpRes.ToInt32() - lpHead.ToInt32() - 1);

            _reserved = new byte[reservedLen];
            Marshal.Copy(lpRes, _reserved, 0, reservedLen);

            return(lpRes);
        }