OpenOffice .odt Opened Up – Part 3a: Styles/font-face-decls

Overview

In my last article, OpenOffice .odt Opened Up – Part 2: Meta and Settings, I discussed two of the four top level subdocument elements, office:document-meta and office:document-settings. In this article, I will be taking a closer look at the office:document-styles element, in particular the office:font-face-decls sub-element. As before, my test cases where produced with the following software:

  • SuSE Linux 10.1
  • OpenOffice 2.0.2.7.1
  • zip 2.31 (March 8th 2005)

The Relax-NG schema language is used to define elements of the specification. The original source document can be downloaded here oo_part1.odt, and in particular the subdocument under observation can be downloaded here styles.xml.

The office:document-styles element

The office:document-styles root element contains all font face declarations, named styles, automatic styles and master styles need for the document.

office:document-styles schema

<define name="office-document-styles">
  <element name="office:document-styles">
    <ref name="office-document-common-attrs" />
    <ref name="office-font-face-decls" />
    <ref name="office-styles" />
    <ref name="office-automatic-styles" />
    <ref name="office-master-styles" />
  </element>
</define>

Next let us explore the office:font-face-decls sub-element.

The office:font-face-decls element

This element is actually duplicated in the top-level office:document-content element. A few simple test indicate that, if differences exist in the two sub-elements, complete element omissions in one are populated by the other, and where two elements differ in content the definition in office:document-styles takes precedence, though this behavior is not defined explicately in the specification.

The office:font-face-decls element consist of style:font-face elements. If you remember, we generated our test document by selecting text from a pdf and pasting that text into an .odt. This generated such style:font-face elements as follows:

<style:font-face style:name="EIDQUI+CMSLTT10"
                 svg:font-family="EIDQUI+CMSLTT10"/>

<style:font-face style:name="FFWLFJ+CMR10"
                 svg:font-family="FFWLFJ+CMR10"/>

<style:font-face style:name="GRVNVC+CMTT9"
                 svg:font-family="GRVNVC+CMTT9"/>

<style:font-face style:name="HJCZVV+CMTT8"
                 svg:font-family="HJCZVV+CMTT8"/>

<style:font-face style:name="Lucidasans1"
                 svg:font-family="Lucidasans"/>

With the exception of the last element, this looks pretty ugly. The following is a sample of style:font-face elements taken from a newly created document.

<style:font-face style:name="HG Mincho Light J"
                 svg:font-family="’HG Mincho Light J’"
                 style:font-pitch="variable"/>

<style:font-face style:name="Lucidasans"
                 svg:font-family="Lucidasans"
                 style:font-pitch="variable"/>

<style:font-face style:name="Thorndale AMT"
                 svg:font-family="’Thorndale AMT’"
                 style:font-family-generic="roman"
                 style:font-pitch="variable"/>

<style:font-face style:name="Albany AMT"
                 svg:font-family="’Albany AMT’"
                 style:font-family-generic="swiss" />

The reason for this is that OpenDocument font face declarations directly correspond to the @font-face font description of CSS2 and the <font-face> element of SVG, but have two extensions.

  1. OpenDocument font face declarations optionally may have an unique name. This name can be used inside styles as the value of the style:font-name attribute to immediately select a font face declaration. If a font face declaration is referenced this way, the steps described in CSS2 font matching algorithms for selecting a font declaration based on the font-family, font-style, font-variant, font-weight and font-size descriptors will not take place, but the referenced font face declaration is used directly.
  2. Some additional font descriptor attributes may exist.

Which basically means svg:font-family="EIDQUI+CMSLTT10" uses the SVG font matching algorithm and not the named font. SVG is beyond the scope of this article. Reference material for SVG font declarations can be found here.

Back to the bigger picture. The benefit we can observe from this, is that a predefined set of fonts can be applied to an .odt. By doing this we can ensure that documents contain a consistent set of fonts and eliminate potential redundancy or functional overlap. Care must be taken that if a style:font-face is replaced, that all style:font-name, style:font-name-complex and style:font-name-asian attributes are examined and replaced as well. While potential size gains are arguably minimal, gains in consistent look and output are immeasurable.

One option Open Office gives the user to tackle this issue is the font replacement option. Simply choose Tools -> Options then OpenOffice.org -> Fonts. You should see a dialog similar to the following:

Font Replacement Dialog

Click for full size image

The Open Office user can simply select which fonts to replace with which fonts on an Always or Screen only case. Though this is not always a complete solution. Amore complete solution will be provided in the final installment of OpenOffice .odt Opened Up – Part 3: Styles. I will provide an application that will indeed optimize all of the aspects of the office:document-style elements. Up next is the office:styles element.

Until next time,

-3monkeys

Popularity: 18% [?]

  • DZone
  • StumbleUpon
  • Technorati
  • del.icio.us
  • Slashdot
  • Digg
  • Reddit
  • NewsVine
  • SphereIt
  • e-mail
  • Facebook
  • Google Bookmarks
  • Live
  • Propeller
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 9.00 out of 10)
Loading ... Loading ...

18 Responses to “OpenOffice .odt Opened Up – Part 3a: Styles/font-face-decls”

  1. Article Submission Says:

    Hi, just thought you’d be interested to know that I have added your blog to my Google bookmarks because of your beautiful blog layout (LOL). With that said, seriously, I believe your blog has one of the cleanest theme I’ve came across. It really makes your blog post easier to read.

  2. FL Studio Tutorials Says:

    I didn’t know you can edit .odt files in this way, thanks for the info.

  3. Mitchell Petruzzelli Says:

    Hi,just learned your web-site when i google some thing and wonder what web hosting do you use for the wordpress,the speed is much more faster than my online web page, i really have to have it.will back to verify it out,several thanks!

  4. Maryland Laptop Repair Says:

    Excellent blog. Can’t wait to check out just what exactly you construct next!

  5. home and family Says:

    Hi admin How are You ? I like your post and i want to stumble it for my friend but i cant see your social bookmark widget in this blog. Please help me friend Thank You

  6. acai berries Says:

    oh my god most of the comments most people make usually are such stoner comments, now and then i question whether they actually examine the content material pieces and reports prior to posting or if perhaps they generally skim the titles and publish first thing comes to mind. anyway, it’s satisfying to go through smart commentary now and then when compared to similar, obsolete post vomit which i generally see on the net

  7. where to buy acai berry scams Says:

    Just one single question though. Maybe you have made creating this blog as your career or do you do this in your spare time? Just curious..

  8. employment in usa Says:

    you have a great page here, lots of good stuff about employment in usa.

  9. Nova Contractor estimates Says:

    Lol that is certainly one of the ways to observe that ;)

  10. ultrarom Says:

    Go to http://www.ultrarom.com for the best forums

  11. nightmareforums.com Says:

    http://www.nightmareforums.com pokemon forums the best of the best

  12. Claude I Love Dior Shirt Says:

    Hardy is known to incorporate Japanese aesthetics into the American tattoo styles and these can be clearly seen in the jeans designed by him. Actually, Hardy started introducing tattoos on clothes in the year 2002, but in 2004, he paired with Christian Audigier for making the brand fashionable and famous.

  13. MCSE Guy Says:

    Im trying to decide between MCSE and CCNA

  14. Abe Pottorff Says:

    Good post! I have a random question for you. How do you get your blog indexed by bing? I have a related web blog.

  15. article directory Says:

    Xclusive Articles – Free article directory to submit your articles to get backlinksand traffic for your site.

  16. Fallon Vejarano Says:

    Extremely interesting stuff. Would you mind if I placed a link to your site from my blog? Google

  17. Deloras Late Says:

    Thank you ! nice find

  18. website visitor tracking Says:

    Excellent article, I really enjoyed reading it and so I have subscribed to the rss feed. It is nice to see that there are other people out there who think along the same lines as I do. Keep up the good work.

Leave a Reply