Skip to content
Myr

wayland: preserve escaped family names when stripping font size

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Avoid rebuilding the stripped font pattern with FcNameUnparse() alone, because it can drop escaping needed for family names like TX\-02. Format the family separately with explicit escaping so reparsing resolves the intended font.

authored by korigamik-hypr · committed by korigamik-hypr · parent 38e1c6e · Browse files · 1 file+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−1 removed

  • other:+16 added−1 removed

1 file+16 added−1 removed

modified:wayland.c+16 added-1 removed
3121 unmodified lines
31223123 FcPatternRemove(pat, FC_SIZE, 0);3124 FcPatternRemove(pat, FC_PIXEL_SIZE, 0);31253126 FcChar8 *escaped_family = FcPatternFormat(3127 pat, (const FcChar8 *)"%{+family{%{family|escape(\\\\-:,)}}}");3128 FcChar8 *rest = FcPatternFormat(3129 pat, (const FcChar8 *)"%{-family,size,pixelsize{%{=unparse}}}");3130 char *stripped_pattern = NULL;31313132 if (escaped_family == NULL || rest == NULL) {3133 free(escaped_family);3134 free(rest);3126 char *stripped_pattern = (char *)FcNameUnparse(pat);3135 stripped_pattern = (char *)FcNameUnparse(pat);3136 } else {3137 stripped_pattern = xasprintf("%s%s", escaped_family, rest);3138 free(escaped_family);3139 free(rest);3140 }31413142 FcPatternDestroy(pat);31433144 LOG_DBG("%s: pt-size=%.2f, px-size=%d", stripped_pattern, pt_size, px_size);3145
413 unmodified lines