This document is about how to set up and use Fonts.
Table of contents
Every font consists of a font family and a font style. Those are two different objects in IDML-Creator, and those two can be handled differently in InDesign. Set them up like that:
<?php use IDML\Content\Font\FontFamily; use IDML\Content\Font\FontStyle; $helveticaNeue = new FontFamily('Helvetica Neue'); $helveticaNeueRegular = new FontStyle($helveticaNeue, 'Helvetica Neue Regular'); $helveticaNeueItalic = new FontStyle($helveticaNeue, 'Helvetica Neue Italic'); $content ->addFont( $helveticaNeueRegular, $helveticaNeueItalic ) ;
Family name and style name are required attributes here.
Using fonts in styles
The font family and the font style can be used in styles like that:
<?php $myParagraphStyle ->setFontFamily($helveticaNeue) ->setFontStyle($helveticaNeueRegular) ; $myCharacterStyle ->setFontStyle($helveticaNeueItalic) ;
It's not important here if a font is available on a system!
NOTICE: If you want to provide fonts along with your
idml files, create a folder
Document fonts in the same directory. When opening an
indd) file, InDesign will look for this folder and activate all fonts inside.