Book Formatting

From the Oblivion ConstructionSet Wiki
Revision as of 13:07, 13 January 2010 by imported>Aellis (→‎<nowiki><DIV></nowiki>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview[edit | edit source]

Books use a simplified form of HTML to align, color, and change the fonts of the text, as well as insert images.

Only a small subset of HTML’s tags are available in Oblivion books, and even these may have slightly different behavior from what you would see in a web browser.

For the text to be recognized as HTML, it must START with a tag of some sort. The FONT tag is a good first choice, but anything in angle brackets (greater-than, less-than) will work, even “<HTML>”. If the book text starts with words, then any tags in the body of it will be displayed. This way, a plaintext document with < and > used individually won’t be confused with actual HTML.

Warning: Do not use “ speech marks when coding or in writing, only " or ”, the main reason being that “ speech marks tend to disrupt coding. The book will still work, but parts of the coding will be obvious in game (such as having < marks everywhere), and the coding may not have taken effect.

Get into the practice of omitting the quotation marks from the tags you use.  <FONT face="1"> compiles the same as <FONT face=1>.  This way, if you do want to use quotation marks, you can do so without borking your book.
Example: <FONT face=3>Buy the book at "First Edition".</FONT>
Will appear in game as: Buy the book at "First Edition".

Supported Tags[edit | edit source]

<BR>[edit | edit source]

This tag starts a new line.

Differences: (minor) It will not start a new line on the first line of a book if that line is empty. So if a file starts with <BR>, it will not have a blank first line. Put a space before the <BR> if you want the first tag on a page to actually work.

<P>[edit | edit source]

This tag behaves just like a <BR> tag, but skips ahead one line and starts a new line.

<HR>[edit | edit source]

This tag will force a page break in books, and is ignored in scrolls.

Differences: (minor) In HTML, this tag produces a horizontal line. As HTML does not use pages, it most closely resembles scrolls in behavior.

<DIV>[edit | edit source]

Use this tag to align text to the left, right, or center. (The <CENTER> tag from HTML is not supported.) By itself, it does nothing. Used with an align attribute, it changes the justification of the following text AND starts a new line. Use the following tag attributes to justify text: <DIV align=”left”> <DIV align=”center”> <DIV align=”right”>

Differences: As with the font tag (see <FONT> below), the div tags do not nest as they would in HTML.

If you do nest tags, the <DIV> tag is destroyed when followed by a </FONT> tag.
Example: <DIV align=right>Mytext<FONT face=3>is a handwritten</FONT>note.</DIV>

With normal HTML tags, the result would be:

                                                   Mytext is a handwritten note.

But in game the book will be formatted:

                                                         Mytext is a handwritten
note.

<FONT>[edit | edit source]

Use this tag to change font characteristics. The following tag attributes are available: <FONT color=”FFFFFF”> <FONT face=”1”> or <FONT face=”Kingthings_Regular”> Both attributes can be used in a single <FONT> tag. The “face” attribute can be either the exact font name as defined in the gamesettings, or a numeric index from 1 to 5. Colors are in the standard HTML format of a 2-byte hex triplet. (Each two characters are a hex number from 00 to FF(256). They are red, green, and blue respectively.) The default font is 1, and the default color is black (or “000000”). The end-tag </FONT> will revert text to the defaults. Old font names are auto-mapped to new names, but should be changed anyway.

Oblivion Font Examples.

List of Fonts supported in game:
SFontFile_1=Data\Fonts\Kingthings_Regular.fnt

SFontFile_2=Data\Fonts\Kingthings_Shadowed.fnt

SFontFile_3=Data\Fonts\Tahoma_Bold_Small.fnt

SFontFile_4=Data\Fonts\Daedric_Font.fnt

SFontFile_5=Data\Fonts\Handwritten.fnt

Differences: (major) The fonts used in the game are not Windows fonts, so they cannot be seen in HTML. There may be suitable substitute Windows fonts available for some, but there would have to be separate files to permit each environment to see fonts it recognizes. Also, in HTML font tags can be nested and the end-tag only ends the current font.

<IMG>[edit | edit source]

This command inserts an image into the book. It requires all three attributes to be present in the tag at once. The image is inserted as if it were just a large character of text, just as in HTML. This means you can replace the first character of a paragraph with an image (an initial caps fancy letter image, for example) and the text will format properly around it. You can also surround and image with blank lines and a DIV tag to center it. As with basic HTML, you cannot “flow” text around an image. The (required) attributes are:

<IMG src=”Book/fancy_font/h_62x62.dds” width=62 height=62>

Differences:

In HTML, the entire image file is always displayed, squishing or stretching it to fit the provided width and height, or using the file’s actual sizes if no width or height is stated. In Oblivion, all DDS files must have file sizes that are powers of two (32, 64, 128, 256, etc). Since you may have images of non-powers-of-2 sizes that you wish to display, the width and height are handled differently in books.

You cannot stretch or squish an image in a book, you can only crop. This means that with a width and height of 64 (as in the example above) only the top-left 64x64 section of the image file will be used. The rest of the image file will be ignored. (Naming the files with the correct width and height to display them is probably good practice. Use the full resolution sizes for all resolutions of the image.

NB: The largest Image size possible is 444x650 pixels. Go over this and the book will crash when opened in game. However, this may be variable from person to person, some are getting it as high as 490x680 (and even 490x720 after the first page).

Notes:

  • When you add your images to Data\Textures\Menus, you do not need to add the “Data\Textures\Menus” portion of the pathname in the book text file. That portion will be added automatically. Just make sure that all THREE sizes are created (as placed in the Menus, Menus80, and Menus50 directories). Use the Data\Textures\Menus(50/80)\Book directory, unless the image file already exists elsewhere in the Textures\Menus path.
  • You can use images outside of the Data\Textures\Menus path, by using paths relative to Data\Textures\Menus but the images won't be displayed when you pack them into a BSA.
  • When you use a sub-folder of Data\Textures\Menus (e.g. "Data\Textures\Menus\Mymod"), you can use only one image, but when you run Oblivion in low resolution this image will be resized ingame and might not look as good as it would when you use three separate images in the Menus, "Menus50" and "Menus80" folders.
  • <IMG> tags can sometimes disrupt additional coding in a book, even other <IMG> tags. It seems some form of text, or a space after additional coding placed after an <IMG> tag helps stop the disruption.

Other Tags[edit | edit source]

All other tags will be ignored, although any text inside them (“<CENTER>text</CENTER>”) will be displayed as normal.

Image Files[edit | edit source]

Image files for the menu system have to be created in 3 sizes, 100%, 80% and 50% and placed in three otherwise identical directory trees in the Data\Textures directory. The menus (and books) should behave as if everything is at the 100% size. Scaling and use of the smaller sizes is done automatically when the resolution of the game is lowered.

For the books, it is a good idea to add the size of the portion of the image file that should be displayed to the file name. This will make it easier for book writers to get the correct width and height values.

my_image_52x137.dds

The same name should be use for all three files, even though the active portion of the smaller files is different. A quick way to get the size of the active portion of the image is to control-click the alpha channel in the channel list window and read off the height and width from the info window.


See Also[edit | edit source]

Book

Scroll Tutorial

How to make a book with pictures only

Fancy Fonts