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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 const void* values[] = { ct_font }; | 141 const void* values[] = { ct_font }; |
142 base::ScopedCFTypeRef<CFDictionaryRef> attributes( | 142 base::ScopedCFTypeRef<CFDictionaryRef> attributes( |
143 CFDictionaryCreate(NULL, | 143 CFDictionaryCreate(NULL, |
144 keys, | 144 keys, |
145 values, | 145 values, |
146 arraysize(keys), | 146 arraysize(keys), |
147 NULL, | 147 NULL, |
148 &kCFTypeDictionaryValueCallBacks)); | 148 &kCFTypeDictionaryValueCallBacks)); |
149 | 149 |
150 base::ScopedCFTypeRef<CFStringRef> cf_text( | 150 base::ScopedCFTypeRef<CFStringRef> cf_text( |
151 base::SysUTF16ToCFStringRef(text())); | 151 base::SysUTF16ToCFStringRef(GetDisplayText())); |
tapted
2015/03/02 22:36:38
This is one of the things I tried... unfortunately
Jun Mukai
2015/03/02 23:10:37
I don't think RenderTextMac is quite different her
| |
152 base::ScopedCFTypeRef<CFAttributedStringRef> attr_text( | 152 base::ScopedCFTypeRef<CFAttributedStringRef> attr_text( |
153 CFAttributedStringCreate(NULL, cf_text, attributes)); | 153 CFAttributedStringCreate(NULL, cf_text, attributes)); |
154 base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable( | 154 base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable( |
155 CFAttributedStringCreateMutableCopy(NULL, 0, attr_text)); | 155 CFAttributedStringCreateMutableCopy(NULL, 0, attr_text)); |
156 | 156 |
157 // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the | 157 // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the |
158 // natural text direction. See kCTTypesetterOptionForcedEmbeddingLevel, etc. | 158 // natural text direction. See kCTTypesetterOptionForcedEmbeddingLevel, etc. |
159 | 159 |
160 ApplyStyles(attr_text_mutable, ct_font); | 160 ApplyStyles(attr_text_mutable, ct_font); |
161 line_.reset(CTLineCreateWithAttributedString(attr_text_mutable)); | 161 line_.reset(CTLineCreateWithAttributedString(attr_text_mutable)); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 CTUnderlineStyle value = kCTUnderlineStyleNone; | 358 CTUnderlineStyle value = kCTUnderlineStyleNone; |
359 if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value)) | 359 if (underline && CFNumberGetValue(underline, kCFNumberSInt32Type, &value)) |
360 run->underline = (value == kCTUnderlineStyleSingle); | 360 run->underline = (value == kCTUnderlineStyleSingle); |
361 | 361 |
362 run_origin.offset(run_width, 0); | 362 run_origin.offset(run_width, 0); |
363 } | 363 } |
364 runs_valid_ = true; | 364 runs_valid_ = true; |
365 } | 365 } |
366 | 366 |
367 } // namespace gfx | 367 } // namespace gfx |
OLD | NEW |