global lang
This library provides the interface to LuaTeX's structure representing a language, and the associated functions.
😱 Types incomplete or incorrect? 🙏 Please contribute!
methods
lang.new
function lang.new(id: integer?) -> Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}
id
- Without an argument, the next available internal id number will be assigned to this object. With an argument, an object will be created that links to the internal language with that id number.
@return - The language object.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Create a new language object, with an optional fixed id number.
Example:
Reference:
- Corresponding C source code: llanglib.c#L27-L48
- https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/f52b099f3e01d53dc03b315e1909245c3d5418d3/manual/luatex-languages.tex#L944-954
lang.id
function lang.id(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> integer
language
- The language object.
@return - The number returned is the internal language
id number this object refers to.
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the current internal language
id number.
Example:
Reference:
- Corresponding C source code: llanglib.c#L50-L56
- https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/f52b099f3e01d53dc03b315e1909245c3d5418d3/manual/luatex-languages.tex#L956-960
lang.hyphenation
function lang.hyphenation(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
hyphenation_exceptions: string
)
language
- The language object.
Add hyphenation exceptions.
Example:
local l = lang.new()
lang.hyphenation(l, "man-u-script")
print(lang.hyphenation(l)) -- man-u-script
lang.hyphenation(l, "ca-tas-tro-phe")
print(lang.hyphenation(l)) -- man-u-script ca-tas-tro-phe
Reference:
- Corresponding C source code: llanglib.c#L86-L104
- https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/f52b099f3e01d53dc03b315e1909245c3d5418d3/manual/luatex-languages.tex#L968-980
lang.hyphenation
function lang.hyphenation(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> hyphenation_exceptions string?
language
- The language object.
Get the hyphenation exceptions.
Example:
Reference:
- Corresponding C source code: llanglib.c#L86-L104
- https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/f52b099f3e01d53dc03b315e1909245c3d5418d3/manual/luatex-languages.tex#L968-980
lang.clear_hyphenation
function lang.clear_hyphenation(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
})
Clear the set of hyphenation exceptions.
Example:
local l = lang.new()
print(lang.hyphenation(l)) -- nil
lang.hyphenation(l, "man-u-script")
lang.hyphenation(l, "ca-tas-tro-phe")
print(lang.hyphenation(l)) -- man-u-script ca-tas-tro-phe
lang.clear_hyphenation(l)
print(lang.hyphenation(l)) -- nil
lang.clean
function lang.clean(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
o: string
) -> n string
language
- The language object.
Clear the exception dictionary (string) for this language.
Reference:
- Corresponding C source code: llanglib.c#L223-L241
lang.clean
@param
o
- The language object.
Clear the exception dictionary (string) for this language.
Reference:
- Corresponding C source code: llanglib.c#L223-L241
lang.patterns
function lang.patterns(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
patterns: string
)
language
- The language object.
@param patterns
- For example .ab3a .abb2 .ab5erk
😱 Types incomplete or incorrect? 🙏 Please contribute!
Add additional patterns for this language object.
Reference:
- Corresponding C source code: llanglib.c#L58-L76
lang.patterns
function lang.patterns(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> pattterns string?
language
- The language object.
@return pattterns
- For example .ab3a .abb2 .ab5erk
😱 Types incomplete or incorrect? 🙏 Please contribute!
Return the current set of patterns.
Reference:
- Corresponding C source code: llanglib.c#L58-L76
lang.clear_patterns
function lang.clear_patterns(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
})
Clear the set of hyphenation patterns.
Clear the pattern dictionary for a language.
Reference:
- Corresponding C source code: llanglib.c#L78-L84
lang.hyphenationmin
function lang.hyphenationmin(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
min: integer
)
Set the value of the TeX parameter
\hyphenationmin
.
Reference:
- Corresponding C source code: llanglib.c#L199-L213
lang.hyphenationmin
function lang.hyphenationmin(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> min integer
language
- The language object.
Get the value of the TeX parameter
\hyphenationmin
.
Reference:
- Corresponding C source code: llanglib.c#L199-L213
lang.prehyphenchar
function lang.prehyphenchar(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
char: integer
)
language
- The language object.
Set the “pre-break” hyphen characters for implicit hyphenation in this language.
The intial values are decimal 45 (hyphen) and decimal 0 (indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L106-L120
lang.prehyphenchar
function lang.prehyphenchar(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> char integer
language
- The language object.
Get the “pre-break” hyphen characters for implicit hyphenation in this language.
The intial values are decimal 45 (hyphen) and decimal 0 (indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L106-L120
lang.posthyphenchar
function lang.posthyphenchar(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
char: integer
)
language
- The language object.
Set the “post-break” hyphen characters for implicit hyphenation in this language.
The intial values are decimal 45 (hyphen) and decimal 0 (indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L122-L136
lang.posthyphenchar
function lang.posthyphenchar(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> char integer
language
- The language object.
Get the “post-break” hyphen characters for implicit hyphenation in this language.
The intial values are decimal 45 (hyphen) and decimal 0 (indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L122-L136
lang.preexhyphenchar
function lang.preexhyphenchar(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
char: integer
)
language
- The language object.
Set the “pre-break” hyphen characters for explicit hyphenation in this language.
The hyphen
character is initially
decimal 0
(indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L138-L152
lang.preexhyphenchar
function lang.preexhyphenchar(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> char integer
language
- The language object.
Get the “pre-break” hyphen characters for explicit hyphenation in this language.
The hyphen
character is initially
decimal 0
(indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L138-L152
lang.postexhyphenchar
function lang.postexhyphenchar(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
char: integer
)
language
- The language object.
Set the “post-break” hyphen characters for explicit hyphenation in this language.
The hyphen
character is initially
decimal 0
(indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L183-L197
lang.postexhyphenchar
function lang.postexhyphenchar(language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
}) -> char integer
language
- The language object.
Get the “post-break” hyphen characters for explicit hyphenation in this language.
The hyphen
character is initially
decimal 0
(indicating emptiness).
Reference:
- Corresponding C source code: llanglib.c#L183-L197
lang.hyphenate
function lang.hyphenate(
head: Node {
next = Node?,
prev = Node?,
id = integer,
subtype = integer,
head = Node?,
attr = Node,
},
tail: Node?
) -> success boolean
Hyphenate a node list.
Insert hyphenation points (discretionary nodes) in a node list.
If
tail
is given as argument, processing stops on that node. Currently,
success
is always true if head
(and tail
, if specified)
are proper nodes, regardless of possible other errors.
Hyphenation works only on “characters”, a special subtype of all the glyph
nodes with the node subtype having the value 1
. Glyph modes with
different subtypes are not processed.
Reference:
- Corresponding C source code: llanglib.c#L243-L261
lang.sethjcode
function lang.sethjcode(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
char: integer,
used_char: integer
)
language
- The language object.
Set hj codes.
When you set a hjcode the current sets get initialized unless the set was already
initialized due to \savinghyphcodes
being larger than zero.
Reference:
- Corresponding C source code: llanglib.c#L154-L169
lang.gethjcode
function lang.gethjcode(
language: Language {
id = function,
hyphenation = function,
hyphenation = function,
clear_hyphenation = function,
patterns = function,
patterns = function,
},
char: number
) -> used_char integer
language
- The language object.
Query hj codes.
Reference:
- Corresponding C source code: llanglib.c#L171-L181