class MpInstance
π± Types incomplete or incorrect? π Please contribute!
methods
MpInstance.statistics
function MpInstance.statistics() -> 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
MpInstance.execute
function MpInstance.execute(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
MpInstance.finish
function MpInstance.finish() -> 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
MpInstance.char_width
@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
MpInstance.char_height
@return height
- FM 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
MpInstance.char_depth
@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
MpInstance.get_boolean
Reference:
- Corresponding C source code: lmplib.c#L497-L510
MpInstance.get_numeric
Reference:
- Corresponding C source code: lmplib.c#L482-L495
MpInstance.get_string
Reference:
- Corresponding C source code: lmplib.c#L512-L528
MpInstance.get_path
Reference:
- Corresponding C source code: lmplib.c#L1649-L1693
MpInstance.solve_path
Reference:
- Corresponding C source code: lmplib.c#L978-L1195
π± Types incomplete or incorrect? π Please contribute!