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

Unified Diff: ui/gfx/render_text_win.cc

Issue 46873006: RenderTextWin: Break runs at UBLOCK_MISCELLANEOUS_SYMBOLS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add IsUnusualBlockCode help function, refactor. Created 7 years, 1 month 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_win.cc
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index c808a74ca71e34dc198a4f318f5e55c8acf03f3a..01a04af76b6d8f8620cebafbc2c9c9e0e5ad3d4b 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -246,6 +246,12 @@ void CheckLineIntegrity(const std::vector<internal::Line>& lines,
}
}
+// Returns true if characters of |block_code| may trigger font fallback.
+bool IsUnusualBlockCode(const UBlockCode block_code) {
+ return block_code == UBLOCK_GEOMETRIC_SHAPES ||
+ block_code == UBLOCK_MISCELLANEOUS_SYMBOLS;
+}
+
} // namespace
namespace internal {
@@ -918,7 +924,7 @@ void RenderTextWin::ItemizeLogicalText() {
--run_break;
}
- // Break runs adjacent to UBLOCK_GEOMETRIC_SHAPES character substrings.
+ // Break runs adjacent to character substrings in certain code blocks.
// This avoids using their fallback fonts for more characters than needed,
// in cases like "\x25B6 Media Title", etc. http://crbug.com/278913
if (run_break > run->range.start()) {
@@ -927,11 +933,11 @@ void RenderTextWin::ItemizeLogicalText() {
base::i18n::UTF16CharIterator iter(layout_text.c_str() + run_start,
run_length);
const UBlockCode first_block_code = ublock_getCode(iter.get());
+ const bool first_block_unusual = IsUnusualBlockCode(first_block_code);
while (iter.Advance() && iter.array_pos() < run_length) {
const UBlockCode current_block_code = ublock_getCode(iter.get());
if (current_block_code != first_block_code &&
- (current_block_code == UBLOCK_GEOMETRIC_SHAPES ||
- first_block_code == UBLOCK_GEOMETRIC_SHAPES)) {
+ (first_block_unusual || IsUnusualBlockCode(current_block_code))) {
run_break = run_start + iter.array_pos();
break;
}
« 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