# ZTextMetrics

class Tui::ZTextMetrics

  ZTextMetrics allows measureing the size of a given text and how it is placed into cells. As the details of this process depend on the charateristics of the specific terminal instance, ZTextMetrics can only be obtained directly (by `ZTextMetrics Tui::ZTerminal::textMetrics() const`) or indirectly (by `ZTextMetrics Tui::ZPainter::textMetrics() const`) from a terminal.

  struct ClusterSize
    int codeUnits
    int codePoints
    int columns
  Tui::ZTextMetrics::ClusterSize nextCluster(const QString &data, int offset) const;
  Tui::ZTextMetrics::ClusterSize nextCluster(const QChar *data, int size) const;
  Tui::ZTextMetrics::ClusterSize nextCluster(const char32_t *data, int size) const;
  Tui::ZTextMetrics::ClusterSize nextCluster(const char16_t *data, int size) const;
  Tui::ZTextMetrics::ClusterSize nextCluster(const char *stringUtf8, int utf8CodeUnits) const;
  Tui::ZTextMetrics::ClusterSize nextCluster(QStringView data) const
  Tui::ZTextMetrics::ClusterSize nextCluster(std::u16string_view data) const
  Tui::ZTextMetrics::ClusterSize nextCluster(std::string_view data) const

    The overloads marked with `noconv` participates in overload resolution only if the `string` parameter matches without implicit conversion.

    Return metrics for the next cluster found in the input string.

  Tui::ZTextMetrics::ClusterSize splitByColumns(const QString &data, int maxWidth) const;
  Tui::ZTextMetrics::ClusterSize splitByColumns(const QChar *data, int size, int maxWidth) const;
  Tui::ZTextMetrics::ClusterSize splitByColumns(const char32_t *data, int size, int maxWidth) const;
  Tui::ZTextMetrics::ClusterSize splitByColumns(const char16_t *data, int size, int maxWidth) const;
  Tui::ZTextMetrics::ClusterSize splitByColumns(const char *stringUtf8, int utf8CodeUnits, int maxWidth) const;
  Tui::ZTextMetrics::ClusterSize splitByColumns(QStringView data, int maxWidth) const
  Tui::ZTextMetrics::ClusterSize splitByColumns(std::u16string_view data, int maxWidth) const
  Tui::ZTextMetrics::ClusterSize splitByColumns(std::string_view data, int maxWidth) const

    The overloads marked with `noconv` participates in overload resolution only if the `string` parameter matches without implicit conversion.

    Return metrics for the part of the input string that fits into `maxWidth` columns.

  int sizeInColumns(const QString &data) const;
  int sizeInColumns(const QChar *data, int size) const;
  int sizeInColumns(const char32_t *data, int size) const;
  int sizeInColumns(const char16_t *data, int size) const;
  int sizeInColumns(const char *stringUtf8, int utf8CodeUnits) const;
  int sizeInColumns(QStringView data) const
  int sizeInColumns(std::u16string_view data) const
  int sizeInColumns(std::string_view data) const

    The overloads marked with `noconv` participates in overload resolution only if the `string` parameter matches without implicit conversion.

    Return the size in columns for the passed input string.

  int sizeInClusters(const QString &data) const;
  int sizeInClusters(const QChar *data, int size) const;
  int sizeInClusters(const char32_t *data, int size) const;
  int sizeInClusters(const char16_t *data, int size) const;
  int sizeInClusters(const char *stringUtf8, int utf8CodeUnits) const;
  int sizeInClusters(QStringView data) const
  int sizeInClusters(std::u16string_view data) const
  int sizeInClusters(std::string_view data) const

    The overloads marked with `noconv` participates in overload resolution only if the `string` parameter matches without implicit conversion.

    Return the size in clusters for the passed input string.