OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/render_text_mac.h" | 5 #include "ui/gfx/render_text_mac.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 runs_.clear(); | 99 runs_.clear(); |
100 runs_valid_ = false; | 100 runs_valid_ = false; |
101 } | 101 } |
102 | 102 |
103 void RenderTextMac::EnsureLayout() { | 103 void RenderTextMac::EnsureLayout() { |
104 if (line_.get()) | 104 if (line_.get()) |
105 return; | 105 return; |
106 runs_.clear(); | 106 runs_.clear(); |
107 runs_valid_ = false; | 107 runs_valid_ = false; |
108 | 108 |
109 const Font& font = GetFont(); | 109 const Font& font = GetPrimaryFont(); |
110 base::ScopedCFTypeRef<CFStringRef> font_name_cf_string( | 110 base::ScopedCFTypeRef<CFStringRef> font_name_cf_string( |
111 base::SysUTF8ToCFStringRef(font.GetFontName())); | 111 base::SysUTF8ToCFStringRef(font.GetFontName())); |
112 base::ScopedCFTypeRef<CTFontRef> ct_font( | 112 base::ScopedCFTypeRef<CTFontRef> ct_font( |
113 CTFontCreateWithName(font_name_cf_string, font.GetFontSize(), NULL)); | 113 CTFontCreateWithName(font_name_cf_string, font.GetFontSize(), NULL)); |
114 | 114 |
115 const void* keys[] = { kCTFontAttributeName }; | 115 const void* keys[] = { kCTFontAttributeName }; |
116 const void* values[] = { ct_font }; | 116 const void* values[] = { ct_font }; |
117 base::ScopedCFTypeRef<CFDictionaryRef> attributes( | 117 base::ScopedCFTypeRef<CFDictionaryRef> attributes( |
118 CFDictionaryCreate(NULL, | 118 CFDictionaryCreate(NULL, |
119 keys, | 119 keys, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 run_origin.offset(run_width, 0); | 324 run_origin.offset(run_width, 0); |
325 } | 325 } |
326 runs_valid_ = true; | 326 runs_valid_ = true; |
327 } | 327 } |
328 | 328 |
329 RenderText* RenderText::CreateInstance() { | 329 RenderText* RenderText::CreateInstance() { |
330 return new RenderTextMac; | 330 return new RenderTextMac; |
331 } | 331 } |
332 | 332 |
333 } // namespace gfx | 333 } // namespace gfx |
OLD | NEW |