2.4 Data Structures

Some of the (informal) data structures used in Htmlfontify are detailed here:

hfy-style-assoc

An assoc representing/describing an Emacs face. Properties may be repeated, in which case later properties should be treated as if they were inherited from a “parent” font. (For some properties, only the first encountered value is of any importance, for others the values might be cumulative, and for others they might be cumulative in a complex way.)

Some examples:

(hfy-face-to-style 'default) =>

  (("background"      . "rgb(0, 0, 0)"      )
   ("color"           . "rgb(255, 255, 255)")
   ("font-style"      . "normal"            )
   ("font-weight"     . "500"               )
   ("font-stretch"    . "normal"            )
   ("font-family"     . "misc-fixed"        )
   ("font-size"       . "13pt"              )
   ("text-decoration" . "none"              ))

(hfy-face-to-style 'Info-title-3-face) =>

  (("font-weight"     . "700"        )
   ("font-family"     . "helv"       )
   ("font-size"       . "120%"       )
   ("text-decoration" . "none")      )
hfy-sheet-assoc

An assoc with elements of the form ‘(face-name style-name . style-string)’. The actual stylesheet for each page is derived from one of these.

((default       "default" . "{ background: black; color: white}")
 (font-lock-string-face "string"  . "{ color: rgb(64,224,208) }"))
hfy-facemap-assoc

An assoc of (point . face-symbol) or (point . defface attribute list) and (point . end) elements, in descending order of point value (i.e., from the file’s end to its beginning). The map is in reverse order because inserting a ‘<style>’ tag (or any other string) at point invalidates the map for all entries with a greater value of point. By traversing the map from greatest to least point, we still invalidate the map as we go, but only those points we have already dealt with (and therefore no longer care about) will be invalid at any time.

((64820 . end)
 (64744 . font-lock-comment-face)
 (64736 . end)
 (64722 . font-lock-string-face)
 (64630 . end)
 (64623 . font-lock-string-face)
 (64449 . end)
 ;; Big similar section elided.  You get the idea.
 (5459 . end)
 (5431 . (:inherit font-lock-keyword-face :background "7e7e7e"))
 (5431 . end)
 (4285 . font-lock-constant-face)
 (4285 . end)
 (4221 . font-lock-comment-face)
 (4221 . end)
 (4197 . font-lock-constant-face)
 (4197 . end)
 (1 . font-lock-comment-face))