2011-07-08 04:35:17 +02:00
|
|
|
/*
|
2012-08-12 00:34:13 +02:00
|
|
|
* Copyright © 2010,2012 Google, Inc.
|
2011-07-08 04:35:17 +02:00
|
|
|
*
|
|
|
|
* This is part of HarfBuzz, a text shaping library.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, without written agreement and without
|
|
|
|
* license or royalty fees, to use, copy, modify, and distribute this
|
|
|
|
* software and its documentation for any purpose, provided that the
|
|
|
|
* above copyright notice and the following two paragraphs appear in
|
|
|
|
* all copies of this software.
|
|
|
|
*
|
|
|
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
|
|
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
|
|
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
* DAMAGE.
|
|
|
|
*
|
|
|
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
|
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
|
|
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
|
|
*
|
|
|
|
* Google Author(s): Behdad Esfahbod
|
|
|
|
*/
|
|
|
|
|
2018-08-26 07:36:36 +02:00
|
|
|
#include "hb-ot-shape-complex.hh"
|
2011-07-08 04:35:17 +02:00
|
|
|
|
|
|
|
|
2012-04-10 16:52:07 +02:00
|
|
|
/* Thai / Lao shaper */
|
|
|
|
|
2012-11-15 02:25:03 +01:00
|
|
|
|
|
|
|
/* PUA shaping */
|
|
|
|
|
|
|
|
|
|
|
|
enum thai_consonant_type_t
|
|
|
|
{
|
|
|
|
NC,
|
|
|
|
AC,
|
|
|
|
RC,
|
|
|
|
DC,
|
|
|
|
NOT_CONSONANT,
|
|
|
|
NUM_CONSONANT_TYPES = NOT_CONSONANT
|
|
|
|
};
|
|
|
|
|
|
|
|
static thai_consonant_type_t
|
|
|
|
get_consonant_type (hb_codepoint_t u)
|
|
|
|
{
|
2014-07-11 20:54:42 +02:00
|
|
|
if (u == 0x0E1Bu || u == 0x0E1Du || u == 0x0E1Fu/* || u == 0x0E2Cu*/)
|
2012-11-15 02:25:03 +01:00
|
|
|
return AC;
|
2014-07-11 20:54:42 +02:00
|
|
|
if (u == 0x0E0Du || u == 0x0E10u)
|
2012-11-15 02:25:03 +01:00
|
|
|
return RC;
|
2014-07-11 20:54:42 +02:00
|
|
|
if (u == 0x0E0Eu || u == 0x0E0Fu)
|
2012-11-15 02:25:03 +01:00
|
|
|
return DC;
|
2017-06-19 12:17:09 +02:00
|
|
|
if (hb_in_range<hb_codepoint_t> (u, 0x0E01u, 0x0E2Eu))
|
2012-11-15 02:25:03 +01:00
|
|
|
return NC;
|
|
|
|
return NOT_CONSONANT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum thai_mark_type_t
|
|
|
|
{
|
|
|
|
AV,
|
|
|
|
BV,
|
|
|
|
T,
|
|
|
|
NOT_MARK,
|
|
|
|
NUM_MARK_TYPES = NOT_MARK
|
|
|
|
};
|
|
|
|
|
|
|
|
static thai_mark_type_t
|
|
|
|
get_mark_type (hb_codepoint_t u)
|
|
|
|
{
|
2017-06-19 12:17:09 +02:00
|
|
|
if (u == 0x0E31u || hb_in_range<hb_codepoint_t> (u, 0x0E34u, 0x0E37u) ||
|
|
|
|
u == 0x0E47u || hb_in_range<hb_codepoint_t> (u, 0x0E4Du, 0x0E4Eu))
|
2012-11-15 02:25:03 +01:00
|
|
|
return AV;
|
2017-06-19 12:17:09 +02:00
|
|
|
if (hb_in_range<hb_codepoint_t> (u, 0x0E38u, 0x0E3Au))
|
2012-11-15 02:25:03 +01:00
|
|
|
return BV;
|
2017-06-19 12:17:09 +02:00
|
|
|
if (hb_in_range<hb_codepoint_t> (u, 0x0E48u, 0x0E4Cu))
|
2012-11-15 02:25:03 +01:00
|
|
|
return T;
|
|
|
|
return NOT_MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum thai_action_t
|
|
|
|
{
|
|
|
|
NOP,
|
|
|
|
SD, /* Shift combining-mark down */
|
|
|
|
SL, /* Shift combining-mark left */
|
|
|
|
SDL, /* Shift combining-mark down-left */
|
|
|
|
RD /* Remove descender from base */
|
|
|
|
};
|
|
|
|
|
|
|
|
static hb_codepoint_t
|
|
|
|
thai_pua_shape (hb_codepoint_t u, thai_action_t action, hb_font_t *font)
|
|
|
|
{
|
|
|
|
struct thai_pua_mapping_t {
|
|
|
|
hb_codepoint_t u;
|
|
|
|
hb_codepoint_t win_pua;
|
|
|
|
hb_codepoint_t mac_pua;
|
2017-10-15 12:11:08 +02:00
|
|
|
} const *pua_mappings = nullptr;
|
2012-11-15 02:25:03 +01:00
|
|
|
static const thai_pua_mapping_t SD_mappings[] = {
|
2014-07-11 20:54:42 +02:00
|
|
|
{0x0E48u, 0xF70Au, 0xF88Bu}, /* MAI EK */
|
|
|
|
{0x0E49u, 0xF70Bu, 0xF88Eu}, /* MAI THO */
|
|
|
|
{0x0E4Au, 0xF70Cu, 0xF891u}, /* MAI TRI */
|
|
|
|
{0x0E4Bu, 0xF70Du, 0xF894u}, /* MAI CHATTAWA */
|
|
|
|
{0x0E4Cu, 0xF70Eu, 0xF897u}, /* THANTHAKHAT */
|
|
|
|
{0x0E38u, 0xF718u, 0xF89Bu}, /* SARA U */
|
|
|
|
{0x0E39u, 0xF719u, 0xF89Cu}, /* SARA UU */
|
|
|
|
{0x0E3Au, 0xF71Au, 0xF89Du}, /* PHINTHU */
|
|
|
|
{0x0000u, 0x0000u, 0x0000u}
|
2012-11-15 02:25:03 +01:00
|
|
|
};
|
|
|
|
static const thai_pua_mapping_t SDL_mappings[] = {
|
2014-07-11 20:54:42 +02:00
|
|
|
{0x0E48u, 0xF705u, 0xF88Cu}, /* MAI EK */
|
|
|
|
{0x0E49u, 0xF706u, 0xF88Fu}, /* MAI THO */
|
|
|
|
{0x0E4Au, 0xF707u, 0xF892u}, /* MAI TRI */
|
|
|
|
{0x0E4Bu, 0xF708u, 0xF895u}, /* MAI CHATTAWA */
|
|
|
|
{0x0E4Cu, 0xF709u, 0xF898u}, /* THANTHAKHAT */
|
|
|
|
{0x0000u, 0x0000u, 0x0000u}
|
2012-11-15 02:25:03 +01:00
|
|
|
};
|
|
|
|
static const thai_pua_mapping_t SL_mappings[] = {
|
2014-07-11 20:54:42 +02:00
|
|
|
{0x0E48u, 0xF713u, 0xF88Au}, /* MAI EK */
|
|
|
|
{0x0E49u, 0xF714u, 0xF88Du}, /* MAI THO */
|
|
|
|
{0x0E4Au, 0xF715u, 0xF890u}, /* MAI TRI */
|
|
|
|
{0x0E4Bu, 0xF716u, 0xF893u}, /* MAI CHATTAWA */
|
|
|
|
{0x0E4Cu, 0xF717u, 0xF896u}, /* THANTHAKHAT */
|
|
|
|
{0x0E31u, 0xF710u, 0xF884u}, /* MAI HAN-AKAT */
|
|
|
|
{0x0E34u, 0xF701u, 0xF885u}, /* SARA I */
|
|
|
|
{0x0E35u, 0xF702u, 0xF886u}, /* SARA II */
|
|
|
|
{0x0E36u, 0xF703u, 0xF887u}, /* SARA UE */
|
|
|
|
{0x0E37u, 0xF704u, 0xF888u}, /* SARA UEE */
|
|
|
|
{0x0E47u, 0xF712u, 0xF889u}, /* MAITAIKHU */
|
|
|
|
{0x0E4Du, 0xF711u, 0xF899u}, /* NIKHAHIT */
|
|
|
|
{0x0000u, 0x0000u, 0x0000u}
|
2012-11-15 02:25:03 +01:00
|
|
|
};
|
|
|
|
static const thai_pua_mapping_t RD_mappings[] = {
|
2014-07-11 20:54:42 +02:00
|
|
|
{0x0E0Du, 0xF70Fu, 0xF89Au}, /* YO YING */
|
|
|
|
{0x0E10u, 0xF700u, 0xF89Eu}, /* THO THAN */
|
|
|
|
{0x0000u, 0x0000u, 0x0000u}
|
2012-11-15 02:25:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
switch (action) {
|
|
|
|
case NOP: return u;
|
|
|
|
case SD: pua_mappings = SD_mappings; break;
|
|
|
|
case SDL: pua_mappings = SDL_mappings; break;
|
|
|
|
case SL: pua_mappings = SL_mappings; break;
|
|
|
|
case RD: pua_mappings = RD_mappings; break;
|
|
|
|
}
|
|
|
|
for (; pua_mappings->u; pua_mappings++)
|
|
|
|
if (pua_mappings->u == u)
|
|
|
|
{
|
|
|
|
hb_codepoint_t glyph;
|
|
|
|
if (hb_font_get_glyph (font, pua_mappings->win_pua, 0, &glyph))
|
|
|
|
return pua_mappings->win_pua;
|
|
|
|
if (hb_font_get_glyph (font, pua_mappings->mac_pua, 0, &glyph))
|
|
|
|
return pua_mappings->mac_pua;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static enum thai_above_state_t
|
|
|
|
{ /* Cluster above looks like: */
|
|
|
|
T0, /* ⣤ */
|
|
|
|
T1, /* ⣼ */
|
|
|
|
T2, /* ⣾ */
|
|
|
|
T3, /* ⣿ */
|
|
|
|
NUM_ABOVE_STATES
|
|
|
|
} thai_above_start_state[NUM_CONSONANT_TYPES + 1/* For NOT_CONSONANT */] =
|
|
|
|
{
|
|
|
|
T0, /* NC */
|
|
|
|
T1, /* AC */
|
|
|
|
T0, /* RC */
|
|
|
|
T0, /* DC */
|
|
|
|
T3, /* NOT_CONSONANT */
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct thai_above_state_machine_edge_t {
|
|
|
|
thai_action_t action;
|
|
|
|
thai_above_state_t next_state;
|
|
|
|
} thai_above_state_machine[NUM_ABOVE_STATES][NUM_MARK_TYPES] =
|
|
|
|
{ /*AV*/ /*BV*/ /*T*/
|
|
|
|
/*T0*/ {{NOP,T3}, {NOP,T0}, {SD, T3}},
|
|
|
|
/*T1*/ {{SL, T2}, {NOP,T1}, {SDL,T2}},
|
|
|
|
/*T2*/ {{NOP,T3}, {NOP,T2}, {SL, T3}},
|
|
|
|
/*T3*/ {{NOP,T3}, {NOP,T3}, {NOP,T3}},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static enum thai_below_state_t
|
|
|
|
{
|
|
|
|
B0, /* No descender */
|
|
|
|
B1, /* Removable descender */
|
|
|
|
B2, /* Strict descender */
|
|
|
|
NUM_BELOW_STATES
|
|
|
|
} thai_below_start_state[NUM_CONSONANT_TYPES + 1/* For NOT_CONSONANT */] =
|
|
|
|
{
|
|
|
|
B0, /* NC */
|
|
|
|
B0, /* AC */
|
|
|
|
B1, /* RC */
|
|
|
|
B2, /* DC */
|
|
|
|
B2, /* NOT_CONSONANT */
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct thai_below_state_machine_edge_t {
|
|
|
|
thai_action_t action;
|
|
|
|
thai_below_state_t next_state;
|
|
|
|
} thai_below_state_machine[NUM_BELOW_STATES][NUM_MARK_TYPES] =
|
|
|
|
{ /*AV*/ /*BV*/ /*T*/
|
|
|
|
/*B0*/ {{NOP,B0}, {NOP,B2}, {NOP, B0}},
|
|
|
|
/*B1*/ {{NOP,B1}, {RD, B2}, {NOP, B1}},
|
|
|
|
/*B2*/ {{NOP,B2}, {SD, B2}, {NOP, B2}},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-07-31 03:08:51 +02:00
|
|
|
static void
|
2012-12-06 00:46:04 +01:00
|
|
|
do_thai_pua_shaping (const hb_ot_shape_plan_t *plan HB_UNUSED,
|
2012-11-15 01:24:05 +01:00
|
|
|
hb_buffer_t *buffer,
|
|
|
|
hb_font_t *font)
|
|
|
|
{
|
2019-05-11 08:15:58 +02:00
|
|
|
#ifdef HB_NO_OT_SHAPE_COMPLEX_THAI_FALLBACK
|
2019-04-12 15:35:29 +02:00
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2012-11-15 02:25:03 +01:00
|
|
|
thai_above_state_t above_state = thai_above_start_state[NOT_CONSONANT];
|
|
|
|
thai_below_state_t below_state = thai_below_start_state[NOT_CONSONANT];
|
|
|
|
unsigned int base = 0;
|
|
|
|
|
|
|
|
hb_glyph_info_t *info = buffer->info;
|
|
|
|
unsigned int count = buffer->len;
|
|
|
|
for (unsigned int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
thai_mark_type_t mt = get_mark_type (info[i].codepoint);
|
|
|
|
|
|
|
|
if (mt == NOT_MARK) {
|
|
|
|
thai_consonant_type_t ct = get_consonant_type (info[i].codepoint);
|
|
|
|
above_state = thai_above_start_state[ct];
|
|
|
|
below_state = thai_below_start_state[ct];
|
|
|
|
base = i;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const thai_above_state_machine_edge_t &above_edge = thai_above_state_machine[above_state][mt];
|
|
|
|
const thai_below_state_machine_edge_t &below_edge = thai_below_state_machine[below_state][mt];
|
|
|
|
above_state = above_edge.next_state;
|
|
|
|
below_state = below_edge.next_state;
|
|
|
|
|
|
|
|
/* At least one of the above/below actions is NOP. */
|
|
|
|
thai_action_t action = above_edge.action != NOP ? above_edge.action : below_edge.action;
|
|
|
|
|
2017-08-11 05:54:15 +02:00
|
|
|
buffer->unsafe_to_break (base, i);
|
2012-11-15 02:25:03 +01:00
|
|
|
if (action == RD)
|
|
|
|
info[base].codepoint = thai_pua_shape (info[base].codepoint, action, font);
|
|
|
|
else
|
|
|
|
info[i].codepoint = thai_pua_shape (info[i].codepoint, action, font);
|
|
|
|
}
|
2012-11-15 01:24:05 +01:00
|
|
|
}
|
|
|
|
|
2012-11-15 02:25:03 +01:00
|
|
|
|
2012-11-15 01:24:05 +01:00
|
|
|
static void
|
|
|
|
preprocess_text_thai (const hb_ot_shape_plan_t *plan,
|
2012-08-12 00:34:13 +02:00
|
|
|
hb_buffer_t *buffer,
|
2012-11-15 01:24:05 +01:00
|
|
|
hb_font_t *font)
|
2012-04-10 16:52:07 +02:00
|
|
|
{
|
2012-11-15 01:24:05 +01:00
|
|
|
/* This function implements the shaping logic documented here:
|
|
|
|
*
|
2018-04-12 11:10:45 +02:00
|
|
|
* https://linux.thai.net/~thep/th-otf/shaping.html
|
2012-11-15 01:24:05 +01:00
|
|
|
*
|
|
|
|
* The first shaping rule listed there is needed even if the font has Thai
|
|
|
|
* OpenType tables. The rest do fallback positioning based on PUA codepoints.
|
|
|
|
* We implement that only if there exist no Thai GSUB in the font.
|
|
|
|
*/
|
|
|
|
|
2012-04-10 16:52:07 +02:00
|
|
|
/* The following is NOT specified in the MS OT Thai spec, however, it seems
|
|
|
|
* to be what Uniscribe and other engines implement. According to Eric Muller:
|
|
|
|
*
|
2012-07-23 19:15:33 +02:00
|
|
|
* When you have a SARA AM, decompose it in NIKHAHIT + SARA AA, *and* move the
|
|
|
|
* NIKHAHIT backwards over any tone mark (0E48-0E4B).
|
2012-04-10 16:52:07 +02:00
|
|
|
*
|
|
|
|
* <0E14, 0E4B, 0E33> -> <0E14, 0E4D, 0E4B, 0E32>
|
|
|
|
*
|
2012-07-23 19:15:33 +02:00
|
|
|
* This reordering is legit only when the NIKHAHIT comes from a SARA AM, not
|
2012-04-10 16:52:07 +02:00
|
|
|
* when it's there to start with. The string <0E14, 0E4B, 0E4D> is probably
|
2012-07-23 19:15:33 +02:00
|
|
|
* not what a user wanted, but the rendering is nevertheless nikhahit above
|
2012-04-10 16:52:07 +02:00
|
|
|
* chattawa.
|
|
|
|
*
|
|
|
|
* Same for Lao.
|
2012-07-23 19:52:07 +02:00
|
|
|
*
|
|
|
|
* Note:
|
|
|
|
*
|
2012-11-15 00:51:54 +01:00
|
|
|
* Uniscribe also does some below-marks reordering. Namely, it positions U+0E3A
|
2012-07-23 19:52:07 +02:00
|
|
|
* after U+0E38 and U+0E39. We do that by modifying the ccc for U+0E3A.
|
2012-08-01 23:13:10 +02:00
|
|
|
* See unicode->modified_combining_class (). Lao does NOT have a U+0E3A
|
2012-07-23 19:52:07 +02:00
|
|
|
* equivalent.
|
2012-04-10 16:52:07 +02:00
|
|
|
*/
|
|
|
|
|
2012-07-23 19:15:33 +02:00
|
|
|
|
2012-04-10 16:52:07 +02:00
|
|
|
/*
|
|
|
|
* Here are the characters of significance:
|
|
|
|
*
|
|
|
|
* Thai Lao
|
|
|
|
* SARA AM: U+0E33 U+0EB3
|
|
|
|
* SARA AA: U+0E32 U+0EB2
|
|
|
|
* Nikhahit: U+0E4D U+0ECD
|
|
|
|
*
|
2012-07-23 19:15:33 +02:00
|
|
|
* Testing shows that Uniscribe reorder the following marks:
|
2012-07-23 20:04:42 +02:00
|
|
|
* Thai: <0E31,0E34..0E37,0E47..0E4E>
|
|
|
|
* Lao: <0EB1,0EB4..0EB7,0EC7..0ECE>
|
2012-04-10 16:52:07 +02:00
|
|
|
*
|
|
|
|
* Note how the Lao versions are the same as Thai + 0x80.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* We only get one script at a time, so a script-agnostic implementation
|
|
|
|
* is adequate here. */
|
2014-07-11 20:54:42 +02:00
|
|
|
#define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u)
|
|
|
|
#define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du)
|
2012-04-10 16:52:07 +02:00
|
|
|
#define SARA_AA_FROM_SARA_AM(x) ((x) - 1)
|
2017-06-19 12:17:09 +02:00
|
|
|
#define IS_TONE_MARK(x) (hb_in_ranges<hb_codepoint_t> ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u))
|
2012-04-10 16:52:07 +02:00
|
|
|
|
|
|
|
buffer->clear_output ();
|
|
|
|
unsigned int count = buffer->len;
|
2018-06-01 05:03:00 +02:00
|
|
|
for (buffer->idx = 0; buffer->idx < count && buffer->successful;)
|
2012-04-10 16:52:07 +02:00
|
|
|
{
|
2012-05-13 15:45:18 +02:00
|
|
|
hb_codepoint_t u = buffer->cur().codepoint;
|
2012-04-11 20:19:55 +02:00
|
|
|
if (likely (!IS_SARA_AM (u))) {
|
2012-04-10 16:52:07 +02:00
|
|
|
buffer->next_glyph ();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Is SARA AM. Decompose and reorder. */
|
2018-10-03 20:16:03 +02:00
|
|
|
hb_glyph_info_t &nikhahit = buffer->output_glyph (NIKHAHIT_FROM_SARA_AM (u));
|
|
|
|
_hb_glyph_info_set_continuation (&nikhahit);
|
|
|
|
buffer->replace_glyph (SARA_AA_FROM_SARA_AM (u));
|
2018-06-01 05:03:00 +02:00
|
|
|
if (unlikely (!buffer->successful))
|
2012-04-10 16:52:07 +02:00
|
|
|
return;
|
|
|
|
|
2015-11-03 02:44:05 +01:00
|
|
|
/* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */
|
2012-04-10 16:52:07 +02:00
|
|
|
unsigned int end = buffer->out_len;
|
2014-06-10 14:10:02 +02:00
|
|
|
_hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK);
|
|
|
|
|
|
|
|
/* Ok, let's see... */
|
2012-04-10 16:52:07 +02:00
|
|
|
unsigned int start = end - 2;
|
|
|
|
while (start > 0 && IS_TONE_MARK (buffer->out_info[start - 1].codepoint))
|
|
|
|
start--;
|
|
|
|
|
2012-07-23 19:15:33 +02:00
|
|
|
if (start + 2 < end)
|
|
|
|
{
|
|
|
|
/* Move Nikhahit (end-2) to the beginning */
|
|
|
|
buffer->merge_out_clusters (start, end);
|
|
|
|
hb_glyph_info_t t = buffer->out_info[end - 2];
|
|
|
|
memmove (buffer->out_info + start + 1,
|
|
|
|
buffer->out_info + start,
|
|
|
|
sizeof (buffer->out_info[0]) * (end - start - 2));
|
|
|
|
buffer->out_info[start] = t;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Since we decomposed, and NIKHAHIT is combining, merge clusters with the
|
|
|
|
* previous cluster. */
|
2015-09-01 17:24:54 +02:00
|
|
|
if (start && buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
|
2012-07-23 19:15:33 +02:00
|
|
|
buffer->merge_out_clusters (start - 1, end);
|
|
|
|
}
|
2012-04-10 16:52:07 +02:00
|
|
|
}
|
2018-11-04 08:25:07 +01:00
|
|
|
buffer->swap_buffers ();
|
2012-11-15 01:24:05 +01:00
|
|
|
|
|
|
|
/* If font has Thai GSUB, we are done. */
|
|
|
|
if (plan->props.script == HB_SCRIPT_THAI && !plan->map.found_script[0])
|
|
|
|
do_thai_pua_shaping (plan, buffer, font);
|
2012-04-10 16:52:07 +02:00
|
|
|
}
|
2012-07-31 03:08:51 +02:00
|
|
|
|
|
|
|
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
|
|
|
|
{
|
2017-10-15 12:11:08 +02:00
|
|
|
nullptr, /* collect_features */
|
|
|
|
nullptr, /* override_features */
|
|
|
|
nullptr, /* data_create */
|
|
|
|
nullptr, /* data_destroy */
|
2012-08-12 00:34:13 +02:00
|
|
|
preprocess_text_thai,
|
2017-10-15 12:11:08 +02:00
|
|
|
nullptr, /* postprocess_glyphs */
|
2013-12-31 09:04:35 +01:00
|
|
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
2017-10-15 12:11:08 +02:00
|
|
|
nullptr, /* decompose */
|
|
|
|
nullptr, /* compose */
|
|
|
|
nullptr, /* setup_masks */
|
2018-10-02 14:17:42 +02:00
|
|
|
HB_TAG_NONE, /* gpos_tag */
|
2017-10-15 12:11:08 +02:00
|
|
|
nullptr, /* reorder_marks */
|
2016-02-10 12:10:15 +01:00
|
|
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
2012-11-14 22:48:26 +01:00
|
|
|
false,/* fallback_position */
|
2012-07-31 03:08:51 +02:00
|
|
|
};
|