Example #1
0
 public void Dispose()
 {
     if (!copy)
     {
         FreeTypeNative.FT_Done_Face(reference);
     }
 }
Example #2
0
        /// <summary>
        /// Tries to get the char index for the char code
        /// </summary>
        /// <param name="c"></param>
        /// <param name="glyph"></param>
        /// <returns>Flag indicating whether the glyph exists</returns>
        public bool TryCharIndex(uint c, out uint glyph)
        {
            var index = FreeTypeNative.FT_Get_Char_Index(reference, c);

            glyph = index;
            return(glyph != 0);
        }
Example #3
0
        public void LoadChar(uint c, LoadFlags flags)
        {
            var err = FreeTypeNative.FT_Load_Char(reference, c, (int)flags);

            if (err != 0)
            {
                throw FreeTypeException.Except(err);
            }
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="glyph">Char index <see cref="TryCharIndex"/></param>
        /// <param name="flags"></param>
        /// <exception cref="FreeTypeException"></exception>
        public void LoadGlyph(uint glyph, LoadFlags flags)
        {
            var err = FreeTypeNative.FT_Load_Glyph(reference, glyph, (int)flags);

            if (err != 0)
            {
                throw FreeTypeException.Except(err);
            }
        }
Example #5
0
        public void SetCharSize(Fixed26Dot6 size)
        {
            var err = FreeTypeNative.FT_Set_Char_Size(reference, IntPtr.Zero, (IntPtr)size.Value, 96, 96);

            CalculateMetrics();
            if (err != 0)
            {
                throw FreeTypeException.Except(err);
            }
        }
Example #6
0
        public FreeTypeFace FaceFromFile(string path)
        {
            var error = FreeTypeNative.FT_New_Face(Reference, path, 0, out var face_ptr);

            if (error != 0)
            {
                throw FreeTypeException.Except(error);
            }
            var face = FreeTypeFace.CreateFace(face_ptr);

            return(face);
        }
Example #7
0
 public void ProcessOutline(ref FTOutline outline)
 {
     FreeTypeNative.FT_Outline_Decompose(ref outline, ref funcs, IntPtr.Zero);
 }
Example #8
0
 public bool GetColorLayer(ref FTLayerIterator iterator, ref FTGlyphSlot glyph)
 {
     return(FreeTypeNative.FT_Get_Color_Glyph_Layer(reference, glyph.Index, out var a, out var b, ref iterator));
 }