When characters are in the ranges 61472-61566, 61565-61695, 65535-65535 they are correctly exported with Wingdings font. However, when the character value is outside these ranges the font fallback mechanism exports them with different font and this causes wrong glyph rendering in the resulted PDF.
The following code snippet shows how the Wingdings characters can be modified so that they are correctly exported to PDF when converting from WordsProcessing's RadFlowDocument:
RadFlowDocument document = new DocxFormatProvider().Import(File.ReadAllBytes(@"test_document.docx"));
foreach (Run run in document.EnumerateChildrenOfType<Run>())
{
if (run.FontFamily.GetActualValue(document.Theme).Source.Contains("Wingdings"))
{
StringBuilder modifiedText = new StringBuilder();
foreach (char character in run.Text)
{
modifiedText.Append(character > 256 ? character : (char)(character + 61440));
}
run.Text = modifiedText.ToString();
}
}
Workaround: When creating a RadFixedDocument:
using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(this.fixedDocument))
{
byte[] data = File.ReadAllBytes(@"CustomFont.ttf");
FontsRepository.RegisterFont(new FontFamily("CustomFont"), FontStyles.Normal, FontWeights.Normal, data);
FontBase customFont;
FontsRepository.TryCreateFont(new FontFamily("CustomFont"), FontStyles.Normal, FontWeights.Normal, out customFont);
editor.CharacterProperties.Font = customFont;
string text = "w";
StringBuilder modifiedText = new StringBuilder();
foreach (char character in text)
{
modifiedText.Append(character > 256 ? character : (char)(character + 61440));
}
text = modifiedText.ToString();
editor.InsertRun(text);
}