global mplib
methods
mplib.new
function mplib.new(args: MpArguments?) -> MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
}
Create a new metapost instance.
Reference:
- Source file of the
LuaTeX
manual: luatex-graphics.tex#L381-L385 - Corresponding C source code: lmplib.c#L532-L627
mplib.statistics
function mplib.statistics(mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
}) -> MpStats {
main_memory = integer,
hash_size = integer,
param_size = integer,
max_in_open = integer,
}
Return some statistics for this metapost instance.
This function returns the vital statistics for an MPlib instance.
Note that in the new version of MPlib, this is informational only. The objects are all allocated dynamically, so there is no chance of running out of space unless the available system memory is exhausted.
Reference:
- Source file of the
LuaTeX
manual: luatex-graphics.tex#L470-L482 - Corresponding C source code: lmplib.c#L771-L792
mplib.execute
function mplib.execute(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
code: string
) -> MpResult {
log = string?,
term = string?,
error = string?,
status = MpResultStatus,
fig = MpFig[]?,
}
Execute metapost code in the instance.
You can ask the MetaPost interpreter to run a chunk of code by calling mp.execute()
for various bits of MetaPost language input. Be sure to check the rettable.status
(see below) because when a fatal MetaPost error occurs the
MPlib instance will become unusable thereafter.
Generally speaking, it is best to keep your chunks small, but beware that all chunks have to obey proper syntax, like each of them is a small file. For instance, you cannot split a single statement over multiple chunks.
In contrast with the normal stand alone mpost
command, there is
no
implied βinputβ at the start of the first chunk.
Reference:
- Source file of the
LuaTeX
manual: luatex-graphics.tex#L488-L507 - Corresponding C source code: lmplib.c#L692-L711
mplib.finish
function mplib.finish(mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
}) -> MpResult {
log = string?,
term = string?,
error = string?,
status = MpResultStatus,
fig = MpFig[]?,
}
Finish a metapost instance.
If for some reason you want to stop using an MPlib instance while processing is
not yet actually done, you can call finish
. Eventually, used memory
will be freed and open files will be closed by the Lua garbage collector, but
an explicit finish
is the only way to capture the final part of the
output streams.
Reference:
- Corresponding C source code: lmplib.c#L713-L728
mplib.fields
Get the list of accessible values for a particular object.
Reference:
- Corresponding C source code: lmplib.c#L1548-L1591
mplib.pen_info
Reference:
- Corresponding C source code: lmplib.c#L1474-L1539
mplib.char_width
function mplib.char_width(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
fontname: string,
char: integer
) -> width number
@return width
- AFM units
π± Types incomplete or incorrect? π Please contribute!
Report a character's width.
This function finds the size of a glyph in a defined font. The fontname
is the same name as the argument to infont
; the char
is a glyph
id in the range 0 to 255; the returned width
is in AFM units.
Reference:
- Corresponding C source code: lmplib.c#L748-L751
mplib.char_height
function mplib.char_height(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
fontname: string,
char: integer
) -> height number
@return height
- AFM units
π± Types incomplete or incorrect? π Please contribute!
Report a character's height.
This function finds the size of a glyph in a defined font. The fontname
is the same name as the argument to infont
; the char
is a glyph
id in the range 0 to 255; the returned height
is in AFM units.
Reference:
- Corresponding C source code: lmplib.c#L758-L761
mplib.char_depth
function mplib.char_depth(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
fontname: string,
char: integer
) -> depth number
@return depth
- AFM units
π± Types incomplete or incorrect? π Please contribute!
Report a character's depth.
This function finds the size of a glyph in a defined font. The fontname
is the same name as the argument to infont
; the char
is a glyph
id in the range 0 to 255; the returned depth
is in AFM units.
Reference:
- Corresponding C source code: lmplib.c#L753-L756
mplib.get_boolean
function mplib.get_boolean(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
name: string
) -> value boolean
Reference:
- Corresponding C source code: lmplib.c#L497-L510
mplib.get_numeric
function mplib.get_numeric(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
name: string
) -> value integer
Reference:
- Corresponding C source code: lmplib.c#L482-L495
mplib.get_string
function mplib.get_string(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
name: string
) -> value string
Reference:
- Corresponding C source code: lmplib.c#L512-L528
mplib.get_path
function mplib.get_path(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
name: string
) -> value table
Reference:
- Corresponding C source code: lmplib.c#L1649-L1693
mplib.version
@return version
- for example 2.02
π± Types incomplete or incorrect? π Please contribute!
Return the version of the MetaPost library.
Reference:
- Corresponding C source code: lmplib.c#L763-L769
mplib.solve_path
function mplib.solve_path(
mp: MpInstance {
statistics = function,
execute = function,
finish = function,
char_width = function,
char_height = function,
char_depth = function,
get_boolean = function,
get_numeric = function,
get_string = function,
get_path = function,
solve_path = function,
},
coordinates: table,
cyclic: boolean
)
Reference:
- Corresponding C source code: lmplib.c#L978-L1195
π± Types incomplete or incorrect? π Please contribute!