Comments, moved ImFontAtlas::Flags to "public" area.

This commit is contained in:
omar 2018-02-14 12:04:21 +01:00
parent fed0a884f7
commit 024e23c4d7
3 changed files with 5 additions and 3 deletions

View File

@ -1707,13 +1707,13 @@ struct ImFontAtlas
// Members // Members
//------------------------------------------- //-------------------------------------------
ImFontAtlasFlags Flags; // Build flags (see ImFontAtlasFlags_)
ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure. ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.
int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1.
// [Internal] // [Internal]
// NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.
ImFontAtlasFlags Flags; // Build flags
unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight
unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4
int TexWidth; // Texture width calculated during Build(). int TexWidth; // Texture width calculated during Build().

View File

@ -1360,15 +1360,16 @@ static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_Count_][
ImFontAtlas::ImFontAtlas() ImFontAtlas::ImFontAtlas()
{ {
Flags = 0x00;
TexID = NULL; TexID = NULL;
TexDesiredWidth = 0; TexDesiredWidth = 0;
TexGlyphPadding = 1; TexGlyphPadding = 1;
TexPixelsAlpha8 = NULL; TexPixelsAlpha8 = NULL;
TexPixelsRGBA32 = NULL; TexPixelsRGBA32 = NULL;
TexWidth = TexHeight = 0; TexWidth = TexHeight = 0;
TexUvScale = ImVec2(0.0f, 0.0f); TexUvScale = ImVec2(0.0f, 0.0f);
TexUvWhitePixel = ImVec2(0.0f, 0.0f); TexUvWhitePixel = ImVec2(0.0f, 0.0f);
Flags = 0x00;
for (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++) for (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++)
CustomRectIds[n] = -1; CustomRectIds[n] = -1;
} }

View File

@ -80,6 +80,7 @@ In this document:
- Mind the fact that some graphics drivers have texture size limitation. - Mind the fact that some graphics drivers have texture size limitation.
- Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function). - Set io.Fonts.TexDesiredWidth to specify a texture width to minimize texture height (see comment in ImFontAtlas::Build function).
- Set io.Fonts.Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight; to disable rounding the texture height to the next power of two.
- You may reduce oversampling, e.g. config.OversampleH = 2 or 1. - You may reduce oversampling, e.g. config.OversampleH = 2 or 1.
- Reduce glyphs ranges, consider calculating them based on your source data if this is possible. - Reduce glyphs ranges, consider calculating them based on your source data if this is possible.
@ -111,7 +112,7 @@ In this document:
Offset font vertically by altering the io.Font->DisplayOffset value: Offset font vertically by altering the io.Font->DisplayOffset value:
ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels); ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
font->DisplayOffset.y += 1; // Render 1 pixel down font->DisplayOffset.y = 1; // Render 1 pixel down
--------------------------------------- ---------------------------------------