mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-03 05:57:38 -05:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp
This commit is contained in:
17
misc/fonts/ProggyVector-ExtractScript.txt
Normal file
17
misc/fonts/ProggyVector-ExtractScript.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
# Usage: fontforge.exe -script ProggyVector-ExtractScript.txt
|
||||
Open("ProggyVector-Regular.ttf")
|
||||
SelectMore(0x20,0xFF)
|
||||
SelectMore(0x20AC) # Euro sign
|
||||
SelectInvert()
|
||||
DetachAndRemoveGlyphs()
|
||||
SelectAll()
|
||||
RemoveOverlap()
|
||||
Simplify()
|
||||
i=0
|
||||
while (i < 23)
|
||||
SetTTFName(0x409,i,"")
|
||||
i=i+1
|
||||
endloop
|
||||
SetFontNames(".",".",".",".",".",".")
|
||||
Generate("ProggyVector-minimal.ttf")
|
||||
# At this point you can use binary_to_compressed_c.exe -u8 ProggyVector-minimal.ttf proggy_vector_minimal_ttf
|
||||
@@ -153,7 +153,7 @@ struct ImGui_ImplFreeType_Data
|
||||
struct ImGui_ImplFreeType_FontSrcData
|
||||
{
|
||||
// Initialize from an external data buffer. Doesn't copy data, and you must ensure it stays valid up to this object lifetime.
|
||||
bool InitFont(FT_Library ft_library, ImFontConfig* src, ImGuiFreeTypeLoaderFlags extra_user_flags);
|
||||
bool InitFont(FT_Library ft_library, const ImFontConfig* src, ImGuiFreeTypeLoaderFlags extra_user_flags);
|
||||
void CloseFont();
|
||||
ImGui_ImplFreeType_FontSrcData() { memset((void*)this, 0, sizeof(*this)); }
|
||||
~ImGui_ImplFreeType_FontSrcData() { CloseFont(); }
|
||||
@@ -172,7 +172,7 @@ struct ImGui_ImplFreeType_FontSrcBakedData
|
||||
ImGui_ImplFreeType_FontSrcBakedData() { memset((void*)this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
bool ImGui_ImplFreeType_FontSrcData::InitFont(FT_Library ft_library, ImFontConfig* src, ImGuiFreeTypeLoaderFlags extra_font_loader_flags)
|
||||
bool ImGui_ImplFreeType_FontSrcData::InitFont(FT_Library ft_library, const ImFontConfig* src, ImGuiFreeTypeLoaderFlags extra_font_loader_flags)
|
||||
{
|
||||
FT_Error error = FT_New_Memory_Face(ft_library, (const FT_Byte*)src->FontData, (FT_Long)src->FontDataSize, (FT_Long)src->FontNo, &FtFace);
|
||||
if (error != 0)
|
||||
@@ -187,12 +187,8 @@ bool ImGui_ImplFreeType_FontSrcData::InitFont(FT_Library ft_library, ImFontConfi
|
||||
LoadFlags = 0;
|
||||
if ((UserFlags & ImGuiFreeTypeLoaderFlags_Bitmap) == 0)
|
||||
LoadFlags |= FT_LOAD_NO_BITMAP;
|
||||
|
||||
if (UserFlags & ImGuiFreeTypeLoaderFlags_NoHinting)
|
||||
LoadFlags |= FT_LOAD_NO_HINTING;
|
||||
else
|
||||
src->PixelSnapH = true; // FIXME: A bit weird to do this this way.
|
||||
|
||||
if (UserFlags & ImGuiFreeTypeLoaderFlags_NoAutoHint)
|
||||
LoadFlags |= FT_LOAD_NO_AUTOHINT;
|
||||
if (UserFlags & ImGuiFreeTypeLoaderFlags_ForceAutoHint)
|
||||
@@ -424,6 +420,7 @@ static bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* s
|
||||
float size = baked->Size;
|
||||
if (src->MergeMode && src->SizePixels != 0.0f)
|
||||
size *= (src->SizePixels / baked->OwnerFont->Sources[0]->SizePixels);
|
||||
size *= src->ExtraSizeScale;
|
||||
|
||||
ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
|
||||
bd_font_data->BakedLastActivated = baked;
|
||||
@@ -541,12 +538,8 @@ static bool ImGui_ImplFreeType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConf
|
||||
|
||||
const float ref_size = baked->OwnerFont->Sources[0]->SizePixels;
|
||||
const float offsets_scale = (ref_size != 0.0f) ? (baked->Size / ref_size) : 1.0f;
|
||||
float font_off_x = (src->GlyphOffset.x * offsets_scale);
|
||||
float font_off_y = (src->GlyphOffset.y * offsets_scale) + baked->Ascent;
|
||||
if (src->PixelSnapH) // Snap scaled offset. This is to mitigate backward compatibility issues for GlyphOffset, but a better design would be welcome.
|
||||
font_off_x = IM_ROUND(font_off_x);
|
||||
if (src->PixelSnapV)
|
||||
font_off_y = IM_ROUND(font_off_y);
|
||||
float font_off_x = ImFloor(src->GlyphOffset.x * offsets_scale + 0.5f); // Snap scaled offset.
|
||||
float font_off_y = ImFloor(src->GlyphOffset.y * offsets_scale + 0.5f) + baked->Ascent;
|
||||
float recip_h = 1.0f / rasterizer_density;
|
||||
float recip_v = 1.0f / rasterizer_density;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user