sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.7k stars 639 forks source link

SharpDX.DirectWrite.GlyphRun doesn't have 'glyphCount' member. #1031

Open poweryang1 opened 6 years ago

poweryang1 commented 6 years ago

I just update SharpDX 4.0.1 -> SharpDX 4.1.0.

SharpDX.DirectWrite.GlyphRun doesn't have 'glyphCount' member.

Please fix it.

xoofx commented 6 years ago

afaik, GlyphRun.glyphCount has never been made public since its creation

https://github.com/sharpdx/SharpDX/blob/e3889153c411f9f3861bf9831ea9ed57d2efb04b/Source/SharpDX.Direct2D1/DirectWrite/Mapping.xml#L68

Not sure how did you get any access to it...

ziriax commented 6 years ago

Reflection? :)

poweryang1 commented 6 years ago

Umm.

In case of custom TextRendererBase class, I should override DrawGlyphRun() method.

public override Result DrawGlyphRun(object clientDrawingContext, float baselineOriginX, float baselineOriginY, MeasuringMode measuringMode, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, ComObject clientDrawingEffect);

In that DrawGlyphRun() method, I use glyphRun.FontFace.GetGlyphRunOutline() method call.

'glyphRun.FontFace.GetGlyphRunOutline()' method call needs a 'glyphCount' argument.

How do I get a 'glyphCount'??

xoofx commented 6 years ago

You have it through the arrays .Length. You can make a PR to provide this as a readonly variable if you want.