EDF font reference: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
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''
   defaultcolor  ''color''
   blockcentered  ''boolean''
   normalcolor    ''color''
   patchnumoffset ''integer''
   highlightcolor ''color''
  errorcolor    ''color''
   colortables    ''table''
  }
  }


Font names have maximum 128 characters.
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 <code>font</code>, and ''fields'' are the same fields as in a <code>font</code>'s definition. Only include the fields you intend to modify over the original font.


==Properties==
==Properties==
Line 26: Line 48:
!Key
!Key
!Description
!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.
||'''start'''||First character in font. Can be either a character or an ASCII number.
Line 32: Line 56:
|-
|-
||'''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 38: Line 64:
|-
|-
||'''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 45: Line 79:
||'''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'''.
|-
||'''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.
|-
||'''defaultcolor'''||Default font color. See the color keywords section in this page for details.
|-
||'''normalcolor'''||Normal font color. See the color keywords section in this page for details.
|-
||'''highlightcolor'''||Highlight font color. See the color keywords section in this page for details.
|-
||'''errorcolor'''||Error font color. See the color keywords section in this page for details.
|-
|-
||'''usespacesize'''||Whether to use '''spacesize''' distance for space size, instead of the character graphics.
||'''colortables'''||This is a block looking like this:
{
    ''color_name'' ''translation_list''
    ''color_name'' ''translation_list''
    ...
}
Each ''color_name'' is one of the color names specified in the "color names" section of this page. ''Translation_list'' can either be <code>@identity</code>, in which case it performs no translation, or a comma-separated list of <code>''n1'':''n2''=''n3'':''n4''</code> pairs, or <code>''n1''=''n3''</code> pairs, which set what palette colors (or ranges thereof) to change to what.
|}
|}
''To be continued.''
==Color names==
The color fields allow one the following values: brick, tan, gray, green, brown, gold, red, blue, orange, yellow, custom1, custom2, custom3, custom4.
 
[[Category:EDF]]

Latest revision as of 14:42, 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

  defaultcolor   color
  normalcolor    color
  highlightcolor color
  errorcolor     color
  colortables    table
}

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[edit]

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.

defaultcolor Default font color. See the color keywords section in this page for details.
normalcolor Normal font color. See the color keywords section in this page for details.
highlightcolor Highlight font color. See the color keywords section in this page for details.
errorcolor Error font color. See the color keywords section in this page for details.
colortables This is a block looking like this:
{
   color_name translation_list
   color_name translation_list
   ...
}

Each color_name is one of the color names specified in the "color names" section of this page. Translation_list can either be @identity, in which case it performs no translation, or a comma-separated list of n1:n2=n3:n4 pairs, or n1=n3 pairs, which set what palette colors (or ranges thereof) to change to what.

Color names[edit]

The color fields allow one the following values: brick, tan, gray, green, brown, gold, red, blue, orange, yellow, custom1, custom2, custom3, custom4.