RFP: XP font mapping mechanism

From: Dom Lachowicz (doml@appligent.com)
Date: Wed Oct 02 2002 - 15:29:46 EDT

  • Next message: Gansser, Martin: "AW2 crashed after load a Worddocument"

    Hi,

    So my latest build doc brought up some confusion on IRC about what the
    "Luxi Sans" font was, and is an example of a much larger problem - we
    have no good font name mapping solution in place, so necessarily some
    font information gets lost when a document moves from one machine to
    another (and especially across platforms), and is parallel to the font
    embedding problem that Joaquin and I were discussing last month.

    What I am proposing here comes in several parts:

    1) We create a user-editable XML based file containing font name
    information, aliases, platform names, alternates, et. al.

    2) Create a singleton "mapper" class whose job is:
    a) to return the proper GR_Font (or font name) for a given input font
    name and graphics class
    b) to return a font name and alternates list based on and input name
    and possibly some auxiliary data, such as output format (RTF and HTML
    come to mind)

    3) Use information gathered in 2.b when saving to virtually every
    format, where appropriate

    The DTD would look something like
    <!ELEMENT font>
    <!ATTLIST font
            id %String; #REQUIRED
            aliases %StringList; #IMPLIED
            alternates %StringList; #IMPLIED
    >

    A use of said DTD might look like:

    <font id="Times New Roman" aliases="Nimbus Roman 9L, Nimbus Roman"
    alternates="Times, Georgia"/>

    and would correspond in the ABW and HTML formats to something like:
    style="font-family:Times New Roman,Times,Georgia"

    where alternates is a list of IDREFS to other <font> entries and the
    font-family entry looks like: id,alternates. Aliases need not be
    IDREFS, since they would essentially be alternate (platform specific)
    names for the id attribute.

    If needed, we could expand this list to also have additional
    information. Poor nonsensical example follows:

    <font id="Times New Roman" aliases="Nimbus Roman 9L, Nimbus Roman"
    alternates="Times, Georgia"
    file-format="rtf:Comic Sans MS; latex:Rubbish"/>

    which means "when saving to RTF, use 'Comic Sans MS' as the font's name
    and 'Rubbish' when saving to LaTeX". These would also necessarily be
    IDREFS to other listed fonts, thus making re-loading the RTF
    transparent to our users and to our formatting engine.

    If a font installed on a user's system isn't present in our list, we
    will still display the document using that font on the user's computer,
    and save that name in the ABW file. However, when loading on a 3rd
    party machine, we would use a default like Times Roman for viewing
    purposes instead. In this case, the result is no worse than our present
    behavior, and arguably could not get much better.

    Again, this is just an idea, and probably a poor one at that. I'm
    admittedly out of my league here. I'm looking for constructive feedback
    suggestions from other people on the list, not criticism and flameage.
    Other information, links, feedback appreciated.

    Thanks,
    Dom
    /me already forsees Andrew wanting to add locale information to the
    above DTD



    This archive was generated by hypermail 2.1.4 : Wed Oct 02 2002 - 15:35:37 EDT