static thai_consonant_type_t
get_consonant_type (hb_codepoint_t u)
{ if (u == 0x0E1Bu || u == 0x0E1Du || u == 0x0E1Fu/* || u == 0x0E2Cu*/) return AC; if (u == 0x0E0Du || u == 0x0E10u) return RC; if (u == 0x0E0Eu || u == 0x0E0Fu) return DC; if (hb_in_range<hb_codepoint_t> (u, 0x0E01u, 0x0E2Eu)) return NC; return NOT_CONSONANT;
}
staticvoid
preprocess_text_thai (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
hb_font_t *font)
{ /* This function implements the shaping logic documented here: * *https://linux.thai.net/~thep/th-otf/shaping.html * *ThefirstshapingrulelistedthereisneededevenifthefonthasThai *OpenTypetables.TherestdofallbackpositioningbasedonPUAcodepoints. *WeimplementthatonlyifthereexistnoThaiGSUBinthefont.
*/
/* The following is NOT specified in the MS OT Thai spec, however, it seems *tobewhatUniscribeandotherenginesimplement.AccordingtoEricMuller: * *WhenyouhaveaSARAAM,decomposeitinNIKHAHIT+SARAAA,*and*movethe *NIKHAHITbackwardsoveranyabove-basemarks. * *<0E14,0E4B,0E33>-><0E14,0E4D,0E4B,0E32> * *ThisreorderingislegitonlywhentheNIKHAHITcomesfromaSARAAM,not *whenit'stheretostartwith.Thestring<0E14,0E4B,0E4D>isprobably *notwhatauserwanted,buttherenderingisneverthelessnikhahitabove *chattawa. * *SameforLao. * *Note: * *Uniscribealsodoessomebelow-marksreordering.Namely,itpositionsU+0E3A *afterU+0E38andU+0E39.WedothatbymodifyingthecccforU+0E3A. *Seeunicode->modified_combining_class().LaodoesNOThaveaU+0E3A *equivalent.
*/
/* We only get one script at a time, so a script-agnostic implementation
* is adequate here. */ #define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u) #define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du) #define SARA_AA_FROM_SARA_AM(x) ((x) - 1) #define IS_ABOVE_BASE_MARK(x) (hb_in_ranges<hb_codepoint_t> ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u, 0x0E3Bu, 0x0E3Bu))
buffer->clear_output (); unsignedint count = buffer->len; for (buffer->idx = 0; buffer->idx < count /* No need for: && buffer->successful */;)
{
hb_codepoint_t u = buffer->cur().codepoint; if (likely (!IS_SARA_AM (u)))
{ if (unlikely (!buffer->next_glyph ())) break; continue;
}
/* Is SARA AM. Decompose and reorder. */
(void) buffer->output_glyph (NIKHAHIT_FROM_SARA_AM (u));
_hb_glyph_info_set_continuation (&buffer->prev()); if (unlikely (!buffer->replace_glyph (SARA_AA_FROM_SARA_AM (u)))) break;
/* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */ unsignedint end = buffer->out_len;
_hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK);
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. */ if (start && buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
buffer->merge_out_clusters (start - 1, end);
}
}
buffer->sync ();
/* 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);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.