StrfName's String property uses Marshal.PtrToStringUni to cast the recieved string to a C# string, passing it the string_len from the StrfName structure of FreeType. According to FreeType's documentation, string_len represents the length of string in bytes, while PtrToStringUni's len parameter recieves number of Unicode characters to copy, each being 2 bytes. This results in StrfName's Strings being longer than they really are.
Tested this change on some Windows embedded fonts in Win7, and the fields now get fetched correctly.
StrfName's String property uses Marshal.PtrToStringUni to cast the recieved string to a C# string, passing it the
string_len
from the StrfName structure of FreeType. According to FreeType's documentation,string_len
represents the length of string in bytes, whilePtrToStringUni
'slen
parameter recieves number of Unicode characters to copy, each being 2 bytes. This results in StrfName's Strings being longer than they really are.Tested this change on some Windows embedded fonts in Win7, and the fields now get fetched correctly.