Skip to content

Commit

Permalink
Word Export LT-21673: Fix font problems for bidi text (#193)
Browse files Browse the repository at this point in the history
For some writing systems Word was not using the correct
font or correct font size.
  • Loading branch information
mark-sil authored Oct 31, 2024
1 parent f3354e9 commit cc18faf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Src/xWorks/WordStylesGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,13 @@ private static StyleRunProperties AddFontInfoWordStyles(BaseStyleInfo projectSty

if (fontName != null)
{
// Note: if desired, multiple fonts can be used for different text types in a single run
// by separately specifying font names to use for ASCII, High ANSI, Complex Script, and East Asian content.
var font = new RunFonts(){Ascii = fontName};
var font = new RunFonts()
{
Ascii = fontName,
HighAnsi = fontName,
ComplexScript = fontName,
EastAsia = fontName
};
charDefaults.Append(font);
}

Expand All @@ -531,7 +535,9 @@ private static StyleRunProperties AddFontInfoWordStyles(BaseStyleInfo projectSty
// OpenXML expects fontsize given in halves of a point; thus we divide by 500.
fontSize = fontSize / 500;
var size = new FontSize() { Val = fontSize.ToString() };
var sizeCS = new FontSizeComplexScript() { Val = fontSize.ToString() };
charDefaults.Append(size);
charDefaults.Append(sizeCS);
}

// Check for bold
Expand Down

0 comments on commit cc18faf

Please sign in to comment.