Example #1
0
		public GlyphPosition[] GlyphPositions()
		{
			int length;
			IntPtr glyphPositionPtr = HB.hb_buffer_get_glyph_positions(reference, out length);
			var glyphPositions = new GlyphPosition[length];
			for (int i = 0; i < length; ++i)
			{
				glyphPositions[i] = new GlyphPosition();
				Marshal.PtrToStructure(glyphPositionPtr + 20 * i, glyphPositions[i]);
			}

			return glyphPositions;
		}
Example #2
0
        public GlyphPosition[] GlyphPositions()
        {
            int    length;
            IntPtr glyphPositionPtr = HB.hb_buffer_get_glyph_positions(reference, out length);
            var    glyphPositions   = new GlyphPosition[length];

            for (int i = 0; i < length; ++i)
            {
#if FIX
                // Portable class library Profile 111 does not support
                // the generic version of Marshal.PtrToStructure
                glyphPositions[i] = Marshal.PtrToStructure <GlyphPosition>(
                    glyphPositionPtr + 20 * i);
#else
                // This version causes boxing.
                glyphPositions[i] = (GlyphPosition)Marshal.PtrToStructure(
                    glyphPositionPtr + 20 * i, typeof(GlyphPosition));
#endif
            }

            return(glyphPositions);
        }