Enums

This document is about the enums of the IDML-Creator. They keep string values correct — every enum value matches exactly what the IDML specification (Appendix D, datatype.rnc) expects as an attribute value. That is why the enums mostly carry the same name as the setter they belong to: $color->setModel(Model::SPOT).

A complete list with all values is available directly in the idml-specification. This page shows the enums you will meet most often.

Table of contents

Units

Numbers default to points. Pass the unit as the last parameter of the respective setter:

<?php

use BitAndBlack\IdmlCreator\Content\Enum\Unit;

/** @var \BitAndBlack\IdmlCreator\Content\Rectangle $shape any shape — e.g. a rectangle, oval or polygon */
$shape->setSize(100, 200, Unit::MILLIMETERS);

Colors

<?php

use BitAndBlack\IdmlCreator\Content\Enum\Color\Model;
use BitAndBlack\IdmlCreator\Content\Enum\Color\Space;

/** @var \BitAndBlack\IdmlCreator\Content\Color\Color $color a color, created in the "colors" chapter */
$color
    ->setModel(Model::PROCESS) // or Model::SPOT
    ->setSpace(Space::CMYK)    // or Space::RGB, Space::LAB
;

The layer color enum holds the colors that a layer can get in the InDesign UI (Color::OLIVEGREEN, Color::RED, ...).

Stories and text

<?php

use BitAndBlack\IdmlCreator\Content\Enum\Story\Direction;
use BitAndBlack\IdmlCreator\Content\Enum\Story\Orientation;

/** @var \BitAndBlack\IdmlCreator\Content\Story\Story $story a story, created in the "typography" chapter */
$story
    ->setStoryOrientation(Orientation::VERTICAL)
    ->setStoryDirection(Direction::RIGHT_TO_LEFT)
;

Spreads and pages

Where a page sits inside a spread:

<?php

use BitAndBlack\IdmlCreator\Content\Enum\Spread\PagePosition;

/** @var \BitAndBlack\IdmlCreator\Content\Spread\Spread $spread a spread, created in the "pages" chapter */
/** @var \BitAndBlack\IdmlCreator\Content\Page $page a page, created in the "pages" chapter */
$spread->addPage($page, PagePosition::RIGHT);

All six values are described in the pages chapter.

Paragraph styles

Deep properties of a paragraph style use enums whose values come straight from the XML schema of the specification:

<?php

use BitAndBlack\IdmlCreator\Content\Enum\Styles\GridAlignment;
use BitAndBlack\IdmlCreator\Content\Enum\Styles\PositionalForm;

/** @var \BitAndBlack\IdmlCreator\Content\Style\ParagraphStyle $paragraphStyle a paragraph style, created in the "styling text" chapter */
$paragraphStyle
    ->setGridAlignment(GridAlignment::ALIGN_EM_TOP)
    ->setPositionalForm(PositionalForm::INITIAL)
;

Text frames

The options of a text frame are driven by enums, too — wrap mode and side, vertical justification and the anchored object settings:

<?php

use BitAndBlack\IdmlCreator\Content\Enum\AnchoredObjectSetting\AnchorPosition;
use BitAndBlack\IdmlCreator\Content\Enum\TextWrapMode;
use BitAndBlack\IdmlCreator\Content\Enum\TextWrapSide;
use BitAndBlack\IdmlCreator\Content\Enum\VerticalJustification;

/** @var \BitAndBlack\IdmlCreator\Content\TextFrame\TextFramePreference $textFramePreference a text frame preference, created in the "text frames" chapter */
/** @var \BitAndBlack\IdmlCreator\Content\SplineItem\TextWrapPreference $textWrapPreference a text wrap preference, created in the "text frames" chapter */
/** @var \BitAndBlack\IdmlCreator\Content\SplineItem\AnchoredObjectSetting $anchoredObjectSetting an anchored object setting, created in the "text frames" chapter */
$textFramePreference->setVerticalJustification(VerticalJustification::CENTER_ALIGN);
$textWrapPreference
    ->setTextWrapMode(TextWrapMode::BOUNDING_BOX)
    ->setTextWrapSide(TextWrapSide::BOTH_SIDES)
;
$anchoredObjectSetting->setAnchoredPosition(AnchorPosition::INLINE_POSITION);

Shapes and strokes

The visual style of corners and lines:

<?php

use BitAndBlack\IdmlCreator\Content\Enum\CornerOptions;
use BitAndBlack\IdmlCreator\Content\Enum\StrokeAlignment;
use BitAndBlack\IdmlCreator\Content\Enum\StrokeType;

/** @var \BitAndBlack\IdmlCreator\Content\Rectangle $rectangle a rectangle, created in the "shapes" chapter */
$rectangle
    ->setTopLeftCornerOption(CornerOptions::ROUNDED)
    ->setStrokeType(StrokeType::DASHED)
    ->setStrokeAlignment(StrokeAlignment::CENTER_ALIGNMENT)
;