Skip to content

Commit 5e07a3a

Browse files
author
Jiang Jiang
committed
Fix HarfBuzz Thai character SARA AM handling
This patch is contributed by Thanomsub Noppaburana from libthai. It added a special thai shaping function to handle SARA AM character for fonts without OpenType rules to support it, like Nokia Pure Text AS. With modification to logClusters assignment to make sure that QTextLine::glyphRuns(int from, int length) returns correct glyphs. Task-number: QTBUG-21206 Change-Id: I5a78ee1ab2b4c874c7d0df17d4ee6d264ed5a790 Reviewed-by: Lars Knoll <[email protected]>
1 parent f86ca84 commit 5e07a3a

File tree

3 files changed

+352
-40
lines changed

3 files changed

+352
-40
lines changed

src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ extern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item);
111111
extern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item);
112112
extern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item);
113113
extern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item);
114+
extern HB_Bool HB_ThaiShape(HB_ShaperItem *shaper_item);
114115

115116
extern void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes);
116117

src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ const HB_ScriptEngine HB_ScriptEngines[] = {
618618
// Sinhala
619619
{ HB_IndicShape, HB_IndicAttributes },
620620
// Thai
621-
{ HB_BasicShape, HB_ThaiAttributes },
621+
{ HB_ThaiShape, HB_ThaiAttributes },
622622
// Lao
623623
{ HB_BasicShape, 0 },
624624
// Tibetan
@@ -1308,18 +1308,18 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do
13081308

13091309
#ifdef OT_DEBUG
13101310
if (doLogClusters) {
1311-
DEBUG("log clusters after shaping:");
1312-
for (int j = 0; j < length; j++)
1313-
DEBUG(" log[%d] = %d", j, item->log_clusters[j]);
1311+
DEBUG("log clusters after shaping:\n");
1312+
for (unsigned int j = 0; j < item->item.length; j++)
1313+
DEBUG(" log[%d] = %d\n", j, item->log_clusters[j]);
13141314
}
1315-
DEBUG("final glyphs:");
1316-
for (int i = 0; i < (int)hb_buffer->in_length; ++i)
1317-
DEBUG(" glyph=%4x char_index=%d mark: %d cmp: %d, clusterStart: %d advance=%d/%d offset=%d/%d",
1318-
glyphs[i].glyph, hb_buffer->in_string[i].cluster, glyphs[i].attributes.mark,
1319-
glyphs[i].attributes.combiningClass, glyphs[i].attributes.clusterStart,
1320-
glyphs[i].advance.x.toInt(), glyphs[i].advance.y.toInt(),
1321-
glyphs[i].offset.x.toInt(), glyphs[i].offset.y.toInt());
1322-
DEBUG("-----------------------------------------");
1315+
DEBUG("final glyphs:\n");
1316+
for (unsigned int i = 0; i < item->num_glyphs; ++i)
1317+
DEBUG(" glyph=%4x char_index=%d mark: %d cmp: %d, clusterStart: %d advance=%d offset=%d/%d\n",
1318+
glyphs[i], face->buffer->in_string[i].cluster, attributes[i].mark,
1319+
attributes[i].combiningClass, attributes[i].clusterStart,
1320+
item->advances[i] >> 6,
1321+
item->offsets[i].x >> 6, item->offsets[i].y >> 6);
1322+
DEBUG("-----------------------------------------\n");
13231323
#endif
13241324
return true;
13251325
}

0 commit comments

Comments
 (0)