TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Text

Shaping, fonts, text atlases, numeric text and the clipboard. More...

Concepts

concept  tachyon::NumericFieldType

Classes

class  tachyon::IClipboard
 The clipboard text editors copy to and paste from; GUIApplication::SetClipboard sets one (default: SDL's, or LocalClipboard without SDL). More...
class  tachyon::LocalClipboard
 A clipboard inside the process, not shared with other applications. More...
struct  tachyon::IconTextPlacement
 Placement of a text + icon pair inside rect: More...
struct  tachyon::NumericFieldConfig< T >
 Drag speed and range of a numeric Field, specialized per value type. More...
struct  tachyon::NumericFieldConfig< double >
 NumericFieldConfig for double values. More...
struct  tachyon::NumericFieldConfig< float >
 NumericFieldConfig for float values. More...
struct  tachyon::NumericFieldConfig< uint64_t >
 NumericFieldConfig for uint64_t values. More...
struct  tachyon::NumericFieldConfig< uint32_t >
 NumericFieldConfig for uint32_t values. More...
struct  tachyon::NumericFieldConfig< uint16_t >
 NumericFieldConfig for uint16_t values. More...
struct  tachyon::NumericFieldConfig< uint8_t >
 NumericFieldConfig for uint8_t values. More...
struct  tachyon::NumericFieldConfig< int64_t >
 NumericFieldConfig for int64_t values. More...
struct  tachyon::NumericFieldConfig< int32_t >
 NumericFieldConfig for int32_t values. More...
struct  tachyon::NumericFieldConfig< int16_t >
 NumericFieldConfig for int16_t values. More...
struct  tachyon::NumericFieldConfig< int8_t >
 NumericFieldConfig for int8_t values. More...
union  tachyon::NumericValue
class  tachyon::TextAtlasManager
class  tachyon::ITextValidator
 What an editable field takes as text, asked while it is edited. More...
struct  tachyon::TextConverter< T >
 Turns a field's value into the text it shows and edits, and edited text back into a value. More...
struct  tachyon::TextConverter< T >
struct  tachyon::FontFaceSource
 One face of a font family: a font file, or font data in memory that stays valid while the family is registered (embedded in the executable, say). More...
struct  tachyon::IconMeasurement
struct  tachyon::TextMeasurement
struct  tachyon::TextWrapContext
struct  tachyon::LinkStyle
 Colors of a link run, normal and hovered. More...
struct  tachyon::ContentRun
 One run of rich text: a piece of text or an inline icon. More...
class  tachyon::ITextSystem
 Text and icon registration, measurement, rendering and editing. More...
class  tachyon::SkribidiTextSystem
 Skribidi-based implementation of ITextSystem. More...

Enumerations

enum class  tachyon::NumericType {
  tachyon::NumericType::None , tachyon::NumericType::TypeUnsignedBit = 16 , tachyon::NumericType::TypeSignedBit = 32 , tachyon::NumericType::TypeFloatBit = 64 ,
  tachyon::NumericType::TypeUInt8 = TypeUnsignedBit | 1 , tachyon::NumericType::TypeUInt16 = TypeUnsignedBit | 2 , tachyon::NumericType::TypeUInt32 = TypeUnsignedBit | 3 , tachyon::NumericType::TypeUInt64 = TypeUnsignedBit | 4 ,
  tachyon::NumericType::TypeInt8 = TypeSignedBit | 1 , tachyon::NumericType::TypeInt16 = TypeSignedBit | 2 , tachyon::NumericType::TypeInt32 = TypeSignedBit | 3 , tachyon::NumericType::TypeInt64 = TypeSignedBit | 4 ,
  tachyon::NumericType::TypeFloat = TypeFloatBit | 1 , tachyon::NumericType::TypeDouble = TypeFloatBit | 2
}
enum class  tachyon::TextureIndex : uint32_t { tachyon::TextureIndex::Invalid = 0 }
enum class  tachyon::TextEditBehavior : uint8_t {
  tachyon::TextEditBehavior::None = 0 , tachyon::TextEditBehavior::ContinuousUpdate = 1 << 0 , tachyon::TextEditBehavior::Multiline = 1 << 1 , tachyon::TextEditBehavior::AcceptTabs = 1 << 2 ,
  tachyon::TextEditBehavior::ReadOnly = 1 << 3
}

Functions

int32_t tachyon::HorizontalAlignOffset (TextAlign horizontalAlignment, int32_t boxWidth, int32_t contentWidth)
 X offset, in pixels, of contentWidth content aligned inside a boxWidth box.
int32_t tachyon::VerticalAlignOffset (TextAlign verticalAlignment, int32_t boxHeight, int32_t contentHeight)
IconTextPlacement tachyon::ComputeIconTextPlacement (const IntRect &rect, int32_t textWidth, int32_t textHeight, const IconMeasurement &iconMeasurement, IconSide iconSide, int32_t iconTextGap, TextAlign horizontalAlignment, TextAlign verticalAlignment=TextAlign::Start)
int32_t tachyon::IconAwareLayoutMaxWidth (int32_t rectWidth, const IconMeasurement &iconMeasurement, IconSide iconSide, int32_t iconTextGap, bool hasIcon)
 The max width to lay text out in: rectWidth minus the icon and gap for a Left / Right icon, so text-align can't reach into the icon area; rectWidth otherwise.
std::string tachyon::FormatNumber (NumericType type, const NumericValue &value)
 value as text; floats use up to 9 significant digits, NaN and infinities spelled out.
bool tachyon::ParseNumber (std::string_view text, NumericType type, NumericValue &outValue)
 The whole text as a number of type: in range and, for floats, finite.
bool tachyon::FilterNumberText (NumericType type, std::string &text)
 Strips what a number of type can't hold (letters, a second dot, ...).
bool tachyon::IsNumberCharacter (NumericType type, uint32_t codepoint)
 Whether codepoint can be typed into a number of type.
template<typename T>
constexpr NumericType tachyon::GetNumericType (const T &)
template<>
constexpr NumericType tachyon::GetNumericType (const int8_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const int16_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const int32_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const int64_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const uint8_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const uint16_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const uint32_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const uint64_t &)
template<>
constexpr NumericType tachyon::GetNumericType (const float &)
template<>
constexpr NumericType tachyon::GetNumericType (const double &)
template<typename T>
NumericType tachyon::CopyNumericTypeTo (const T &, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const int8_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const int16_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const int32_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const int64_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const uint8_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const uint16_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const uint32_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const uint64_t &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const float &src, NumericValue &dst)
template<>
NumericType tachyon::CopyNumericTypeTo (const double &src, NumericValue &dst)
template<typename T>
bool tachyon::CopyNumericTypeTo (NumericType, const NumericValue &, T &)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, int8_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, int16_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, int32_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, int64_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, uint8_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, uint16_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, uint32_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, uint64_t &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, float &dst)
template<>
bool tachyon::CopyNumericTypeTo (NumericType type, const NumericValue &src, double &dst)
template<typename T>
bool tachyon::EqualsNumericType (NumericType, NumericValue &, const T &)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const int8_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const int16_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const int32_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const int64_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const uint8_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const uint16_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const uint32_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const uint64_t &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const float &right)
template<>
bool tachyon::EqualsNumericType (NumericType type, NumericValue &left, const double &right)
bool tachyon::EqualsNumericType (NumericType leftType, NumericValue &left, NumericType rightType, const NumericValue &right)
template<typename T>
const TextConverter< T > & tachyon::DefaultTextConverter ()
 The converter a field uses for T when it is given none.
uint32_t tachyon::NextUtf8Codepoint (std::string_view text, size_t &i)
 The codepoint starting at text[i], with i moved past it.
void tachyon::AppendUtf8 (std::string &out, uint32_t codepoint)
std::string tachyon::ToValidUtf8 (std::string_view text)
 Text with each malformed byte replaced by U+FFFD (the replacement character).
size_t tachyon::LastUtf8CodepointSize (std::string_view text)
 The byte length of text's last codepoint (0 when empty).

Variables

enum tachyon::ImageIndex
 defined in gui_image.h
constexpr uint32_t tachyon::kInvalidCodepoint = 0xFFFFFFFFu

Detailed Description

Shaping, fonts, text atlases, numeric text and the clipboard.

Enumeration Type Documentation

◆ NumericType

enum class tachyon::NumericType
strong

#include <gui_core/text/gui_numeric_type.h>

Enumerator
None 

not a numeric type

TypeUnsignedBit 
TypeSignedBit 
TypeFloatBit 
TypeUInt8 
TypeUInt16 
TypeUInt32 
TypeUInt64 
TypeInt8 
TypeInt16 
TypeInt32 
TypeInt64 
TypeFloat 
TypeDouble 

◆ TextureIndex

enum class tachyon::TextureIndex : uint32_t
strong

#include <gui_core/text/gui_text_atlas_manager.h>

Enumerator
Invalid 

◆ TextEditBehavior

enum class tachyon::TextEditBehavior : uint8_t
strong

#include <gui_core/text/gui_text_system.h>

Enumerator
None 
ContinuousUpdate 

update the text on every keystroke, not only on commit

Multiline 

Enter inserts a newline instead of committing.

AcceptTabs 

Tab inserts a tab character instead of moving focus.

ReadOnly 

selectable and copyable, but not editable

Function Documentation

◆ HorizontalAlignOffset()

int32_t tachyon::HorizontalAlignOffset ( TextAlign horizontalAlignment,
int32_t boxWidth,
int32_t contentWidth )
inline

#include <gui_core/text/gui_icon_text_placement.h>

X offset, in pixels, of contentWidth content aligned inside a boxWidth box.

Vertical values map as skribidi does: Top acts as left, Bottom as right.

◆ VerticalAlignOffset()

int32_t tachyon::VerticalAlignOffset ( TextAlign verticalAlignment,
int32_t boxHeight,
int32_t contentHeight )
inline

◆ ComputeIconTextPlacement()

IconTextPlacement tachyon::ComputeIconTextPlacement ( const IntRect & rect,
int32_t textWidth,
int32_t textHeight,
const IconMeasurement & iconMeasurement,
IconSide iconSide,
int32_t iconTextGap,
TextAlign horizontalAlignment,
TextAlign verticalAlignment = TextAlign::Start )
inline

◆ IconAwareLayoutMaxWidth()

int32_t tachyon::IconAwareLayoutMaxWidth ( int32_t rectWidth,
const IconMeasurement & iconMeasurement,
IconSide iconSide,
int32_t iconTextGap,
bool hasIcon )
inline

#include <gui_core/text/gui_icon_text_placement.h>

The max width to lay text out in: rectWidth minus the icon and gap for a Left / Right icon, so text-align can't reach into the icon area; rectWidth otherwise.

◆ FormatNumber()

std::string tachyon::FormatNumber ( NumericType type,
const NumericValue & value )

#include <gui_core/text/gui_numeric_text.h>

value as text; floats use up to 9 significant digits, NaN and infinities spelled out.

◆ ParseNumber()

bool tachyon::ParseNumber ( std::string_view text,
NumericType type,
NumericValue & outValue )

#include <gui_core/text/gui_numeric_text.h>

The whole text as a number of type: in range and, for floats, finite.

◆ FilterNumberText()

bool tachyon::FilterNumberText ( NumericType type,
std::string & text )

#include <gui_core/text/gui_numeric_text.h>

Strips what a number of type can't hold (letters, a second dot, ...).

Partial forms that can still be finished ("-", "1e-") stay. True if Text changed.

◆ IsNumberCharacter()

bool tachyon::IsNumberCharacter ( NumericType type,
uint32_t codepoint )

#include <gui_core/text/gui_numeric_text.h>

Whether codepoint can be typed into a number of type.

◆ GetNumericType() [1/11]

template<typename T>
NumericType tachyon::GetNumericType ( const T & )
constexpr

◆ GetNumericType() [2/11]

template<>
NumericType tachyon::GetNumericType ( const int8_t & )
constexpr

◆ GetNumericType() [3/11]

template<>
NumericType tachyon::GetNumericType ( const int16_t & )
constexpr

◆ GetNumericType() [4/11]

template<>
NumericType tachyon::GetNumericType ( const int32_t & )
constexpr

◆ GetNumericType() [5/11]

template<>
NumericType tachyon::GetNumericType ( const int64_t & )
constexpr

◆ GetNumericType() [6/11]

template<>
NumericType tachyon::GetNumericType ( const uint8_t & )
constexpr

◆ GetNumericType() [7/11]

template<>
NumericType tachyon::GetNumericType ( const uint16_t & )
constexpr

◆ GetNumericType() [8/11]

template<>
NumericType tachyon::GetNumericType ( const uint32_t & )
constexpr

◆ GetNumericType() [9/11]

template<>
NumericType tachyon::GetNumericType ( const uint64_t & )
constexpr

◆ GetNumericType() [10/11]

template<>
NumericType tachyon::GetNumericType ( const float & )
constexpr

◆ GetNumericType() [11/11]

template<>
NumericType tachyon::GetNumericType ( const double & )
constexpr

◆ CopyNumericTypeTo() [1/22]

template<typename T>
NumericType tachyon::CopyNumericTypeTo ( const T & ,
NumericValue & dst )

◆ CopyNumericTypeTo() [2/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const int8_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [3/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const int16_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [4/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const int32_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [5/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const int64_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [6/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const uint8_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [7/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const uint16_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [8/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const uint32_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [9/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const uint64_t & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [10/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const float & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [11/22]

template<>
NumericType tachyon::CopyNumericTypeTo ( const double & src,
NumericValue & dst )
inline

◆ CopyNumericTypeTo() [12/22]

template<typename T>
bool tachyon::CopyNumericTypeTo ( NumericType ,
const NumericValue & ,
T &  )

◆ CopyNumericTypeTo() [13/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
int8_t & dst )
inline

◆ CopyNumericTypeTo() [14/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
int16_t & dst )
inline

◆ CopyNumericTypeTo() [15/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
int32_t & dst )
inline

◆ CopyNumericTypeTo() [16/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
int64_t & dst )
inline

◆ CopyNumericTypeTo() [17/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
uint8_t & dst )
inline

◆ CopyNumericTypeTo() [18/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
uint16_t & dst )
inline

◆ CopyNumericTypeTo() [19/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
uint32_t & dst )
inline

◆ CopyNumericTypeTo() [20/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
uint64_t & dst )
inline

◆ CopyNumericTypeTo() [21/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
float & dst )
inline

◆ CopyNumericTypeTo() [22/22]

template<>
bool tachyon::CopyNumericTypeTo ( NumericType type,
const NumericValue & src,
double & dst )
inline

◆ EqualsNumericType() [1/12]

template<typename T>
bool tachyon::EqualsNumericType ( NumericType ,
NumericValue & ,
const T &  )

◆ EqualsNumericType() [2/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const int8_t & right )
inline

◆ EqualsNumericType() [3/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const int16_t & right )
inline

◆ EqualsNumericType() [4/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const int32_t & right )
inline

◆ EqualsNumericType() [5/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const int64_t & right )
inline

◆ EqualsNumericType() [6/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const uint8_t & right )
inline

◆ EqualsNumericType() [7/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const uint16_t & right )
inline

◆ EqualsNumericType() [8/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const uint32_t & right )
inline

◆ EqualsNumericType() [9/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const uint64_t & right )
inline

◆ EqualsNumericType() [10/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const float & right )
inline

◆ EqualsNumericType() [11/12]

template<>
bool tachyon::EqualsNumericType ( NumericType type,
NumericValue & left,
const double & right )
inline

◆ EqualsNumericType() [12/12]

bool tachyon::EqualsNumericType ( NumericType leftType,
NumericValue & left,
NumericType rightType,
const NumericValue & right )
inline

◆ DefaultTextConverter()

template<typename T>
const TextConverter< T > & tachyon::DefaultTextConverter ( )

#include <gui_core/text/gui_text_converter.h>

The converter a field uses for T when it is given none.

◆ NextUtf8Codepoint()

uint32_t tachyon::NextUtf8Codepoint ( std::string_view text,
size_t & i )
inline

#include <gui_core/text/gui_utf8.h>

The codepoint starting at text[i], with i moved past it.

kInvalidCodepoint for a malformed or cut-off sequence (i moves one byte).

◆ AppendUtf8()

void tachyon::AppendUtf8 ( std::string & out,
uint32_t codepoint )
inline

◆ ToValidUtf8()

std::string tachyon::ToValidUtf8 ( std::string_view text)
inline

#include <gui_core/text/gui_utf8.h>

Text with each malformed byte replaced by U+FFFD (the replacement character).

◆ LastUtf8CodepointSize()

size_t tachyon::LastUtf8CodepointSize ( std::string_view text)
inline

#include <gui_core/text/gui_utf8.h>

The byte length of text's last codepoint (0 when empty).

Variable Documentation

◆ ImageIndex

◆ kInvalidCodepoint

uint32_t tachyon::kInvalidCodepoint = 0xFFFFFFFFu
inlineconstexpr