Type in Japanese text in RichTextBox that word wraps beyond the first line and export it to PDF. The text should always be left aligned (as visually shown when typing) but has an "indent" when exported when the font is Segoe UI.
Hi, Adam,
My name is Dess and I am a member of the Telerik Document Processing team. My colleague, Dimitar, brought this thread to my attention as the inquiry is more related to the Telerik Document Processsing Libraries than to the WPF RichTextBox control.
I have opened a new support ticket on your behalf with the WordsProcessing product. Please have a look at Ticket ID: 1683327 in your Telerik account.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!
I've done a lot more digging... I may have mis-lead a little bit since we have to go through so much trouble to convert from RadDocument to RadFixedDocument...
I've deduced it down to being the Fixed.Model.Editing.Block measures to a much greater width than it should be when text is inserted. So the "offset" bug is in fact on our side, BUT it's an offset based off the increased difference in Block size, which seems to be on Telerik's end.
Here's some sample code to distinguish the problem:
internal static void Export(RadRichTextBox textBox)
{
BuildBlock(textBox.Document.EnumerateChildrenOfType<Span>().First());
}
private static void BuildBlock(Span span)
{
var block = new Telerik.Windows.Documents.Fixed.Model.Editing.Block();
block.TextProperties.FontSize = span.FontSize;
block.InsertText(span.FontFamily, span.FontStyle, span.FontWeight, span.Text);
var textWidth = span.GetAssociatedLayoutBoxes().Aggregate(0.0f, (sum, box) => box.BoundingRectangle.Width + sum);
var blockWidth = block.Measure().Width;
// Assert.That(blockWidth, Is.InRange(textWidth - 0.001, textWidth + 0.001));
}
You can set a button control to call this with a RadRichTextBox width 330, height 100, Font Segoe UI, Font Size 24, Text 私は測定を散会に分けて
<telerik:RadRichTextBox
x:Name="radRichTextBox"
Width="330"
Height="100"
VerticalScrollBarVisibility="Disabled">
</telerik:RadRichTextBox>
<Button Grid.Row="1" Content="Export to PDF" Click="Button_Click"/>
The Assert should be around 319 for both... for a font family like Meiryo it's the same, but not for Segoe UI.
Hope this helps!
Hi Adam,
I have created a test project but still cannot reproduce it. I have recorded a small video. Could you please check it and let me know what I am missing?
I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik
Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!
Yep! Not sure why the image got broken. Trying to add it again and also attaching it as a file.
You can just type this text into a plain document with just RichTextBox with a width of 250 height 100 (fontsize 20 font Segoe UI)
私は測定を散会に分けてやるつもりです
Hi Adam,
The image is missing for some reason. Can you attach it again, please? In addition, can you attach the sample document that you are exporting to pdf (doxc or XAML format).
Thank you in advance for your patience and cooperation
Regards,
Dimitar
Progress Telerik
Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!