Emphasis Opcodes

Christian Egli edited this page Jun 9, 2016 · 10 revisions

Table of Contents

Introduction

In many braille systems emphasis such as bold, italics or underline is indicated using special dot patterns that mark the start and often also the end. For some languages these braille indicators differ depending on the context, i.e. here is an separate indicator for an emphasized word and another one for an emphasized phrase. To accomodate for all these usage scenarios liblouis provides a number of opcodes for various contexts.

At the same time some braille systems use different indicators for different kinds of emphasis while others know only one kind of emphasis. For that reason liblouis doesn’t hard code any emphasis but the table author defines which kind of emphasis exist for a specific language using the emphclass opcode.

Emphasis class

The emphclass opcode defines the classes of emphasis that are relevant for a particular language. For all emphasis that need special indicators an emphasis class has to be declared.

emphclass italic
emphclass underline
emphclass bold
emphclass transnote

Contexts

In order to understand the capabilities of Liblouis for emphasis handling we have to look at the different contexts that are supported.

None

For some languages there is no such concept as contexts. Empasis is always handled the same regardless of context. There is simply an indicator for the beginning of emphasis and another one for the end of the emphasis.

Opcodes

begemph <emphasis class>

Braille dot pattern to indicate the beginning of emphasis.

begemph italic 46-3

endemph <emphasis class>

Braille dot pattern to indicate the end of emphasis.

endemph italic 46-36

Letter

Some languages have special indicators for single letter emphasis.

Opcodes

emphletter <emphasis class>

Braille dot pattern to indicate that the next character is emphasized.

emphletter italic 46-25

Word

Many languages have special indicators for emphasized words. Usually they start at the beginning of the word and and implicitely, i.e. without a closing indicator at the end of the word. There are also use cases where the emphasis starts in the middle of the word and an explicit closing indicator is required.

Opcodes

begemphword <emphasis class>

Braille dot pattern to indicate the beginning of an emphasized word or the beginning of emphasized characters within a word.

begemphword underline 456-36

endemphword <emphasis class>

Generally emphasis with word context ends when the word ends. However when an indication is required to close a word emphasis then this opcode defines the Braille dot pattern that indicates the end of a word emphasis.

endemphword transnote 6-3

If emphasis ends in the middle of a word the Braille dot pattern defined in this opcode is also used.

Phrase

Many languages have a concept of a phrase where the emphasis is valid for a number of words. The beginning of the phase is indicated with a braille dot pattern and a closing indicator is put before or after the last word of the phrase.

Opcodes

begemphphrase <emphasis class>

Braille dot pattern to indicate the beginning of a phrase.

begemphphrase bold 456-46-46

endemphphrase <emphasis class> before

Braille dot pattern to indicate the end of a phrase. The closing indicator will be placed before the last word of the phrase.

endemphphrase bold before 456-46

endemphphrase <emphasis class> after

Braille dot pattern to indicate the end of a phrase. The closing indicator will be placed after the last word of the phrase. If both endemphphrase <emphasis class> before and endemphphrase <emphasis class> after are defined an error will be signaled.

endemphphrase underline after 6-3

lenemphphrase <emphasis class>

Define how many words are required before a sequence of words is considered a phrase.

lenemphphrase underline 3

In the middle of a word

Not implemented right now

In some rare cases a language defines separate braille dot patterns for emphasis beginning at the start of a word or in the middle of a word. In that case both begitalword and begitalwithinword have to be defined. If these opcodes are not defined the same braille dot pattern is used for both contexts, i.e. for an emphasis starting at the beginning or in the middle of a word and conversely for a closing emphasis at the end of in the middle of a word.

begitalwithinword

In some rare cases a language defines separate braille dot patterns for emphasis beginning at the start of a word or in the middle of a word. In that case both begitalword and begitalwithinword have to be defined.

enditalwithinword

Similarly, some languages define separate braille dot patterns for closing emphasis at the end of a word or in the middle of a word. In that case both enditalword and enditalwithinword have to be defined.

Fallback behaviour

Many braille systems either handle emphasis using no contexts or otherwise by employing a combination of the letter, word and phrase contexts. So if a table defines any opcodes for the letter, word or phrase contexts then liblouis will signal an error for opcodes that define emphasis with no context. In other words contrary to previous versions of liblouis there is no fallback behaviour.

As a consequence of this is that there will only be emphasis for a context when the table defines it. So for example when defining a braille dot pattern for phrases and not for words liblouis will not indicate emphasis on words that aren’t part of a phrase.

Upgrade from previous versions

With the introduction of the new emphasis functionality the opcodes were renamed to make their intent more clear. If you are upgrading a table from an older version of Liblouis the following table should help with the migration:

Old opcode New opcode
begemph *
endemph *
singleletter* emphletter *
firstletter* begemphword *
lastletter* endemphword *
firstword* begemphphrase *
lastword*before endemphphrase * before
lastword*after endemphphrase * after
len*phrase lenemphphrase *

Note that firstletter* and begemphword * do not exactly behave the same way. firstletter* was explicitely meant for emphasis indication within a word. begemphword on the other hand is really used to indicate emphasis on words where the emphasis is shorter than a phrase. If the emphasis starts within a word however the indicator defined with begemphword is also used.