[client] imgui: use improved high DPI rendering

This actually makes imgui render at a higher resolution, avoiding scaling
and resulting blurriness.
This commit is contained in:
Quantum
2021-07-23 00:01:10 -04:00
committed by Geoffrey McRae
parent b5c5ecc074
commit 5d053128ac
11 changed files with 122 additions and 18 deletions

View File

@@ -29,6 +29,7 @@
#include <string.h>
#include <assert.h>
#include <math.h>
#include <fontconfig/fontconfig.h>
bool util_fileGetContents(const char * filename, char ** buffer, size_t * length)
{
@@ -258,3 +259,48 @@ int util_mergeOverlappingRects(FrameDamageRect * out, const FrameDamageRect * re
out[o++] = out[i];
return o;
}
char * util_getUIFont(const char * fontName)
{
static FcConfig * fc = NULL;
char * ttf = NULL;
if (!fc)
fc = FcInitLoadConfigAndFonts();
if (!fc)
{
DEBUG_ERROR("FcInitLoadConfigAndFonts Failed");
return NULL;
}
FcPattern * pat = FcNameParse((const FcChar8*) fontName);
if (!pat)
{
DEBUG_ERROR("FCNameParse failed");
return NULL;
}
FcConfigSubstitute(fc, pat, FcMatchPattern);
FcDefaultSubstitute(pat);
FcResult result;
FcChar8 * file = NULL;
FcPattern * match = FcFontMatch(fc, pat, &result);
if (!match)
{
DEBUG_ERROR("FcFontMatch Failed");
goto fail_parse;
}
if (FcPatternGetString(match, FC_FILE, 0, &file) == FcResultMatch)
ttf = strdup((char *) file);
else
DEBUG_ERROR("Failed to locate the requested font: %s", fontName);
FcPatternDestroy(match);
fail_parse:
FcPatternDestroy(pat);
return ttf;
}