WPF Telerik RadRichTextBox cannot display italic fonts

0 Answers 48 Views
RichTextBox
Tran
Top achievements
Rank 1
Tran asked on 06 Dec 2023, 04:35 AM

Hello,

I'm using RadRichTextBox (WPF Telerik 2021.1.222.40) and get an error about my span's font can't cannot be italicized. From what I'm investigating, it seems like my FontFamily is specifying the style so I can't reassign the FontStyle. Some fonts where I am experiencing this problem: MS 明朝 Regular, MS Pゴシック Regular, A-OTF 新ゴ Pro B, A-OTF 新ゴ Pro EL... I assume it has to do with the suffixes behind the font names: Regular, B, EL

Has anyone else encountered this issue?

Thanks for your help.

This is the xaml content of RadRichTextBox:


<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" xmlns:s="clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents" xmlns:r="clr-namespace:Telerik.Windows.Documents.Model.Revisions;assembly=Telerik.Windows.Documents" xmlns:n="clr-namespace:Telerik.Windows.Documents.Model.Notes;assembly=Telerik.Windows.Documents" xmlns:th="clr-namespace:Telerik.Windows.Documents.Model.Themes;assembly=Telerik.Windows.Documents" version="1.2" LayoutMode="Flow" LineSpacing="18.6700000762939" LineSpacingType="AtLeast" ParagraphDefaultSpacingAfter="0" ParagraphDefaultSpacingBefore="0" SectionDefaultPageMargin="73,79,72,64" SectionDefaultPageSize="816,1056" SelectedBibliographicStyleName="\APA.XSL" StyleName="defaultDocumentStyle">
  <t:RadDocument.Captions>
    <t:CaptionDefinition IsDefault="True" IsLinkedToHeading="False" Label="Figure" LinkedHeadingLevel="0" NumberingFormat="Arabic" SeparatorType="Hyphen" />
    <t:CaptionDefinition IsDefault="True" IsLinkedToHeading="False" Label="Table" LinkedHeadingLevel="0" NumberingFormat="Arabic" SeparatorType="Hyphen" />
  </t:RadDocument.Captions>
  <t:RadDocument.ProtectionSettings>
    <t:DocumentProtectionSettings EnableDocumentProtection="True" Enforce="False" HashingAlgorithm="None" HashingSpinCount="0" ProtectionMode="ReadOnly" />
  </t:RadDocument.ProtectionSettings>
  <t:RadDocument.Styles>
    <s:StyleDefinition DisplayName="Document Default Style" IsCustom="False" IsDefault="False" IsPrimary="True" Name="defaultDocumentStyle" Type="Default">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LineSpacing="18.6700000762939" LineSpacingType="AtLeast" SpacingAfter="0" TextAlignment="Justify" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="A-OTF ゴシックMB101 Pro U,MS Gothic" FontSize="14" FontStyle="Normal" FontWeight="Normal" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 1 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading1" Name="Heading1Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontSize="18.6666660308838" FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 2 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading2" Name="Heading2Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontSize="17.3333339691162" FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 3 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading3" Name="Heading3Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 4 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading4" Name="Heading4Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" FontWeight="Bold" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 5 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading5" Name="Heading5Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 6 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading6" Name="Heading6Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" ForeColor="#FF4F81BD" ThemeFontFamily="major" ThemeForeColor="accent1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 7 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading7" Name="Heading7Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontStyle="Italic" ForeColor="#FF000000" ThemeFontFamily="major" ThemeForeColor="text1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 8 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading8" Name="Heading8Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontSize="13.3333330154419" ForeColor="#FF000000" ThemeFontFamily="major" ThemeForeColor="text1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Heading 9 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading9" Name="Heading9Char" Type="Character">
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontSize="13.3333330154419" FontStyle="Italic" ForeColor="#FF000000" ThemeFontFamily="major" ThemeForeColor="text1" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="Normal" IsCustom="False" IsDefault="True" IsPrimary="True" Name="Normal" Type="Paragraph" />
    <s:StyleDefinition DisplayName="TableDefault" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TableDefault" Type="Table">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LineSpacing="18.6700000762939" LineSpacingType="AtLeast" SpacingAfter="0" TextAlignment="Justify" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.TableStyle>
        <s:TableProperties Borders="1,Single,#FF000000,none,,">
          <s:TableProperties.TableLook>
            <t:TableLook />
          </s:TableProperties.TableLook>
        </s:TableProperties>
      </s:StyleDefinition.TableStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TableNormal" IsCustom="False" IsDefault="True" IsPrimary="True" Name="TableNormal" Type="Table" />
    <s:StyleDefinition DisplayName="TitleLevel1" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel1" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="24" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Gothic" FontSize="18.6700000762939" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel2" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel2" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="24" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Gothic" FontSize="18.6700000762939" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel3" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel3" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="24" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="16" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel4" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel4" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="21.3299999237061" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="14" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel5" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel5" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="21.3299999237061" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="14" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel6" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel6" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="21.3299999237061" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="14" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel7" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel7" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="21.3299999237061" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="14" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel8" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel8" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="21.3299999237061" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="14" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
    <s:StyleDefinition DisplayName="TitleLevel9" IsCustom="True" IsDefault="False" IsPrimary="True" Name="TitleLevel9" Type="Paragraph">
      <s:StyleDefinition.ParagraphStyle>
        <s:ParagraphProperties LeftIndent="0" LineSpacing="21.3299999237061" LineSpacingType="AtLeast" SpacingAfter="0" SpacingBefore="0" />
      </s:StyleDefinition.ParagraphStyle>
      <s:StyleDefinition.SpanStyle>
        <s:SpanProperties FontFamily="MS Mincho" FontSize="14" />
      </s:StyleDefinition.SpanStyle>
    </s:StyleDefinition>
  </t:RadDocument.Styles>
  <t:Section PageSize="793.700805664063,1122.51965332031">
    <t:Paragraph Background="#FFD8D6CB" StyleName="TitleLevel1">
      <t:ReadOnlyRangeStart AnnotationID="1" />
      <t:Span Tag="[INDEX_SID:3295715,DOC_DATA_SID:2646844]" Text="てきすと" />
    </t:Paragraph>
    <t:Paragraph FirstLineIndent="-12" FontSize="12" LeftIndent="33.3300018310547" LineSpacing="16" LineSpacingType="AtLeast" RightIndent="0" SpacingAfter="4" SpacingBefore="0" TextAlignment="Justify">
      <t:Paragraph.ParagraphSymbolPropertiesStyle>
        <s:SpanProperties BaselineAlignment="Baseline" FontFamily="MS Pゴシック Regular,MS PGothic" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" UnderlineDecoration="None" />
      </t:Paragraph.ParagraphSymbolPropertiesStyle>
      <t:ReadOnlyRangeEnd AnnotationID="1" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS Pゴシック Regular,MS PGothic" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" Text="*" UnderlineDecoration="None" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS 明朝 Regular,MS Mincho" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" Text="少額" UnderlineDecoration="None" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS 明朝 Regular,MS Mincho" FontSize="12" FontStyle="Italic" ForeColor="#FF000000" Text="貯蓄非" UnderlineDecoration="None" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS 明朝 Regular,MS Mincho" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" Text="課税制度" UnderlineDecoration="None" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS Pゴシック Regular,MS PGothic" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" Text="(マル優)" UnderlineDecoration="None" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS ゴシック Regular,MS Gothic" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" Text="をご利用いただけます" UnderlineDecoration="None" />
      <t:Span BaselineAlignment="Baseline" FontFamily="MS Pゴシック Regular,MS PGothic" FontSize="12" FontStyle="Normal" ForeColor="#FF000000" Text="。詳しくは販売会社にお問い合わせください。" UnderlineDecoration="None" />
    </t:Paragraph>
  </t:Section>
</t:RadDocument>

Martin Ivanov
Telerik team
commented on 26 Dec 2023, 09:15 AM

I have tested the document in a new project with RTB and the italic seems to work on my side. Can you tell me what error you experience? Also, can you try this with the latest version of Telerik UI for WPF?
Tran
Top achievements
Rank 1
commented on 26 Dec 2023, 09:42 AM | edited

- Can you tell me what error you experience? :  when I use the font-family-name has font-style-name like: A-OTF 太ゴB101 Pr5 Bold (has Bold in font-family-name), A-OTF 新ゴ Pro L (has L in font-family-name), A-OTF 新ゴ Pro H (has H in font-family-name)... and change attribute FontStyle="Italic" in t:Span element. And text cannot be italicized. It looks like this:

<t:Span BaselineAlignment="Baseline" FontFamily="A-OTF 太ゴB101 Pr5 Bold" FontSize="12" FontStyle="Italic" ForeColor="#FF000000" Text="流し込み操作ボタン" UnderlineDecoration="None" />

 

-Also, can you try this with the latest version of Telerik UI for WPF?: Yes, I tried with the latest version of Telerik UI for WPF. But it got the same error.

I have attached a photo when using it with MS WORD and Telerik.

Martin Ivanov
Telerik team
commented on 02 Jan 2024, 01:24 PM

Thank you for the additional information. I still cannot recreate the issue. Can you check the attached project and let me know if I am missing anything?

No answers yet. Maybe you can help?

Tags
RichTextBox
Asked by
Tran
Top achievements
Rank 1
Share this question
or