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

Side by Side Diff: chrome/browser/views/about_chrome_view.cc

Issue 338029: Got the about panel to have its text lined up correctly.
Patch Set: Added pango font metrics cache Created 11 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 unified diff | Download patch
« no previous file with comments | « app/gfx/font_skia.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/views/about_chrome_view.h" 5 #include "chrome/browser/views/about_chrome_view.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/color_utils.h" 8 #include "app/gfx/color_utils.h"
9 #include "base/i18n/word_iterator.h" 9 #include "base/i18n/word_iterator.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // the LTR string. 553 // the LTR string.
554 if (ltr_within_rtl && word[word.size() - 1] == L' ') { 554 if (ltr_within_rtl && word[word.size() - 1] == L' ') {
555 int space_w = font.GetStringWidth(L" "), space_h = font.height(); 555 int space_w = font.GetStringWidth(L" "), space_h = font.height();
556 canvas->SizeStringInt(L" ", font, &space_w, &space_h, flags); 556 canvas->SizeStringInt(L" ", font, &space_w, &space_h, flags);
557 x += space_w; 557 x += space_w;
558 } 558 }
559 } 559 }
560 int y = position->height() + bounds.y(); 560 int y = position->height() + bounds.y();
561 561
562 // Draw the text on the screen (mirrored, if RTL run). 562 // Draw the text on the screen (mirrored, if RTL run).
563 canvas->DrawStringInt(word, font, text_color, x, y, w, h, flags); 563 canvas->DrawStringInt(
564 word, font, text_color, x, y, w, font.height(), flags);
564 565
565 if (word.size() > 0 && word[word.size() - 1] == L'\x0a') { 566 if (word.size() > 0 && word[word.size() - 1] == L'\x0a') {
566 // When we come across '\n', we move to the beginning of the next line. 567 // When we come across '\n', we move to the beginning of the next line.
567 position->set_width(0); 568 position->set_width(0);
568 position->Enlarge(0, font.height()); 569 position->Enlarge(0, font.height());
569 } else { 570 } else {
570 // Otherwise, we advance position to the next word. 571 // Otherwise, we advance position to the next word.
571 position->Enlarge(w, 0); 572 position->Enlarge(w, 0);
572 } 573 }
573 574
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 View* parent = GetParent(); 858 View* parent = GetParent();
858 parent->Layout(); 859 parent->Layout();
859 860
860 // Check button may have appeared/disappeared. We cannot call this during 861 // Check button may have appeared/disappeared. We cannot call this during
861 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. 862 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet.
862 if (window()) 863 if (window())
863 GetDialogClientView()->UpdateDialogButtons(); 864 GetDialogClientView()->UpdateDialogButtons();
864 } 865 }
865 866
866 #endif 867 #endif
OLDNEW
« no previous file with comments | « app/gfx/font_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698