Index: ui/gfx/render_text_win.cc |
=================================================================== |
--- ui/gfx/render_text_win.cc (revision 111944) |
+++ ui/gfx/render_text_win.cc (working copy) |
@@ -359,7 +359,7 @@ |
return bounds; |
} |
-bool RenderTextWin::IsCursorablePosition(size_t position) { |
+bool RenderTextWin::IsCursorablePosition(size_t position, bool is_trailing) { |
if (position == 0 || position == text().length()) |
return true; |
@@ -368,6 +368,8 @@ |
return false; |
internal::TextRun* run = runs_[run_index]; |
+ if (is_trailing && !run->script_analysis.fRTL) |
msw
2011/11/29 20:42:00
Shouldn't this be done before |GetRunContainingPos
|
+ position++; |
size_t start = run->range.start(); |
if (position == start) |
return true; |
@@ -466,6 +468,7 @@ |
internal::TextRun* run = *run_iter; |
size_t run_length = run->range.length(); |
const wchar_t* run_text = &(text()[run->range.start()]); |
+ bool tried_fallback = false; |
// Select the font desired for glyph generation. |
SelectObject(hdc, run->font.GetNativeFont()); |
@@ -490,12 +493,15 @@ |
if (hr == E_OUTOFMEMORY) { |
max_glyphs *= 2; |
} else if (hr == USP_E_SCRIPT_NOT_IN_FONT) { |
- // TODO(msw): Don't use SCRIPT_UNDEFINED. Apparently Uniscribe can crash |
- // on certain surrogate pairs with SCRIPT_UNDEFINED. |
- // See https://bugzilla.mozilla.org/show_bug.cgi?id=341500 |
- // And http://maxradi.us/documents/uniscribe/ |
- if (run->script_analysis.eScript == SCRIPT_UNDEFINED) |
- break; |
+ // Only try font fallback if it hasn't yet been attempted for this run. |
+ if (tried_fallback) { |
+ // TODO(msw): Don't use SCRIPT_UNDEFINED. Apparently Uniscribe can |
+ // crash on certain surrogate pairs with SCRIPT_UNDEFINED. |
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=341500 |
+ // And http://maxradi.us/documents/uniscribe/ |
+ run->script_analysis.eScript = SCRIPT_UNDEFINED; |
+ break; |
+ } |
// The run's font doesn't contain the required glyphs, use an alternate. |
if (ChooseFallbackFont(hdc, run->font, run_text, run_length, |
@@ -504,7 +510,7 @@ |
SelectObject(hdc, run->font.GetNativeFont()); |
} |
- run->script_analysis.eScript = SCRIPT_UNDEFINED; |
+ tried_fallback = true; |
} else { |
break; |
} |