Re: Font blacklist

Johannes Hofmann <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Hi Sebastian,

On Tue, Sep 15, 2015 at 08:55:30PM +0200, Sebastian Geerken wrote:
> Hi!
> 
> After a dist upgrade to Debian Jessie some rather ugly fonts got
> installed, which make reading texts tedious. A possible workaround is
> attached: a blacklist for fonts (not yet committed). What do you
> think?

couldn't one get a similar effect with fontconfig using <rejectfont>?
See
http://www.freedesktop.org/software/fontconfig/fontconfig-user.html

  Johannes


> 
> Sebastian
> 
> PS: strcasecmp may not be portable.
> 

> diff -r ea3ff2a0a636 dillorc
> --- a/dillorc	Wed Jul 08 18:43:25 2015 +0000
> +++ b/dillorc	Tue Sep 15 20:48:19 2015 +0200
> @@ -73,6 +73,12 @@
>  # Minimum font size in pixels
>  #font_min_size=6
>  
> +# Define fonts dillo should not use at all, typically because their quality is
> +# that bad that you prefer alternatives. You can specify multiple fonts.
> +#font_blacklist=uglyfont
> +#font_blacklist=unattractivefont
> +#font_blacklist=awkwardfont
> +
>  # Show tooltip popups for HTML title attributes
>  #show_tooltip=YES
>  
> diff -r ea3ff2a0a636 src/prefs.c
> --- a/src/prefs.c	Wed Jul 08 18:43:25 2015 +0000
> +++ b/src/prefs.c	Tue Sep 15 20:48:19 2015 +0200
> @@ -51,6 +51,7 @@
>     prefs.font_monospace = dStrdup(PREFS_FONT_MONOSPACE);
>     prefs.font_sans_serif = dStrdup(PREFS_FONT_SANS_SERIF);
>     prefs.font_serif = dStrdup(PREFS_FONT_SERIF);
> +   prefs.font_blacklist = dList_new(16);
>     prefs.fullwindow_start = FALSE;
>  
>     /* these four constitute the geometry */
> @@ -138,6 +139,7 @@
>     dFree(prefs.font_monospace);
>     dFree(prefs.font_sans_serif);
>     dFree(prefs.font_serif);
> +   dList_free(prefs.font_blacklist);
>     a_Url_free(prefs.home);
>     dFree(prefs.http_language);
>     a_Url_free(prefs.http_proxy);
> diff -r ea3ff2a0a636 src/prefs.h
> --- a/src/prefs.h	Wed Jul 08 18:43:25 2015 +0000
> +++ b/src/prefs.h	Tue Sep 15 20:48:19 2015 +0200
> @@ -101,6 +101,7 @@
>     char *font_cursive;
>     char *font_fantasy;
>     char *font_monospace;
> +   Dlist *font_blacklist;
>     bool_t enterpress_forces_submit;
>     bool_t middle_click_opens_new_tab;
>     bool_t right_click_closes_tab;
> diff -r ea3ff2a0a636 src/prefsparser.cc
> --- a/src/prefsparser.cc	Wed Jul 08 18:43:25 2015 +0000
> +++ b/src/prefsparser.cc	Tue Sep 15 20:48:19 2015 +0200
> @@ -162,6 +162,7 @@
>        { "font_monospace", &prefs.font_monospace, PREFS_STRING, 0 },
>        { "font_sans_serif", &prefs.font_sans_serif, PREFS_STRING, 0 },
>        { "font_serif", &prefs.font_serif, PREFS_STRING, 0 },
> +      { "font_blacklist", &prefs.font_blacklist, PREFS_STRINGS, 0 },
>        { "fullwindow_start", &prefs.fullwindow_start, PREFS_BOOL, 0 },
>        { "geometry", NULL, PREFS_GEOMETRY, 0 },
>        { "home", &prefs.home, PREFS_URL, 0 },
> diff -r ea3ff2a0a636 src/styleengine.cc
> --- a/src/styleengine.cc	Wed Jul 08 18:43:25 2015 +0000
> +++ b/src/styleengine.cc	Tue Sep 15 20:48:19 2015 +0200
> @@ -391,7 +391,10 @@
>                    fontName = prefs.font_fantasy;
>                 else if (dStrAsciiCasecmp (p->value.strVal, "monospace") == 0)
>                    fontName = prefs.font_monospace;
> -               else if (Font::exists(layout, p->value.strVal))
> +               else if (Font::exists(layout, p->value.strVal) &&
> +                        !dList_find_custom(prefs.font_blacklist,
> +                                           p->value.strVal,
> +                                           (dCompareFunc) strcasecmp))
>                    fontName = p->value.strVal;
>  
>                 if (fontName) {   // font found




> _______________________________________________
> Dillo-dev mailing list
> [email protected]
> http://lists.dillo.org/cgi-bin/mailman/listinfo/dillo-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.