Chromium Code Reviews| Index: third_party/WebKit/Source/platform/fonts/opentype/OpenTypeCapsSupportMPL.cpp |
| diff --git a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeCapsSupportMPL.cpp b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeCapsSupportMPL.cpp |
| index de00748ea59c8a4a3d943d536de3e1d297ea96f4..3aab5b09f53dcdd49b60e705a876c4b9ab55f778 100644 |
| --- a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeCapsSupportMPL.cpp |
| +++ b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeCapsSupportMPL.cpp |
| @@ -29,52 +29,37 @@ bool OpenTypeCapsSupport::supportsOpenTypeFeature( |
| || tag == HB_TAG('u', 'n', 'i', 'c') |
| || tag == HB_TAG('v', 'e', 'r', 't'))); |
| - bool result = false; |
| - |
| if (!hb_ot_layout_has_substitution(face)) |
| return false; |
| // Get the OpenType tag(s) that match this script code |
| - const size_t kMaxScriptTags = 4; |
| - hb_tag_t scriptTags[kMaxScriptTags] = { |
| + hb_tag_t scriptTags[] = { |
| HB_TAG_NONE, |
| HB_TAG_NONE, |
| HB_TAG_NONE, |
| - HB_TAG_NONE |
| }; |
| hb_ot_tags_from_script(static_cast<hb_script_t>(script), |
| &scriptTags[0], |
| &scriptTags[1]); |
| - // Replace the first remaining NONE with DEFAULT |
| - for (size_t i = 0; i < kMaxScriptTags; ++i) { |
| - if (scriptTags[i] == HB_TAG_NONE) { |
| - scriptTags[i] = HB_OT_TAG_DEFAULT_SCRIPT; |
| - break; |
| - } |
| - } |
| - |
| - // Now check for 'smcp' under the first of those scripts that is present |
| const hb_tag_t kGSUB = HB_TAG('G', 'S', 'U', 'B'); |
| - for (size_t j = 0; j < kMaxScriptTags; ++j) { |
| - if (scriptTags[j] == HB_TAG_NONE) |
| - break; |
| + unsigned scriptIndex = 0; |
| + // Identify for which script a GSUB table is available. |
| + if (!hb_ot_layout_table_choose_script(face, |
| + kGSUB, |
| + scriptTags, |
| + &scriptIndex, |
| + nullptr)) { |
| + return false; |
|
drott
2016/05/26 08:14:05
This was not in your original suggestion. I guess
behdad
2016/05/27 17:33:29
No no. The return value means something else. It
|
| + } |
| - unsigned scriptIndex; |
| - if (hb_ot_layout_table_find_script(face, |
| - kGSUB, |
| - scriptTags[j], |
| - &scriptIndex)) { |
| - if (hb_ot_layout_language_find_feature(face, kGSUB, |
| - scriptIndex, |
| - HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX, |
| - tag, nullptr)) { |
| - result = true; |
| - } |
| - break; |
| - } |
| + if (hb_ot_layout_language_find_feature(face, kGSUB, |
| + scriptIndex, |
| + HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX, |
| + tag, nullptr)) { |
| + return true; |
| } |
| - return result; |
| + return false; |
| } |
| } // namespace blink |