GXUNC class

class GXUNC(handle=0)

GXUNC class.

This library is not a class. Use the GXUNC library functions to work with Unicode characters and strings. Since version 6.2 all strings are represented internally in the the GX engine as UTF-8. The character set concept was discarded as a way to work with characters that does not fall within the normal ASCII range 0x01-0x7F. The utilities here aids with any new functionality that is now possible (e.g. an expanded symbol range with TrueType fonts).

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod is_valid_utf16_char(ch)

Check if the UTF-16 value is a valid Unicode character code point.

Parameters:ch (int) – UTF-16 value (32-bit int, lower 16 bits used, upper bits reserved for future use)
Return type:bool

New in version 6.2.

License: Geosoft Open License

classmethod null()

A null (undefined) instance of GXUNC

Returns:A null GXUNC
Return type:GXUNC
classmethod utf16_val_to_str(ch, str_val)

Convert a UTF-16 value to a UTF-8 encoded string.

Parameters:
  • ch (int) – UTF-16 value (32-bit int, lower 16 bits used, upper bits reserved for future use)
  • str_val (str_ref) – Converted string

New in version 6.2.

License: Geosoft Open License

Note: An empty string will be returned for invalid symbols

classmethod valid_symbol(face, geofont, number)

See if a Symbol number is valid in a particular font.

Parameters:
  • face (str) – Face name (undecorated)
  • geofont (bool) – Geosoft font?
  • number (int) – Symbol number
Return type:

bool

New in version 6.2.

License: Geosoft Open License

classmethod validate_symbols(vv, face, geofont)

High performance method to see if a set of symbols are valid in a particular font.

Parameters:
  • vv (GXVV) – GXVV of symbols
  • face (str) – Face name (undecorated)
  • geofont (bool) – Geosoft font?

New in version 6.2.

License: Geosoft Open License

Note: Invalid symbols in the GXVV will be set to -1 by this call. GXVV has to be of type GS_LONG.

UTF8 constants

UTF-8 Defines

UTF8_MAX_CHAR

Maximum width of a single Unicode code point as a UTF8 constants string, including terminator (5)

gxapi.UTF8_MAX_CHAR = 5