我无法使用尖锐的 DX 计算 glyphRun 的宽度。下面是我用来呈现 glyphRun 的代码,字符串需要呈现为 char,如下所示。
private void RenderGlyphRun(FontFace fontFace)
    {
        GlyphRun glyphRun = new GlyphRun();
        glyphRun.FontFace = fontFace;
        glyphRun.FontSize = 23;
        left = 50;
        top = 50;
        string word = "Hello World";
        foreach (char letter in word)
        {
            string stringToBeRendered = letter.ToString();
            int[] codePoints = new int[stringToBeRendered.Length];
            char[] charsToBeRendered = stringToBeRendered.ToCharArray();
            for (int i = 0; i < charsToBeRendered.Length; i++)
            {
                codePoints[i] = (int)charsToBeRendered[i];
            }
            short[] glyphIndices = fontFace.GetGlyphIndices(codePoints);
            glyphRun.Indices = glyphIndices;
            var BrushColor = SharpDX.Color.Black;
            SharpDX.DirectWrite.Matrix mtrx = new SharpDX.DirectWrite.Matrix();
            mtrx.M11 = 1F;
            mtrx.M12 = 0;
            mtrx.M21 = 0;
            mtrx.M22 = 1F;
            mtrx.Dx = 0;
            mtrx.Dy = 0;
            GlyphMetrics[] metrics = fontFace.GetGdiCompatibleGlyphMetrics(23, 1, mtrx, false, glyphIndices, false);
            FontMetrics metr = fontFace.GetGdiCompatibleMetrics(23, 1, new SharpDX.DirectWrite.Matrix());
            _pRenderTarget.DrawGlyphRun(new SharpDX.DrawingPointF(left, top), glyphRun, new SharpDX.Direct2D1.SolidColorBrush(_pRenderTarget, BrushColor), MeasuringMode.GdiClassic);
            left += (metrics[0].AdvanceWidth - metrics[0].RightSideBearing + metrics[0].LeftSideBearing) / 100;                
        }
    }
渲染字符串中的字符间距非常不同。请帮我解决一下这个。