rigImGui 0.1.1
RigKit pack API - rigImGui
Loading...
Searching...
No Matches
rigkit::FontPicker Namespace Reference

Reusable font path + optional size control for Preferences / effect UIs. More...

Functions

std::vector< std::string > listInstalledFonts ()
 Filenames (not full paths) found under the fonts data directory.
std::string resolveFontPath (const std::string &pathOrName)
 Resolve relative name against fonts dir, or return absolute path as-is.
bool draw (const char *strId, std::string &path, float *sizePx, IMui *ui, std::function< void(std::string)> onBrowse=nullptr, float *weight=nullptr)
 Draw combo of installed fonts + Browse... (+ optional size / weight).
bool bakeGlyphAtlas (const std::string &fontPathOrName, float sizePixels, const char *codepoints, unsigned &outTexture, int &outW, int &outH, std::vector< float > &outUVs)
 Bake a standalone glyph atlas (ImGui atlas builder to GL texture).

Detailed Description

Reusable font path + optional size control for Preferences / effect UIs.

Lists TTFs under AppPaths::getFontsDir(), Browse via IMui file dialog.

Function Documentation

◆ bakeGlyphAtlas()

bool rigkit::FontPicker::bakeGlyphAtlas ( const std::string & fontPathOrName,
float sizePixels,
const char * codepoints,
unsigned & outTexture,
int & outW,
int & outH,
std::vector< float > & outUVs )

Bake a standalone glyph atlas (ImGui atlas builder to GL texture).

Does not touch the live UI font. Caller owns outTexture (glDeleteTextures). outUVs is 4 floats per character in codepoints (u0,v0,u1,v1).

◆ draw()

bool rigkit::FontPicker::draw ( const char * strId,
std::string & path,
float * sizePx,
IMui * ui,
std::function< void(std::string)> onBrowse = nullptr,
float * weight = nullptr )

Draw combo of installed fonts + Browse... (+ optional size / weight).

Parameters
sizePxNull to hide size control.
uiUsed for Browse (openFileDialog). May be null (Browse disabled).
onBrowseOptional; when set, Browse uses this instead of writing path (required when path is a temporary).
weightNull to hide the wght slider (100-900). Needs a variable font plus FreeType at load time.
Returns
true if path, size, or weight changed this frame (sync edits only).