Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
ImFontGlyphRangesBuilder Struct Reference

#include <src/imgui/imgui.h>

+ Collaboration diagram for ImFontGlyphRangesBuilder:

Public Member Functions

 ImFontGlyphRangesBuilder ()
 
void Clear ()
 
bool GetBit (size_t n) const
 
void SetBit (size_t n)
 
void AddChar (ImWchar c)
 
IMGUI_API void AddText (const char *text, const char *text_end=NULL)
 
IMGUI_API void AddRanges (const ImWchar *ranges)
 
IMGUI_API void BuildRanges (ImVector< ImWchar > *out_ranges)
 

Public Attributes

ImVector< ImU32UsedChars
 

Detailed Description

Constructor & Destructor Documentation

◆ ImFontGlyphRangesBuilder()

ImFontGlyphRangesBuilder::ImFontGlyphRangesBuilder ( )
inline
2539{ Clear(); }
void Clear()
Definition imgui.h:2540

Member Function Documentation

◆ AddChar()

void ImFontGlyphRangesBuilder::AddChar ( ImWchar  c)
inline
2543{ SetBit(c); } // Add character
void SetBit(size_t n)
Definition imgui.h:2542

Referenced by AddRanges(), AddText(), and Slic3r::GUI::ImGuiWrapper::init_font().

+ Here is the caller graph for this function:

◆ AddRanges()

void ImFontGlyphRangesBuilder::AddRanges ( const ImWchar ranges)
3077{
3078 for (; ranges[0]; ranges += 2)
3079 for (ImWchar c = ranges[0]; c <= ranges[1]; c++)
3080 AddChar(c);
3081}
ImWchar16 ImWchar
Definition imgui.h:220
void AddChar(ImWchar c)
Definition imgui.h:2543

References AddChar().

Referenced by Slic3r::GUI::Emboss::StyleManager::create_imgui_font(), and Slic3r::GUI::ImGuiWrapper::init_font().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddText()

void ImFontGlyphRangesBuilder::AddText ( const char *  text,
const char *  text_end = NULL 
)
3064{
3065 while (text_end ? (text < text_end) : *text)
3066 {
3067 unsigned int c = 0;
3068 int c_len = ImTextCharFromUtf8(&c, text, text_end);
3069 text += c_len;
3070 if (c_len == 0)
3071 break;
3072 AddChar((ImWchar)c);
3073 }
3074}
int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end)
Definition imgui.cpp:1619

References AddChar(), and ImTextCharFromUtf8().

Referenced by Slic3r::GUI::Emboss::StyleManager::create_imgui_font().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildRanges()

void ImFontGlyphRangesBuilder::BuildRanges ( ImVector< ImWchar > *  out_ranges)
3084{
3085 const int max_codepoint = IM_UNICODE_CODEPOINT_MAX;
3086 for (int n = 0; n <= max_codepoint; n++)
3087 if (GetBit(n))
3088 {
3089 out_ranges->push_back((ImWchar)n);
3090 while (n < max_codepoint && GetBit(n + 1))
3091 n++;
3092 out_ranges->push_back((ImWchar)n);
3093 }
3094 out_ranges->push_back(0);
3095}
#define IM_UNICODE_CODEPOINT_MAX
Definition imgui.h:2010
bool GetBit(size_t n) const
Definition imgui.h:2541
void push_back(const T &v)
Definition imgui.h:1696

References GetBit(), IM_UNICODE_CODEPOINT_MAX, and ImVector< T >::push_back().

Referenced by Slic3r::GUI::Emboss::StyleManager::create_imgui_font(), and Slic3r::GUI::ImGuiWrapper::init_font().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Clear()

void ImFontGlyphRangesBuilder::Clear ( )
inline
2540{ int size_in_bytes = (IM_UNICODE_CODEPOINT_MAX + 1) / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }
unsigned int ImU32
Definition imgui.h:229
ImVector< ImU32 > UsedChars
Definition imgui.h:2537
T * Data
Definition imgui.h:1657
void resize(int new_size)
Definition imgui.h:1690

References ImVector< T >::Data, IM_UNICODE_CODEPOINT_MAX, and ImVector< T >::resize().

+ Here is the call graph for this function:

◆ GetBit()

bool ImFontGlyphRangesBuilder::GetBit ( size_t  n) const
inline
2541{ int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; } // Get bit n in the array

Referenced by BuildRanges().

+ Here is the caller graph for this function:

◆ SetBit()

void ImFontGlyphRangesBuilder::SetBit ( size_t  n)
inline
2542{ int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array

Member Data Documentation

◆ UsedChars

ImVector<ImU32> ImFontGlyphRangesBuilder::UsedChars

The documentation for this struct was generated from the following files: