[PATCH:twm] Do not try to extend the font-pattern with a wild-card.

Alan Coopersmith alan.coopersmith at oracle.com
Sun Jul 19 08:15:50 PDT 2015


On 07/19/15 03:05 AM, Thomas Klausner wrote:
> From: Michael van Elst <mlelstv at NetBSD.org>
>
> This will almost always select the wrong fontset and use wrong metrics.
>
> Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
> ---
>   src/util.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/src/util.c b/src/util.c
> index 9e5675a..4b94051 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -589,17 +589,13 @@ GetFont(MyFont *font)
>       int ascent;
>       int descent;
>       int fnum;
> -    char *basename2;
>
>       if (use_fontset) {
>   	if (font->fontset != NULL){
>   	    XFreeFontSet(dpy, font->fontset);
>   	}
>
> -	basename2 = malloc(strlen(font->name) + 3);
> -	if (basename2) sprintf(basename2, "%s,*", font->name);
> -	else basename2 = font->name;
> -	if( (font->fontset = XCreateFontSet(dpy, basename2,
> +	if( (font->fontset = XCreateFontSet(dpy, font->name,
>   					    &missing_charset_list_return,
>   					    &missing_charset_count_return,
>   					    &def_string_return)) == NULL) {
> @@ -607,7 +603,6 @@ GetFont(MyFont *font)
>   			 ProgramName, font->name);
>   	    exit(1);
>   	}
> -	if (basename2 != font->name) free(basename2);
>   	for(i=0; i<missing_charset_count_return; i++){
>   	    printf("%s: warning: font for charset %s is lacking.\n",
>   		   ProgramName, missing_charset_list_return[i]);
>

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list