< prev index next >

src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-fallback.hh

Print this page
rev 48332 : 8193515 : AIX : new Harfbuzz 1.7.1 version fails to compile


  60     hb_codepoint_t u_glyph, s_glyph;
  61 
  62     if (!s ||
  63         !hb_font_get_glyph (font, u, 0, &u_glyph) ||
  64         !hb_font_get_glyph (font, s, 0, &s_glyph) ||
  65         u_glyph == s_glyph ||
  66         u_glyph > 0xFFFFu || s_glyph > 0xFFFFu)
  67       continue;
  68 
  69     glyphs[num_glyphs].set (u_glyph);
  70     substitutes[num_glyphs].set (s_glyph);
  71 
  72     num_glyphs++;
  73   }
  74 
  75   if (!num_glyphs)
  76     return nullptr;
  77 
  78   /* Bubble-sort or something equally good!
  79    * May not be good-enough for presidential candidate interviews, but good-enough for us... */
  80   hb_stable_sort (&glyphs[0], num_glyphs, OT::GlyphID::cmp, &substitutes[0]);
  81 
  82   OT::Supplier<OT::GlyphID> glyphs_supplier      (glyphs, num_glyphs);
  83   OT::Supplier<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
  84 
  85   /* Each glyph takes four bytes max, and there's some overhead. */
  86   char buf[(SHAPING_TABLE_LAST - SHAPING_TABLE_FIRST + 1) * 4 + 128];
  87   OT::hb_serialize_context_t c (buf, sizeof (buf));
  88   OT::SubstLookup *lookup = c.start_serialize<OT::SubstLookup> ();
  89   bool ret = lookup->serialize_single (&c,
  90                                        OT::LookupFlag::IgnoreMarks,
  91                                        glyphs_supplier,
  92                                        substitutes_supplier,
  93                                        num_glyphs);
  94   c.end_serialize ();
  95   /* TODO sanitize the results? */
  96 
  97   return ret ? c.copy<OT::SubstLookup> () : nullptr;
  98 }
  99 
 100 static OT::SubstLookup *


 109   /* We know that all our ligatures are 2-component */
 110   OT::GlyphID ligature_list[ARRAY_LENGTH_CONST (first_glyphs) * ARRAY_LENGTH_CONST(ligature_table[0].ligatures)];
 111   unsigned int component_count_list[ARRAY_LENGTH_CONST (ligature_list)];
 112   OT::GlyphID component_list[ARRAY_LENGTH_CONST (ligature_list) * 1/* One extra component per ligature */];
 113   unsigned int num_ligatures = 0;
 114 
 115   /* Populate arrays */
 116 
 117   /* Sort out the first-glyphs */
 118   for (unsigned int first_glyph_idx = 0; first_glyph_idx < ARRAY_LENGTH (first_glyphs); first_glyph_idx++)
 119   {
 120     hb_codepoint_t first_u = ligature_table[first_glyph_idx].first;
 121     hb_codepoint_t first_glyph;
 122     if (!hb_font_get_glyph (font, first_u, 0, &first_glyph))
 123       continue;
 124     first_glyphs[num_first_glyphs].set (first_glyph);
 125     ligature_per_first_glyph_count_list[num_first_glyphs] = 0;
 126     first_glyphs_indirection[num_first_glyphs] = first_glyph_idx;
 127     num_first_glyphs++;
 128   }
 129   hb_stable_sort (&first_glyphs[0], num_first_glyphs, OT::GlyphID::cmp, &first_glyphs_indirection[0]);
 130 
 131   /* Now that the first-glyphs are sorted, walk again, populate ligatures. */
 132   for (unsigned int i = 0; i < num_first_glyphs; i++)
 133   {
 134     unsigned int first_glyph_idx = first_glyphs_indirection[i];
 135 
 136     for (unsigned int second_glyph_idx = 0; second_glyph_idx < ARRAY_LENGTH (ligature_table[0].ligatures); second_glyph_idx++)
 137     {
 138       hb_codepoint_t second_u   = ligature_table[first_glyph_idx].ligatures[second_glyph_idx].second;
 139       hb_codepoint_t ligature_u = ligature_table[first_glyph_idx].ligatures[second_glyph_idx].ligature;
 140       hb_codepoint_t second_glyph, ligature_glyph;
 141       if (!second_u ||
 142           !hb_font_get_glyph (font, second_u,   0, &second_glyph) ||
 143           !hb_font_get_glyph (font, ligature_u, 0, &ligature_glyph))
 144         continue;
 145 
 146       ligature_per_first_glyph_count_list[i]++;
 147 
 148       ligature_list[num_ligatures].set (ligature_glyph);
 149       component_count_list[num_ligatures] = 2;




  60     hb_codepoint_t u_glyph, s_glyph;
  61 
  62     if (!s ||
  63         !hb_font_get_glyph (font, u, 0, &u_glyph) ||
  64         !hb_font_get_glyph (font, s, 0, &s_glyph) ||
  65         u_glyph == s_glyph ||
  66         u_glyph > 0xFFFFu || s_glyph > 0xFFFFu)
  67       continue;
  68 
  69     glyphs[num_glyphs].set (u_glyph);
  70     substitutes[num_glyphs].set (s_glyph);
  71 
  72     num_glyphs++;
  73   }
  74 
  75   if (!num_glyphs)
  76     return nullptr;
  77 
  78   /* Bubble-sort or something equally good!
  79    * May not be good-enough for presidential candidate interviews, but good-enough for us... */
  80   hb_stable_sort (&glyphs[0], num_glyphs, OT::GlyphID::cmphelper, &substitutes[0]);
  81 
  82   OT::Supplier<OT::GlyphID> glyphs_supplier      (glyphs, num_glyphs);
  83   OT::Supplier<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
  84 
  85   /* Each glyph takes four bytes max, and there's some overhead. */
  86   char buf[(SHAPING_TABLE_LAST - SHAPING_TABLE_FIRST + 1) * 4 + 128];
  87   OT::hb_serialize_context_t c (buf, sizeof (buf));
  88   OT::SubstLookup *lookup = c.start_serialize<OT::SubstLookup> ();
  89   bool ret = lookup->serialize_single (&c,
  90                                        OT::LookupFlag::IgnoreMarks,
  91                                        glyphs_supplier,
  92                                        substitutes_supplier,
  93                                        num_glyphs);
  94   c.end_serialize ();
  95   /* TODO sanitize the results? */
  96 
  97   return ret ? c.copy<OT::SubstLookup> () : nullptr;
  98 }
  99 
 100 static OT::SubstLookup *


 109   /* We know that all our ligatures are 2-component */
 110   OT::GlyphID ligature_list[ARRAY_LENGTH_CONST (first_glyphs) * ARRAY_LENGTH_CONST(ligature_table[0].ligatures)];
 111   unsigned int component_count_list[ARRAY_LENGTH_CONST (ligature_list)];
 112   OT::GlyphID component_list[ARRAY_LENGTH_CONST (ligature_list) * 1/* One extra component per ligature */];
 113   unsigned int num_ligatures = 0;
 114 
 115   /* Populate arrays */
 116 
 117   /* Sort out the first-glyphs */
 118   for (unsigned int first_glyph_idx = 0; first_glyph_idx < ARRAY_LENGTH (first_glyphs); first_glyph_idx++)
 119   {
 120     hb_codepoint_t first_u = ligature_table[first_glyph_idx].first;
 121     hb_codepoint_t first_glyph;
 122     if (!hb_font_get_glyph (font, first_u, 0, &first_glyph))
 123       continue;
 124     first_glyphs[num_first_glyphs].set (first_glyph);
 125     ligature_per_first_glyph_count_list[num_first_glyphs] = 0;
 126     first_glyphs_indirection[num_first_glyphs] = first_glyph_idx;
 127     num_first_glyphs++;
 128   }
 129   hb_stable_sort (&first_glyphs[0], num_first_glyphs, OT::GlyphID::cmphelper, &first_glyphs_indirection[0]);
 130 
 131   /* Now that the first-glyphs are sorted, walk again, populate ligatures. */
 132   for (unsigned int i = 0; i < num_first_glyphs; i++)
 133   {
 134     unsigned int first_glyph_idx = first_glyphs_indirection[i];
 135 
 136     for (unsigned int second_glyph_idx = 0; second_glyph_idx < ARRAY_LENGTH (ligature_table[0].ligatures); second_glyph_idx++)
 137     {
 138       hb_codepoint_t second_u   = ligature_table[first_glyph_idx].ligatures[second_glyph_idx].second;
 139       hb_codepoint_t ligature_u = ligature_table[first_glyph_idx].ligatures[second_glyph_idx].ligature;
 140       hb_codepoint_t second_glyph, ligature_glyph;
 141       if (!second_u ||
 142           !hb_font_get_glyph (font, second_u,   0, &second_glyph) ||
 143           !hb_font_get_glyph (font, ligature_u, 0, &ligature_glyph))
 144         continue;
 145 
 146       ligature_per_first_glyph_count_list[i]++;
 147 
 148       ligature_list[num_ligatures].set (ligature_glyph);
 149       component_count_list[num_ligatures] = 2;


< prev index next >