src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-hangul.cc
changeset 50826 f5b95be8b6e2
parent 48274 51772bf1fb0c
child 54232 7c11a7cc7c1d
equal deleted inserted replaced
50825:aa0a35b071fb 50826:f5b95be8b6e2
   149    *
   149    *
   150    *   - <L>: U+1100..115F, U+A960..A97F
   150    *   - <L>: U+1100..115F, U+A960..A97F
   151    *   - <V>: U+1160..11A7, U+D7B0..D7C7
   151    *   - <V>: U+1160..11A7, U+D7B0..D7C7
   152    *   - <T>: U+11A8..11FF, U+D7CB..D7FB
   152    *   - <T>: U+11A8..11FF, U+D7CB..D7FB
   153    *
   153    *
   154    *   - Only the <L,V> sequences for the 11xx ranges combine.
   154    *   - Only the <L,V> sequences for some of the U+11xx ranges combine.
   155    *   - Only <LV,T> sequences for T in U+11A8..11C3 combine.
   155    *   - Only <LV,T> sequences for some of the Ts in U+11xx range combine.
   156    *
   156    *
   157    * Here is what we want to accomplish in this shaper:
   157    * Here is what we want to accomplish in this shaper:
   158    *
   158    *
   159    *   - If the whole syllable can be precomposed, do that,
   159    *   - If the whole syllable can be precomposed, do that,
   160    *   - Otherwise, fully decompose and apply ljmo/vjmo/tjmo features.
   160    *   - Otherwise, fully decompose and apply ljmo/vjmo/tjmo features.
   186   unsigned int start = 0, end = 0; /* Extent of most recently seen syllable;
   186   unsigned int start = 0, end = 0; /* Extent of most recently seen syllable;
   187                                     * valid only if start < end
   187                                     * valid only if start < end
   188                                     */
   188                                     */
   189   unsigned int count = buffer->len;
   189   unsigned int count = buffer->len;
   190 
   190 
   191   for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
   191   for (buffer->idx = 0; buffer->idx < count && buffer->successful;)
   192   {
   192   {
   193     hb_codepoint_t u = buffer->cur().codepoint;
   193     hb_codepoint_t u = buffer->cur().codepoint;
   194 
   194 
   195     if (isHangulTone (u))
   195     if (isHangulTone (u))
   196     {
   196     {
   267           /* Try to compose; if this succeeds, end is set to start+1. */
   267           /* Try to compose; if this succeeds, end is set to start+1. */
   268           hb_codepoint_t s = SBase + (l - LBase) * NCount + (v - VBase) * TCount + tindex;
   268           hb_codepoint_t s = SBase + (l - LBase) * NCount + (v - VBase) * TCount + tindex;
   269           if (font->has_glyph (s))
   269           if (font->has_glyph (s))
   270           {
   270           {
   271             buffer->replace_glyphs (t ? 3 : 2, 1, &s);
   271             buffer->replace_glyphs (t ? 3 : 2, 1, &s);
   272             if (unlikely (buffer->in_error))
   272             if (unlikely (!buffer->successful))
   273               return;
   273               return;
   274             end = start + 1;
   274             end = start + 1;
   275             continue;
   275             continue;
   276           }
   276           }
   277         }
   277         }
   317         unsigned int new_tindex = buffer->cur(+1).codepoint - TBase;
   317         unsigned int new_tindex = buffer->cur(+1).codepoint - TBase;
   318         hb_codepoint_t new_s = s + new_tindex;
   318         hb_codepoint_t new_s = s + new_tindex;
   319         if (font->has_glyph (new_s))
   319         if (font->has_glyph (new_s))
   320         {
   320         {
   321           buffer->replace_glyphs (2, 1, &new_s);
   321           buffer->replace_glyphs (2, 1, &new_s);
   322           if (unlikely (buffer->in_error))
   322           if (unlikely (!buffer->successful))
   323             return;
   323             return;
   324           end = start + 1;
   324           end = start + 1;
   325           continue;
   325           continue;
   326         }
   326         }
   327         else
   327         else
   343             font->has_glyph (decomposed[1]) &&
   343             font->has_glyph (decomposed[1]) &&
   344             (!tindex || font->has_glyph (decomposed[2])))
   344             (!tindex || font->has_glyph (decomposed[2])))
   345         {
   345         {
   346           unsigned int s_len = tindex ? 3 : 2;
   346           unsigned int s_len = tindex ? 3 : 2;
   347           buffer->replace_glyphs (1, s_len, decomposed);
   347           buffer->replace_glyphs (1, s_len, decomposed);
   348           if (unlikely (buffer->in_error))
   348           if (unlikely (!buffer->successful))
   349             return;
   349             return;
   350 
   350 
   351           /* We decomposed S: apply jamo features to the individual glyphs
   351           /* We decomposed S: apply jamo features to the individual glyphs
   352            * that are now in buffer->out_info.
   352            * that are now in buffer->out_info.
   353            */
   353            */