@elextr requested changes on this pull request.

Neat.

Its not perfect (eg Indic combining chars have class 0), but at least it should not result in invalid strings and the user can always override it with the preference.


In src/utils.c:

> @@ -766,21 +766,47 @@ gchar *utils_get_date_time(const gchar *format, time_t *time_to_use)
 }
 
 
+/* Extracts initials from @p name, with some Unicode support */
+GEANY_EXPORT_SYMBOL

If its exported it should be documented ?


In src/utils.c:

>  gchar *utils_get_initials(const gchar *name)
 {
-	gint i = 1, j = 1;
-	gchar *initials = g_malloc0(5);
+	GString *initials;
+	gchar *composed;
+	gboolean at_bound = TRUE;
+	gboolean prev_matched = FALSE;
+
+	g_return_val_if_fail(name != NULL, NULL);
+
+	composed = g_utf8_normalize(name, -1, G_NORMALIZE_DEFAULT_COMPOSE);

I suspect it should be G_NORMALIZE_ALL_COMPOSE so composite characters get split and other compatibility transforms. (==NFKC?).

I am unsure if (for example) ligatures can occur as first letters of names, and if they do is the "initial" the ligature or the first letter of it? Currently it selects the ligature as the "initial". Anyway its not critical so long as the user can override it with the "initials" preference.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3846/review/2012843161@github.com>