Home
Categories
Dictionary
Download
Project Details
Changes Log
Who We Are
FAQ
License

Fonts



The "fonts" element in the XML graphics definition File regroup definition of fonts They will be used for all widgets which uses a font index. Each font has the following attributes:
  • "index": the index of the font which is the value which will represent the font in Definition files
  • "name" the name of the font which can also represent the font in DFs
There are several ways to define a Font:
  • without a font family
  • pointing to a system font family
  • pointing to a physical font file


In all of these cases, the font may have the following attributes:
  • "size": the font size (in points, ARINC units - 100th of mm - or pixels)
  • "italic": true if the font is in italic
  • "bold": true if the font is in bold
  • "fontPosition" to define on which line the characters baseline should be aligned

Font resolution

Without a font family

If no font family is specified, the default java font for the platform will be used. For example:
      <font name="t1" index="1" size="12" />

Pointing to a system font family

If a "fontpath" is specified with a "physicalName" attribute, a system font with the associated font family name will be retrieved. For example:
      <font name="t3" index="3" size="10" >
         <fontPath physicalName="Courier New"/>
      </font>

Pointing to a physical font file

If a "fontpath" is specified with a "path "attribute, the font will be retrieved from a font file. For example:
      <font name="F1" index="4" size="10" >
         <fontPath path="myFont.ttf"/>
      </font>
By default, a TrueType or OpenType font file is assumed, but you can also use a Type1 font file by specifying the "fontFormat" attribute. For example:
      <font name="F1" index="4" size="10" >
         <fontPath fontFormat="TYPE1" path="myFont.pfm"/>
      </font>

Font characteristics

Font size

A Font height is specified by its ascent and descent. The Font size as defined in typography is defined by the distance between the descender line and the ascender line in points (1/72th of inch):
  • The ascent represent the height of capital letters
  • The descent is the distance from the baseline to the line where some lowercase characters might extend (for example, the leg of a "p" character

font

The font size can be defined in:
  • points (1/72th of an inch): this is the default unit, used if you just specify a size, of it the "pt" tag is prsent after the size value. For example:
                <font name="t1" index="1" size="12" />
                <font name="t2" index="2" size="12pt" />
    
  • ARINC units (1/100th of mm): used if the "arinc" tag is present after the size value. For example:
                <font name="t1" index="1" size="1500arinc" />
    
  • pixels: used if the "px" tag is present after the size value. For example:
                <font name="t1" index="1" size="20px" />
    
In the default case (point size), the size is defined as in typography as the height between the descender line and the ascender line. I the pixels and arinc cases, the size is define as the height between the basline and the baseline.

Point Unit

The size of a Font is usually set in Points, one Point being equal to 1/72 of an Inch. However this specification of a Point assumes a monitor with 72 DPI, which is not always the case. The result is that the actual size of the Font may not be as expected, for fonts whose size has been specified as Points (the default one).

See https://doridori.github.io/Whats-the-Point-(in-fonts-sizing)/ for a detailed explanation about the possible differences depending on the Operating System.

Font position

The "fontPosition" attribute allows to specify how the font characters are aligned vertically.
  • "baseline": the reference of the characters position is the baseline
  • "descent" (the default): the reference of the characters position is the descender line
Note that by default the font characters are aligned on the descender line, which means that upper case characters won't be aligned on their bottom position. If you mostly deal with upper case characters, and you want to control precisely the height of the characters and their position, you should use the following options:
  • fontPosition = baseline so that upper case characters are algined on their bottom position
  • fontSize defined in ARINC Units so that the siez of the font precisely define the height of upper case characters

Example

   <fonts>
      <font index="30" name="default" />
      <font name="t1" index="1" size="12" />
      <font name="t2" index="2" size="14" />
      <font name="t3" index="3" size="10" >
         <fontPath physicalName="Courier New"/>
      </font>
      <font name="F1" index="4" size="10" >
         <fontPath path="myFont.ttf"/>
      </font>
   </fonts>

See also


Categories: client | conf | server | user

Copyright 2016-2017 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v2 licence