NSX (QFont)

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
 
(41 intermediate revisions by one user not shown)
Line 1: Line 1:
= Introduction =
+
[[NSX|NSX scripts]] that holds parameters for [[NetherMenu]] font draw module.
  
.QFONT files are [[NSX|.NSX scripts]] that holds parameters for [[NetherMenu]] font draw module.
+
Example QFONT file:
 
+
Example of .QFONT file contents:
+
  
 
  ''[qfont]''
 
  ''[qfont]''
Line 19: Line 17:
 
  r_shadowofs=0 0.5 0.5
 
  r_shadowofs=0 0.5 0.5
  
= Structure =
+
== Structure ==
  
== [qfont] group ==
+
{| border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse; width:100%"
 
+
! width=6% | Key pair
Should be the first groups of file, it sets font drawer and face group.
+
! width=83% | Description
 
+
|-
==== type ''x'' ====
+
| '''[qfont]'''
Type of font drawer, each of it has it's advantages and disadvantages:
+
| Should be the first groups of file.
 +
|-
 +
|'''type'''=''x''
 +
|Type of font drawer, each of it has it's advantages and disadvantages:
  
 
Possible values:
 
Possible values:
* ''ft'' - Darkplaces vector fonts using freetype library
+
* FT - Darkplaces vector fonts using freetype library
* ''ascii'' - Quake ascii conchars (256 chars on a 16*16 table)
+
* ASCII - Quake ascii conchars (256 chars on a 16*16 table)
* ''glyph'' - QuakeC glyph font renderer (each char is separatepic).
+
* GLYPH - QuakeC glyph font renderer (each char is separate picture)
 +
|-
 +
|'''face'''=''string''
 +
|Font face. For freetype and glyph font renderers this is name of group. For Ascii it's a path to conchars texture.
 +
|-
 +
|'''brightness'''=''value''
 +
|Floating point value of brightness scale. 1 is nothing, 0.1 is 10% etc.
 +
|-
 +
|'''scale'''=''x'' ''y''
 +
|Two floating point values storing horizontal and vertical scale of font chars.
 +
|-
 +
|'''width'''=''x''
 +
|X component of scale.
 +
|-
 +
|'''height'''=''y''
 +
|Y component of scale.
 +
|-
 +
|'''respath'''=''path''
 +
|Path to font resources. Could be relative (if begins with ./) or absolute (from gamedir). Default is subfolder named as font file (i.e if font file is gfx/myfont.qfont, it's default resources directory will be ''gfx/myfont/'').
 +
|}
  
==== face ''path'' ====
+
{{hidden begin | Freetype font face group }}
Path to the font face group.
+
  
==== brightness ''x'' ====
+
Attributes of font face for freetype font renderer.
  
Floating point value of brightness scale. 1 is nothing, 0.1 is 10% etc.
+
{| border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse; width:100%"
 
+
! width=6% | Key pair
Applies to all renderer types.
+
! width=83% | Description
 
+
|-
==== scale ''x'' ''y'' ====
+
|'''file'''=''path''
 
+
|Path to .OTF/.TTF font file. Could be relative to respath (if begins with ./) or absolute (from gamedir root).
Two floating point values storing horizontal and vertical scale of font chars.
+
|-
 
+
|'''slot'''=''slotname''
Applies to all renderer types.
+
|Engine font slot. Used to replace fontmaps that was already initialized.
 
+
==== width ''x'' ====
+
 
+
X component of scale.
+
 
+
==== height ''y'' ====
+
 
+
Y component of scale.
+
 
+
==== respath ''path'' ====
+
 
+
Path to font resources. Default path is sub-folder named as qfont file without extension.
+
 
+
== face group for freetype font ==
+
 
+
==== sizes "size1 size2 size3..." ====
+
 
+
Which glyph sizes to render (for different size fonts).
+
 
+
Default value is "16 24".
+
 
+
==== slot "x" ====
+
 
+
Engine font slot. Used to replace fontmaps that was already initialized.
+
  
 
Darkplaces engine have this fixed slots: default, console, sbar, notify, chat, centerprint, infobar,  menu, user0, user1, user2, user3, user4, user5, user6, user7.
 
Darkplaces engine have this fixed slots: default, console, sbar, notify, chat, centerprint, infobar,  menu, user0, user1, user2, user3, user4, user5, user6, user7.
 +
|-
 +
|'''glyphs'''=''string''
 +
|Engine font slot. Used to replace fontmaps that was already initialized.
  
==== glyphs "string" ====
+
Engine will render font pages containing this string chars (others will be rendered on demand).
 +
|-
 +
|'''r_antialias'''=''0/1''
 +
|Toggles antialiasing for font pages renderer.
 +
|-
 +
|'''r_hinting'''=''0/1/2/3''
 +
|Toggles hinting for font pages renderer. 0 - no hinting, 1 - light autohintinh, 2 - full autohinting, 3 - full hinting.
 +
|-
 +
|'''r_shadow'''=''strength''
 +
|Outline shadow strength (could be more than 1).
 +
|-
 +
|'''r_shadowblur'''=''strength''
 +
|Outline shadow blur.
 +
|-
 +
|'''r_shadowofs'''=''x y z''
 +
|Outline shadow offset. X and Y applied during rendering. Z is applied during blur.
 +
|-
 +
|'''r_charcushion'''=''x''
 +
|Characters vertical offset in percents (1 - 100%, 0.1 - 10%).
 +
|-
 +
|'''r_charscale'''=''x''
 +
|Characters uniform scale.
 +
|}
 +
{{hidden end}}
  
Engine will render font pages containing this string chars.
+
{{hidden begin | Glyph font face group }}
  
==== r_antialias "0/1" ====
+
Attributes of font face for glyph font renderer.
  
Toggles antialiasing for font pages renderer.
+
{| border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse; width:100%"
 +
! width=6% | Key pair
 +
! width=83% | Description
 +
|-
 +
|'''respath'''=''path''
 +
|Absolute path that overrides default font resources path.
 +
|-
 +
|'''glyph'''=''variable''
 +
|Value is a string of: ''picture'' kern ''left'' ''right'' '''codes''' ''code1'' ''code2'' ''codeX''. Kern parmeter is optional. One pic may have many ASCII codes.
 +
|}
 +
{{hidden end}}
  
==== r_hinting "0/1" ====
+
[[Category:File formats]]
  
Toggles hinting for font pages renderer. 0 - no hinting, 1 - light autohintinh, 2 - full autohinting, 3 - full hinting.
+
__NOTOC__
 
+
 
+
+
if (key == "r_antialias")  { r_antialias = stof(val); continue; }
+
if (key == "r_hinting")    { r_hinting = stof(val); continue; }
+
if (key == "r_shadow")    { r_outline = stof(val); continue; }
+
if (key == "r_shadowblur") { r_outlineblur = stof(val); continue; }
+
if (key == "r_shadowofs")  { r_outlineofs = stov(val); continue; }
+
if (key == "r_charcushion"){ r_charcushion = stof(val); continue; }
+
if (key == "r_charscale")  { r_charscale = stof(val); continue; }
+
 
+
[[Category:File formats]]
+

Latest revision as of 01:57, 18 July 2012

NSX scripts that holds parameters for NetherMenu font draw module.

Example QFONT file:

[qfont]
type=FT
face=default
brightness=0.8
width=1.2

[default]
file=./big.ttf
sizes=38
glyphs=abcdefghijklmnopqrttuvwxyz0123456789
r_shadow=0.8
r_shadowblur=1
r_shadowofs=0 0.5 0.5

[edit] Structure

Key pair Description
[qfont] Should be the first groups of file.
type=x Type of font drawer, each of it has it's advantages and disadvantages:

Possible values:

  • FT - Darkplaces vector fonts using freetype library
  • ASCII - Quake ascii conchars (256 chars on a 16*16 table)
  • GLYPH - QuakeC glyph font renderer (each char is separate picture)
face=string Font face. For freetype and glyph font renderers this is name of group. For Ascii it's a path to conchars texture.
brightness=value Floating point value of brightness scale. 1 is nothing, 0.1 is 10% etc.
scale=x y Two floating point values storing horizontal and vertical scale of font chars.
width=x X component of scale.
height=y Y component of scale.
respath=path Path to font resources. Could be relative (if begins with ./) or absolute (from gamedir). Default is subfolder named as font file (i.e if font file is gfx/myfont.qfont, it's default resources directory will be gfx/myfont/).
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox