Font handling in Notes rich text to HTML (v2)

These are the html options that control how the web server converts FONT information from notes rich text. The "master option" enables the others (otherwise they are ignored).

Font Features

The various kinds of information about font and text are called "features" in this document.

The features are

color (example: red, #F0F0F0)
the styles: bold, italic, strikethrough, underline
face (example: default serif, Arial)
size (example: 10pt, 24pt)

Rich Text Information vs HTML

All notes rich text has font information associated with it. When translating to HTML we don't necessarily want to generate tags for all that information because the HTML would be too verbose. Therefore there are options that establish default values for certain font features -- HTML will be generated only if the rich text differs from the default. Some of the defaults can be turned off so that html will always be generated.

Feature: face
Defaults: one or more of the "generic fonts" (e.g. "default serif")
Override: yes - see FontGenericSerif, FontGenericSansSerif, and FontGenericMonospace

Feature: size
Default: 10pt
Override: yes - see FontSizeMapping, FontSizeDefault

Feature: color
Default: black
Override: no

Feature: styles - bold, italic, strikethrough, underline
Default: plain
Override: no

Conversion Description

Each feature can have its own tag associated with it, and/or there can be one overall "general" tag for the entire block of information. There can be "style" generated for each feature and it can be associated with either the general tag or the specific tag. There can be a "class" (of a fixed name) generated for each feature and associated with the general tag or each individual tag.

Combinations can be created that make no sense, so the application designer must take care.

Options Description

Note: there are several sets of tags that have the same form and differ only by the feature name they control. In that case the descriptions have {X} in them where {X} can be:

        Bold, Italic, Underline, Strikethrough, Size, Face, Color


FontConversion - the master option

0 (classic) - the original web server handling
1 (style) - use combinations of span and other new tags, as controlled by the remaining options.



FontTag - the tag to use for the overall or "common" tag.

0 (none) - do not generate common tag
1 (span) - default - use a span tag.

FontClass (ignored if FontTag=0)

0 (none) - default - no class on the common tag
1 (common) - add class "domino_text" to the common tag
2 (inner) - add a special <span class=> inside the common tag but outside any individual tag.

Font{X}Style - generate a "stylesheet" fragment for the feature.

This fragment will be put into a "style" attribute.

0(none) - do not generate a style attribute for feature {X}
1(common) - default - add the stylesheet fragment to the style attribute of the common tag
2(individual) - put the stylesheet fragment on the individual tag


Font{X}Tag - individual tag for feature {X}

0(none) - default - no individual tag
1(native) - not implemented - generate a native tag if possible
2(span) - generate a span tag for this feature
3(em) - generate <em>
4(strong) - generate <strong>

Font{X}Class

0(none) - default - no class
1(common) - class name on common tag
2(individual) - class name on individual tag

class names used for values of {X} for option “2”

Bold - domino_style_b
Italic - domino_style_i
Underline - domino_style_u
Strikethrough - domino_style_s
Face
domino_face_serif - if the face is generic serif
domino_face_sansserif - if the face is generic sans serif
domino_face_monospace - if the face is generic monospace
domino_face - any other named face
Color - domino_font_color
Size - domino_font_size

FontSizeMapping - how to map notes font point sizes to html styles

0 (absolute) - the point size 'p' in notes is mapped to 'p'pt in CSS
1 (percent) - default - point size is turned into a percent (%) of a base value (see FontSizeDefault)
2 (virtual) - virtual mapping (like in classic)

FontSizeDefault - interpretation depends on FontSizeMapping value.

FontSizeMapping=0(absolute)
0 - always use font size
1-255 - don't use tag / class / style when font is this value
FontSizeMapping=1(percent)
0 - built in default base of 10pt (but all font sizes are "of interest")
1-255 - specify default base (100%) - if the notes font is the base size no tag / style / class is generated.
FontSizeMapping=2(virtual)
- not implemented

FontGenericSerif - what kind of markup to use for text marked with "default serif".

0 - default - do not generate font markup
1 - generate "font-family: serif" if the font is "default serif"

FontGenericSansSerif (default) - what kind of markup to use for text marked with "generic sans-serif"

0 - default - do not generate font markup
1 - generate "font-family: sans-serif" (if FontFaceStyle is set)
generate class "domino_font_sansserif" (if FontFaceClass is set)

FontGenericMonospace - what kind of markup to use for text marked as "generic monospace"

0 - do not generate font markup
1 - default - generate "font-family: monospace"

TextExactSpacing

0 - text spacing is not altered from the notes source, HTML agents may collapse multiple spaces to one space.
1 - default- preserve multiple spaces in the text by using . This provides a look truer to the notes client, but increases the size of the HTML stream.

Examples

Note 'X' in the option settings below indicates that all the options not explicitly shown are set to this value.

* Base example as used with various combinations of the "alternate II" font options

Assume you have some text,

"Hello World!"

that you mark as bold, italic, underline, strikethru, dark red, 17pt, Lucida Sans Unicode.

The web server would generate this HTML:

    <b><i><u><s><font size="5" color="#C00000" face="Lucida Sans Unicode">Hello World!</font></s></u></i></b>

(The web server translates the point size 17 to a "virtual size" attribute value of "7". There is a web server table that defines how the point sizes are mapped to virtual size numbers.)

* direct use of inline style (this uses all the default setting of the options if FontConversion=1)

FontConversion=1, FontTag=0, FontClass=0,

    <span style="font-weight: bold; font-style: italic; text-decoration: underline line-through; color: #C00000; font-family: Lucida Sans Unicode; font-size: 170%">
        Hello World!
    </span>

        Note that the point size 17pt has been changed to 170% -- this is 170% of 10pt -- the assumed default size

* marking with inner span for override.

FontClass=2
    <span style="font-weight: bold; font-style: italic; text-decoration: underline line-through; color: #C00000; font-family: Lucida Sans Unicode; font-size: large"><span class="domino_text">Hello World!</span></span>

* Separate classes to mimic the original tags (we don't generate the stylesheet for the class itself)

Font{X}Style=0, Font{X}Tag=2, Font{X}Class=2

    <span class="domino_font_color">
        <span class="domino_style_b">
            <span class="domino_style_i">
                <span class="domino_style_u">
                    <span class="domino_style_s">
                        <span class="domino_font_size">
                            <span class="domino_face">
                                Hello World!
                            </span>
                        </span>
                    </span>
                </span>
            </span>
        </span>
    </span>

To get all classes at the top level:

Font{X}Style=0, Font{X}Tag=2, Font{X}Class=1

    <span class="domino_font_color domino_style_b domino_style_i domino_style_u domino_style_s domino_font_size domino_face">
        Hello World!
    </span>

* completely disabling font size and face (and taking the other options at their defaults)

FontSizeStyle=0, FontSizeTag=0, FontFaceStyle=0, FontFaceTag=0

    <span style="font-weight: bold; font-style: italic; text-decoration: underline line-through; color: #C00000 ">
        Hello World!
    </span>

* turn everything off

FontBoldStyle=0, FontBoldTag=0, FontBoldClass=0
FontItalicStyle=0, FontItalicTag=0, FontItalicClass=0
FontUnderlineStyle=0, FontUnderlineTag=0, FontUnderlineClass=0
FontStrikethroughStyle=0, FontStrikethroughTag=0, FontStrikethroughClass=0
FontSizeStyle=0, FontSizeTag=0, FontSizeClass=0
FontFaceStyle=0, FontFaceTag=0, FontFaceClass=0
FontColorStyle=0, FontColorTag=0, FontColorClass=0

        Hello World!

* common span with individual native style (maybe this will go away - i.e. no "native" option)

Font{X}Style=1, Font{X}Tag=native, Font{X}Class=0
    <span style="font-weight: bold; font-style: italic; text-decoration: underline line-through; color: #C00000; font-family: Lucida Sans Unicode; font-size: 170%">
        <b><i><u><s>Hello World!</s></u></i></b>
    </span>

Comment: since u and s are deprecated, maybe we shouldn't have anything for them in "native" mode (or we give up native mode completely)

* lots of useless spans

FontTag=span, Font{X}Style=0, Font{X}Tag=span, Font{X}Class=0
        <span><span><span><span><span><span><span><span>Hello world!</span></span></span></span></span></span></span></span>

        comment: pretty useless, but you can do it.

* individual styles

Font{X}Style=2, Font{X}Tag=2, Font{X}Class=0

        <span style="font-weight: bold;">
         <span style="font-style: italic;">
          <span style="text-decoration: underline">
           <span style="text-decoration: line-through">
            <span style="color: #C00000;">
             <span style="font-family: Lucida Sans Unicode;">
              <span style="font-size: 170%">Hello world!</span>
             </span>
            </span>
           </span>
          </span>
         </span>
        </span>

* mixture of style for color and face, individual mapping of bold to strong, italic to emphasis, and classes for underline and strikethrough. (domino does not generate the style associated with the class)

FontFaceStyle=1, FontColorStyle=1, FontSizeStyle=1, Font{X}Style=0,
FontBoldTag=4, FontItalicTag=3, Font{X}Tag=2,
FontUnderlineClass=individual, FontStrikethroughClass=individual
        <span style="color: #C00000; font-family: Lucida Sans Unicode; font-size: 170%">
         <strong>
          <em>
           <span class=domino_style_u>
                <span class=domino_style_s>Hello World!</span>
           </span>
          </em>
         </strong>
        </span>

* common class, no specific styles.

Font{X}Style=0, Font{X}Tag=0, Font{X}Class=0, FontTag=2 FontClass=1
        <span class="domino_text">Hello world!</span>

* Example of using defaults to limit the markup generated.

Suppose you wrote this text in the notes editor and marked it "default sans serif", 12pt,

        Hello World!

Using the built in defaults of the html options you would get:

        <span style="font-size: 120%;>Hello World!</span>

If you set:

FontSizeDefault=12



you would see:

        Hello World!

Of course, now fonts that are NOT 12pt will have markup generated for them. You would use this option to tailor the html default to the defaults used in the notes editor.

* controlling the generic font faces used.

Still using the above example code, note that absent any explicit style sheet added by the application, when shown in the browser this text will be in the font configured by the browser user, even though it is marked as "default sans serif" in notes.

If you wanted to generate html to that explicitly styled the default sans serif font use:

FontGenericSansSerif=1, FontSizeDefault=12 to generate:
FontGenericDefault=6
        <span style="font-family: sans-serif">Hello World!</span>

To get a class name rather than an explicit font family:

FontFaceClass=1, FontFaceStyle=0, FontGenericSansSerif=1, FontSizeDefault=12
        <span class="domino_face_sansserif">Hello World!</span>

(You would need to define the style for the class yourself)

If for some reason you wanted both a style and a class such that you could use the class to override the style:

FontFaceTag=2, FontFaceClass=2, FontGenericSansSerif=1, FontSizeDefault=12
        <span style="font-family: sans-serif"><span class="domino_face_sansserif">Hello World!</span></span>

Appendix 1: list of the options (and default values – indicated with “!”)

! FontConversion=0
  FontTag=span
  FontClass=0
! FontBoldStyle=1
  FontBoldTag=0
  FontBoldClass=0
! FontItalicStyle=1
  FontItalicTag=0
  FontItalicClass=0
! FontUnderlineStyle=1
  FontUnderlineTag=0
  FontUnderlineClass=0
! FontStrikethroughStyle=1
  FontStrikethroughTag=0
  FontStrikethroughClass=0
  FontShadowStyle=1
  FontShadowTag=0
  FontShadowClass=0
  FontEmbossStyle=1
  FontEmbossTag=0
  FontEmbossClass=0
  FontExtrudeStyle=0
  FontExtrudeTag=0
  FontExtrudeClass=0
! FontSizeStyle=1
  FontSizeTag=0
  FontSizeClass=0
! FontFaceStyle=1
  FontFaceTag=0
  FontFaceClass=0
! FontColorStyle=1
  FontColorTag=0
  FontColorClass=0
! FontSizeMapping=1
! FontSizeDefault=10
! FontGenericSerif=0
! FontGenericSansSerif=0
! FontGenericMonospace=1
! TextExactSpacing=1