embedFont

embedFont

ADVANCED / PREMIUM TRIAL

Embeds a TTF font in a Word document.

Description
public embedFont (string $fontSource, string $fontName, [array $options])
Parameters

fontSource

TTF font path.

fontName

Font name.

options

The possible keys and values of this array are:

Key Type Description
charset string 00 as default.
styleEmbedding string Regular (default), Bold, Italic, BoldItalic.
Exceptions

Method not available.

Code samples

Example #1

The resulting Word document looks like:

Example #2

The resulting Word document looks like:

Release notes
  • phpdocx 13.0:
    • updated the internal algorithm.
  • phpdocx 11.0:
    • prevent adding duplicated fonts.
    • fixed misspelled styleEmbedding option.
  • phpdocx 10.0:
    • new method.