Mach Modules Documentation
Lua Module API Documentation
Loading...
Searching...
No Matches
FormattingModule.lua File Reference

Go to the source code of this file.

Functions

Formatting CreateFont (point_size, bold, italics, underlined)
 Create a wx font using the MachMotion standard font family.
Formatting ConvertFontStringToFontObject (font_string)
 Convert a native font info descriptor string to a wx font object.
Formatting ConvertFontObjectToFontString (font_object)
 Convert a wx font object to its native font info descriptor string.
Formatting IsFontWeight (font_object, weight)
 Check whether a wx font object has a specific font weight.
Formatting IsFontWeightBold (font_object)
 Check whether a wx font object has a bold-class font weight.
Formatting IsFontName (font_object, name)
 Check whether a wx font object has a specific face name.
Formatting GetFontName (font_object)
 Get the face name of a wx font object.
Formatting SetFontName (font_object, name)
 Set the face name of a wx font object.
Formatting GetFontFamily (font_object)
 Get the font family of a wx font object.
Formatting SetFontFamily (font_object, name)
 Set the font family of a wx font object.
Formatting IsApprovedScreenFont (font_object)
 Check whether a font object uses an approved MachMotion screen font face name.
Formatting IsApprovedFont (wxfont)
 Check whether a wx font object uses an approved MachMotion font face name.
Formatting CreateCodeBlocksFont (point_size, bold, italics, underlined)
 Create a wxFont using the CodeBlocks monospace font family.
Formatting GetDefault ()
 Get the default color sentinel value indicating no color override.
Formatting GetPink ()
 Get the color pink.
Formatting GetPurple ()
 Get the color purple.
Formatting GetLightBlue ()
 Get the color light blue.
Formatting GetBrightBlue ()
 Get the color bright blue.
Formatting GetNeonBlue ()
 Get the color neon blue.
Formatting GetBlue ()
 Get the color blue.
Formatting GetLightGreen ()
 Get the color light green.
Formatting GetGreen ()
 Get the color green.
Formatting GetDarkGreen ()
 Get the color dark green.
Formatting GetPaleYellow ()
 Get the color pale yellow.
Formatting GetYellow ()
 Get the color yellow.
Formatting GetOrange ()
 Get the MachMotion standard orange color.
Formatting GetBrown ()
 Get the color brown.
Formatting GetRed ()
 Get the color red.
Formatting GetDarkRed ()
 Get the color dark red.
Formatting GetGrey ()
 Get the color grey.
Formatting GetOffWhite ()
 Get the color off-white.
Formatting GetWhite ()
 Get the color white.
Formatting GetBlack ()
 Get the color black.
Formatting GetMachMotionGrey ()
 Get the MachMotion standard grey UI color.
Formatting GetMMDROReadFG ()
 Get the DRO read foreground color from the active color scheme.
Formatting GetMMDROReadBG ()
 Get the DRO read background color from the active color scheme.
Formatting GetMMDROWriteFG ()
 Get the DRO write foreground color from the active color scheme.
Formatting GetMMDROWriteBG ()
 Get the DRO write background color from the active color scheme.
Formatting GetMMDROWriteEditdorBG ()
 Get the DRO write editor background color from the active color scheme.
Formatting GetMMMachineCordFG ()
 Get the machine coordinates DRO foreground color from the active color scheme.
Formatting GetMMMachineCordBG ()
 Get the machine coordinates DRO background color from the active color scheme.
Formatting PartCordFG ()
 Get the part coordinates DRO foreground color from the active color scheme.
Formatting PartCordBG ()
 Get the part coordinates DRO background color from the active color scheme.

Function Documentation

◆ ConvertFontObjectToFontString()

Formatting ConvertFontObjectToFontString ( font_object )

Convert a wx font object to its native font info descriptor string.

Parameters
font_object(userdata) The wx.wxFont object to convert
Returns
(string) The native font info descriptor string representing the font
See also
Formatting.ConvertFontStringToFontObject() for the inverse operation
Note
Documentation generated by AI on 2026-03-03

◆ ConvertFontStringToFontObject()

Formatting ConvertFontStringToFontObject ( font_string )

Convert a native font info descriptor string to a wx font object.

Creates a default wx.wxFont and applies the native font info string via SetNativeFontInfo() to reconstruct the font described by the string.

Parameters
font_string(string) A native font info descriptor string as returned by GetNativeFontInfoDesc()
Returns
(userdata) A wx.wxFont object initialized from the provided font string
See also
Formatting.ConvertFontObjectToFontString() for the inverse operation
Note
Documentation generated by AI on 2026-03-03

◆ CreateCodeBlocksFont()

Formatting CreateCodeBlocksFont ( point_size ,
bold ,
italics ,
underlined  )

Create a wxFont using the CodeBlocks monospace font family.

Creates a wx.wxFont using Formatting.CodeBlocksFontName ("Courier New") with the specified style options. Unlike CreateFont(), bold maps to wxFONTWEIGHT_BOLD (not SemiBold). If point_size is nil, defaults to Formatting.FontSizeStandard. If underlined is nil or not a boolean, defaults to false.

Parameters
point_size(number|nil) The font point size. Defaults to Formatting.FontSizeStandard if nil
bold(boolean|nil) If true, uses wxFONTWEIGHT_BOLD; otherwise wxFONTWEIGHT_NORMAL
italics(boolean|nil) If true, uses wxFONTSTYLE_ITALIC; otherwise wxFONTSTYLE_NORMAL
underlined(boolean|nil) If true, the font is underlined. Defaults to false if nil or non-boolean
Returns
(userdata) A wx.wxFont using the CodeBlocks monospace face name
See also
Formatting.CreateFont() for the standard UI font equivalent
Note
Documentation generated by AI on 2026-03-03

◆ CreateFont()

Formatting CreateFont ( point_size ,
bold ,
italics ,
underlined  )

Create a wx font using the MachMotion standard font family.

Creates a wx.wxFont using Formatting.FontName ("Roboto SemiCondensed") with the specified style options. Bold maps to wxFONTWEIGHT_SEMIBOLD. If point_size is nil, defaults to Formatting.FontSizeStandard. If underlined is nil or not a boolean, defaults to false. Includes a workaround for a ZeroBrane Studio issue where weight may be nil.

Parameters
point_size(number|nil) The font point size. Defaults to Formatting.FontSizeStandard if nil
bold(boolean|nil) If true, uses wxFONTWEIGHT_SEMIBOLD; otherwise wxFONTWEIGHT_NORMAL
italics(boolean|nil) If true, uses wxFONTSTYLE_ITALIC; otherwise wxFONTSTYLE_NORMAL
underlined(boolean|nil) If true, the font is underlined. Defaults to false if nil or non-boolean
Returns
(userdata) A wx.wxFont using the MachMotion standard face name
See also
Formatting.CreateCodeBlocksFont() for the monospace font equivalent
Note
Documentation generated by AI on 2026-03-03

◆ GetBlack()

Formatting GetBlack ( )

Get the color black.

Returns
(userdata) A wx.wxColour with RGB value (0, 0, 0)
Note
Documentation generated by AI on 2026-03-03

◆ GetBlue()

Formatting GetBlue ( )

Get the color blue.

Returns
(userdata) A wx.wxColour with RGB value (0, 0, 255)
Note
Documentation generated by AI on 2026-03-03

◆ GetBrightBlue()

Formatting GetBrightBlue ( )

Get the color bright blue.

Returns
(userdata) A wx.wxColour with RGB value (0, 150, 255)
Note
Documentation generated by AI on 2026-03-03

◆ GetBrown()

Formatting GetBrown ( )

Get the color brown.

Returns
(userdata) A wx.wxColour with RGB value (194, 174, 173)
Note
Documentation generated by AI on 2026-03-03

◆ GetDarkGreen()

Formatting GetDarkGreen ( )

Get the color dark green.

Returns
(userdata) A wx.wxColour with RGB value (0, 116, 49)
Note
Documentation generated by AI on 2026-03-03

◆ GetDarkRed()

Formatting GetDarkRed ( )

Get the color dark red.

Returns
(userdata) A wx.wxColour with RGB value (196, 15, 24)
Note
Documentation generated by AI on 2026-03-03

◆ GetDefault()

Formatting GetDefault ( )

Get the default color sentinel value indicating no color override.

Returns a wx.wxColour constructed with (-1, -1, -1), which wxWidgets interprets as the system default color. Use this to reset a control's color to its default appearance.

Returns
(userdata) A wx.wxColour with RGB value (-1, -1, -1) representing the system default
Note
Documentation generated by AI on 2026-03-03

◆ GetFontFamily()

Formatting GetFontFamily ( font_object )

Get the font family of a wx font object.

Parameters
font_object(userdata) The wx.wxFont object to query
Returns
(number) The wx font family constant (e.g., wx.wxFONTFAMILY_DEFAULT)
Note
Documentation generated by AI on 2026-03-03

◆ GetFontName()

Formatting GetFontName ( font_object )

Get the face name of a wx font object.

Parameters
font_object(userdata) The wx.wxFont object to query
Returns
(string) The font face name (e.g., "Roboto SemiCondensed")
Note
Documentation generated by AI on 2026-03-03

◆ GetGreen()

Formatting GetGreen ( )

Get the color green.

Returns
(userdata) A wx.wxColour with RGB value (0, 225, 0)
Note
Documentation generated by AI on 2026-03-03

◆ GetGrey()

Formatting GetGrey ( )

Get the color grey.

Returns
(userdata) A wx.wxColour with RGB value (224, 224, 224)
Note
Documentation generated by AI on 2026-03-03

◆ GetLightBlue()

Formatting GetLightBlue ( )

Get the color light blue.

Returns
(userdata) A wx.wxColour with RGB value (148, 190, 254)
Note
Documentation generated by AI on 2026-03-03

◆ GetLightGreen()

Formatting GetLightGreen ( )

Get the color light green.

Returns
(userdata) A wx.wxColour with RGB value (157, 255, 140)
Note
Documentation generated by AI on 2026-03-03

◆ GetMachMotionGrey()

Formatting GetMachMotionGrey ( )

Get the MachMotion standard grey UI color.

Returns
(userdata) A wx.wxColour with RGB value (71, 81, 92)
Note
Documentation generated by AI on 2026-03-03

◆ GetMMDROReadBG()

Formatting GetMMDROReadBG ( )

Get the DRO read background color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.Read.Bg
Note
Documentation generated by AI on 2026-03-03

◆ GetMMDROReadFG()

Formatting GetMMDROReadFG ( )

Get the DRO read foreground color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.Read.Fg
Note
Documentation generated by AI on 2026-03-03

◆ GetMMDROWriteBG()

Formatting GetMMDROWriteBG ( )

Get the DRO write background color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.Write.Bg
Note
Documentation generated by AI on 2026-03-03

◆ GetMMDROWriteEditdorBG()

Formatting GetMMDROWriteEditdorBG ( )

Get the DRO write editor background color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.Write.EditorBg
Note
Documentation generated by AI on 2026-03-03

◆ GetMMDROWriteFG()

Formatting GetMMDROWriteFG ( )

Get the DRO write foreground color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.Write.Fg
Note
Documentation generated by AI on 2026-03-03

◆ GetMMMachineCordBG()

Formatting GetMMMachineCordBG ( )

Get the machine coordinates DRO background color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.MachineCoords.Bg
Note
Documentation generated by AI on 2026-03-03

◆ GetMMMachineCordFG()

Formatting GetMMMachineCordFG ( )

Get the machine coordinates DRO foreground color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.MachineCoords.Fg
Note
Documentation generated by AI on 2026-03-03

◆ GetNeonBlue()

Formatting GetNeonBlue ( )

Get the color neon blue.

Returns
(userdata) A wx.wxColour with RGB value (31, 81, 255)
Note
Documentation generated by AI on 2026-03-03

◆ GetOffWhite()

Formatting GetOffWhite ( )

Get the color off-white.

Returns
(userdata) A wx.wxColour with RGB value (244, 244, 244)
Note
Documentation generated by AI on 2026-03-03

◆ GetOrange()

Formatting GetOrange ( )

Get the MachMotion standard orange color.

Returns
(userdata) A wx.wxColour with RGB value (235, 124, 47)
Note
Documentation generated by AI on 2026-03-03

◆ GetPaleYellow()

Formatting GetPaleYellow ( )

Get the color pale yellow.

Returns
(userdata) A wx.wxColour with RGB value (250, 254, 169)
Note
Documentation generated by AI on 2026-03-03

◆ GetPink()

Formatting GetPink ( )

Get the color pink.

Returns
(userdata) A wx.wxColour with RGB value (255, 196, 255)
Note
Documentation generated by AI on 2026-03-03

◆ GetPurple()

Formatting GetPurple ( )

Get the color purple.

Returns
(userdata) A wx.wxColour with RGB value (191, 136, 198)
Note
Documentation generated by AI on 2026-03-03

◆ GetRed()

Formatting GetRed ( )

Get the color red.

Returns
(userdata) A wx.wxColour with RGB value (237, 28, 36)
Note
Documentation generated by AI on 2026-03-03

◆ GetWhite()

Formatting GetWhite ( )

Get the color white.

Returns
(userdata) A wx.wxColour with RGB value (255, 255, 255)
Note
Documentation generated by AI on 2026-03-03

◆ GetYellow()

Formatting GetYellow ( )

Get the color yellow.

Returns
(userdata) A wx.wxColour with RGB value (255, 255, 0)
Note
Documentation generated by AI on 2026-03-03

◆ IsApprovedFont()

Formatting IsApprovedFont ( wxfont )

Check whether a wx font object uses an approved MachMotion font face name.

Parameters
wxfont(userdata) The wx.wxFont object to check
Returns
(boolean) True if the font face name matches Formatting.FontName or Formatting.AlternateFontName
See also
Formatting.IsApprovedScreenFont() for the equivalent check using font objects
Note
Documentation generated by AI on 2026-03-03

◆ IsApprovedScreenFont()

Formatting IsApprovedScreenFont ( font_object )

Check whether a font object uses an approved MachMotion screen font face name.

Parameters
font_object(userdata) The wx.wxFont object to check
Returns
(boolean) True if the font face name matches Formatting.FontName or Formatting.AlternateFontName
See also
Formatting.IsApprovedFont() for the equivalent check using a wxfont parameter
Note
Documentation generated by AI on 2026-03-03

◆ IsFontName()

Formatting IsFontName ( font_object ,
name  )

Check whether a wx font object has a specific face name.

Parameters
font_object(userdata) The wx.wxFont object to check
name(string) The font face name to compare against
Returns
(boolean) True if the font's face name matches the provided name
Note
Documentation generated by AI on 2026-03-03

References name().

◆ IsFontWeight()

Formatting IsFontWeight ( font_object ,
weight  )

Check whether a wx font object has a specific font weight.

Parameters
font_object(userdata) The wx.wxFont object to check
weight(number) The wx font weight constant to compare against (e.g., wx.wxFONTWEIGHT_BOLD)
Returns
(boolean) True if the font's current weight matches the provided weight constant
See also
Formatting.IsFontWeightBold() for checking bold-class weights
Note
Documentation generated by AI on 2026-03-03

◆ IsFontWeightBold()

Formatting IsFontWeightBold ( font_object )

Check whether a wx font object has a bold-class font weight.

Returns true if the font weight is any of SemiBold, Bold, or ExtraBold as defined by Formatting.FontWeightSemiBold, Formatting.FontWeightBold, and Formatting.FontWeightExtraBold.

Parameters
font_object(userdata) The wx.wxFont object to check
Returns
(boolean) True if the font weight is SemiBold, Bold, or ExtraBold; false otherwise
See also
Formatting.IsFontWeight() for checking against a specific weight constant
Note
Documentation generated by AI on 2026-03-03

◆ PartCordBG()

Formatting PartCordBG ( )

Get the part coordinates DRO background color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.PartCoords.Bg
Note
Documentation generated by AI on 2026-03-03

◆ PartCordFG()

Formatting PartCordFG ( )

Get the part coordinates DRO foreground color from the active color scheme.

Returns
(userdata) A wx.wxColour constructed from Formatting.ColorScheme.DRO.PartCoords.Fg
Note
Documentation generated by AI on 2026-03-03

◆ SetFontFamily()

Formatting SetFontFamily ( font_object ,
name  )

Set the font family of a wx font object.

Parameters
font_object(userdata) The wx.wxFont object to modify
name(number) The wx font family constant (e.g., wx.wxFONTFAMILY_DEFAULT)
Returns
(boolean) True if the font family was set successfully
Note
Documentation generated by AI on 2026-03-03

References name().

◆ SetFontName()

Formatting SetFontName ( font_object ,
name  )

Set the face name of a wx font object.

Parameters
font_object(userdata) The wx.wxFont object to modify
name(string) The font face name to apply (e.g., "Roboto SemiCondensed")
Returns
(boolean) True if the face name was set successfully
Note
Documentation generated by AI on 2026-03-03

References name().