FontType

Backed enum for the font type accepted by Import::__construct.

Table of contents

Namespace: Com\Tecnick\Pdf\Font

enum FontType: string

Source: src/FontType.php:38

Backed enum for the font type accepted by Import::__construct. The backing value of each case is the canonical type name; the empty string selects autodetection.

Cases

  • Auto = '': Autodetect the font type from the file contents.
  • Core = 'Core': Adobe Font Metrics (one of the 14 Core fonts).
  • TrueType = 'TrueType': TrueType with a single-byte encoding.
  • TrueTypeUnicode = 'TrueTypeUnicode': TrueType with a Unicode encoding.
  • Type1 = 'Type1': Adobe Type 1.
  • Cid0Jp = 'CID0JP': CID-0 Japanese.
  • Cid0Kr = 'CID0KR': CID-0 Korean.
  • Cid0Cs = 'CID0CS': CID-0 Chinese Simplified.
  • Cid0Ct = 'CID0CT': CID-0 Chinese Traditional.

Methods

fromLoose()

Resolve a loose font type value to the matching enum case.

Accepts the canonical type name, the empty string for autodetection, or an enum instance, which is returned unchanged.

public static fromLoose(string|self $value): self

Parameters:

  • $value (string|self): Font type name or enum case.

Returns: self

Throws:

  • Exception: if the value does not match a known font type.

Source: src/FontType.php:77