HyphenationOptions

New in version 5.0

HyphenationOptions ( lineBreakFlag ;​ hyphenationExceptions )

Argument Type Range Default Note
lineBreakFlag int -1..13 1
hyphenationExceptions str 0..100000 ""
Examples

HyphenationOptions(0) /* Disable hyphenation, i.e. word based line breaks. */

HyphenationOptions(1) /* Use English-US hyphen rules (default). */

HyphenationOptions(5) /* Use French hyphen rules. */

HyphenationOptions(3;​"derby-ter-min wach-stu-be microsoft") /* Use German hyphen rules together with a list of exceptions for specific words. */

Description

The hyphenation of text can be controlled by the function HyphenationOptions(). The first argument lineBreakFlag can be used to define where to insert line breaks. The following flags are available:

  • –1   Character based line breaks. No hyphenation.
  •  0   Word based line breaks. No hyphenation.
  •  1   English-US hyphen rules (default).
  •  2   English-GB hyphen rules.
  •  3   German hyphen rules.
  •  4   Spanish hyphen rules.
  •  5   French hyphen rules.
  •  6   Italian hyphen rules.
  •  7   Greek hyphen rules.
  •  8   Dutch hyphen rules.
  •  9   Danish hyphen rules.
  • 10   Swedish hyphen rules.
  • 11   Norwegian hyphen rules.
  • 12   Finnish hyphen rules.
  • 13   Portuguese hyphen rules.

A list of hyphenation exceptions can be added as a second argument. The words are separated by spaces, tabs or line feeds. For example:

HyphenationOptions(3;​"zeit-erspar-nis wachs-tu-be filemaker")

The new xmCHART 5 text engine also supports soft hyphens (Unicode U+00AD, UTF-8 encoded: \xC2\xAD). A soft hyphen indicates a hyphenation point, where a line break is preferred when a word is to be hyphenated. For example:

AddText(10;​20;​"Lorem ipsum dolor sit am\xC2\xADet, conse\xC2\xADctetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua";​Verdana;​12;​plain;​black;​;​;​0;​80)

The function HyphenationOptions() works globally and affects all texts in a drawing. However, from time to time, it can be advantageous to override the global hyphenation settings for individual texts. For instance, you may want to disable automatic hyphenation for a diagram title or you have texts in different languages. The lineBreakFlag can be set individually for each text function by adding the line break flag to argument textWidthMax. The argument textWidthMax is available in all text-related functions such as AddText() , LabelStyle() , TitleStyle() , LegendStyle() , AxisLabelStyle() , TagText() etc. For example:


OpenDrawing(800;​600)

HyphenationOptions(1) /* Use English-US hyphen rules (default). */

/* ... */

TitleStyle(Verdana;​14;​bold;​black;​center;​0;​200 0) /* 0...Turn off hyphenation. */

/* ... */

AddText(100;​100;​"Uno dei fatti piu notevoli al principio del decimosesto secolo e senza dubbio l'apparire della cortigiana";​

Verdana;​10;​plain;​black;​left;​baseline;​0;​100 6) /* 6...Use Italian hyphen rules. */

/* ... */

CloseDrawing()

Scroll to Top