====== fonts.js ======

The Fonts JavaScript library ([[https://gitlab.synchro.net/main/sbbs/-/blob/master/exec/load/fonts.js?ref_type=heads|fonts.js]]) parses the ''[[dir:ctrl]]/[[config:fonts.ini]]'' file and loads and/or activates one or more fonts into the user's terminal (e.g. [[http://syncterm.net|SyncTERM]]) applicable to the specified font names or sections, passed as arguments.

Example:

<code javascript>
load("fonts.js", "default");
</code>

The ''[[dir:exec]]/loadfonts.js'' script will execute ''fonts.js'' and have it load the specified fonts from the relevant ''preload'' and ''default'' sections, if present in the ''fonts.ini'' file. The purpose of the ''loadfonts.js'' script is to load and possibly activate these fonts before displaying any answer/login files, if desired, by using adding ''@EXEC:LOADFONTS@'' to one of the early display files (e.g. ''[[dir:text]]/answer.msg'') so the fonts may be used in that file or any other files displayed before user logon. 

The stock [[module:logon]] module also invokes the ''fonts.js'' library, loading the same ''preload'' and ''default'' font sets (if not already loaded) during the logon process.

The [[module:xtrn_sec]] module uses ''fonts.js'' to load custom per-door fonts, if so-configured and applicable to the user's terminal, and then revert back to the ''default'' fonts upon returning from such doors.

===== See Also =====
  * [[:custom:javascript:lib:|JavaScript Libraries]]
  * [[:module:Logon]] module
  * [[:module:xtrn_sec|External Program Section module]]
  * [[:config:fonts.ini]]

{{tag>javascript fonts}}
