| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file contains utility functions for dealing with localized | 5 // This file contains utility functions for dealing with localized |
| 6 // content. | 6 // content. |
| 7 | 7 |
| 8 #ifndef CHROME_COMMON_L10N_UTIL_H_ | 8 #ifndef CHROME_COMMON_L10N_UTIL_H_ |
| 9 #define CHROME_COMMON_L10N_UTIL_H_ | 9 #define CHROME_COMMON_L10N_UTIL_H_ |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 // Returns the locale-specific text direction. | 111 // Returns the locale-specific text direction. |
| 112 // This function retrieves the application locale and determines the text | 112 // This function retrieves the application locale and determines the text |
| 113 // direction. Its possible results are listed below: | 113 // direction. Its possible results are listed below: |
| 114 // * LEFT_TO_RIGHT: Left-To-Right (e.g. English, Chinese, etc.); | 114 // * LEFT_TO_RIGHT: Left-To-Right (e.g. English, Chinese, etc.); |
| 115 // * RIGHT_TO_LEFT: Right-To-Left (e.g. Arabic, Hebrew, etc.), and; | 115 // * RIGHT_TO_LEFT: Right-To-Left (e.g. Arabic, Hebrew, etc.), and; |
| 116 // * UNKNOWN_DIRECTION: unknown (or error). | 116 // * UNKNOWN_DIRECTION: unknown (or error). |
| 117 TextDirection GetTextDirection(); | 117 TextDirection GetTextDirection(); |
| 118 | 118 |
| 119 // Given the string in |text|, returns the directionality of the first |
| 120 // character with strong directionality in the string. If no character in the |
| 121 // text has strong directionality, LEFT_TO_RIGHT is returned. The Bidi |
| 122 // character types L, LRE, LRO, R, AL, RLE, and RLO are considered as strong |
| 123 // directionality characters. Please refer to http://unicode.org/reports/tr9/ |
| 124 // for more information. |
| 125 TextDirection GetFirstStrongCharacterDirection(const std::wstring& text); |
| 126 |
| 119 // Given the string in |text|, this function creates a copy of the string with | 127 // Given the string in |text|, this function creates a copy of the string with |
| 120 // the appropriate Unicode formatting marks that mark the string direction | 128 // the appropriate Unicode formatting marks that mark the string direction |
| 121 // (either left-to-right or right-to-left). The new string is returned in | 129 // (either left-to-right or right-to-left). The new string is returned in |
| 122 // |localized_text|. The function checks both the current locale and the | 130 // |localized_text|. The function checks both the current locale and the |
| 123 // contents of the string in order to determine the direction of the returned | 131 // contents of the string in order to determine the direction of the returned |
| 124 // string. The function returns true if the string in |text| was properly | 132 // string. The function returns true if the string in |text| was properly |
| 125 // adjusted. | 133 // adjusted. |
| 126 // | 134 // |
| 127 // Certain LTR strings are not rendered correctly when the context is RTL. For | 135 // Certain LTR strings are not rendered correctly when the context is RTL. For |
| 128 // example, the string "Foo!" will appear as "!Foo" if it is rendered as is in | 136 // example, the string "Foo!" will appear as "!Foo" if it is rendered as is in |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 296 |
| 289 private: | 297 private: |
| 290 UBiDi* bidi_; | 298 UBiDi* bidi_; |
| 291 | 299 |
| 292 DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); | 300 DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); |
| 293 }; | 301 }; |
| 294 | 302 |
| 295 } | 303 } |
| 296 | 304 |
| 297 #endif // CHROME_COMMON_L10N_UTIL_H_ | 305 #endif // CHROME_COMMON_L10N_UTIL_H_ |
| OLD | NEW |