---
name: "PDF::Builder::Resource::CIDFont"
section: "3pm"
platform: "linux"
package: "perl-pdf-builder"
version: "3.028-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/PDF::Builder::Resource::CIDFont"
---

# PDF::Builder::Resource::CIDFont(3pm)

Base class for CID fonts Inherits from PDF::Builder::Resource::BaseFont

## NAME

PDF::Builder::Resource::CIDFont - Base class for CID fonts

Inherits from PDF::Builder::Resource::BaseFont

## METHODS

### new

```
    $font = PDF::Builder::Resource::CIDFont->new($pdf, $name)
```

Returns a cid-font object, base class for all CID-based fonts.

### glyphByCId

```
    $n = $font->glyphByCId($gid)
```

Returns a character's glyph name (string), given its glyph ID.

### uniByCId

```
    $u = $font->uniByCId($gid)
```

Returns a character's Unicode point, given its glyph ID. If no match, return U+0000.

### cidByUni

```
    $c = $font->cidByUni($uid)
```

Returns a glyph ID, given its Unicode point.

### cidByEnc

```
    $c = $font->cidByEnc($char)
```

Returns a character's glyph ID, given its encoding (single byte value 0 to 255).

### wxByCId

```
    $w = $font->wxByCId($gid)
```

Returns a character's width, given its glyph ID. Typically this is based on a 1000 unit wide grid.

### wxByUni

```
    $w = $font->wxByUni($uid)
```

Returns a character's width, given its Unicode point. Typically this is based on a 1000 unit wide grid.

### wxByEnc

```
    $w = $font->wxByEnc($enc)
```

Returns a character's width, given its encoding (a single byte character in the range 0 to 255). Typically this is based on a 1000 unit wide grid.

### width

```
    $w = $font->width($string)
```

Returns a string's width. This is typically based on a 1000 wide grid for each glyph.

### width\_cid

```
    $w = $font->width_cid($gid)
```

Returns a character's width, given its glyph ID. This is typically based on a 1000 wide grid for a glyph.

### cidsByStr

```
    $cidstring = $font->cidsByStr($string)
```

Returns the cid-string (as a single text string, not an array) from string,  based on the font's encoding map.

### cidsByUtf

```
    $cidstring = $font->cidsByUtf($utf8string)
```

Returns the CID-encoded string (a text string, not an array) from utf8-string.

### textByStr

```
    $cid_string = $font->textByStr($text)
```

Returns a cid text string, given a text string.

### textByStrKern

```
    $cid_string = $font->textByStrKern($text, $size, $indent)
```

Returns a cid string, given character text, size, and indentation.

### text

```
    $stream_str = $font->text($text, $size, $indent)
```

Returns a PDF text stream-ready code block to output the given text.

### text\_cid

```
    $stream_str = $font->text_cid($text, $size)
```

Returns a PDF text stream-ready output using glyph IDs, given input text and  size.

### text\_cid\_kern

```
    $font->text_cid_kern($text, $size, $indent)
```

Returns a PDF output-ready stream command using glyph IDs, given text, size,  and indentation.

### encodeByName

```
    $font = $font->encodeByName($enc)
```

Returns updated `$font` object, given an input encoding.

### glyphNum

```
    $g_or_w = $font->glyphNum()
```

If 'glyphs' table is defined for a font, return its size; otherwise, return the 'wx' widths table size.
