Example #1
0
        /// <summary>
        ///     Loads all the unicode ranges.
        /// </summary>
        private void LoadRanges(GdiDeviceContent dc) {
            GlyphSet glyphSet = new GlyphSet();
            uint size = LibWrapper.GetFontUnicodeRanges(dc.Handle, glyphSet);
            if (size == 0) {
                throw new Exception("Unable to retrieve unicode ranges.");
            }

            unicodeRanges = new UnicodeRange[glyphSet.cRanges];
            for (int i = 0, offset = 0; i < glyphSet.cRanges; i++) {
                ushort wcLow = (ushort) (glyphSet.ranges[offset++] + (glyphSet.ranges[offset++] << 8));
                ushort cGlyphs = (ushort) (glyphSet.ranges[offset++] + (glyphSet.ranges[offset++] << 8));
                unicodeRanges[i] = new UnicodeRange(dc, wcLow, (ushort) (wcLow + cGlyphs - 1));
            }
        }
        /// <summary>
        ///     Loads all the unicode ranges.
        /// </summary>
        private void LoadRanges(GdiDeviceContent dc)
        {
            GlyphSet glyphSet = new GlyphSet();
            uint     size     = LibWrapper.GetFontUnicodeRanges(dc.Handle, glyphSet);

            if (size == 0)
            {
                throw new Exception("Unable to retrieve unicode ranges.");
            }

            unicodeRanges = new UnicodeRange[glyphSet.cRanges];
            for (int i = 0, offset = 0; i < glyphSet.cRanges; i++)
            {
                ushort wcLow   = (ushort)(glyphSet.ranges[offset++] + (glyphSet.ranges[offset++] << 8));
                ushort cGlyphs = (ushort)(glyphSet.ranges[offset++] + (glyphSet.ranges[offset++] << 8));
                unicodeRanges[i] = new UnicodeRange(dc, wcLow, (ushort)(wcLow + cGlyphs - 1));
            }
        }
Example #3
0
 internal static extern uint GetFontUnicodeRanges(
     IntPtr hdc,   // handle to DC
     [Out, MarshalAs(UnmanagedType.LPStruct)]
     GlyphSet lpgs // glyph set
     );