1655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod/* 211138ccff71f442da1fcf64faa0e1d22e083e775Behdad Esfahbod * Copyright © 2011,2012 Google, Inc. 3655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * 4655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * This is part of HarfBuzz, a text shaping library. 5655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * 6655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * Permission is hereby granted, without written agreement and without 7655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 8655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * software and its documentation for any purpose, provided that the 9655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * above copyright notice and the following two paragraphs appear in 10655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * all copies of this software. 11655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * 12655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * DAMAGE. 17655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * 18655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * 24655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod * Google Author(s): Behdad Esfahbod 25655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod */ 26655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod 2711138ccff71f442da1fcf64faa0e1d22e083e775Behdad Esfahbod#include "hb-ot-shape-normalize-private.hh" 280736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod#include "hb-ot-shape-complex-private.hh" 29655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod#include "hb-ot-shape-private.hh" 30655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod 31655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod 325d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod/* 335d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * HIGHLEVEL DESIGN: 345d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 355d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * This file exports one main function: _hb_ot_shape_normalize(). 365d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 375d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * This function closely reflects the Unicode Normalization Algorithm, 38c346671b6b9b05fa51b95c16212eb29ac69510faBehdad Esfahbod * yet it's different. 39c346671b6b9b05fa51b95c16212eb29ac69510faBehdad Esfahbod * 40c346671b6b9b05fa51b95c16212eb29ac69510faBehdad Esfahbod * Each shaper specifies whether it prefers decomposed (NFD) or composed (NFC). 41c346671b6b9b05fa51b95c16212eb29ac69510faBehdad Esfahbod * The logic however tries to use whatever the font can support. 425d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 435d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * In general what happens is that: each grapheme is decomposed in a chain 44947c9a778c0d4b428b58806f98c34ede59b7439cBehdad Esfahbod * of 1:2 decompositions, marks reordered, and then recomposed if desired, 455d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * so far it's like Unicode Normalization. However, the decomposition and 465d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * recomposition only happens if the font supports the resulting characters. 475d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 485d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * The goals are: 495d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 505d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * - Try to render all canonically equivalent strings similarly. To really 515d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * achieve this we have to always do the full decomposition and then 525d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * selectively recompose from there. It's kinda too expensive though, so 535d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * we skip some cases. For example, if composed is desired, we simply 545d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * don't touch 1-character clusters that are supported by the font, even 555d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * though their NFC may be different. 565d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 575d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * - When a font has a precomposed character for a sequence but the 'ccmp' 58947c9a778c0d4b428b58806f98c34ede59b7439cBehdad Esfahbod * feature in the font is not adequate, use the precomposed character 595d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * which typically has better mark positioning. 605d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 6155deff7595ef357d000fef83559c74c9f8acad00Behdad Esfahbod * - When a font does not support a combining mark, but supports it precomposed 62c346671b6b9b05fa51b95c16212eb29ac69510faBehdad Esfahbod * with previous base, use that. This needs the itemizer to have this 63e3b2e077f549b04779c08a9fedb1f35b9f11075cBehdad Esfahbod * knowledge too. We need to provide assistance to the itemizer. 6455deff7595ef357d000fef83559c74c9f8acad00Behdad Esfahbod * 655c8174eda32c08187bc2ed40eefa1017f5b40668Behdad Esfahbod * - When a font does not support a character but supports its canonical 665c8174eda32c08187bc2ed40eefa1017f5b40668Behdad Esfahbod * decomposition, well, use the decomposition. 675d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod * 6884186a64004e5dcd2ce98b564d0e0a09aa5d68b2Behdad Esfahbod * - The complex shapers can customize the compose and decompose functions to 6984186a64004e5dcd2ce98b564d0e0a09aa5d68b2Behdad Esfahbod * offload some of their requirements to the normalizer. For example, the 7084186a64004e5dcd2ce98b564d0e0a09aa5d68b2Behdad Esfahbod * Indic shaper may want to disallow recomposing of two matras. 715d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod */ 725d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod 73eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbodstatic bool 74eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahboddecompose_unicode (const hb_ot_shape_normalize_context_t *c, 750736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_codepoint_t ab, 760736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_codepoint_t *a, 770736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_codepoint_t *b) 78428dfcab6634ff264570a0a5d715efb8048c3db5Behdad Esfahbod{ 79ea512f71084296be3bd893f78650def894066de0Behdad Esfahbod return (bool) c->unicode->decompose (ab, a, b); 80428dfcab6634ff264570a0a5d715efb8048c3db5Behdad Esfahbod} 81428dfcab6634ff264570a0a5d715efb8048c3db5Behdad Esfahbod 82eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbodstatic bool 83eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbodcompose_unicode (const hb_ot_shape_normalize_context_t *c, 840736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_codepoint_t a, 850736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_codepoint_t b, 860736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_codepoint_t *ab) 87428dfcab6634ff264570a0a5d715efb8048c3db5Behdad Esfahbod{ 88ea512f71084296be3bd893f78650def894066de0Behdad Esfahbod return (bool) c->unicode->compose (a, b, ab); 89428dfcab6634ff264570a0a5d715efb8048c3db5Behdad Esfahbod} 90428dfcab6634ff264570a0a5d715efb8048c3db5Behdad Esfahbod 91b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbodstatic inline void 92b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbodset_glyph (hb_glyph_info_t &info, hb_font_t *font) 93b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod{ 948b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod font->get_nominal_glyph (info.codepoint, &info.glyph_index()); 95b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod} 96b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod 978d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbodstatic inline void 98b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbodoutput_char (hb_buffer_t *buffer, hb_codepoint_t unichar, hb_codepoint_t glyph) 99c311d852080b50ffc85e80168de62abb05a6be59Behdad Esfahbod{ 100b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->cur().glyph_index() = glyph; 1017793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod buffer->output_glyph (unichar); /* This is very confusing indeed. */ 1026986208ba3b395534f4c7bcfa51df6bf9038f717Behdad Esfahbod _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer); 103c311d852080b50ffc85e80168de62abb05a6be59Behdad Esfahbod} 10445412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbod 1058d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbodstatic inline void 106b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbodnext_char (hb_buffer_t *buffer, hb_codepoint_t glyph) 1078d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod{ 108b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->cur().glyph_index() = glyph; 1098d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod buffer->next_glyph (); 1108d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod} 1118d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod 1128d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbodstatic inline void 1138d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbodskip_char (hb_buffer_t *buffer) 1148d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod{ 1158d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod buffer->skip_glyph (); 1168d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod} 1178d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod 118f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod/* Returns 0 if didn't decompose, number of resulting characters otherwise. */ 119f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbodstatic inline unsigned int 120eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahboddecompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint_t ab) 121655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod{ 122b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod hb_codepoint_t a, b, a_glyph, b_glyph; 123ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod hb_buffer_t * const buffer = c->buffer; 124ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod hb_font_t * const font = c->font; 12545412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbod 126eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod if (!c->decompose (c, ab, &a, &b) || 1278b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod (b && !font->get_nominal_glyph (b, &b_glyph))) 128f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return 0; 12945412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbod 1308b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod bool has_a = (bool) font->get_nominal_glyph (a, &a_glyph); 1314ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod if (shortest && has_a) { 1324ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod /* Output a and b */ 133ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod output_char (buffer, a, a_glyph); 134f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod if (likely (b)) { 135ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod output_char (buffer, b, b_glyph); 136f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return 2; 137f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod } 138f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return 1; 1394ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod } 140655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod 141f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod unsigned int ret; 1420736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod if ((ret = decompose (c, shortest, a))) { 143f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod if (b) { 144ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod output_char (buffer, b, b_glyph); 145f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return ret + 1; 146f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod } 147f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return ret; 1484ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod } 14945412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbod 1504ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod if (has_a) { 151ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod output_char (buffer, a, a_glyph); 152f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod if (likely (b)) { 153ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod output_char (buffer, b, b_glyph); 154f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return 2; 155f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod } 156f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return 1; 15745412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbod } 15845412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbod 159f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod return 0; 1605c6f5982d78e2d7fadc2fbb8b4f3a4be9420c59aBehdad Esfahbod} 1615c6f5982d78e2d7fadc2fbb8b4f3a4be9420c59aBehdad Esfahbod 1626e74c64211b6aaac48bae8c87f9420d8dc03fd93Behdad Esfahbodstatic inline void 163eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahboddecompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest) 1645c6f5982d78e2d7fadc2fbb8b4f3a4be9420c59aBehdad Esfahbod{ 1650736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_buffer_t * const buffer = c->buffer; 1661eff4350239b0768e1042b52db9fb1c0d266f96aBehdad Esfahbod hb_codepoint_t u = buffer->cur().codepoint; 16775483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod hb_codepoint_t glyph; 1684ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod 1698b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod if (shortest && c->font->get_nominal_glyph (u, &glyph)) 17075483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod { 171b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod next_char (buffer, glyph); 17275483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod return; 17375483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod } 17475483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod 17575483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod if (decompose (c, shortest, u)) 17675483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod { 1778d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod skip_char (buffer); 17875483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod return; 17975483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod } 18075483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod 1818b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod if (!shortest && c->font->get_nominal_glyph (u, &glyph)) 18275483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod { 183b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod next_char (buffer, glyph); 18475483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod return; 18575483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod } 18675483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod 18775483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod if (_hb_glyph_info_is_unicode_space (&buffer->cur())) 1887793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod { 18975483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod hb_codepoint_t space_glyph; 19075483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod hb_unicode_funcs_t::space_t space_type = buffer->unicode->space_fallback_type (u); 1918b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod if (space_type != hb_unicode_funcs_t::NOT_SPACE && c->font->get_nominal_glyph (0x0020u, &space_glyph)) 19275483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod { 19375483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod _hb_glyph_info_set_unicode_space_fallback_type (&buffer->cur(), space_type); 19475483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod next_char (buffer, space_glyph); 19575483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK; 19675483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod return; 19775483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod } 1987793aad946e09b53523b30d57de85abd1d15f8b6Behdad Esfahbod } 19975483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod 20052e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod if (u == 0x2011u) 20152e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod { 2029cbc39aef962a95b0eba32c24ff9c415d1316d56Behdad Esfahbod /* U+2011 is the only sensible character that is a no-break version of another character 2039cbc39aef962a95b0eba32c24ff9c415d1316d56Behdad Esfahbod * and not a space. The space ones are handled already. Handle this lone one. */ 20452e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod hb_codepoint_t other_glyph; 2058b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod if (c->font->get_nominal_glyph (0x2010u, &other_glyph)) 20652e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod { 20752e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod next_char (buffer, other_glyph); 20852e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod return; 20952e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod } 21052e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod } 21152e6c4e15893ed1cb0997795912a07b3e446b65aBehdad Esfahbod 21275483aafa6ad02d6391712d082d093823edcd758Behdad Esfahbod next_char (buffer, glyph); /* glyph is initialized in earlier branches. */ 213b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod} 214b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod 215b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbodstatic inline void 2168fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbodhandle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit) 217b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod{ 2188fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod /* TODO Currently if there's a variation-selector we give-up, it's just too hard. */ 2190736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_buffer_t * const buffer = c->buffer; 220ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod hb_font_t * const font = c->font; 221abadc1717d997b69f987fdf1be9e12156d2d13d6Behdad Esfahbod for (; buffer->idx < end - 1 && !buffer->in_error;) { 222b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) { 223b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod /* The next two lines are some ugly lines... But work. */ 2248b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod if (font->get_variation_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index())) 22579d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod { 22679d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod buffer->replace_glyphs (2, 1, &buffer->cur().codepoint); 22779d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod } 22879d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod else 22979d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod { 23079d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod /* Just pass on the two characters separately, let GSUB do its magic. */ 231ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod set_glyph (buffer->cur(), font); 23279d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod buffer->next_glyph (); 233ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod set_glyph (buffer->cur(), font); 23479d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod buffer->next_glyph (); 23579d1007a501fd63c0ba4d51038c513e6b8b94740Behdad Esfahbod } 236c7a84917208528040aaf9ad0a9a0b26aabeabc9cBehdad Esfahbod /* Skip any further variation selectors. */ 237c7a84917208528040aaf9ad0a9a0b26aabeabc9cBehdad Esfahbod while (buffer->idx < end && unlikely (buffer->unicode->is_variation_selector (buffer->cur().codepoint))) 238c7a84917208528040aaf9ad0a9a0b26aabeabc9cBehdad Esfahbod { 239ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod set_glyph (buffer->cur(), font); 240c7a84917208528040aaf9ad0a9a0b26aabeabc9cBehdad Esfahbod buffer->next_glyph (); 241c7a84917208528040aaf9ad0a9a0b26aabeabc9cBehdad Esfahbod } 242b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod } else { 243ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod set_glyph (buffer->cur(), font); 244b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->next_glyph (); 245b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod } 246b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod } 247b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod if (likely (buffer->idx < end)) { 248ac8cd511911c7dca6222d14fa758bff75d601567Behdad Esfahbod set_glyph (buffer->cur(), font); 249b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->next_glyph (); 250b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod } 251655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod} 252655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod 2536e74c64211b6aaac48bae8c87f9420d8dc03fd93Behdad Esfahbodstatic inline void 2548fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahboddecompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit) 255655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod{ 2560736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_buffer_t * const buffer = c->buffer; 257abadc1717d997b69f987fdf1be9e12156d2d13d6Behdad Esfahbod for (unsigned int i = buffer->idx; i < end && !buffer->in_error; i++) 258208f70f0553d73d2908b21b9552298029482a8b9Behdad Esfahbod if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) { 2598fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod handle_variation_selector_cluster (c, end, short_circuit); 2606e74c64211b6aaac48bae8c87f9420d8dc03fd93Behdad Esfahbod return; 261af913c5788e600e36d29f44fe4e77db84cf8c442Behdad Esfahbod } 262d6b9c6d20041b4f4fa11befc179aee757c41904dBehdad Esfahbod 263abadc1717d997b69f987fdf1be9e12156d2d13d6Behdad Esfahbod while (buffer->idx < end && !buffer->in_error) 2648fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod decompose_current_character (c, short_circuit); 265f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod} 266f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod 2676e74c64211b6aaac48bae8c87f9420d8dc03fd93Behdad Esfahbodstatic inline void 2688fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahboddecompose_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool might_short_circuit, bool always_short_circuit) 269f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod{ 2700736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod if (likely (c->buffer->idx + 1 == end)) 2718fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod decompose_current_character (c, might_short_circuit); 272f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod else 2738fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod decompose_multi_char_cluster (c, end, always_short_circuit); 274655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod} 275655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod 276f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod 27745d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbodstatic int 27845d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbodcompare_combining_class (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb) 27945d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbod{ 280d1deaa2f5bd028e8076265cba92cffa4fa2834acBehdad Esfahbod unsigned int a = _hb_glyph_info_get_modified_combining_class (pa); 281d1deaa2f5bd028e8076265cba92cffa4fa2834acBehdad Esfahbod unsigned int b = _hb_glyph_info_get_modified_combining_class (pb); 28245d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbod 28345d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbod return a < b ? -1 : a == b ? 0 : +1; 28445d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbod} 28545d6f29f15f1d2323bcaa2498aed23ff0c8a1567Behdad Esfahbod 286f4cb4762986a28634fa7de9b706f9d37859b881eBehdad Esfahbod 28745412523dc295cb5ee12e096bfacb282cc925843Behdad Esfahbodvoid 288eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod_hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, 2890736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_buffer_t *buffer, 2900736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod hb_font_t *font) 291655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod{ 292980e25cad2e58c31f5361862b9223d94ec47fc7aBehdad Esfahbod if (unlikely (!buffer->len)) return; 293980e25cad2e58c31f5361862b9223d94ec47fc7aBehdad Esfahbod 2948f3eebf7ee4005f9a8efaafcb7f4058cc0a3756eBehdad Esfahbod _hb_buffer_assert_unicode_vars (buffer); 2958f3eebf7ee4005f9a8efaafcb7f4058cc0a3756eBehdad Esfahbod 2963d6ca0d32e5c6597acfcf59301cb1905586ddb52Behdad Esfahbod hb_ot_shape_normalization_mode_t mode = plan->shaper->normalization_preference; 297eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod const hb_ot_shape_normalize_context_t c = { 298eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod plan, 2990736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod buffer, 3000736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod font, 301eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod buffer->unicode, 302eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod plan->shaper->decompose ? plan->shaper->decompose : decompose_unicode, 303eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod plan->shaper->compose ? plan->shaper->compose : compose_unicode 3040736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod }; 3050736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod 3068fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod bool always_short_circuit = mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE; 3078fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod bool might_short_circuit = always_short_circuit || 3088fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod (mode != HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED && 3098fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod mode != HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT); 31034c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod unsigned int count; 3115d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod 312c311d852080b50ffc85e80168de62abb05a6be59Behdad Esfahbod /* We do a fairly straightforward yet custom normalization process in three 3135389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod * separate rounds: decompose, reorder, recompose (if desired). Currently 3145389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod * this makes two buffer swaps. We can make it faster by moving the last 3155389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod * two rounds into the inner loop for the first round, but it's more readable 3165389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod * this way. */ 3175d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod 31834c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 3194ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod /* First round, decompose */ 3204ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod 3215389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod buffer->clear_output (); 32234c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod count = buffer->len; 323abadc1717d997b69f987fdf1be9e12156d2d13d6Behdad Esfahbod for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;) 3245d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod { 325655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod unsigned int end; 326468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod for (end = buffer->idx + 1; end < count; end++) 327c7dfe316f8c0fc04b7976fca5e58eb46d91b4821jfkthame if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[end])))) 328655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod break; 3295d90a342e319068716429bf7af76c3896b61a0e5Behdad Esfahbod 3308fc1f7fe74a25bf8549f5edd79c7da6b720eb064Behdad Esfahbod decompose_cluster (&c, end, might_short_circuit, always_short_circuit); 331655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod } 332468e9cb25c9bc14781b7013e447d763f93bf76a3Behdad Esfahbod buffer->swap_buffers (); 3334ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod 33434c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 3354ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod /* Second round, reorder (inplace) */ 3364ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod 33734c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod count = buffer->len; 33834c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod for (unsigned int i = 0; i < count; i++) 33934c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod { 340d1deaa2f5bd028e8076265cba92cffa4fa2834acBehdad Esfahbod if (_hb_glyph_info_get_modified_combining_class (&buffer->info[i]) == 0) 34134c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod continue; 34234c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 34334c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod unsigned int end; 34434c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod for (end = i + 1; end < count; end++) 345d1deaa2f5bd028e8076265cba92cffa4fa2834acBehdad Esfahbod if (_hb_glyph_info_get_modified_combining_class (&buffer->info[end]) == 0) 34634c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod break; 34734c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 34885846b3de7491b6a07fed6a2c0c6c1b09943b249Behdad Esfahbod /* We are going to do a O(n^2). Only do this if the sequence is short. */ 34934c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod if (end - i > 10) { 35034c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod i = end; 35134c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod continue; 35234c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod } 35334c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 354e995d33c10a4bd9404699d01bddb2b69d811e9edBehdad Esfahbod buffer->sort (i, end, compare_combining_class); 35534c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 35634c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod i = end; 35734c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod } 35834c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 3594ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod 36008cf5d75ef0c75095173dec822ccb07defaaa6c2Behdad Esfahbod if (mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE || 36108cf5d75ef0c75095173dec822ccb07defaaa6c2Behdad Esfahbod mode == HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED) 3625389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod return; 3635389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod 3644ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod /* Third round, recompose */ 36534c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 3665389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod /* As noted in the comment earlier, we don't try to combine 3675389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod * ccc=0 chars with their previous Starter. */ 3684ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod 3695389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod buffer->clear_output (); 3705389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod count = buffer->len; 3715389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod unsigned int starter = 0; 372b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->next_glyph (); 373abadc1717d997b69f987fdf1be9e12156d2d13d6Behdad Esfahbod while (buffer->idx < count && !buffer->in_error) 3745389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod { 3755389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod hb_codepoint_t composed, glyph; 376269de14dda7a86a20917fa9ea6a5864929c41364Behdad Esfahbod if (/* We don't try to compose a non-mark character with it's preceding starter. 377269de14dda7a86a20917fa9ea6a5864929c41364Behdad Esfahbod * This is both an optimization to avoid trying to compose every two neighboring 378269de14dda7a86a20917fa9ea6a5864929c41364Behdad Esfahbod * glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul 379269de14dda7a86a20917fa9ea6a5864929c41364Behdad Esfahbod * fonts are not designed to mix-and-match pre-composed syllables and Jamo. */ 380269de14dda7a86a20917fa9ea6a5864929c41364Behdad Esfahbod HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur())) && 381968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod /* If there's anything between the starter and this char, they should have CCC 382968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod * smaller than this character's. */ 383968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod (starter == buffer->out_len - 1 || 38499c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod _hb_glyph_info_get_modified_combining_class (&buffer->prev()) < _hb_glyph_info_get_modified_combining_class (&buffer->cur())) && 385968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod /* And compose. */ 386eba312c8d1b2bbe8cb9b6414e843e78d2c521aa4Behdad Esfahbod c.compose (&c, 3870736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod buffer->out_info[starter].codepoint, 3880736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod buffer->cur().codepoint, 3890736915b8ed789a209205fec762997af3a8af89cBehdad Esfahbod &composed) && 390968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod /* And the font has glyph for the composite. */ 3918b5bc141cd3a6bfcea3c91a882a630426876ceb3Behdad Esfahbod font->get_nominal_glyph (composed, &glyph)) 3925389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod { 393bc8357ea7b4c0d7c715aae353176434fb9460205Behdad Esfahbod /* Composes. */ 394b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->next_glyph (); /* Copy to out-buffer. */ 395bc8357ea7b4c0d7c715aae353176434fb9460205Behdad Esfahbod if (unlikely (buffer->in_error)) 396bc8357ea7b4c0d7c715aae353176434fb9460205Behdad Esfahbod return; 397bc8357ea7b4c0d7c715aae353176434fb9460205Behdad Esfahbod buffer->merge_out_clusters (starter, buffer->out_len); 3988d1eef3f32fb539de2a72804fa3834acc18daab5Behdad Esfahbod buffer->out_len--; /* Remove the second composable. */ 39964426ec73a987bfe1e71a293ee195f268897e8d6Behdad Esfahbod /* Modify starter and carry on. */ 40064426ec73a987bfe1e71a293ee195f268897e8d6Behdad Esfahbod buffer->out_info[starter].codepoint = composed; 40164426ec73a987bfe1e71a293ee195f268897e8d6Behdad Esfahbod buffer->out_info[starter].glyph_index() = glyph; 4026986208ba3b395534f4c7bcfa51df6bf9038f717Behdad Esfahbod _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer); 403e02d9257863b49e33ab5942971266349d3c548f6Behdad Esfahbod 4045389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod continue; 4055389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod } 4065389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod 407e02d9257863b49e33ab5942971266349d3c548f6Behdad Esfahbod /* Blocked, or doesn't compose. */ 408b00321ea78793d9b3592b5173a9800e6322424feBehdad Esfahbod buffer->next_glyph (); 409968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod 41099c2695759a6af855d565f4994bbdf220570bb48Behdad Esfahbod if (_hb_glyph_info_get_modified_combining_class (&buffer->prev()) == 0) 411968318455304804dc53045e8ba0cd4d76800c02dBehdad Esfahbod starter = buffer->out_len - 1; 4124ff0d2d9dfc4f7e4880a4e964ca9872624508ea0Behdad Esfahbod } 4135389ff4dbc46c76c9483e3c95f22524b60e21166Behdad Esfahbod buffer->swap_buffers (); 41434c22f816808d061a980cffca12de03beb437fa0Behdad Esfahbod 415655586fe5e1fadf2a2ef7826e61ee9a445ffa37aBehdad Esfahbod} 416