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

Side by Side Diff: printing/printed_document_win.cc

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/printed_document.cc ('k') | views/controls/button/checkbox.cc » ('j') | 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 "printing/printed_document.h" 5 #include "printing/printed_document.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "gfx/font.h" 9 #include "gfx/font.h"
10 #include "printing/page_number.h" 10 #include "printing/page_number.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 DCHECK_NE(res, 0); 107 DCHECK_NE(res, 0);
108 } 108 }
109 109
110 // Print the header and footer. Offset by printable area offset (see comment 110 // Print the header and footer. Offset by printable area offset (see comment
111 // above). 111 // above).
112 SimpleModifyWorldTransform( 112 SimpleModifyWorldTransform(
113 context, 113 context,
114 -page_setup.printable_area().x(), 114 -page_setup.printable_area().x(),
115 -page_setup.printable_area().y(), 115 -page_setup.printable_area().y(),
116 1); 116 1);
117 int base_font_size = gfx::Font().height(); 117 int base_font_size = gfx::Font().GetHeight();
118 int new_font_size = ConvertUnit(10, 118 int new_font_size = ConvertUnit(10,
119 immutable_.settings_.desired_dpi, 119 immutable_.settings_.desired_dpi,
120 immutable_.settings_.device_units_per_inch()); 120 immutable_.settings_.device_units_per_inch());
121 DCHECK_GT(new_font_size, base_font_size); 121 DCHECK_GT(new_font_size, base_font_size);
122 gfx::Font font(gfx::Font().DeriveFont(new_font_size - base_font_size)); 122 gfx::Font font(gfx::Font().DeriveFont(new_font_size - base_font_size));
123 HGDIOBJ old_font = SelectObject(context, font.hfont()); 123 HGDIOBJ old_font = SelectObject(context, font.GetNativeFont());
124 DCHECK(old_font != NULL); 124 DCHECK(old_font != NULL);
125 // We don't want a white square around the text ever if overflowing. 125 // We don't want a white square around the text ever if overflowing.
126 SetBkMode(context, TRANSPARENT); 126 SetBkMode(context, TRANSPARENT);
127 PrintHeaderFooter(context, page, PageOverlays::LEFT, PageOverlays::TOP, 127 PrintHeaderFooter(context, page, PageOverlays::LEFT, PageOverlays::TOP,
128 font); 128 font);
129 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::TOP, 129 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::TOP,
130 font); 130 font);
131 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::TOP, 131 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::TOP,
132 font); 132 font);
133 PrintHeaderFooter(context, page, PageOverlays::LEFT, PageOverlays::BOTTOM, 133 PrintHeaderFooter(context, page, PageOverlays::LEFT, PageOverlays::BOTTOM,
134 font); 134 font);
135 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::BOTTOM, 135 PrintHeaderFooter(context, page, PageOverlays::CENTER, PageOverlays::BOTTOM,
136 font); 136 font);
137 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::BOTTOM, 137 PrintHeaderFooter(context, page, PageOverlays::RIGHT, PageOverlays::BOTTOM,
138 font); 138 font);
139 int res = RestoreDC(context, saved_state); 139 int res = RestoreDC(context, saved_state);
140 DCHECK_NE(res, 0); 140 DCHECK_NE(res, 0);
141 } 141 }
142 142
143 } // namespace printing 143 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printed_document.cc ('k') | views/controls/button/checkbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698