private FT_Glyph_Get_CBox ( |
||
glyph | ||
bbox_mode | GlyphBBoxMode | |
acbox | SharpFont.BBox | |
return | void |
/// <summary> /// <para> /// Return a glyph's ‘control box’. The control box encloses all the outline's points, including Bézier control /// points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some /// situations (like when rotating an outline which contains Bézier outside arcs). /// </para> /// <para> /// Computing the control box is very fast, while getting the bounding box can take much more time as it needs /// to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component /// which is dedicated to this single task. /// </para> /// </summary> /// <remarks> /// <para> /// Coordinates are relative to the glyph origin, using the y upwards convention. /// </para> /// <para> /// If the glyph has been loaded with <see cref="LoadFlags.NoScale" />, ‘bbox_mode’ must be set to /// <see cref="GlyphBBoxMode.Unscaled" /> to get unscaled font units in 26.6 pixel format. The value /// <see cref="GlyphBBoxMode.Subpixels" /> is another name for this constant. /// </para> /// <para> /// If the font is tricky and the glyph has been loaded with <see cref="LoadFlags.NoScale" />, the resulting /// CBox is meaningless. To get reasonable values for the CBox 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 CBox which can be eventually converted back to font units. /// </para> /// <para> /// Note that the maximum coordinates are exclusive, which means that one can compute the width and height of /// the glyph image (be it in integer or 26.6 pixels) as: /// </para> /// <para> /// <code> /// width = bbox.xMax - bbox.xMin; /// height = bbox.yMax - bbox.yMin; /// </code> /// </para> /// <para> /// Note also that for 26.6 coordinates, if ‘bbox_mode’ is set to <see cref="GlyphBBoxMode.Gridfit" />, the /// coordinates will also be grid-fitted, which corresponds to: /// </para> /// <para> /// <code> /// bbox.xMin = FLOOR(bbox.xMin); /// bbox.yMin = FLOOR(bbox.yMin); /// bbox.xMax = CEILING(bbox.xMax); /// bbox.yMax = CEILING(bbox.yMax); /// </code> /// </para> /// <para> /// To get the bbox in pixel coordinates, set ‘bbox_mode’ to <see cref="GlyphBBoxMode.Truncate" />. /// </para> /// <para> /// To get the bbox in grid-fitted pixel coordinates, set ‘bbox_mode’ to <see cref="GlyphBBoxMode.Pixels" />. /// </para> /// </remarks> /// <param name="mode">The mode which indicates how to interpret the returned bounding box values.</param> /// <returns> /// The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted. /// </returns> public BBox GetCBox(GlyphBBoxMode mode) { if (IsDisposed) { throw new ObjectDisposedException("Glyph", "Cannot access a disposed object."); } BBox box; FT.FT_Glyph_Get_CBox(Reference, mode, out box); return(box); }
public BBox GetCBox(GlyphBBoxMode mode) { if (disposed) { throw new ObjectDisposedException("Glyph", "Cannot access a disposed object."); } BBoxRec box = new BBoxRec(); FT.FT_Glyph_Get_CBox(Reference, mode, ref box); return(new BBox(box)); }
/// <summary><para> /// Return a glyph's ‘control box’. The control box encloses all the outline's points, including Bézier control /// points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some /// situations (like when rotating an outline which contains Bézier outside arcs). /// </para><para> /// Computing the control box is very fast, while getting the bounding box can take much more time as it needs /// to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component /// which is dedicated to this single task. /// </para></summary> /// <remarks><para> /// Coordinates are relative to the glyph origin, using the y upwards convention. /// </para><para> /// If the glyph has been loaded with <see cref="LoadFlags.NoScale"/>, ‘bbox_mode’ must be set to /// <see cref="GlyphBBoxMode.Unscaled"/> to get unscaled font units in 26.6 pixel format. The value /// <see cref="GlyphBBoxMode.Subpixels"/> is another name for this constant. /// </para><para> /// If the font is tricky and the glyph has been loaded with <see cref="LoadFlags.NoScale"/>, the resulting /// CBox is meaningless. To get reasonable values for the CBox 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 CBox which can be eventually converted back to font units. /// </para><para> /// Note that the maximum coordinates are exclusive, which means that one can compute the width and height of /// the glyph image (be it in integer or 26.6 pixels) as: /// </para><para> /// <code> /// width = bbox.xMax - bbox.xMin; /// height = bbox.yMax - bbox.yMin; /// </code> /// </para><para> /// Note also that for 26.6 coordinates, if ‘bbox_mode’ is set to <see cref="GlyphBBoxMode.Gridfit"/>, the /// coordinates will also be grid-fitted, which corresponds to: /// </para><para> /// <code> /// bbox.xMin = FLOOR(bbox.xMin); /// bbox.yMin = FLOOR(bbox.yMin); /// bbox.xMax = CEILING(bbox.xMax); /// bbox.yMax = CEILING(bbox.yMax); /// </code> /// </para><para> /// To get the bbox in pixel coordinates, set ‘bbox_mode’ to <see cref="GlyphBBoxMode.Truncate"/>. /// </para><para> /// To get the bbox in grid-fitted pixel coordinates, set ‘bbox_mode’ to <see cref="GlyphBBoxMode.Pixels"/>. /// </para></remarks> /// <param name="mode">The mode which indicates how to interpret the returned bounding box values.</param> /// <returns> /// The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted. /// </returns> public BBox GetCBox(GlyphBBoxMode mode) { FT.FT_Glyph_Get_CBox(Reference, mode, out var box); return(box); }