Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 299023003: Remove reference to hb-icu which is not built on CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: eol Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 05732c00d69efbf7cb3f66b89e95df86bfab74b7..10e7a1a5276931a44ad6e8ff6643d5a03bba9ed9 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -8,7 +8,6 @@
#include "base/i18n/break_iterator.h"
#include "base/i18n/char_iterator.h"
-#include "third_party/harfbuzz-ng/src/hb-icu.h"
#include "third_party/harfbuzz-ng/src/hb.h"
#include "third_party/icu/source/common/unicode/ubidi.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -314,6 +313,14 @@ int ScriptInterval(const base::string16& text,
return length;
}
+// A port of hb_icu_script_to_script because harfbuzz on CrOS is built without
+// hb-icu. See http://crbug.com/356929
+inline hb_script_t ICUScriptToHBScript(UScriptCode script) {
+ if (script == USCRIPT_INVALID_CODE)
+ return HB_SCRIPT_INVALID;
+ return hb_script_from_string(uscript_getShortName(script), -1);
+}
+
} // namespace
namespace internal {
@@ -908,7 +915,7 @@ void RenderTextHarfBuzz::ShapeRun(internal::TextRunHarfBuzz* run) {
hb_buffer_t* buffer = hb_buffer_create();
hb_buffer_add_utf16(buffer, reinterpret_cast<const uint16*>(text.c_str()),
text.length(), run->range.start(), run->range.length());
- hb_buffer_set_script(buffer, hb_icu_script_to_script(run->script));
+ hb_buffer_set_script(buffer, ICUScriptToHBScript(run->script));
hb_buffer_set_direction(buffer,
run->direction == UBIDI_LTR ? HB_DIRECTION_LTR : HB_DIRECTION_RTL);
// TODO(ckocagil): Should we determine the actual language?
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698