nsComplexBreaker.h (1438B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 #ifndef nsComplexBreaker_h__ 6 #define nsComplexBreaker_h__ 7 8 #include <stdint.h> 9 /** 10 * Find line break opportunities in aText[] of aLength characters, 11 * filling boolean values indicating line break opportunities for 12 * corresponding charactersin aBreakBefore[] on return. 13 */ 14 void NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength, 15 uint8_t* aBreakBefore); 16 17 class ComplexBreaker { 18 public: 19 static void Initialize(); 20 21 static void Shutdown(); 22 23 /** 24 * A wrapper around the platform specific NS_GetComplexLineBreaks, which adds 25 * caching of the results to mitigate sometimes expensive implementation. 26 * @param aText - pointer to the text to process for possible line breaks 27 * @param aLength - the length to process 28 * @param aBreakBefore - result array correlated to aText, where element is 29 * set to true if line can be broken before 30 * corresponding character in aText and false otherwise 31 */ 32 static void GetBreaks(const char16_t* aText, uint32_t aLength, 33 uint8_t* aBreakBefore); 34 }; 35 36 #endif /* nsComplexBreaker_h__ */