Ejemplo n.º 1
0
        public void SetHorizontalGlyphAdvanceDelegate(GlyphAdvanceDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_h_advance_func(Handle, DelegateProxies.GlyphAdvanceProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 2
0
        public void SetNominalGlyphsDelegate(NominalGlyphsDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_nominal_glyphs_func(Handle, DelegateProxies.NominalGlyphsProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 3
0
        public void SetVariationGlyphDelegate(VariationGlyphDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_variation_glyph_func(Handle, DelegateProxies.VariationGlyphProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 4
0
        public void SetGlyphFromNameDelegate(GlyphFromNameDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_from_name_func(Handle, DelegateProxies.GlyphFromNameProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 5
0
        public void SetVerticalFontExtentsDelegate(FontExtentsDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_font_v_extents_func(Handle, DelegateProxies.FontExtentsProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 6
0
        public void SetGlyphContourPointDelegate(GlyphContourPointDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_contour_point_func(Handle, DelegateProxies.GlyphContourPointProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 7
0
        public void SetVerticalGlyphOriginDelegate(GlyphOriginDelegate del, ReleaseDelegate destroy)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_v_origin_func(Handle, DelegateProxies.GlyphOriginProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 8
0
        public void SetComposeDelegate(ComposeDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, new UserDataDelegate(() => this), destroy);

            HarfBuzzApi.hb_unicode_funcs_set_compose_func(Handle, DelegateProxies.ComposeProxy, ctx,
                                                          DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 9
0
        public void SetScriptDelegate(ScriptDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMultiUserData(del, destroy, this);

            HarfBuzzApi.hb_unicode_funcs_set_script_func(
                Handle, DelegateProxies.ScriptProxy, (void *)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 10
0
        public void SetFontFunctions(FontFunctions fontFunctions, object fontData, ReleaseDelegate destroy)
        {
            _ = fontFunctions ?? throw new ArgumentNullException(nameof(fontFunctions));

            var container = new FontUserData(this, fontData);
            var ctx       = DelegateProxies.CreateMultiUserData(destroy, container);

            HarfBuzzApi.hb_font_set_funcs(Handle, fontFunctions.Handle, (void *)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 11
0
        private static IntPtr Create(IntPtr data, int length, MemoryMode mode, object context, ReleaseDelegate releaseProc)
        {
            var del = releaseProc != null && context != null
                                ? new ReleaseDelegate((_) => releaseProc(context))
                                : releaseProc;
            var proxy = DelegateProxies.Create(del, DelegateProxies.ReleaseDelegateProxy, out _, out var ctx);

            return(HarfBuzzApi.hb_blob_create(data, length, mode, ctx, proxy));
        }
Ejemplo n.º 12
0
        public void SetGeneralCategoryDelegate(GeneralCategoryDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMultiUserData(del, destroy, this);

            HarfBuzzApi.hb_unicode_funcs_set_general_category_func(
                Handle, DelegateProxies.GeneralCategoryProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 13
0
        public void SetDecomposeDelegate(DecomposeDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMultiUserData(del, destroy, this);

            HarfBuzzApi.hb_unicode_funcs_set_decompose_func(
                Handle, DelegateProxies.DecomposeProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 14
0
        public void SetCombiningClassDelegate(CombiningClassDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMultiUserData(del, destroy, this);

            HarfBuzzApi.hb_unicode_funcs_set_combining_class_func(
                Handle, DelegateProxies.CombiningClassProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 15
0
        public void SetGlyphExtentsDelegate(GlyphExtentsDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_extents_func(
                Handle, DelegateProxies.GlyphExtentsProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 16
0
        public void SetHorizontalGlyphKerningDelegate(GlyphKerningDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_h_kerning_func(
                Handle, DelegateProxies.GlyphKerningProxy, (void *)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 17
0
        public void SetVerticalGlyphAdvancesDelegate(GlyphAdvancesDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMulti(del, destroy);

            HarfBuzzApi.hb_font_funcs_set_glyph_v_advances_func(
                Handle, DelegateProxies.GlyphAdvancesProxy, (void *)ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 18
0
        public Face(GetTableDelegate getTable, object context, ReleaseDelegate destroy)
            : this(IntPtr.Zero)
        {
            if (getTable == null)
            {
                throw new ArgumentNullException(nameof(getTable));
            }

            var ctx = DelegateProxies.CreateMulti <GetTableDelegate> ((_, t, __) => getTable.Invoke(this, t, context), context, destroy);

            Handle = HarfBuzzApi.hb_face_create_for_tables(DelegateProxies.GetTableDelegateProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 19
0
        public Face(GetTableDelegate getTable, ReleaseDelegate destroy)
            : this(IntPtr.Zero)
        {
            if (getTable == null)
            {
                throw new ArgumentNullException(nameof(getTable));
            }

            Handle = HarfBuzzApi.hb_face_create_for_tables(
                DelegateProxies.GetTableDelegateProxy,
                DelegateProxies.CreateMultiUserData(getTable, destroy, this),
                DelegateProxies.ReleaseDelegateProxyForMulti);
        }
Ejemplo n.º 20
0
        private static IntPtr Create(IntPtr data, int length, MemoryMode mode, ReleaseDelegate releaseProc)
        {
            var proxy = DelegateProxies.Create(releaseProc, DelegateProxies.ReleaseDelegateProxy, out _, out var ctx);

            return(HarfBuzzApi.hb_blob_create(data, length, mode, ctx, proxy));
        }