Font Markup Extension for Web UI's

I’m working on Zifmia and needed to reimplement some of the font styles (bold, italcs) that I had removed from the FyreVM engine. I decided to build a series of font objects in I7 that could be used in text. The code below is a work in progress and I’m looking for comments on making it cleaner, safer, and simple to use.

This extension does not necessarily need FyreVM or Zifmia. If you plan to output your code to Quixe and have your own javascript code, the resulting markup can be reformatted (RegEx) to CSS or HTML. Of course Zarf will eventually offer a CSS implementation within Glulx that will supercede my font extension (and do much more), but I’m only focused on font usage. I still believe windowing, text position, and similar things are better served contextually through UI components. In any case, the code is below…comments are welcome.

David C.


"Fonts" by David Cornelson

Use Hex Color Values translates as (- Constant HEX_VALUES; -)

A font-color is a kind of thing. It has some text called the hex value.

AliceBlue is a font-color. The hex value of AliceBlue is "#F0F8FF".
AntiqueWhite is a font-color. The hex value of AntiqueWhite is "#FAEBD7".
Aqua is a font-color. The hex value of Aqua is "#00FFFF".
Aquamarine is a font-color. The hex value of Aquamarine is "#7FFFD4".
Azure is a font-color. The hex value of Azure is "#F0FFFF".
Beige is a font-color. The hex value of Beige is "#F5F5DC".
Bisque is a font-color. The hex value of Bisque is "#FFE4C4".
Black is a font-color. The hex value of Black is "#000000".
BlanchedAlmond is a font-color. The hex value of BlanchedAlmond is "#FFEBCD".
Blue is a font-color. The hex value of Blue is "#0000FF".
BlueViolet is a font-color. The hex value of BlueViolet is "#8A2BE2".
Brown is a font-color. The hex value of Brown is "#A52A2A".
BurlyWood is a font-color. The hex value of BurlyWood is "#DEB887".
CadetBlue is a font-color. The hex value of CadetBlue is "#5F9EA0".
Chartreuse is a font-color. The hex value of Chartreuse is "#7FFF00".
Chocolate is a font-color. The hex value of Chocolate is "#D2691E".
Coral is a font-color. The hex value of Coral is "#FF7F50".
CornflowerBlue is a font-color. The hex value of CornflowerBlue is "#6495ED".
Cornsilk is a font-color. The hex value of Cornsilk is "#FFF8DC".
Crimson is a font-color. The hex value of Crimson is "#DC143C".
Cyan is a font-color. The hex value of Cyan is "#00FFFF".
DarkBlue is a font-color. The hex value of DarkBlue is "#00008B".
DarkCyan is a font-color. The hex value of DarkCyan is "#008B8B".
DarkGoldenRod is a font-color. The hex value of DarkGoldenRod is "#B8860B".
DarkGray is a font-color. The hex value of DarkGray is "#A9A9A9".
DarkGrey is a font-color. The hex value of DarkGrey is "#A9A9A9".
DarkGreen is a font-color. The hex value of DarkGreen is "#006400".
DarkKhaki is a font-color. The hex value of DarkKhaki is "#BDB76B".
DarkMagenta is a font-color. The hex value of DarkMagenta is "#8B008B".
DarkOliveGreen is a font-color. The hex value of DarkOliveGreen is "#556B2F".
Darkorange is a font-color. The hex value of Darkorange is "#FF8C00".
DarkOrchid is a font-color. The hex value of DarkOrchid is "#9932CC".
DarkRed is a font-color. The hex value of DarkRed is "#8B0000".
DarkSalmon is a font-color. The hex value of DarkSalmon is "#E9967A".
DarkSeaGreen is a font-color. The hex value of DarkSeaGreen is "#8FBC8F".
DarkSlateBlue is a font-color. The hex value of DarkSlateBlue is "#483D8B".
DarkSlateGray is a font-color. The hex value of DarkSlateGray is "#2F4F4F".
DarkSlateGrey is a font-color. The hex value of DarkSlateGrey is "#2F4F4F".
DarkTurquoise is a font-color. The hex value of DarkTurquoise is "#00CED1".
DarkViolet is a font-color. The hex value of DarkViolet is "#9400D3".
DeepPink is a font-color. The hex value of DeepPink is "#FF1493".
DeepSkyBlue is a font-color. The hex value of DeepSkyBlue is "#00BFFF".
DimGray is a font-color. The hex value of DimGray is "#696969".
DimGrey is a font-color. The hex value of DimGrey is "#696969".
DodgerBlue is a font-color. The hex value of DodgerBlue is "#1E90FF".
FireBrick is a font-color. The hex value of FireBrick is "#B22222".
FloralWhite is a font-color. The hex value of FloralWhite is "#FFFAF0".
ForestGreen is a font-color. The hex value of ForestGreen is "#228B22".
Fuchsia is a font-color. The hex value of Fuchsia is "#FF00FF".
Gainsboro is a font-color. The hex value of Gainsboro is "#DCDCDC".
GhostWhite is a font-color. The hex value of GhostWhite is "#F8F8FF".
Gold is a font-color. The hex value of Gold is "#FFD700".
GoldenRod is a font-color. The hex value of GoldenRod is "#DAA520".
Gray is a font-color. The hex value of Gray is "#808080".
Grey is a font-color. The hex value of Grey is "#808080".
Green is a font-color. The hex value of Green is "#008000".
GreenYellow is a font-color. The hex value of GreenYellow is "#ADFF2F".
HoneyDew is a font-color. The hex value of HoneyDew is "#F0FFF0".
HotPink is a font-color. The hex value of HotPink is "#FF69B4".
IndianRed  is a font-color. The hex value of IndianRed  is "#CD5C5C".
Indigo  is a font-color. The hex value of Indigo  is "#4B0082".
Ivory is a font-color. The hex value of Ivory is "#FFFFF0".
Khaki is a font-color. The hex value of Khaki is "#F0E68C".
Lavender is a font-color. The hex value of Lavender is "#E6E6FA".
LavenderBlush is a font-color. The hex value of LavenderBlush is "#FFF0F5".
LawnGreen is a font-color. The hex value of LawnGreen is "#7CFC00".
LemonChiffon is a font-color. The hex value of LemonChiffon is "#FFFACD".
LightBlue is a font-color. The hex value of LightBlue is "#ADD8E6".
LightCoral is a font-color. The hex value of LightCoral is "#F08080".
LightCyan is a font-color. The hex value of LightCyan is "#E0FFFF".
LightGoldenRodYellow is a font-color. The hex value of LightGoldenRodYellow is "#FAFAD2".
LightGray is a font-color. The hex value of LightGray is "#D3D3D3".
LightGrey is a font-color. The hex value of LightGrey is "#D3D3D3".
LightGreen is a font-color. The hex value of LightGreen is "#90EE90".
LightPink is a font-color. The hex value of LightPink is "#FFB6C1".
LightSalmon is a font-color. The hex value of LightSalmon is "#FFA07A".
LightSeaGreen is a font-color. The hex value of LightSeaGreen is "#20B2AA".
LightSkyBlue is a font-color. The hex value of LightSkyBlue is "#87CEFA".
LightSlateGray is a font-color. The hex value of LightSlateGray is "#778899".
LightSlateGrey is a font-color. The hex value of LightSlateGrey is "#778899".
LightSteelBlue is a font-color. The hex value of LightSteelBlue is "#B0C4DE".
LightYellow is a font-color. The hex value of LightYellow is "#FFFFE0".
Lime is a font-color. The hex value of Lime is "#00FF00".
LimeGreen is a font-color. The hex value of LimeGreen is "#32CD32".
Linen is a font-color. The hex value of Linen is "#FAF0E6".
Magenta is a font-color. The hex value of Magenta is "#FF00FF".
Maroon is a font-color. The hex value of Maroon is "#800000".
MediumAquaMarine is a font-color. The hex value of MediumAquaMarine is "#66CDAA".
MediumBlue is a font-color. The hex value of MediumBlue is "#0000CD".
MediumOrchid is a font-color. The hex value of MediumOrchid is "#BA55D3".
MediumPurple is a font-color. The hex value of MediumPurple is "#9370D8".
MediumSeaGreen is a font-color. The hex value of MediumSeaGreen is "#3CB371".
MediumSlateBlue is a font-color. The hex value of MediumSlateBlue is "#7B68EE".
MediumSpringGreen is a font-color. The hex value of MediumSpringGreen is "#00FA9A".
MediumTurquoise is a font-color. The hex value of MediumTurquoise is "#48D1CC".
MediumVioletRed is a font-color. The hex value of MediumVioletRed is "#C71585".
MidnightBlue is a font-color. The hex value of MidnightBlue is "#191970".
MintCream is a font-color. The hex value of MintCream is "#F5FFFA".
MistyRose is a font-color. The hex value of MistyRose is "#FFE4E1".
Moccasin is a font-color. The hex value of Moccasin is "#FFE4B5".
NavajoWhite is a font-color. The hex value of NavajoWhite is "#FFDEAD".
Navy is a font-color. The hex value of Navy is "#000080".
OldLace is a font-color. The hex value of OldLace is "#FDF5E6".
Olive is a font-color. The hex value of Olive is "#808000".
OliveDrab is a font-color. The hex value of OliveDrab is "#6B8E23".
Orange is a font-color. The hex value of Orange is "#FFA500".
OrangeRed is a font-color. The hex value of OrangeRed is "#FF4500".
Orchid is a font-color. The hex value of Orchid is "#DA70D6".
PaleGoldenRod is a font-color. The hex value of PaleGoldenRod is "#EEE8AA".
PaleGreen is a font-color. The hex value of PaleGreen is "#98FB98".
PaleTurquoise is a font-color. The hex value of PaleTurquoise is "#AFEEEE".
PaleVioletRed is a font-color. The hex value of PaleVioletRed is "#D87093".
PapayaWhip is a font-color. The hex value of PapayaWhip is "#FFEFD5".
PeachPuff is a font-color. The hex value of PeachPuff is "#FFDAB9".
Peru is a font-color. The hex value of Peru is "#CD853F".
Pink is a font-color. The hex value of Pink is "#FFC0CB".
Plum is a font-color. The hex value of Plum is "#DDA0DD".
PowderBlue is a font-color. The hex value of PowderBlue is "#B0E0E6".
Purple is a font-color. The hex value of Purple is "#800080".
Red is a font-color. The hex value of Red is "#FF0000".
RosyBrown is a font-color. The hex value of RosyBrown is "#BC8F8F".
RoyalBlue is a font-color. The hex value of RoyalBlue is "#4169E1".
SaddleBrown is a font-color. The hex value of SaddleBrown is "#8B4513".
Salmon is a font-color. The hex value of Salmon is "#FA8072".
SandyBrown is a font-color. The hex value of SandyBrown is "#F4A460".
SeaGreen is a font-color. The hex value of SeaGreen is "#2E8B57".
SeaShell is a font-color. The hex value of SeaShell is "#FFF5EE".
Sienna is a font-color. The hex value of Sienna is "#A0522D".
Silver is a font-color. The hex value of Silver is "#C0C0C0".
SkyBlue is a font-color. The hex value of SkyBlue is "#87CEEB".
SlateBlue is a font-color. The hex value of SlateBlue is "#6A5ACD".
SlateGray is a font-color. The hex value of SlateGray is "#708090".
SlateGrey is a font-color. The hex value of SlateGrey is "#708090".
Snow is a font-color. The hex value of Snow is "#FFFAFA".
SpringGreen is a font-color. The hex value of SpringGreen is "#00FF7F".
SteelBlue is a font-color. The hex value of SteelBlue is "#4682B4".
Tan is a font-color. The hex value of Tan is "#D2B48C".
Teal is a font-color. The hex value of Teal is "#008080".
Thistle is a font-color. The hex value of Thistle is "#D8BFD8".
Tomato is a font-color. The hex value of Tomato is "#FF6347".
Turquoise is a font-color. The hex value of Turquoise is "#40E0D0".
Violet is a font-color. The hex value of Violet is "#EE82EE".
Wheat is a font-color. The hex value of Wheat is "#F5DEB3".
White is a font-color. The hex value of White is "#FFFFFF".
WhiteSmoke is a font-color. The hex value of WhiteSmoke is "#F5F5F5".
Yellow is a font-color. The hex value of Yellow is "#FFFF00".

The font-family is a kind of value. The font-families are serif, sans-serif, cursive, symbol, or monospace. The font-family is usually sans-serif.

A type-face is a kind of thing. A type-face has a font-family called the font family. A type-face has some text called the name.

Arial is a type-face. The name of Arial is "Arial".
Helvetica is a type-face. The name of Helvetica is "Helvetica".
Arial Black is a type-face. The name of Arial Black is "Arial Black".
Gadget is a type-face. The name of Gadget is "Gadget".
Comic Sans is a type-face. The font family of Comic Sans is cursive. The name of Comic Sans is "Comic Sans".
Courier New is a type-face. The font family of Courier New is monospace. The name of Courier New is "Courier New".
Georgia is a type-face. The font family of Georgia is serif. The name of Georgia is "Georgia".
Impact is a type-face. The name of Impact is "Impact".
Charcoal is a type-face. The name of Charcoal is "Charcoal".
Lucida Console is a type-face. The font family of Lucida Console is monospace. The name of Lucida Console is "Lucida Console".
Lucida Sans Console is a type-face. The name of Lucida Sans Console is "Lucida Sans Console".
Lucida Grande is a type-face. The name of Lucida Grande is "Lucida Grande".
PalatinoLinotype is a type-face. The font family of PalatinoLinotype is serif. The name of PalatinoLinotype is "Palatino Linotype".
Book Antiqua is a type-face. The font family of Book Antiqua is serif. The name of Book Antiqua is "Book Antiqua".
Palatino is a type-face. The font family of Palatino is serif. The name of Palatino is "Palatino".
Tahoma is a type-face. The name of Tahoma is "Tahoma".
Geneva is a type-face. The name of Geneva is "Geneva".
Times Roman is a type-face. The font family of Times Roman is serif. The name of Times Roman is "Times Roman".
TimesFont is a type-face. The font family of TimesFont is serif. The name of TimesFont is "Times".
Trebuchet MS is a type-face. The name of Trebuchet MS is "Trebuchet MS".
Verdana is a type-face. The name of Verdana is "Verdana".
MSSansSerif is a type-face. The name of MSSansSerif is "MS Sans Serif".
MSSerif is a type-face. The font family of MSSerif is serif. The name of MSSerif is "MS Serif".
New York is a type-face. The font family of New York is serif. The name of New York is "New York".

A font-class is a kind of thing.
A font-class has a type-face called typeface. The typeface of font-class is usually Arial.
A font-class has a font-family called the font family.
A font-class has some text called the name.
A font-class has some number called the size. The size of font-class is usually 10.
A font-class has a font-color called the font color. The font color of font-class is usually Black.
A font-class has a truth state called The Bold Style. The Bold Style is usually false.
A font-class has a truth state called The Italic Style. The Italic Style is usually false.
A font-class has a truth state called The Underline Style. The Underline Style is usually false.
A font-class has a truth state called The Strikethrough Style. The Strikethrough Style is usually false.
A font-class has a truth state called The Subscript Style. The Subscript Style is usually false.
A font-class has a truth state called The Superscript Style. The Superscript Style is usually false.

To say (font - font-class):
	say "<font name='[name of typeface of font]' size='[size of font]' ";
	if Hex Color Values option is not active, say "color='[font color of font]'";
	if Hex Color Values option is active, say "color='[hex value of font color of font]'";
	if bold style of font is true, say " +b";
	if italic style of font is true, say " +i";
	if underline style of font is true, say " +u";
	if strikethrough style of font is true, say " +st";
	if subscript style of font is true, say " +sub";
	if superscript style of font is true, say " +sup";
	say ">";
	
To say end font:
	say "</font>".

[Use Hex Color Values.]

The Font Library is a room. "There are fonts lying all over the place."

Green Normal is a font-class. The font color of Green Normal is Green. The Bold Style of Green Normal is true.

Black Normal is a font-class. The typeface of Black Normal is Georgia.

Purple Scribble is a font-class. The font color of Purple Scribble is Purple. The Underline Style of Purple Scribble is true. The typeface of Purple Scribble is Comic Sans.

An egg is in the Font Library. "The [green normal]green[end font], jewel-encrusted egg gleams at you like a rare treasure."

A sign is in the Font Library. "The [black normal]sign[end font] is here."

A garden hose is in the Font Library. "The [purple scribble]purple garden hose[end font] is twisted about the lawn.";

[
* * * Sample Output * * *

Fonts
An Interactive Fiction by David Cornelson
Release 1 / Serial number 110318 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Font Library
There are fonts lying all over the place.

The <font name="Arial" size="10" color="Green" +b>green</font>, jewel-encrusted egg gleams at you like a rare treasure.

The <font name="Georgia" size="10" color="Black">sign</font> is here.

The <font name="Comic Sans" size="10" color="Purple" +u>purple garden hose</font> is twisted about the lawn.

]

EEEK! Don’t subclass off of Thing, it’s an in-game prop! Use a kind of value instead.

This compiles and seems to work, and avoids objects which involve more overhead – especially if the parser is running over them being subclassed from Thing!


"Fonts" by David Cornelson

Use hex color values translates as (- Constant HEX_VALUES; -).

A font-color is a kind of value.  Some font-colors are defined by the table of font colors.

Table of font colors
font-color	hex value
Black 		 "#000000"
AliceBlue 		 "#F0F8FF"
AntiqueWhite 		 "#FAEBD7"
Aqua 		 "#00FFFF"
Aquamarine 		 "#7FFFD4"
Azure 		 "#F0FFFF"
Beige 		 "#F5F5DC"
Bisque 		 "#FFE4C4"
BlanchedAlmond 		 "#FFEBCD"
Blue 		 "#0000FF"
BlueViolet 		 "#8A2BE2"
Brown 		 "#A52A2A"
BurlyWood 		 "#DEB887"
CadetBlue 		 "#5F9EA0"
Chartreuse 		 "#7FFF00"
Chocolate 		 "#D2691E"
Coral 		 "#FF7F50"
CornflowerBlue 		 "#6495ED"
Cornsilk 		 "#FFF8DC"
Crimson 		 "#DC143C"
Cyan 		 "#00FFFF"
DarkBlue 		 "#00008B"
DarkCyan 		 "#008B8B"
DarkGoldenRod 		 "#B8860B"
DarkGray 		 "#A9A9A9"
DarkGrey 		 "#A9A9A9"
DarkGreen 		 "#006400"
DarkKhaki 		 "#BDB76B"
DarkMagenta 		 "#8B008B"
DarkOliveGreen 		 "#556B2F"
Darkorange 		 "#FF8C00"
DarkOrchid 		 "#9932CC"
DarkRed 		 "#8B0000"
DarkSalmon 		 "#E9967A"
DarkSeaGreen 		 "#8FBC8F"
DarkSlateBlue 		 "#483D8B"
DarkSlateGray 		 "#2F4F4F"
DarkSlateGrey 		 "#2F4F4F"
DarkTurquoise 		 "#00CED1"
DarkViolet 		 "#9400D3"
DeepPink 		 "#FF1493"
DeepSkyBlue 		 "#00BFFF"
DimGray 		 "#696969"
DimGrey 		 "#696969"
DodgerBlue 		 "#1E90FF"
FireBrick 		 "#B22222"
FloralWhite 		 "#FFFAF0"
ForestGreen 		 "#228B22"
Fuchsia 		 "#FF00FF"
Gainsboro 		 "#DCDCDC"
GhostWhite 		 "#F8F8FF"
Gold 		 "#FFD700"
GoldenRod 		 "#DAA520"
Gray 		 "#808080"
Grey 		 "#808080"
Green 		 "#008000"
GreenYellow 		 "#ADFF2F"
HoneyDew 		 "#F0FFF0"
HotPink 		 "#FF69B4"
IndianRed		 "#CD5C5C"
Indigo		 "#4B0082"
Ivory 		 "#FFFFF0"
Khaki 		 "#F0E68C"
Lavender 		 "#E6E6FA"
LavenderBlush 		 "#FFF0F5"
LawnGreen 		 "#7CFC00"
LemonChiffon 		 "#FFFACD"
LightBlue 		 "#ADD8E6"
LightCoral 		 "#F08080"
LightCyan 		 "#E0FFFF"
LightGoldenRodYellow 		 "#FAFAD2"
LightGray 		 "#D3D3D3"
LightGrey 		 "#D3D3D3"
LightGreen 		 "#90EE90"
LightPink 		 "#FFB6C1"
LightSalmon 		 "#FFA07A"
LightSeaGreen 		 "#20B2AA"
LightSkyBlue 		 "#87CEFA"
LightSlateGray 		 "#778899"
LightSlateGrey 		 "#778899"
LightSteelBlue 		 "#B0C4DE"
LightYellow 		 "#FFFFE0"
Lime 		 "#00FF00"
LimeGreen 		 "#32CD32"
Linen 		 "#FAF0E6"
Magenta 		 "#FF00FF"
Maroon 		 "#800000"
MediumAquaMarine 		 "#66CDAA"
MediumBlue 		 "#0000CD"
MediumOrchid 		 "#BA55D3"
MediumPurple 		 "#9370D8"
MediumSeaGreen 		 "#3CB371"
MediumSlateBlue 		 "#7B68EE"
MediumSpringGreen 		 "#00FA9A"
MediumTurquoise 		 "#48D1CC"
MediumVioletRed 		 "#C71585"
MidnightBlue 		 "#191970"
MintCream 		 "#F5FFFA"
MistyRose 		 "#FFE4E1"
Moccasin 		 "#FFE4B5"
NavajoWhite 		 "#FFDEAD"
Navy 		 "#000080"
OldLace 		 "#FDF5E6"
Olive 		 "#808000"
OliveDrab 		 "#6B8E23"
Orange 		 "#FFA500"
OrangeRed 		 "#FF4500"
Orchid 		 "#DA70D6"
PaleGoldenRod 		 "#EEE8AA"
PaleGreen 		 "#98FB98"
PaleTurquoise 		 "#AFEEEE"
PaleVioletRed 		 "#D87093"
PapayaWhip 		 "#FFEFD5"
PeachPuff 		 "#FFDAB9"
Peru 		 "#CD853F"
Pink 		 "#FFC0CB"
Plum 		 "#DDA0DD"
PowderBlue 		 "#B0E0E6"
Purple 		 "#800080"
Red 		 "#FF0000"
RosyBrown 		 "#BC8F8F"
RoyalBlue 		 "#4169E1"
SaddleBrown 		 "#8B4513"
Salmon 		 "#FA8072"
SandyBrown 		 "#F4A460"
SeaGreen 		 "#2E8B57"
SeaShell 		 "#FFF5EE"
Sienna 		 "#A0522D"
Silver 		 "#C0C0C0"
SkyBlue 		 "#87CEEB"
SlateBlue 		 "#6A5ACD"
SlateGray 		 "#708090"
SlateGrey 		 "#708090"
Snow 		 "#FFFAFA"
SpringGreen 		 "#00FF7F"
SteelBlue 		 "#4682B4"
Tan 		 "#D2B48C"
Teal 		 "#008080"
Thistle 		 "#D8BFD8"
Tomato 		 "#FF6347"
Turquoise 		 "#40E0D0"
Violet 		 "#EE82EE"
Wheat 		 "#F5DEB3"
White 		 "#FFFFFF"
WhiteSmoke 		 "#F5F5F5"
Yellow 		 "#FFFF00"


The font-family is a kind of value. The font-families are serif, sans-serif, cursive, symbol, or monospace. The font-family is usually sans-serif.

A type-face is a kind of value.  Some type-faces are defined by the table of type faces.

Table of type faces
type-face	font family		printed name (text)
Arial		font-family		"Arial"
Helvetica 		sans-serif		"Helvetica"
Arial Blac		sans-serif		"Arial Black"
Gadget 		sans-serif		"Gadget"
Comic Sans 	sans-serif		"Comic Sans"
Courier New 	sans-serif		"Courier New"
Georgia 		serif		"Georgia"
Impact 		sans-serif		"Impact"
Charcoal 		sans-serif		"Charcoal"
Lucida Console 	monospace		 "Lucida Console"
Lucida Sans Consol	sans-serif	 "Lucida Sans Console"
Lucida Grand		sans-serif 	"Lucida Grande"
Palatino Linotype	serif 		"Palatino Linotype"
 Book Antiqua 		serif		"Book Antiqua"
Palatino 		serif 		"Palatino"
Tahoma 		sans-serif		"Tahoma"
Geneva 		sans-serif		"Geneva"
Times Roman 	serif		"Times Roman"
TimesFont 	serif 		"Times"
Trebuchet M	sans-serif		"Trebuchet MS"
Verdana 		sans-serif		"Verdana"
MS Sans Serif 	sans-serif			"MS Sans Serif"
MS Serif 		serif 		"MS Serif"
New York 		serif		"New York"

A font-class is a kind of value. Some font-classes are defined by the table of font classes.

Table of font classes
font-class			typeface		printed name		size	font color	bold style	italic style	underline style	strikethrough style	subscript style		superscript style
default font class	Arial			"default font class"	0	Black	false	false	false	false	false	false
Green Normal		Arial			"green normal"		0	Green
Black Normal 		georgia		"black normal"
Purple Scribble		comic sans	"purple scribble"	0	Purple	false	false	true

To say (font - font-class):
   say "<font name='[printed name of typeface of font]' size='[size of font]' ";
   if Hex Color Values option is not active, say "color='[font color of font]'";
   if Hex Color Values option is active, say "color='[hex value of font color of font]'";
   if bold style of font is true, say " +b";
   if italic style of font is true, say " +i";
   if underline style of font is true, say " +u";
   if strikethrough style of font is true, say " +st";
   if subscript style of font is true, say " +sub";
   if superscript style of font is true, say " +sup";
   say ">";
   
To say end font:
   say "</font>".

[Use hex color values.]

The Font Library is a room. "There are fonts lying all over the place."

An egg is in the Font Library. "The [green normal]green[end font], jewel-encrusted egg gleams at you like a rare treasure."

A sign is in the Font Library. "The [black normal]sign[end font] is here."

A garden hose is in the Font Library. "The [purple scribble]purple garden hose[end font] is twisted about the lawn."

And…

I also change “name” to the standard “printed name”, and removed the family column from font class because it was redundant.

EDIT: moved Black to the first row of its table so Inform defaults to it rather than AliceBlue, as the example shows.

I just noticed I missed the bit about font size defaulting to 10. Set 10 to the size for “default font class” and then the say-phrase can just use the size corresponding to a font-class of the default font class if the passed-in class has a blank entry for its own size.

I guess that personally I’d prefer that the styles be output using span + class names rather than inline font styling. This has the advantage of allowing the author to change styles after the fact w/o having to rebuild the game (black & orange type for Halloween, green & red type for Christmas!). It also requires a bit less in-game processing, since you wouldn’t have to reassemble the string each time the font style is called for.

–Erik

The font tag has also been deprecated for the last 13 years.

That wasn’t intended to be a font tag. It’s just some way to transmit markup of some text from a game file to a client, which could be a browser or something else, but probably a browser.

David C.

I really dislike tables in I7 from an authorial perspective. I understand there is overhead with having a 150 extra objects, but the trade-off of clear, readable code is worth it.

David C.