public (IEnumerable <float> Advances, float Total) GetAdvancesForGlyphs (TFont font, IEnumerable <TGlyph> glyphs, int nGlyphs) { using var glyphArray = new Structures.RentedArray <TGlyph>(glyphs, nGlyphs); var advanceSizes = new CGSize[nGlyphs]; var combinedAdvance = font.CtFont.GetAdvancesForGlyphs (CTFontOrientation.Default, glyphArray.Result.Array, advanceSizes, nGlyphs); return(advanceSizes.Select(advance => (float)advance.Width), (float)combinedAdvance); }
public (IEnumerable <float> Advances, float Total) GetAdvancesForGlyphs(TFont font, ForEach <TGlyph> glyphs, int nGlyphs) { var glyphArray = new TGlyph[nGlyphs]; glyphs.CopyTo(glyphArray); var advanceSizes = new CGSize[nGlyphs]; var combinedAdvance = font.CtFont.GetAdvancesForGlyphs(CTFontOrientation.Default, glyphArray, advanceSizes, nGlyphs); return(advanceSizes.Select(advance => (float)advance.Width), (float)combinedAdvance); }