Lines Matching +full:range +full:- +full:double
1 // SPDX-License-Identifier: GPL-2.0
3 * ucs.c - Universal Character Set processing
28 if (cp < entry->first) in interval16_cmp()
29 return -1; in interval16_cmp()
30 if (cp > entry->last) in interval16_cmp()
40 if (cp < entry->first) in interval32_cmp()
41 return -1; in interval32_cmp()
42 if (cp > entry->last) in interval32_cmp()
49 if (cp < ranges[0].first || cp > ranges[size - 1].last) in cp_in_range16()
58 if (cp < ranges[0].first || cp > ranges[size - 1].last) in cp_in_range32()
68 * ucs_is_zero_width() - Determine if a Unicode code point is zero-width.
69 * @cp: Unicode code point (UCS-4)
71 * Return: true if the character is zero-width, false otherwise
84 * ucs_is_double_width() - Determine if a Unicode code point is double-width.
85 * @cp: Unicode code point (UCS-4)
87 * Return: true if the character is double-width, false otherwise
101 * Using u16 to save space since all values are within BMP range.
122 if (search_key->base < entry->base) in recomposition_cmp()
123 return -1; in recomposition_cmp()
124 if (search_key->base > entry->base) in recomposition_cmp()
128 if (search_key->mark < entry->mark) in recomposition_cmp()
129 return -1; in recomposition_cmp()
130 if (search_key->mark > entry->mark) in recomposition_cmp()
138 * ucs_recompose() - Attempt to recompose two Unicode characters into a single character.
139 * @base: Base Unicode code point (UCS-4)
140 * @mark: Combining mark Unicode code point (UCS-4)
146 /* Check if characters are within the range of our table */ in ucs_recompose()
158 return result ? result->recomposed : 0; in ucs_recompose()
162 * The fallback table structures implement a 2-level lookup.
172 u8 offset; /* Offset within page (0-255) */
173 u8 fallback; /* Fallback character or range start marker */
183 if (page < entry->page) in ucs_page_desc_cmp()
184 return -1; in ucs_page_desc_cmp()
185 if (page > entry->page) in ucs_page_desc_cmp()
195 if (offset < entry->offset) in ucs_page_entry_cmp()
196 return -1; in ucs_page_entry_cmp()
197 if (entry->fallback == UCS_PAGE_ENTRY_RANGE_MARKER) { in ucs_page_entry_cmp()
201 if (offset > entry->offset) in ucs_page_entry_cmp()
208 * ucs_get_fallback() - Get a substitution for the provided Unicode character
209 * @cp: Unicode code point (UCS-4)
228 * Full-width to ASCII mapping (covering all printable ASCII 33-126) in ucs_get_fallback()
229 * 0xFF01 (!) to 0xFF5E (~) -> ASCII 33 (!) to 126 (~) in ucs_get_fallback()
233 return cp - 0xFF01 + 33; in ucs_get_fallback()
242 entry = __inline_bsearch(&offset, ucs_fallback_entries + page->start, in ucs_get_fallback()
243 page->count, sizeof(*ucs_fallback_entries), in ucs_get_fallback()
248 if (entry->fallback == UCS_PAGE_ENTRY_RANGE_MARKER) in ucs_get_fallback()
250 return entry->fallback; in ucs_get_fallback()