Hyphens


Automatically hyphenates words when wrapping text.

Inserts hyphens at syllable boundaries based on language rules.

Suggest manual line break opportunities using:

  • Soft hyphen (\u00AD): Marks a wrapping opportunity. The hyphen is only visible if the word wraps at this point.

  • Hard hyphen (\u2010): Inserts a permanently visible hyphen that also allows wrapping.

Default is Hyphens.None (no automatic hyphenation).

Summary

Public companion functions

Hyphens
valueOf(value: Int)

Creates Hyphens from value.

Cmn

Public companion properties

Hyphens

Breaks words automatically at syllable boundaries.

Cmn
Hyphens

Lines will break with no hyphenation.

Cmn
Hyphens

Represents an unset Hyphens value.

Cmn

Public functions

open String
Cmn

Public properties

Int

internal integer representation of the hyphenation mode.

Cmn

Extension functions

inline Hyphens
Hyphens.takeOrElse(block: () -> Hyphens)

If isSpecified is true then this is returned, otherwise block is executed and its result is returned.

Cmn

Extension properties

Boolean

Returns true if it is not Hyphens.Unspecified.

Cmn

Public companion functions

valueOf

fun valueOf(value: Int): Hyphens

Creates Hyphens from value.

Useful for serialization/deserialization.

Parameters
value: Int

internal integer representation.

Throws
IllegalArgumentException

if value is invalid.

See also
value

Public companion properties

Auto

val AutoHyphens

Breaks words automatically at syllable boundaries.

Manual suggestions (like soft hyphens) override automatic breaks.

+---------+
| Experi- |
| mental  |
+---------+

None

val NoneHyphens

Lines will break with no hyphenation.

"Hard" hyphens will still be respected. However, no automatic hyphenation will be attempted. If a word must be broken due to being longer than a line, it will break at any character and will not attempt to break at a syllable boundary.

+---------+
| Experim |
| ental   |
+---------+

Unspecified

val UnspecifiedHyphens

Represents an unset Hyphens value.

Public functions

toString

open fun toString(): String

Public properties

value

val valueInt

internal integer representation of the hyphenation mode.

Extension functions

Hyphens.takeOrElse

inline fun Hyphens.takeOrElse(block: () -> Hyphens): Hyphens

If isSpecified is true then this is returned, otherwise block is executed and its result is returned.

Extension properties

Hyphens.isSpecified

val Hyphens.isSpecifiedBoolean

Returns true if it is not Hyphens.Unspecified.

See also
Unspecified