| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 runs_.clear(); | 100 runs_.clear(); |
| 101 runs_valid_ = false; | 101 runs_valid_ = false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void RenderTextMac::EnsureLayout() { | 104 void RenderTextMac::EnsureLayout() { |
| 105 if (line_.get()) | 105 if (line_.get()) |
| 106 return; | 106 return; |
| 107 runs_.clear(); | 107 runs_.clear(); |
| 108 runs_valid_ = false; | 108 runs_valid_ = false; |
| 109 | 109 |
| 110 const Font& font = GetFont(); | 110 const Font& font = GetPrimaryFont(); |
| 111 base::ScopedCFTypeRef<CFStringRef> font_name_cf_string( | 111 base::ScopedCFTypeRef<CFStringRef> font_name_cf_string( |
| 112 base::SysUTF8ToCFStringRef(font.GetFontName())); | 112 base::SysUTF8ToCFStringRef(font.GetFontName())); |
| 113 base::ScopedCFTypeRef<CTFontRef> ct_font( | 113 base::ScopedCFTypeRef<CTFontRef> ct_font( |
| 114 CTFontCreateWithName(font_name_cf_string, font.GetFontSize(), NULL)); | 114 CTFontCreateWithName(font_name_cf_string, font.GetFontSize(), NULL)); |
| 115 | 115 |
| 116 const void* keys[] = { kCTFontAttributeName }; | 116 const void* keys[] = { kCTFontAttributeName }; |
| 117 const void* values[] = { ct_font }; | 117 const void* values[] = { ct_font }; |
| 118 base::ScopedCFTypeRef<CFDictionaryRef> attributes( | 118 base::ScopedCFTypeRef<CFDictionaryRef> attributes( |
| 119 CFDictionaryCreate(NULL, | 119 CFDictionaryCreate(NULL, |
| 120 keys, | 120 keys, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 run_origin.offset(run_width, 0); | 334 run_origin.offset(run_width, 0); |
| 335 } | 335 } |
| 336 runs_valid_ = true; | 336 runs_valid_ = true; |
| 337 } | 337 } |
| 338 | 338 |
| 339 RenderText* RenderText::CreateInstance() { | 339 RenderText* RenderText::CreateInstance() { |
| 340 return new RenderTextMac; | 340 return new RenderTextMac; |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace gfx | 343 } // namespace gfx |
| OLD | NEW |