FontTools.init

Syntax

init(value: PP.Font, _reInit: Boolean);

Parameters

value. Font settings.

_reInit. If the value is True, refresh is executed, event if the set font and the font to be set match.

Description

The init method determines font settings.

Comments

The method is identical to the FontTools.setFont method.

Example

To execute the example it is necessary that the <head> tag of HTML page contains links to PP.js script files, to PP.css styles file and resources file (for example, resources.ru.js), in the <body> tag of HTML page of the <div> item with the Panel identifier and the example must be placed in the <script> tag.

// Create panel container
var container = new PP.Ui.GridPanel({ 
  ParentNode: document.getElementById("Panel") }
);
// Create panel
var fontTools = new PP.Ui.FontTools({
  FamilyVisible: true,
  FamilyLabelVisible: false,
  Font: new PP.Font({ FontFamily: 'Arial', Size: 8, SizeUnits: PP.SizeUnits.Pt }),
});
// Add panel to container
container.add(fontTools);
// Set other font size
fontTools.init(new PP.Font({ FontFamily: 'Arial', Size: 12, SizeUnits: PP.SizeUnits.Pt }));
// Add event handler
fontTools.PropertyChanged.add(function(sender, args){
console.log(args.Font);
});

After executing the example a font setup panel is created. On manual changing of font parameters the console displays information about new font.

See also:

FontTools