@addFontControls(ID, [PARAMS], [FITMODE], [FILENAMETITLE])

Add a font control panel to a block element.

The following parameters are recognized:

ID

The ID of a existing block entity (div, pre, p, ...).

[PARAMS]

Optional JavaScript object of parameter "tweaks". See the FontControl.createParams() method for a list of all available settings (you can specify any subset of these values.

[FITMODE]

Optional screen fit mode. Defaults to: 'full'. This parameter can be set to 'fit' or 'full'.

[FILENAMETITLE]

File name and PDF title for this command (optional).

This macro is used to add the "font control" panel to and block element within the document. Review the code of the FontControl.createParams() method in "include/javascript/FontControl.js" for information about the various parameters one may pass (and look at the example below).

Example of using the macro:

<div @htmlAttr("id","longBlock")>
<h2>We can put multiple things inside.</h2>

<p>The following lists some different ways font styles
can be specified, and one can observe how they are affected:</p>

<ul>
  <li><span @htmlAttr("style","font-size: 120%;")>font-size: 120%;</span></li>
  <li><span @htmlAttr("style","font-size: small;")>font-size: small;</span></li>
  <li><span @htmlAttr("style","font-size: 14pt;")>font-size: 14pt;</span></li>
  <li><span @htmlAttr("style","font-size: 14px;")>font-size: 14px;</span></li>
  <li><span @htmlAttr("style","font-size: 2em;")>font-size: 2em;</span></li>
  <li><span @htmlAttr("style","font-size: .25in;")>font-size: .25in;</span></li>
</div>
@addFontControls("longBlock")

<!-- Example of passing parameters. -->
<pre id="codeListing" class="programListing" style="margin: 0px, padding: 4px;">

NstDom.getScrollBarWidth = function() {

  // Only compute one time
  if (this._ScrollBarWidthComputed) {
    if (NstDom.debugLevel(8, true)) {
      NstConsole.echo("Estimated Scrollbar Width: " + this._ScrollBarWidth);
    }
    return this._ScrollBarWidth;
  }

  // pseudo code below - real code is in "include/javascript/core.js"
  this._ScrollBarWidthComputed = true;
  this._ScrollBarWidth = 27;
  return this._ScrollBarWidth;
}

</pre>
@addFontControl("codeListing","")

Assuming the com.ccg.macros.at.All class is within your CLASSPATH and the config/html.at macros file has been generated (Hint: run make atmacros in the wui directory), a developer should be able to run the above example by copy/pasting from below:

[root@probe root]# java com.ccg.macros.at.All <<EOF
@include("config/html.at",,"d")

<div @htmlAttr("id","longBlock")>
<h2>We can put multiple things inside.</h2>

<p>The following lists some different ways font styles
can be specified, and one can observe how they are affected:</p>

<ul>
  <li><span @htmlAttr("style","font-size: 120%;")>font-size: 120%;</span></li>
  <li><span @htmlAttr("style","font-size: small;")>font-size: small;</span></li>
  <li><span @htmlAttr("style","font-size: 14pt;")>font-size: 14pt;</span></li>
  <li><span @htmlAttr("style","font-size: 14px;")>font-size: 14px;</span></li>
  <li><span @htmlAttr("style","font-size: 2em;")>font-size: 2em;</span></li>
  <li><span @htmlAttr("style","font-size: .25in;")>font-size: .25in;</span></li>
</div>
@addFontControls("longBlock")

<!-- Example of passing parameters. -->
<pre id="codeListing" class="programListing" style="margin: 0px, padding: 4px;">

NstDom.getScrollBarWidth = function() {

  // Only compute one time
  if (this._ScrollBarWidthComputed) {
    if (NstDom.debugLevel(8, true)) {
      NstConsole.echo("Estimated Scrollbar Width: " + this._ScrollBarWidth);
    }
    return this._ScrollBarWidth;
  }

  // pseudo code below - real code is in "include/javascript/core.js"
  this._ScrollBarWidthComputed = true;
  this._ScrollBarWidth = 27;
  return this._ScrollBarWidth;
}

</pre>
@addFontControl("codeListing","")

EOF

This macro is defined as:

@javascriptBegin()
  new FontControl(document.getElementById('@param(0)'), @fnb("@param(1)","{
      buttons: FontControl.ALL_BUTTONS | FontControl.VIEW_BUTTON | FontControl.DOWNLOAD_BUTTON | FontControl.COPY_CONTENTS_BUTTON,
      scrollBottom: false,
      fileNamePrefix: @ifEqual("@param(3)","","'command'","'@param(3)'"),
      initMode: '@fnb("@param(2)","full")'
    }"));
@javascriptEnd()