GNOME Bugzilla – Bug 83935
GtkEntry's default invisible char should be U+25CF
Last modified: 2008-09-19 13:46:08 UTC
The current default invisible character for GtkEntry is '*', which works fine. However, I think U+25CF BLACK CIRCLE is more asthetically pleasing and should be the default. Unfortunately, not all fonts provide a glyph for this character, so you'll probably need to determine whether the theme's font provides it, and fall back to the asterisk if U+25CF is not available.
Created attachment 8953 [details] Demonstration of U+25CF as the invisible character
Related to bug 63633. The problem is that a lot of fonts don't have this character, and then you will either get: - A box with the unicode code point. - A bullet selected from some other font, which might not work well.
*** Bug 307304 has been marked as a duplicate of this bug. ***
I think 2022 bullet is nicer. 2022: • vs. 25CF: ● Windows XP and Mac OS X use a bullet. Black circle looks far too big IMO. Also, bullet is available in every font. Black circle is not - so there goes that problem.
I think you'll find that bullet is not, by any stretch of the imagination, available in every font; more common than U+25CF perhaps... My experience is that many fonts have 2022 too small to look good in the usage; I dont' think XP and OS X actually use a bullet character; or if they do then they are using particular font choices that have unusually large bullets. (But I'd agree that U+25CF is too large.)
After playing with some font settings I can see your point. A patch to add configurability in rc files is on Bug 307304.
Maybe we should just draw a suitable bulled ourselves ?
Or use pango_layout_get_missing_glyph_count() to choose what to use.
Created attachment 106126 [details] [review] [PATCH] Find an appropriate invisible char through pango_layout_get_unknown_glyphs_count(). Fallback to '*' as always if nothing is found. gtk/gtkentry.c | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-)
Hi Carlos This patch should handle font changes, too.
Created attachment 106679 [details] [review] updated patch Ah, right, added this and some control to avoid setting the char if it has been explicitly set by the user.
Seems to do the job, though I am wondering if it would be a better approach to maintain and use an "actual_invisible_char" private variable instead, which can be updated on every style change based upon the "invisible_char" public variable that is set. That way, even programmer-set invisible characters are checked for their existence in the current typeface, though as a drawback it means you can't have a whole list of preferred characters. What do you think?
I tested the patch, it works nicely here. I don't think there is a need to check characters provided by programmers. If the author of a particular program uses *any* fonts or characters that diverge from defaults he should check that they are actually available and provide fallbacks himself, including the password character, imho.
The patch should disable font fallback IMO.
Created attachment 111600 [details] [review] updated patch, disables font fallback as suggested by Behdad Too bad that with this patch it resorts to BULLET instead of BLACK CIRCLE with bitstream vera sans :), but disabling font fallback makes sense.
comment on the latest patch: sorry for nitpicking, but shouldn't 0x002a be removed from invisible_chars, as there is a « return '*' » at the end of find_invisible_char?
Patch looks fine to me. You may want to fix the nit that Guillaume found. Also, we need to update the docs in several places: gtk_entry_set_visibility and gtk_entry_set_invisible_char both mention '*' as default invisible char. They should say that GTK+ picks the best available invisible character from the current font, unless one is explicitly set.
Oh, one more little issue: with the patch as is, there is no way to go back to the unset state once you've called gtk_entry_set_invisible_char(). I propose to add a boolean property invisible-char-set (you already have that field, anyway).
Go go gadget commit. A seven year old bug yesterday and a six year old one today... on a roll...
Fantastic!
Created attachment 116236 [details] [review] updated patch This patch fixes all the mentioned issues, adds gtk_entry_unset_invisible_char() and the "invisible-char-set" boolean property, and actually disables font fallback, sorry about that
The Since tags need updating to 2.16 now, and please add the new functions to gtk-sections.txt too when you are comitting.
Just committed the patch with these changes, thanks!