fix Raqm fallback for first codepoint, use first font's missing glyph instead of last font's missing glyph

This commit is contained in:
nulano 2023-02-02 15:55:42 +00:00 committed by Nulano
parent c244169a8e
commit cbbd9bd27d

View File

@ -463,7 +463,7 @@ text_layout_raqm(
} }
} }
for (face = 0; face < family->font_count; face++) { for (face = 0; ; face++) {
#ifdef RAQM_VERSION_ATLEAST #ifdef RAQM_VERSION_ATLEAST
#if RAQM_VERSION_ATLEAST(0, 9, 0) #if RAQM_VERSION_ATLEAST(0, 9, 0)
if (face >= 1) { if (face >= 1) {
@ -544,7 +544,9 @@ text_layout_raqm(
} }
} else { } else {
start = 0; start = 0;
for (i = 0; i <= size; i++) { /* use first font's missing glyph */
int f = face < family->font_count ? face : 0;
for (i = 1; i <= size; i++) {
if (i < size) { if (i < size) {
if (fallback[i] == -2) { if (fallback[i] == -2) {
/* not a cluster boundary */ /* not a cluster boundary */
@ -557,7 +559,7 @@ text_layout_raqm(
} }
if (fallback[start] < 0) { if (fallback[start] < 0) {
raqm_set_freetype_face_range( raqm_set_freetype_face_range(
rq, family->faces[face], start, i - start); rq, family->faces[f], start, i - start);
} else { } else {
raqm_set_freetype_face_range( raqm_set_freetype_face_range(
rq, family->faces[fallback[start]], start, i - start); rq, family->faces[fallback[start]], start, i - start);
@ -578,14 +580,11 @@ text_layout_raqm(
goto failed; goto failed;
} }
//if (face + 1 == family->font_count) { if (family->font_count == 1 || face == family->font_count) {
// break;
//}
if (family->font_count == 1) {
break; break;
} }
for (i = 1; i < size; i++) { for (i = 0; i < size; i++) {
if (fallback[i] == -1) { if (fallback[i] == -1) {
fallback[i] = -2; fallback[i] = -2;
} }
@ -603,7 +602,6 @@ text_layout_raqm(
fallback[cluster] = face; fallback[cluster] = face;
} }
} }
if (!missing) { if (!missing) {
break; break;
} }