﻿<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/xsl" href="../style/class_view.xsl"?>
<FontLab>
===============================================
  FontLab - class to represent FontLab program interface
===============================================
You can access members of this class using object 'fl'

<CONSTRUCTOR>
  There is no explicit constructor for this class, use pre-initialized object 'fl'
  Always use "from FL import all" at the beginning of your macro. <rm>Expanded description</rm>

</CONSTRUCTOR>
	<ATTRIBUTES>
  font(<cl>Font</cl>)              - read-only - currently active font
  ifont(integer)           - index of currently active font
  ifontslist(integer)      - index of currently selected font in the fonts list panel
  glyph(<cl>Glyph</cl>)            - read-only - currently active glyph in
                             Font, Glyph or Metrics windows
  iglyph(integer)          - index of currently active glyph
  tobject(integer)         - read-only - type of the currently selected object
                             in the Glyph Window
  iobject(integer)         - read-only - index of currently selected object in
                             the Glyph Window
  mainwindow(integer)      - read-only - reference to FontLab's main window
  path(string)             - read-only - full path to directory where running
                             application is located
  filename(string)         - read-only - application filename
  version(string)          - read-only - application version
  productnumber(integer)   - read-only - product number
  serialnumber(string)     - read-only - serial number as appears in the About window
  username(string)         - read-only - user name as appears in the About window
  count(integer)           - read-only - number of opened fonts (fast operation)
  count_selected(integer)  - read-only - number of the selected glyphs 
                             in the Font Window (fast operation)
  window(integer)          - reference to the currently active Glyph, 
                             Font or Metrics window
  delta(<cl>Point</cl>)             - delta value of current coordinate translation 
                             in the active Glyph Window
  scale(<cl>Point</cl>(float))      - scale value of current coordinate translation 
                             in the active Glyph Window
  tablet_active(boolean)   - True if tablet is present and active
  tablet_pressure(integer) - current tablet's pen pressure
  preview(string)          - contents of the preview panel <rm>not reported by docstring</rm>
  namfilename(string)      - filename of the default NAM file used to generate names or Unicodes 
                             <rm>new in v4.54 Mac/Win</rm>

</ATTRIBUTES>
	<OPERATIONS>
  len() - returns number of opened fonts
  [] - returns Font by index

</OPERATIONS>
	<METHODS>
  Close() | (fontindex)      - closes the current or 'fontindex' font
  Open(string filename) | (string filename, boolean addtolist)
                             - opens the font from file using current opening options.
                               If 'addtolist' is True, font is added to FontLab's font list

  Save(string filename) | (int fontindex, string filename)
                             - saves the current or selected font
                               using strandard FontLab's Save routine

  GetPathName() | (string title, string message) 
                        - displays a dialog box for selecting a folder name and returns 
                          a string with the selected path
                          <rm>new in v4.54 Mac/Win</rm>
  
  GetFileName() | (int open_save, string extension, string defaultfilename, string filter)
                        - displays a dialog box for selecting a file name and returns
                          a string with the selected path; 
                          open_save: 0 for Save As, 1 for Open; extension: an extension if 
                          the user enters a filename without one, e.g. "vfb"; 
                          defaultfilename <rm>Windows-only?</rm>: file name or path put by 
                          default in the File name textbox (possibly Windows-only); 
                          filter <rm>Windows-only?</rm>: filenames in the Files of Type/Save 
                          as Type combo box, use following format: 
                          "FontLab (*.vfb)|*.vfb|PostScript Type 1 (*.pfb)|"
                          <rm>new in v4.54 Mac/Win</rm>
  
  GenerateFont(fontType, filename)
                        - generates Font, available font types:
                          ftFONTLAB            - FontLab VFB font
                          ftTYPE1              - PC Type 1 font (binary/PFB)
                          ftTYPE1_MM           - PC MultipleMaster font (PFB)
                          ftTYPE1ASCII         - PC Type 1 font (ASCII/PFA)
                          ftTYPE1ASCII_MM      - PC MultipleMaster font (ASCII/PFA)
                          ftTRUETYPE           - PC TrueType/TT OpenType font (TTF)
                          ftOPENTYPE           - PS OpenType (CFF-based) font (OTF)
                          ftMACTYPE1           - Mac Type 1 font (generates suitcase 
                                                 and LWFN file, optionally AFM)
                          ftMACTRUETYPE        - Mac TrueType font (generates suitcase)
                          ftMACTRUETYPE_DFONT  - Mac TrueType font (generates suitcase with 
                                                 resources in data fork)
                          <rm>Since v4.52 Mac and v4.53 Win, this method is implemented 
                          in the FontLab class. In FontLab 4.5 and 4.51 for Mac, 
                          GenerateFont was a method of the <cl>Font</cl> class but 
                          that has been deprecated. </rm>    

  Add(<cl>Font</cl> font)             - adds 'font' to list of opened fonts and opens 
                               the Font Window for it
  UpdateFont() | (fontindex) - updates current font or 'fontindex' (slow operation)

  SetFontWindow(fontindex, Rect position, state)
                             - sets window size and style for Font Window
                               here font 'fontindex' is presented

  UpdateGlyph() | (glyphindex) - updates current or 'glyphindex' glyph of the current font
  EditGlyph() | (glyphindex) - opens the Glyph window for the 'glyphindex' glyph
                               in the current font

  CallCommand(commandcode)   - simulates the menu or toolbar command.
                               Check WS_* constants for list of available commands

  Selected() | (glyphindex)  - returns True if current glyph or 'glyphindex' glyph is selected

  Select(glyphid) | (glyphid, value)
                             - changes glyph's selection state.
                               'glyphid' may be string (glyph name),
                               Uni (Unicode index) or integer (glyph index)

  Unselect()                 - deselects all glyphs in the current font (fast operation)

  Message(string message, string question, string OKstring, string Cancelstring)
                             - shows the alert message dialog box,
                               all parameters but first can be omitted

  ScreenToGlyph(<cl>Point</cl> position) - converts screen coordinates to glyph
                               coordinates in the current Glyph Window
  GlyphToScreen(<cl>Point</cl> position) - converts glyph coordinates to screen
                               coordinates in the current Glyph Window
  UpdateRect(<cl>Rect</cl> r)         - updates rectangle in the current Glyph Window

  HitContour(<cl>Point</cl> p)        - contour hit detection in the current Glyph Window -
                               returns tuple of (nodeindex, nodesubindex, hit_time)

  GetCanvas()                - returns <cl>Canvas</cl> for the current Glyph Window
  GetConvert(<cl>Canvas</cl> c)       - copies conversion parameters from the current 
                               Glyph Window to the Canvas c

  BeginProgress(string title, counts)
                             - opens the Progress dialog box with. 'counts' - number of 'ticks'

  TickProgress(tick)         - updates the Progress bar,
                               returns False if Cancel button was pressed.
                               This is relatively 'expensive' operation

  EndProgress()              - closes the Progress dialog box

  Random(hivalue) | (lovalue, hivalue) - returns random value (fast operation)

  TransformGlyph(<cl>glyph</cl>, code, text)
                             - transforms the glyph using one of the Transform actions.
                               Save one of Transform Range programs for reference to
                               format of the command string

  ForSelected(string function_name)
                             - calls 'function_name' for each selected glyph in the current 
                               font. Function has following format:
                               function(<cl>Font</cl> font, <cl>Glyph</cl> glyph, glyphindex)

  SetUndo()                  - save current state to undo buffer
                               <rm>this method is not reported by the docstring</rm>
	</METHODS>
</FontLab>
