EDF font reference: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 4: Line 4:
  {
  {
   id            ''number''
   id            ''number''
   start          ''text''
 
   end            ''text''
   start          ''character''
   end            ''character''
 
   linesize      ''number''
   linesize      ''number''
  usespacesize  ''true/false''
   spacesize      ''number''
   spacesize      ''number''
   widthdelta    ''number''
   widthdelta    ''number''
   tallestchar    ''number''
   tallestchar    ''number''
  blockcentered  ''true/false''
   centerwidth    ''number''
   centerwidth    ''number''
 
   linearformat  ''text''
   linearformat  ''text''
   linearlump    ''identifier''
   linearlump    ''identifier''
  requantize    ''true/false''
  colorable      ''true/false''
  uppercase      ''true/false''
  patchnumoffset ''integer''
   filter        ''block''
   filter        ''block''
  colorable      ''boolean''
 
  uppercase      ''boolean''
  blockcentered  ''boolean''
  patchnumoffset ''integer''
  }
  }


Line 44: Line 51:
|-
|-
||'''linesize'''||Text line height.
||'''linesize'''||Text line height.
|-
||'''usespacesize'''||Whether to use '''spacesize''' distance for space size, instead of the character graphics.
|-
|-
||'''spacesize'''||Width of space character, if '''usespacesize''' is '''true'''.
||'''spacesize'''||Width of space character, if '''usespacesize''' is '''true'''.
Line 50: Line 59:
|-
|-
||'''tallestchar'''||Absolute height: the height of the tallest font character.
||'''tallestchar'''||Absolute height: the height of the tallest font character.
|-
||'''blockcentered'''||Whether characters are centered in position.
|-
|-
||'''centerwidth'''||Centered width, constant width, used only when '''blockcentered''' is on.
||'''centerwidth'''||Centered width, constant width, used only when '''blockcentered''' is on.
|-
||'''linearformat'''||Unused. Now the format is determined from the content of the '''linearlump'''
|-
||'''linearlump'''||Name of graphics lump which contains all characters. It can be a raw format or a Doom GFX format.
|-
||'''requantize'''||In case of PNG lump, requantize to the palette.
|-
|-
||'''colorable'''||Whether font color can be changed.
||'''colorable'''||Whether font color can be changed.
Line 57: Line 74:
||'''uppercase'''||Whether font uses uppercase only.
||'''uppercase'''||Whether font uses uppercase only.
|-
|-
||'''blockcentered'''||Whether characters are centered in position.
||'''patchnumoffset'''||An optional value to subtract from a character's ASCII value to determine the name that gets into the lump name. Applies only with '''filter''', not '''linearlump'''.
|-
|-
||'''usespacesize'''||Whether to use '''spacesize''' distance for space size, instead of the character graphics.
||'''filter'''||If not using a '''linearlump''', one or more of this field is required. A '''filter''' is a section which can look like this:
filter { chars { ''list_of_characters'' }; mask ''format'' }
or
filter { start ''character''; end ''character''; mask ''format'' }
depending on whether you want to filter for specific characters, or for a range. For the <code>chars</code> list, you put the components with commas (<code>,</code>) in-between. Each character can be expressed as a literal one, or as an ASCII value.
 
<code>mask</code> is the name of the lump, with placeholder for the given character. Each placeholder can look like the following:
*<code>%.3d</code>: ASCII number padded by up to three zeros. You can put other values instead of 3.
*<code>%c</code>: the character itself.
*<code>%i</code>: ASCII number, not padded.
*<code>%02X</code>: ASCII number encoded in hexadecimal (base 16 number, with A, B, C, D, E, F representing 10-15). This one is padded with up to two zeros. You can put other values instead of 2.
You can also choose not to put any placeholder if you have an exact lump name.
 
Beware of '''patchnumoffset'''. If set, then you need to subtract it from the real ASCII value, to get the value in the lump name.
 
|}
|}
''To be continued.''
''To be continued.''

Revision as of 14:27, 15 November 2024

The font is defined in EDF as follows:

font name
{
  id             number
 
  start          character
  end            character
 
  linesize       number
  usespacesize   true/false
  spacesize      number
  widthdelta     number
  tallestchar    number
  blockcentered  true/false
  centerwidth    number
 
  linearformat   text
  linearlump     identifier
  requantize     true/false
  colorable      true/false
  uppercase      true/false

  patchnumoffset integer
  filter         block
}

Font names have maximum 128 characters.

A font delta structure is available, allowing you to modify an already defined font. Its definition is:

fontdelta
{
  name font_name
  fields
}

where font_name is the name of a previously fully defined font, and fields are the same fields as in a font's definition. Only include the fields you intend to modify over the original font.

Properties

Key Description
id Currently unused, it was needed for the now-disabled Small scripting system.
start First character in font. Can be either a character or an ASCII number.
end Last character in font. Can be either a character or an ASCII number.
linesize Text line height.
usespacesize Whether to use spacesize distance for space size, instead of the character graphics.
spacesize Width of space character, if usespacesize is true.
widthdelta Width delta: how much to reduce the width of each character.
tallestchar Absolute height: the height of the tallest font character.
blockcentered Whether characters are centered in position.
centerwidth Centered width, constant width, used only when blockcentered is on.
linearformat Unused. Now the format is determined from the content of the linearlump
linearlump Name of graphics lump which contains all characters. It can be a raw format or a Doom GFX format.
requantize In case of PNG lump, requantize to the palette.
colorable Whether font color can be changed.
uppercase Whether font uses uppercase only.
patchnumoffset An optional value to subtract from a character's ASCII value to determine the name that gets into the lump name. Applies only with filter, not linearlump.
filter If not using a linearlump, one or more of this field is required. A filter is a section which can look like this:
filter { chars { list_of_characters }; mask format }

or

filter { start character; end character; mask format }

depending on whether you want to filter for specific characters, or for a range. For the chars list, you put the components with commas (,) in-between. Each character can be expressed as a literal one, or as an ASCII value.

mask is the name of the lump, with placeholder for the given character. Each placeholder can look like the following:

  • %.3d: ASCII number padded by up to three zeros. You can put other values instead of 3.
  • %c: the character itself.
  • %i: ASCII number, not padded.
  • %02X: ASCII number encoded in hexadecimal (base 16 number, with A, B, C, D, E, F representing 10-15). This one is padded with up to two zeros. You can put other values instead of 2.

You can also choose not to put any placeholder if you have an exact lump name.

Beware of patchnumoffset. If set, then you need to subtract it from the real ASCII value, to get the value in the lump name.

To be continued.