sharpdx / SharpDX

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

SharpDX.DirectWrite.FontFallback.MapCharacters has incorrect parameter #897

Closed jclin closed 7 years ago

jclin commented 7 years ago

I was going to write a public wrapper for MapCharacters_ but noticed one paramter is incorrect. The method signature generated is:

internal void MapCharacters_(
   System.IntPtr analysisSource, 
   int textPosition, 
   int textLength, 
   SharpDX.DirectWrite.FontCollection baseFontCollection, 
   string baseFamilyName, 
   SharpDX.DirectWrite.FontWeight baseWeight, 
   SharpDX.DirectWrite.FontStyle baseStyle, 
   SharpDX.DirectWrite.FontStretch baseStretch, 
   int mappedLength, 
   out SharpDX.DirectWrite.Font mappedFont, 
   out float scale
) 

However, mappedLength should be an out parameter per the docs. Is there a way for me to fix this on my end without having to tamper with the C# code generation?

xoofx commented 7 years ago

This is usually fixed in the mapping.xml file by adding a line like:

 <map param="IDWriteFontFallback::MapCharacters::mappedLength" attribute="out" />

The mappedLength must match exactly what is in the dwrite header file (sometimes the msdn doc might be off or not accurate).

Also, the parameter analysisSource is a special interface (callback from c++ to C#), so you will have to handle it differently - it should be used elsewhere in the code so you can have a look at it)

jclin commented 7 years ago

👍, thanks!