public void Shape(Buffer buffer, IReadOnlyList <Feature> features, IReadOnlyList <string> shapers) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } var featuresPtr = features == null || features.Count == 0 ? IntPtr.Zero : StructureArrayToPtr(features); var shapersPtr = shapers == null || shapers.Count == 0 ? IntPtr.Zero : StructureArrayToPtr(shapers); HarfBuzzApi.hb_shape_full( Handle, buffer.Handle, featuresPtr, featuresPtr != IntPtr.Zero ? features.Count : 0, shapersPtr); if (featuresPtr != IntPtr.Zero) { Marshal.FreeCoTaskMem(featuresPtr); } if (shapersPtr != IntPtr.Zero) { Marshal.FreeCoTaskMem(shapersPtr); } }
public unsafe ReadOnlySpan <byte> AsSpan() { uint length; var dataPtr = HarfBuzzApi.hb_blob_get_data(Handle, &length); return(new ReadOnlySpan <byte> (dataPtr, (int)length)); }
public bool TryGetPosition(OpenTypeMetricsTag metricsTag, out int position) { fixed(int *p = &position) { return(HarfBuzzApi.hb_ot_metrics_get_position(font.Handle, metricsTag, p)); } }
public unsafe Stream AsStream() { uint length; var dataPtr = HarfBuzzApi.hb_blob_get_data(Handle, &length); return(new UnmanagedMemoryStream((byte *)dataPtr, length)); }
protected override void DisposeHandler() { if (Handle != IntPtr.Zero) { HarfBuzzApi.hb_unicode_funcs_destroy(Handle); } }
public bool TryGetNominalGlyph(uint unicode, out uint glyph) { fixed(uint *g = &glyph) { return(HarfBuzzApi.hb_font_get_nominal_glyph(Handle, unicode, g)); } }
public bool TryGetGlyphExtents(uint glyph, out GlyphExtents extents) { fixed(GlyphExtents *e = &extents) { return(HarfBuzzApi.hb_font_get_glyph_extents(Handle, glyph, e)); } }
public bool TryCompose(uint a, uint b, out uint ab) { fixed(uint *abPtr = &ab) { return(HarfBuzzApi.hb_unicode_compose(Handle, a, b, abPtr)); } }
public bool TryGetGlyph(uint unicode, uint variationSelector, out uint glyph) { fixed(uint *g = &glyph) { return(HarfBuzzApi.hb_font_get_glyph(Handle, unicode, variationSelector, g)); } }
public FontExtents GetFontExtentsForDirection(Direction direction) { FontExtents extents; HarfBuzzApi.hb_font_get_extents_for_direction(Handle, direction, &extents); return(extents); }
protected override void DisposeHandler() { if (Handle != IntPtr.Zero) { HarfBuzzApi.hb_font_destroy(Handle); } }
public bool TryGetGlyphFromName(string name, out uint glyph) { fixed(uint *g = &glyph) { return(HarfBuzzApi.hb_font_get_glyph_from_name(Handle, name, name.Length, g)); } }
public bool TryGetVerticalFontExtents(out FontExtents extents) { fixed(FontExtents *e = &extents) { return(HarfBuzzApi.hb_font_get_v_extents(Handle, e)); } }
public Stream AsStream() { unsafe { var dataPtr = HarfBuzzApi.hb_blob_get_data(Handle, out var length); return(new UnmanagedMemoryStream(dataPtr, length)); } }
public bool TryGetVariationGlyph(uint unicode, out uint glyph) { fixed(uint *g = &glyph) { return(HarfBuzzApi.hb_font_get_variation_glyph(Handle, unicode, 0, g)); } }
public ReadOnlySpan <byte> AsSpan() { unsafe { var dataPtr = HarfBuzzApi.hb_blob_get_data(Handle, out var length); return(new ReadOnlySpan <byte> (dataPtr, length)); } }
public bool TryGetGlyphFromString(string s, out uint glyph) { fixed(uint *g = &glyph) { return(HarfBuzzApi.hb_font_glyph_from_string(Handle, s, -1, g)); } }
public void GetGlyphAdvanceForDirection(uint glyph, Direction direction, out int x, out int y) { fixed(int *xPtr = &x) fixed(int *yPtr = &y) { HarfBuzzApi.hb_font_get_glyph_advance_for_direction(Handle, glyph, direction, xPtr, yPtr); } }
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); }
public bool TryDecompose(uint ab, out uint a, out uint b) { fixed(uint *aPtr = &a) fixed(uint *bPtr = &b) { return(HarfBuzzApi.hb_unicode_decompose(Handle, ab, aPtr, bPtr)); } }
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); }
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); }
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); }
public bool TryGetGlyphContourPointForOrigin(uint glyph, uint pointIndex, Direction direction, out int x, out int y) { fixed(int *xPtr = &x) fixed(int *yPtr = &y) { return(HarfBuzzApi.hb_font_get_glyph_contour_point_for_origin(Handle, glyph, pointIndex, direction, xPtr, yPtr)); } }
public bool TryGetVerticalGlyphOrigin(uint glyph, out int xOrigin, out int yOrigin) { fixed(int *x = &xOrigin) fixed(int *y = &yOrigin) { return(HarfBuzzApi.hb_font_get_glyph_v_origin(Handle, glyph, x, y)); } }
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); }
public void GetScale(out int xScale, out int yScale) { fixed(int *x = &xScale) fixed(int *y = &yScale) { HarfBuzzApi.hb_font_get_scale(Handle, x, y); } }
public bool TryGetGlyphContourPoint(uint glyph, uint pointIndex, out int x, out int y) { fixed(int *xPtr = &x) fixed(int *yPtr = &y) { return(HarfBuzzApi.hb_font_get_glyph_contour_point(Handle, glyph, pointIndex, xPtr, yPtr)); } }
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); }
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); }