Ticket

https://revodigital.atlassian.net/browse/MLE-261?atlOrigin=eyJpIjoiOGI5MzI0YjBmZTU0NDE4Y2FmOGMzYzU3MGViMTVlNmUiLCJwIjoiaiJ9

Introduction

Every text in pamela can be fully configured using a specific interface: ITextConfiguration. It allows to specify custom appearance for texts in tables or barcodes. Below there is a full list of its properties.

Configuration interface

This is the interface that contains all possible customizations to text

export interface ITextConfiguration {
  fontSize?: number;

  textColor?: string;

  fontName?: string;

  bold?: boolean;

  italic?: boolean;

  textAlign?: HorizontalAlignment;

  verticalAlign?: VerticalAlignment;

  padding?: number;
}
TYPESCRIPT

Properties list

This is a list of all the properties.

Property

Type

Description

Default

Optional

fontSize

number

Font size in pixels

10

(tick)

textColor

string

Text color in html hex format or by known name

'black'

(tick)

fontName

string

Font name

'arial'

(tick)

bold

boolean

Text bold

false

(tick)

italic

boolean

Text italic

false

(tick)

textAlign

HorizontalAlignment

Horizontal text alignment

HorizontalTextAlignment.Center

(tick)

verticalAlign

VerticalAlignment

Vertical text alignment

VerticalAlignment.Center

(tick)

padding

number

Text padding

0

(tick)

Helper class

The helper class TextConfiguration can be used to easily manage text configuration and access default values.

export abstract class TextConfiguration implements ITextConfiguration {
  [fields]
  
  protected constructor(options: ITextConfiguration) {...}
  
  static getDefaultOptions(): ITextConfiguration {
    return {
      textAlign: HorizontalAlignment.Center,
      bold: false,
      fontName: 'arial',
      italic: false,
      textColor: 'black',
      fontSize: 10,
      padding: 0,
    }
  }
}
TYPESCRIPT