---
name: "CL_Font_Description"
section: "3"
platform: "linux"
package: "clanlib0-common-dev"
version: "0.4.4-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/CL_Font_Description"
---

# CL\_Font\_Description(3)

Font provider interface.

## NAME

CL\_Font\_Description - Font provider interface.

## DESCRIPTION

The font description class is used by the font class to load the font.

Currently ClanLib support two types of fonts:

The old method.

You may find some 256 color indexed fonts with some of ClanLib's example applications. They use the three last colors in the palette to seperate the letters, break the line, and to determine the size of the font. The method is deprecated.

The new method.

The font description class constructs the font letters from an image with alpha values. Each letter is seperated with transparent lines and the font description class uses this information to determine where it so seperate the letters.

CL\_Font\_Description allows you to adjust how much transparent a line must be before it consideres it as a letter seperator line. The trans\_limit parameter handles this.

If your font is italic you can use the subtract\_width parameter to move the printed letters "closer to each other". This is, with a fine word, called the kerning of the font.

## CLASS MEMBERS

- std::vector\<CL\_SurfaceProvider\*\> **letter\_providers**

  - int **space\_len**

  - int **subtract\_width**

  - std::string **letters**

  - **CL\_Font\_Description**(

  ```
  CL_InputSource *input)
  ```

- **CL\_Font\_Description**(

  ```
   CL_SurfaceProvider *p,
  int x,
  int y,
  int *tcols,
  int num_tcols,
  int spacelen,
  int subtract_width,
  const char *letters)
  ```

- **CL\_Font\_Description**(

  ```
   CL_SurfaceProvider *source,
  float trans_limit,
  int space_len,
  int subtract_width,
  const char *letters)
  ```

## MEMBERS WITH DESCRIPTIONS

- std::vector\<CL\_SurfaceProvider\*\> **letter\_providers**

  ```
  Description:
  ```

- int **space\_len**

  ```
  Description:
  ```

- int **subtract\_width**

  ```
  Description:
  ```

- std::string **letters**

  ```
  Description:
  ```

- **CL\_Font\_Description**(

  ```
  CL_InputSource *input)
  ```

  ```
  Description:
  ```

  This constructor is used to load the font from an input source. Usually this from a resource datafile.

  Normally you do not use this constructor directly. It is much easier to use CL\_Font::load() when retrieving a font from a datafile.

- **CL\_Font\_Description**(

  ```
   CL_SurfaceProvider *p,
  int x,
  int y,
  int *tcols,
  int num_tcols,
  int spacelen,
  int subtract_width,
  const char *letters)
  ```

  ```
  Parameters:
  p - Image which contain the font letters.
  x - Start x coordinate on top-left most font letter.
  y - Start y coordinate on top-left most font letter.
  tcols - Array of colors to be transparent.
  num_tcols - Number of elements in the tcols array.
  spacelen - Pixel width of the space character.
  subtract_width - Width to subtract from each letter when drawing the font (aka. font kerning).
  letters - String containing all the letters listed in the image file. Must be ordered in the same way as in the image file.
  ```

  ```
  Description:
  ```

  This constructs a font description using the old font method. It is obsolete and only provided for backward compatibility. Please don't use it.

- **CL\_Font\_Description**(

  ```
   CL_SurfaceProvider *source,
  float trans_limit,
  int space_len,
  int subtract_width,
  const char *letters)
  ```

  ```
  Parameters:
  source - Image which contain the font letters.
  trans_limit - The maximum amount of alpha allowed before a pixel is no longer considered transparent.
  space_len - Pixel width of the space character.
  subtract_width - Width to subtract from each letter when drawing the font (aka. font kerning).
  letters - String containing all the letters listed in the image file. Must be ordered in the same way as in the image file.
  ```

  ```
  Description:
  ```

  This constructs a font description using the new alpha cutter method. Please have a look on the class overview reference page for more information.

## SEE ALSO

All ClanLib API classes can be found in **clanlib (3)**.

## AUTHORS

Originally written by Magnus Norddahl \<*mbn@dark.x.dtu.dk*\> and Martin Starch \<*starch@dark.x.dtu.dk*\>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at **http://somewhere.in.the.world.org**).

See **clanlib (3)** to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.
