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

Unified Diff: ui/gfx/render_text_win.cc

Issue 10315007: Detect missing glyphs as returned by Vista in RenderTextWin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « ui/gfx/render_text_win.h ('k') | 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
===================================================================
--- ui/gfx/render_text_win.cc (revision 134923)
+++ ui/gfx/render_text_win.cc (working copy)
@@ -653,6 +653,23 @@
glyphs_missing = true;
break;
}
+
+ // On Vista, when trying to draw Simplified Chinese via font linking,
msw 2012/05/02 22:19:09 Perhaps generalize this comment if there may be ot
Alexei Svitkine (slow) 2012/05/03 14:37:20 Done.
+ // missing glyphs in the Meiryo font are returned as wgBlank instead
+ // of wgDefault, with fZeroWidth set.
+ if (run->glyphs[i] == properties.wgBlank &&
+ run->visible_attributes[i].fZeroWidth) {
+ // Check whether this glyph corresponds entirely to whitespace. If
+ // it doesn't, assume there are missing glyphs.
+ const ui::Range range = GetTextRangeForRunGlyph(run, i);
+ DCHECK_NE(0U, range.length());
msw 2012/05/02 22:19:09 Use DCHECK_GT? Also DCHECK_LT/LE(range.end(), run-
+
+ const string16 glyph_text(&run_text[range.start()], range.length());
+ if (!ContainsOnlyWhitespace(glyph_text)) {
+ glyphs_missing = true;
+ break;
+ }
+ }
}
}
@@ -804,17 +821,32 @@
}
SelectionModel RenderTextWin::FirstSelectionModelInsideRun(
- internal::TextRun* run) {
+ const internal::TextRun* run) {
size_t cursor = IndexOfAdjacentGrapheme(run->range.start(), CURSOR_FORWARD);
return SelectionModel(cursor, CURSOR_BACKWARD);
}
SelectionModel RenderTextWin::LastSelectionModelInsideRun(
- internal::TextRun* run) {
+ const internal::TextRun* run) {
size_t caret = IndexOfAdjacentGrapheme(run->range.end(), CURSOR_BACKWARD);
return SelectionModel(caret, CURSOR_FORWARD);
}
+ui::Range RenderTextWin::GetTextRangeForRunGlyph(const internal::TextRun* run,
+ size_t glyph_index) const {
+ int first_seen = -1;
+ int last_seen = -1;
+ for (size_t char_index = 0; char_index < run->range.length(); ++char_index) {
+ if (run->logical_clusters[char_index] == glyph_index) {
+ last_seen = char_index;
+ if (first_seen == -1)
+ first_seen = char_index;
+ }
+ }
+ DCHECK_NE(first_seen, -1);
+ return ui::Range(first_seen, last_seen + 1);
+}
+
RenderText* RenderText::CreateRenderText() {
return new RenderTextWin;
}
« no previous file with comments | « ui/gfx/render_text_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698