FT_Outline_Get_BBox() private method

private FT_Outline_Get_BBox ( IntPtr outline, SharpFont.BBox &abbox ) : System.Error
outline System.IntPtr
abbox SharpFont.BBox
return System.Error
Example #1
0
        /// <summary>
        /// Compute the exact bounding box of an outline. This is slower than computing the control box. However, it
        /// uses an advanced algorithm which returns very quickly when the two boxes coincide. Otherwise, the outline
        /// Bézier arcs are traversed to extract their extrema.
        /// </summary>
        /// <remarks>
        /// If the font is tricky and the glyph has been loaded with <see cref="LoadFlags.NoScale"/>, the resulting
        /// BBox is meaningless. To get reasonable values for the BBox it is necessary to load the glyph at a large
        /// ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting
        /// the BBox which can be eventually converted back to font units.
        /// </remarks>
        /// <returns>The outline's exact bounding box.</returns>
        public BBox GetBBox()
        {
            Error err = FT.FT_Outline_Get_BBox(Reference, out var bbox);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            return(bbox);
        }
Example #2
0
        /// <summary>
        /// Compute the exact bounding box of an outline. This is slower than computing the control box. However, it
        /// uses an advanced algorithm which returns very quickly when the two boxes coincide. Otherwise, the outline
        /// Bézier arcs are traversed to extract their extrema.
        /// </summary>
        /// <remarks>
        /// If the font is tricky and the glyph has been loaded with <see cref="LoadFlags.NoScale"/>, the resulting
        /// BBox is meaningless. To get reasonable values for the BBox it is necessary to load the glyph at a large
        /// ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting
        /// the BBox which can be eventually converted back to font units.
        /// </remarks>
        /// <returns>The outline's exact bounding box.</returns>
        public BBox GetBBox()
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Outline", "Cannot access a disposed object.");
            }

            BBox  bbox;
            Error err = FT.FT_Outline_Get_BBox(reference, out bbox);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            return(bbox);
        }