/// <summary> /// This method creates an outline collection. /// </summary> /// <param name="formattedData"> This parameter references the formatted input sink. </param> /// <param name="geometryCache"> This parameter references the text geometry cache. </param> /// <param name="clusterBidiLevels"> This parameter references the cluster bidi levels. </param> /// <returns> This method returns a new outline collection containing an outline for each formatted cluster. </returns> private static OutlineCollection CreateOutlineList( FormatterSink formattedData, TextGeometryCache geometryCache, out byte[] clusterBidiLevels) { _OutlineListBuilder.Clear(); clusterBidiLevels = new byte[formattedData.Clusters.Count]; int geometryClusterIndex = 0; for(int i = 0; i < formattedData.Runs.Count; ++i) { FormattedRun run = formattedData.Runs[i]; FontFace face = run.Font.ResolveFace(); float emSize = face.Metrics.Ascent + face.Metrics.Descent; float baseline = face.Metrics.Ascent / emSize; foreach(int clusterIndex in run.Clusters) { Geometry geometry = geometryCache.Retrieve( clusterIndex, run.BidiLevel, run.Font, formattedData); _OutlineListBuilder.Add(new Outline(geometry, run.EmSize, baseline)); clusterBidiLevels[geometryClusterIndex] = run.BidiLevel; geometryClusterIndex++; } } return new OutlineCollection(_OutlineListBuilder); }