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)
            {
#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);
        }
Example #2
0
 public int GetHorizontalKerning(uint leftGlyph, uint rightGlyph)
 {
     return(HB.hb_font_get_glyph_h_kerning(reference, leftGlyph, rightGlyph));
 }
Example #3
0
 public static Font FromFTFace(Face face)
 {
     return(new Font {
         reference = HB.hb_ft_font_create(face.Reference, IntPtr.Zero)
     });
 }
Example #4
0
 public static void Shape(this Font font, Buffer buffer)
 {
     HB.hb_shape(font.Reference, buffer.Reference, IntPtr.Zero, 0);
 }
Example #5
0
 public void AddText(string str)
 {
     byte[] text = System.Text.Encoding.UTF8.GetBytes(str);
     HB.hb_buffer_add_utf8(reference, text, text.Length, 0, text.Length);
 }
Example #6
0
 public Buffer()
 {
     reference = HB.hb_buffer_create();
 }