From 12e17ee86e102d37f5a8555326de761c5075fa09 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sun, 12 Jan 2020 18:16:56 +0000 Subject: [PATCH] fonts: Use a more efficient method. This existing test is far too slow (though more accurate). On FreeBSD and OpenBSD we have strcasestr. Am happier to use this for the sake of "usability". Keep the code around for reference. --- src/bin/screens/edi_settings_font.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/screens/edi_settings_font.c b/src/bin/screens/edi_settings_font.c index f1bce4d..2612ae3 100644 --- a/src/bin/screens/edi_settings_font.c +++ b/src/bin/screens/edi_settings_font.c @@ -2,6 +2,10 @@ # include "config.h" #endif +#if defined(__linux__) +# define _GNU_SOURCE +#endif + #include #include @@ -9,6 +13,8 @@ #include "edi_private.h" +#include + #define FONT_STEP (1.0 / (EDI_FONT_MAX - EDI_FONT_MIN)) static Evas_Object *op_fontslider, *op_fontlist, *op_fsml, *op_fbig; @@ -48,6 +54,7 @@ _edi_settings_font_preview_add(Evas_Object *parent, const char *font_name, int f return widget; } +#if 0 static Eina_Bool _font_monospaced_check(const char *name, Evas_Object *parent) { @@ -78,6 +85,8 @@ _font_monospaced_check(const char *name, Evas_Object *parent) return EINA_TRUE; } +#endif + static void _parse_font_name(const char *full_name, const char **name, const char **pretty_name) @@ -329,7 +338,7 @@ edi_settings_font_add(Evas_Object *opbox) { f = calloc(1, sizeof(Font)); _parse_font_name(fname, &f->full_name, &f->pretty_name); - if (!_font_monospaced_check(f->full_name, opbox)) + if (!strcasestr(f->full_name, "mono")) { free(f); continue;