Determine which font of rFonts to use


  • Hello, I am writing some logic to determine which of the 4 fonts in an rFonts element would be used for each character in a run: ascii, hAnsi, cs, or eastAsia (or the ...theme versions if defined). I came across a details description of the algorithm Word uses in the [MS-OI29500] document (Office Implementation Information for ISO/IEC 29500 Standards Support). The section I am referring to is "2.1.87 Part 1 Section, rFonts (Run Fonts)", part b. I have a few questions about this section:

    • One paragraph states "If the eastAsia (or eastAsiaTheme if defined) attribute’s value is “Times New Roman” and the ascii (or asciiTheme if defined) and hAnsi (or hAnsiTheme if defined) attributes are equal, then the ascii (or asciiTheme if defined) font is used." I assume the "...attributes are equal..." portion is equivalent to "...attributes are equal to each other...". In other words, the ascii and hAnsi values don't need to be "Times New Roman" for this statement to hold true. But if the ascii and hAnsi are any font and are the same, and the eastAsia font is "Times New Roman", then the ascii font is used. Is this a correct assumption?
    • There is a table mapping character ranges to font types with two sentences preceding it which say "Otherwise, the following table is used. For all ranges not listed in the following table, the hAnsi (or hAnsiTheme if defined) font shall be used". However, the cs font type is never mentioned in this table. It appears that the only way a cs font is used is if the cs or rtl elements are present in the run, as per one of the paragraphs before this table. Is this correct or are there some ranges that do use cs which are not included in this table (contrary to the preceding statement)?
    • Many of the character ranges in the table mentioned above, such as "General Punctuation", have as their full Classification "If the hint is eastAsia then eastAsia (or eastAsiaTheme if defined) is used." But this does not indicate what is used if the hint is not eastAsia. Does this imply that cs, ascii, hAnsi, or something else is used when the hint is not eastAsia?
    • Are there certain character ranges that are always complex script? Is so, what are they? If not, what is the best way to determine if a character is complex script? Is there a way to do this in the .NET Framework when running in a low-trust environment or is it only possible via Windows APIs?

    Thank you in advance for any help you can offer.

    Wednesday, August 7, 2013 5:45 PM

All replies

  • Hi Michael

    I think I should move this from here (Word for Developers) to the specialized forum for Office implementations of the Open XML File formats?

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, August 8, 2013 12:43 PM