---
name: "extract_font_range"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/extract_font_range"
---

# extract\_font\_range(3alleg)

Extracts a range of characters from a font. Allegro game programming library.

## NAME

extract\_font\_range - Extracts a range of characters from a font. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**FONT \*extract\_font\_range(FONT \*f, int begin, int end)**

## DESCRIPTION

This function extracts a character range from a font and returns a new font that contains only the range of characters selected by this function. You can pass -1 for either the lower or upper bound if you want to select all characters from the start or to the end of the font. Example:

```
   FONT *myfont;
   FONT *capitals;
   FONT *fontcopy;
   ...
   /* Create a font of only capital letters */
   capitals = extract_font_range(myfont, 'A', 'Z');
   /* Create a copy of the font */
   fontcopy = extract_font_range(myfont, -1, -1);
   ...
   destroy_font(capitals);
   destroy_font(fontcopy);
```

## RETURN VALUE

Returns a pointer to the new font or NULL on error. Remember that you are responsible for destroying the font when you are finished with it to avoid memory leaks.

## SEE ALSO

[**get\_font\_range\_begin**(3alleg)](/get_font_range_begin/3alleg.md), [**get\_font\_range\_end**(3alleg)](/get_font_range_end/3alleg.md), [**merge\_fonts**(3alleg)](/merge_fonts/3alleg.md), [**transpose\_font**(3alleg)](/transpose_font/3alleg.md), [**exfont**(3alleg)](/exfont/3alleg.md)
