OOXML Hacking: Font Themes Complete

I wrote about how to create a basic font theme in 2015: XML Hacking: Font Themes. Thanks to everyone for the comments and feedback that have allowed me to refine the article and make it more helpful.

That article covered a bare bones font theme for European languages (referred to as Latin fonts in Microsoft-speak). International and multilingual users require a theme that can work with a greater variety of languages and fonts, so in this article I’m going to cover how these work and how to create them.


A More Complete Simple Theme

There’s more we can do with the very basic theme from the previous article. In the listing below, a font has been specced for only Latin fonts. Important Note: If you copy and paste these samples, you must change the non-breaking space characters to ordinary spaces. I need to use non-breaking spaces to format an HTML page, but Office will refuse to display your font theme if you don’t search and replace them with regular spaces.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:fontScheme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Test">
  <a:majorFont>
    <a:latin typeface="Arial"/>
    <a:ea typeface=""/>
    <a:cs typeface=""/>
  </a:majorFont>
  <a:minorFont>
    <a:latin typeface="Arial"/>
    <a:ea typeface=""/>
    <a:cs typeface=""/>
  </a:minorFont>
</a:fontScheme>

In both the Major (Headings) and Minor (Body) categories, there are also ea (East Asian) and cs (Complex Scripts) entries. These theme entries are inactive until text is formatted as a relevant language. As long as your text is marked as US English (either by using the Review>Language>Set Proofing Language, or by setting the language in a Style), only the Latin theme fonts will be active. But if you mark text as Chinese, the Office program will check the theme and use the font in the ea tag instead. Likewise, Persian text will activate the cs theme font.

What will not work is to try to set an East Asian or Complex Scripts font in the Latin tag. Depending on the version and platform of Office, you’ll only get European characters showing, or the program will completely ignore your theme. Here’s a simple font theme that will work with Japanese, Arabic and European languages:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:fontScheme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Test">
  <a:majorFont>
    <a:latin typeface="Arial"/>
    <a:ea typeface="Meiryo"/>
    <a:cs typeface="Andalus"/>
  </a:majorFont>
  <a:minorFont>
    <a:latin typeface="Arial"/>
    <a:ea typeface="Meiryo"/>
    <a:cs typeface="Andalus"/>
  </a:minorFont>
</a:fontScheme>

Depending on which ea or cs font you choose, it may support one or several languages. As an example, CJK fonts will support Chinese, Japanese and Korean. Of course, in a collaboration scenario, the fonts chosen should be available on both Mac and Windows, or the display of one of the langauges may get mangled with a font substitution. The best idea is to stick with fonts distributed by Microsoft with Office.


Complex Font Themes

When you crack open the XML on a document or theme, the font theme information is contained in theme/theme1.xml. This illustrates a font theme that is ready to take on the world:

<a:fontScheme name="Office Theme">
  <a:majorFont>
    <a:latin typeface="Calibri Light" panose="020F0302020204030204"/>
    <a:ea typeface=""/>
    <a:cs typeface=""/>
    <a:font script="Jpan" typeface="MS Pゴシック"/>
    <a:font script="Hang" typeface="맑은 고딕"/>
    <a:font script="Hans" typeface="宋体"/>
    <a:font script="Hant" typeface="新細明體"/>
    <a:font script="Arab" typeface="Times New Roman"/>
    <a:font script="Hebr" typeface="Times New Roman"/>
    <a:font script="Thai" typeface="Angsana New"/>
    <a:font script="Ethi" typeface="Nyala"/>
    <a:font script="Beng" typeface="Vrinda"/>
    <a:font script="Gujr" typeface="Shruti"/>
    <a:font script="Khmr" typeface="MoolBoran"/>
    <a:font script="Knda" typeface="Tunga"/>
    <a:font script="Guru" typeface="Raavi"/>
    <a:font script="Cans" typeface="Euphemia"/>
    <a:font script="Cher" typeface="Plantagenet Cherokee"/>
    <a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
    <a:font script="Tibt" typeface="Microsoft Himalaya"/>
    <a:font script="Thaa" typeface="MV Boli"/>
    <a:font script="Deva" typeface="Mangal"/>
    <a:font script="Telu" typeface="Gautami"/>
    <a:font script="Taml" typeface="Latha"/>
    <a:font script="Syrc" typeface="Estrangelo Edessa"/>
    <a:font script="Orya" typeface="Kalinga"/>
    <a:font script="Mlym" typeface="Kartika"/>
    <a:font script="Laoo" typeface="DokChampa"/>
    <a:font script="Sinh" typeface="Iskoola Pota"/>
    <a:font script="Mong" typeface="Mongolian Baiti"/>
    <a:font script="Viet" typeface="Times New Roman"/>
    <a:font script="Uigh" typeface="Microsoft Uighur"/>
    <a:font script="Geor" typeface="Sylfaen"/>
  </a:majorFont>
</a:fontScheme>

For brevity, I’ve omitted the Minor font section. Instead of setting the ea and cs fonts, this font theme has entries for more tightly defined language groups and different fonts assigned to each one. This level of detail is necessary for a font theme that can be used around the world. Since I copied this listing from theme1.xml, it doesn’t have the XML opening that a standalone font theme would have.

For a complete list of all 4-letter script/language codes, search online for ISO 15924 Code Lists.

Setting up and testing a complex font theme like this is not a simple task. The font switching is automatic and is triggered by the language input setting on your computer, the language set in your template styles and the language set in the text being edited. Please post your comments, let me know of any hiccups or problems you notice and I’ll try to answer your questions.

Brandwares creates font themes to help global corporations support every language. Send me a message for ensure your files have worldwide useability: production@brandwares.com

10:17 pm

14 thoughts on “OOXML Hacking: Font Themes Complete

  1. What’s your take on embedded fonts? Always advise clients on the issues regarding cross-platform compatibility, but would like to know your thoughts on it.
    Thanks

    • Font embedding has several pitfalls that limit its usefulness:

      • Only Truetype and Truetype-flavored OpenType can be embedded. It just doesn’t work with other font formats.
      • Embedding doesn’t work with Office for Mac. You cannot embed fonts in that version and it will not display fonts embedded in Windows.
      • Most foundries limit the embedding permissions of fonts. Often the recipient of the document cannot edit the document using the embedded font. This limits collaboration.
      • Embedded fonts can balloon the size of Office files to many times their original size. You can limit this by choose to embed only the characters used in the document, but then that curtails collaboration again.

      Because of all these factors, I rarely recommend embedding fonts. However, it can be useful if you want to copy the final copy of a presentation from a Windows desktop to a Windows laptop without worrying about copying the fonts as well. In this case, you don’t need collaboration.

  2. Thanks for this post – though I’m afraid the complex script font is not working at all for me. Here is the xml file I am trying:











    The Latin script font works fine, but I can’t get any cs ones to work – the cs fonts simply default back to Times New Roman. Tahoma is a valid cs font – it appears in the Complex Scripts part of the Font dialog, and my Hebrew text appears correctly in Tahoma. I don’t need the ea part.

    Any thoughts?

    • Oops! Sorry, try the XML again:

      <?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
      <a:fontScheme xmlns:a=”http://schemas.openxmlformats.org/drawingml/2006/main” name=”CalibriTahoma”>
      <a:majorFont>
      <a:latin typeface=”Calibri Light”/>
      <a:ea typeface=””/>
      <a:cs typeface=”Tahoma”/>
      </a:majorFont>
      <a:minorFont>
      <a:latin typeface=”Calibri”/>
      <a:ea typeface=””/>
      <a:cs typeface=”Tahoma”/>
      </a:minorFont>
      </a:fontScheme>

      • Your font theme looks fine. The issue is with setting up Word for multiple languages. I started writing a reply, but it got longer and longer until I realized I really need to write an article about this. It’s a complex subject, please stay tuned!

  3. Are you aware of any way to set a fallback default system font in the XML?

    For example if I’m using a non-system font that’s not installed on the users computer, the template automatically switches to Times New Roman, is there a way to control this?

    Embedding the font isn’t an option as the template is required for Windows/Mac.

    Thanks.

  4. Hi John,

    Hope you’re safe and well during this awful time.

    I am developing an interactive PPT Show (nav, drop downs etc).

    But the client’s copies of the .PPSX I send them open in editable mode and not presentaion mode.

    Do you know why this would be please?

    regards,
    Richard

  5. Hello John,

    thank’s a lot for sharing this Themes.
    is it possible to ad something like “bold” or “italic” to the Font?
    For example the different Font styles of Verdana has no different names. If I choose Verdana Bold ( in Germany “fett”) in the drop down menu it is still the verdana but “bold” is chosen in the tick box below.

    Thanks a lot for any suggestions!

    Kind Regarsd,
    Jörg

    • As noted in the article, you can only use the base name of the font. The bold or italic in a font family can’t be entered in a font theme. If the fonts have been created as single fonts, where the Bold version is listed as a separate entry in the font menu, then you can use that font name in a theme. But of course, then the bold and italic buttons will no longer work as expected for that font.

  6. Pingback: PowerPoint Theme Fonts for Mac Users - Magnas Media

  7. I am working on a mac — most of our company is mac. Our brand font is proxima nova – while I started making master slides/template with this font — made a XML font them with proxima nova — now the font does not show up correctly at all. It says proxima but it’s using calibri (i think).

    Is there a fix for this with Proxima Nova?

    Is there a better way to handle our company deck template regarding company wide consistency of fonts?

    I’ve been working on and off on this issue for months now — with no real answers.

    Thank you for any help and insight you can give.

    • There is a mistake in your font theme XML. The most common error is using curly or “smart” quotes instead of straight quotes.

      If you’re unable to get it working on your Mac, try creating the font theme on a Windows computer. Windows versions of Word, PowerPoint and Excel can all create custom font themes. You can also hire us to create a font theme that’s guaranteed to work.

Leave a Reply

*Required fields. Your email address will not be published.

Posting XML? To enter XML code, please replace all less than signs "<" with "&lt;" and greater than signs ">" with "&gt;". Otherwise, Wordpress will strip them out and you will see only a blank area where your code would have appeared.