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.
This commit is contained in:
Alastair Poole 2020-01-12 18:16:56 +00:00
parent 44f862e224
commit 12e17ee86e
1 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,10 @@
# include "config.h"
#endif
#if defined(__linux__)
# define _GNU_SOURCE
#endif
#include <Elementary.h>
#include <Ecore.h>
@ -9,6 +13,8 @@
#include "edi_private.h"
#include <string.h>
#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;