private void CreatePathGeometry() { if(m_pathGeometry != null) { m_pathGeometry.Dispose(); m_pathGeometry = null; } m_pathGeometry = new SlimDX.Direct2D.PathGeometry(InternalRenderTargetResourceOwner.InternalRenderTarget.Factory); m_geometryFilled = false; }
public unsafe D2D.Geometry CreateGeometry(float fontSize, string text, float[] glyphAdvances = null, DW.GlyphOffset[] glyphOffsets = null) { // USC4のコードポイント配列を取得 byte[] utf32 = Encoding.UTF32.GetBytes(text); var cps = new int[text.Length]; fixed(int *p = cps) Marshal.Copy(utf32, 0, (IntPtr)p, utf32.Length); // GlyphIndexの配列に変換 short[] indices = FontFace.GetGlyphIndicesW(cps); // ジオメトリの作成 var geometry = new D2D.PathGeometry(_d2DFactory); using (D2D.GeometrySink sink = geometry.Open()) { _fontFace.GetGlyphRunOutline(fontSize, indices, glyphAdvances, glyphOffsets, false, false, sink); sink.Close(); } return(geometry); }
public override void Dispose() { if (m_pathGeometry != null) { m_pathGeometry.Dispose(); m_pathGeometry = null; } base.Dispose(); }