Mageia Bugzilla – Attachment 5572 Details for
Bug 11743
Problem with cyrillic encoding in xscreensaver lock screen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Updated patch that adds support for cyrillic and japanese UTF-8 to xscreensaver
xscreensaver-5.29-mga-utf8-support.patch (text/plain), 3.61 KB, created by
Nicolas Salguero
on 2014-11-04 14:31:06 CET
(
hide
)
Description:
Updated patch that adds support for cyrillic and japanese UTF-8 to xscreensaver
Filename:
MIME Type:
Creator:
Nicolas Salguero
Created:
2014-11-04 14:31:06 CET
Size:
3.61 KB
patch
obsolete
>diff -ruN xscreensaver-5.30.orig/driver/lock.c xscreensaver-5.30/driver/lock.c >--- xscreensaver-5.30.orig/driver/lock.c 2014-08-05 08:21:30.000000000 +0200 >+++ xscreensaver-5.30/driver/lock.c 2014-10-31 16:06:55.222502559 +0100 >@@ -523,6 +523,11 @@ > Dimension w2 = 0, w3 = 0, button_w = 0; > Dimension h2 = 0, h3 = 0, button_h = 0; > const char *passwd_string = SAMPLE_INPUT; >+ XFontSet fs; >+ char **missing_charset_list = NULL; >+ int missing_charset_count = 0; >+ char *def_string = NULL; >+ struct mlstr_line *line; > > /* Measure the user_label. */ > XTextExtents (pw->label_font, >@@ -561,6 +566,22 @@ > pw->prompt_label = mlstring_new (prompt, pw->label_font, > max_string_width_px); > >+ fs = XCreateFontSet (si->dpy, >+ "*", >+ &missing_charset_list, >+ &missing_charset_count, >+ &def_string); >+ XFreeStringList (missing_charset_list); >+ if (fs != NULL) >+ { >+ pw->prompt_label->overall_width = 0; >+ for (line = pw->prompt_label->lines; line; line = line->next_line) >+ { >+ line->line_width = XmbTextEscapement(fs, line->line, strlen(line->line)); >+ pw->prompt_label->overall_width = MAX(pw->prompt_label->overall_width, line->line_width); >+ } >+ XFreeFontSet(si->dpy, fs); >+ } > if (pw->prompt_label->overall_width > w2) > w2 = pw->prompt_label->overall_width; > >@@ -892,6 +913,10 @@ > struct tm *tm = localtime (&now); > memset (buf, 0, sizeof(buf)); > strftime (buf, sizeof(buf)-1, pw->date_label, tm); >+ XFontSet fs; >+ char **missing_charset_list = NULL; >+ int missing_charset_count = 0; >+ char *def_string = NULL; > > XSetFont (si->dpy, gc1, pw->date_font->fid); > y1 += pw->shadow_width; >@@ -899,7 +924,20 @@ > y1 += spacing/2; > sw = string_width (pw->date_font, buf); > x2 = x1 + x2 - sw; >- XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf)); >+ >+ fs = XCreateFontSet (si->dpy, >+ "*", >+ &missing_charset_list, >+ &missing_charset_count, >+ &def_string); >+ XFreeStringList (missing_charset_list); >+ if (fs == NULL) >+ XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf)); >+ else >+ { >+ XmbDrawString (si->dpy, si->passwd_dialog, fs, gc1, x2, y1, buf, strlen(buf)); >+ XFreeFontSet(si->dpy, fs); >+ } > } > > /* Set up the GCs for the "New Login" and "Unlock" buttons. >diff -ruN xscreensaver-5.30.orig/driver/mlstring.c xscreensaver-5.30/driver/mlstring.c >--- xscreensaver-5.30.orig/driver/mlstring.c 2010-10-09 02:39:09.000000000 +0200 >+++ xscreensaver-5.30/driver/mlstring.c 2014-10-31 15:43:21.165319595 +0100 >@@ -210,6 +210,10 @@ > void > mlstring_draw(Display *dpy, Drawable dialog, GC gc, mlstring *string, int x, int y) { > struct mlstr_line *line; >+ XFontSet fs; >+ char **missing_charset_list = NULL; >+ int missing_charset_count = 0; >+ char *def_string = NULL; > > if (!string) > return; >@@ -218,11 +222,22 @@ > > XSetFont(dpy, gc, string->font_id); > >+ fs = XCreateFontSet (dpy, >+ "*", >+ &missing_charset_list, >+ &missing_charset_count, >+ &def_string); >+ XFreeStringList (missing_charset_list); > for (line = string->lines; line; line = line->next_line) > { >- XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line)); >+ if (fs == NULL) >+ XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line)); >+ else >+ XmbDrawString (dpy, dialog, fs, gc, x, y, line->line, strlen(line->line)); > y += string->font_height * LINE_SPACING; > } >+ if (fs != NULL) >+ XFreeFontSet(dpy, fs); > } > > /* vim:ts=8:sw=2:noet
diff -ruN xscreensaver-5.30.orig/driver/lock.c xscreensaver-5.30/driver/lock.c --- xscreensaver-5.30.orig/driver/lock.c 2014-08-05 08:21:30.000000000 +0200 +++ xscreensaver-5.30/driver/lock.c 2014-10-31 16:06:55.222502559 +0100 @@ -523,6 +523,11 @@ Dimension w2 = 0, w3 = 0, button_w = 0; Dimension h2 = 0, h3 = 0, button_h = 0; const char *passwd_string = SAMPLE_INPUT; + XFontSet fs; + char **missing_charset_list = NULL; + int missing_charset_count = 0; + char *def_string = NULL; + struct mlstr_line *line; /* Measure the user_label. */ XTextExtents (pw->label_font, @@ -561,6 +566,22 @@ pw->prompt_label = mlstring_new (prompt, pw->label_font, max_string_width_px); + fs = XCreateFontSet (si->dpy, + "*", + &missing_charset_list, + &missing_charset_count, + &def_string); + XFreeStringList (missing_charset_list); + if (fs != NULL) + { + pw->prompt_label->overall_width = 0; + for (line = pw->prompt_label->lines; line; line = line->next_line) + { + line->line_width = XmbTextEscapement(fs, line->line, strlen(line->line)); + pw->prompt_label->overall_width = MAX(pw->prompt_label->overall_width, line->line_width); + } + XFreeFontSet(si->dpy, fs); + } if (pw->prompt_label->overall_width > w2) w2 = pw->prompt_label->overall_width; @@ -892,6 +913,10 @@ struct tm *tm = localtime (&now); memset (buf, 0, sizeof(buf)); strftime (buf, sizeof(buf)-1, pw->date_label, tm); + XFontSet fs; + char **missing_charset_list = NULL; + int missing_charset_count = 0; + char *def_string = NULL; XSetFont (si->dpy, gc1, pw->date_font->fid); y1 += pw->shadow_width; @@ -899,7 +924,20 @@ y1 += spacing/2; sw = string_width (pw->date_font, buf); x2 = x1 + x2 - sw; - XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf)); + + fs = XCreateFontSet (si->dpy, + "*", + &missing_charset_list, + &missing_charset_count, + &def_string); + XFreeStringList (missing_charset_list); + if (fs == NULL) + XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf)); + else + { + XmbDrawString (si->dpy, si->passwd_dialog, fs, gc1, x2, y1, buf, strlen(buf)); + XFreeFontSet(si->dpy, fs); + } } /* Set up the GCs for the "New Login" and "Unlock" buttons. diff -ruN xscreensaver-5.30.orig/driver/mlstring.c xscreensaver-5.30/driver/mlstring.c --- xscreensaver-5.30.orig/driver/mlstring.c 2010-10-09 02:39:09.000000000 +0200 +++ xscreensaver-5.30/driver/mlstring.c 2014-10-31 15:43:21.165319595 +0100 @@ -210,6 +210,10 @@ void mlstring_draw(Display *dpy, Drawable dialog, GC gc, mlstring *string, int x, int y) { struct mlstr_line *line; + XFontSet fs; + char **missing_charset_list = NULL; + int missing_charset_count = 0; + char *def_string = NULL; if (!string) return; @@ -218,11 +222,22 @@ XSetFont(dpy, gc, string->font_id); + fs = XCreateFontSet (dpy, + "*", + &missing_charset_list, + &missing_charset_count, + &def_string); + XFreeStringList (missing_charset_list); for (line = string->lines; line; line = line->next_line) { - XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line)); + if (fs == NULL) + XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line)); + else + XmbDrawString (dpy, dialog, fs, gc, x, y, line->line, strlen(line->line)); y += string->font_height * LINE_SPACING; } + if (fs != NULL) + XFreeFontSet(dpy, fs); } /* vim:ts=8:sw=2:noet
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 11743
:
5552
|
5553
| 5572