Font::TTF::Utils(3) User Contributed Perl Documentation Font::TTF::Utils(3)

# [NAME](#NAME)

Font::TTF::Utils - Utility functions to save fingers

# [DESCRIPTION](#DESCRIPTION)

Lots of useful functions to save my fingers, especially for trivial tables

# [FUNCTIONS](#FUNCTIONS)

The following functions are exported

## [($val, $pos) = TTF\_Init\_Fields ($str, $pos)](#%28$val,_$pos%29_=_TTF_Init_Fields_%28$str,_$pos%29)

Given a field description from the "DATA" section, creates an absolute entry in the fields associative array for the class

## [TTF\_Read\_Fields($obj, $dat, $fields)](#TTF_Read_Fields%28$obj,_$dat,_$fields%29)

Given a block of data large enough to account for all the fields in a table, processes the data block to convert to the values in the objects instance variables by name based on the list in the "DATA" block which has been run through "TTF\_Init\_Fields"

## [TTF\_Unpack($fmt, $dat)](#TTF_Unpack%28$fmt,_$dat%29)

A TrueType types equivalent of Perls "unpack" function. Thus $fmt consists of type followed by an optional number of elements to read including \*. The type may be one of:

```
    c       BYTE
    C       CHAR
    f       FIXED
    F       F2DOT14
    l       LONG
    L       ULONG
    s       SHORT
    S       USHORT
    v       Version number (FIXED)
```

Note that "FUNIT", "FWORD" and "UFWORD" are not data types but units.

Returns array of scalar (first element) depending on context

## [$dat = TTF\_Out\_Fields($obj, $fields, $len)](#$dat_=_TTF_Out_Fields%28$obj,_$fields,_$len%29)

Given the fields table from "TTF\_Init\_Fields" writes out the instance variables from the object to the filehandle in TTF binary form.

## [$dat = TTF\_Pack($fmt, @data)](#$dat_=_TTF_Pack%28$fmt,_@data%29)

The TrueType equivalent to Perl's "pack" function. See details of "TTF\_Unpack" for how to work the $fmt string.

## [($num, $range, $select, $shift) = TTF\_bininfo($num)](#%28$num,_$range,_$select,_$shift%29_=_TTF_bininfo%28$num%29)

Calculates binary search information from a number of elements

## [TTF\_word\_utf8($str)](#TTF_word_utf8%28$str%29)

Returns the UTF8 form of the 16 bit string, assumed to be in big endian order, including surrogate handling

## [TTF\_utf8\_word($str)](#TTF_utf8_word%28$str%29)

Returns the 16-bit form in big endian order of the UTF 8 string, including surrogate handling to Unicode.

## [XML\_hexdump($context, $dat)](#XML_hexdump%28$context,_$dat%29)

Dumps out the given data as a sequence of &lt;data&gt; blocks each 16 bytes wide

## [XML\_outhints](#XML_outhints)

Converts a binary string of hinting code into a textual representation

## [make\_circle($f, $cmap, \[$dia, $sb, $opts\])](#make_circle%28$f,_$cmap,__$dia,_$sb,_$opts_%29)

Adds a dotted circle to a font. This function is very configurable. The parameters passed in are:

$f

Font to work with. This is required.

$cmap

A cmap table (not the 'val' sub-element of a cmap) to add the glyph too. Optional.

$dia

Optional diameter for the main circle. Defaults to 80% em

$sb

Side bearing. The left and right side-bearings are always the same. This value defaults to 10% em.

There are various options to control all sorts of interesting aspects of the circle

[numDots](#numDots)

Number of dots in the circle

[numPoints](#numPoints)

Number of curve points to use to create each dot

[uid](#uid)

Unicode reference to store this glyph under in the cmap. Defaults to 0x25CC

[pname](#pname)

Postscript name to give the glyph. Defaults to uni25CC.

[-dRadius](#dRadius)

Radius of each dot.

# [BUGS](#BUGS)

No known bugs

# [AUTHOR](#AUTHOR)

Martin Hosken &lt;http://scripts.sil.org/FontUtils&gt;.

# [LICENSING](#LICENSING)

Copyright (c) 1998-2016, SIL International (http://www.sil.org)

This module is released under the terms of the Artistic License 2.0. For details, see the full text of the license in the file LICENSE.

2026-09-25 perl v5.44.0

---

Document: Font::TTF::Utils(3pm) from perl-font-ttf 1.06-r0 (Chainguard OS)
