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:
parent
44f862e224
commit
12e17ee86e
|
@ -2,6 +2,10 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
|
@ -9,6 +13,8 @@
|
||||||
|
|
||||||
#include "edi_private.h"
|
#include "edi_private.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define FONT_STEP (1.0 / (EDI_FONT_MAX - EDI_FONT_MIN))
|
#define FONT_STEP (1.0 / (EDI_FONT_MAX - EDI_FONT_MIN))
|
||||||
|
|
||||||
static Evas_Object *op_fontslider, *op_fontlist, *op_fsml, *op_fbig;
|
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;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_font_monospaced_check(const char *name, Evas_Object *parent)
|
_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;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_parse_font_name(const char *full_name,
|
_parse_font_name(const char *full_name,
|
||||||
const char **name, const char **pretty_name)
|
const char **name, const char **pretty_name)
|
||||||
|
@ -329,7 +338,7 @@ edi_settings_font_add(Evas_Object *opbox)
|
||||||
{
|
{
|
||||||
f = calloc(1, sizeof(Font));
|
f = calloc(1, sizeof(Font));
|
||||||
_parse_font_name(fname, &f->full_name, &f->pretty_name);
|
_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);
|
free(f);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue