219 }
220 }
221 return false;
222 }
223
224 /* This is almost the same as the method above, except it takes a
225 * char which means it may include undecoded surrogate pairs.
226 * The distinction is made so that code which needs to identify all
227 * cases in which we do not have a simple mapping from
228 * char->unicode character->glyph can be identified.
229 * For example measurement cannot simply sum advances of 'chars',
230 * the caret in editable text cannot advance one 'char' at a time, etc.
231 * These callers really are asking for more than whether 'layout'
232 * needs to be run, they need to know if they can assume 1->1
233 * char->glyph mapping.
234 */
235 public static boolean isNonSimpleChar(char ch) {
236 return
237 isComplexCharCode(ch) ||
238 (ch >= CharToGlyphMapper.HI_SURROGATE_START &&
239 ch <= CharToGlyphMapper.LO_SURROGATE_END);
240 }
241
242 /* If the character code falls into any of a number of unicode ranges
243 * where we know that simple left->right layout mapping chars to glyphs
244 * 1:1 and accumulating advances is going to produce incorrect results,
245 * we want to know this so the caller can use a more intelligent layout
246 * approach. A caller who cares about optimum performance may want to
247 * check the first case and skip the method call if its in that range.
248 * Although there's a lot of tests in here, knowing you can skip
249 * CTL saves a great deal more. The rest of the checks are ordered
250 * so that rather than checking explicitly if (>= start & <= end)
251 * which would mean all ranges would need to be checked so be sure
252 * CTL is not needed, the method returns as soon as it recognises
253 * the code point is outside of a CTL ranges.
254 * NOTE: Since this method accepts an 'int' it is asssumed to properly
255 * represent a CHARACTER. ie it assumes the caller has already
256 * converted surrogate pairs into supplementary characters, and so
257 * can handle this case and doesn't need to be told such a case is
258 * 'complex'.
259 */
|
219 }
220 }
221 return false;
222 }
223
224 /* This is almost the same as the method above, except it takes a
225 * char which means it may include undecoded surrogate pairs.
226 * The distinction is made so that code which needs to identify all
227 * cases in which we do not have a simple mapping from
228 * char->unicode character->glyph can be identified.
229 * For example measurement cannot simply sum advances of 'chars',
230 * the caret in editable text cannot advance one 'char' at a time, etc.
231 * These callers really are asking for more than whether 'layout'
232 * needs to be run, they need to know if they can assume 1->1
233 * char->glyph mapping.
234 */
235 public static boolean isNonSimpleChar(char ch) {
236 return
237 isComplexCharCode(ch) ||
238 (ch >= CharToGlyphMapper.HI_SURROGATE_START &&
239 ch <= CharToGlyphMapper.LO_SURROGATE_END) ||
240 (ch >= CharToGlyphMapper.VS_START &&
241 ch <= CharToGlyphMapper.VS_END);
242 }
243
244 /* If the character code falls into any of a number of unicode ranges
245 * where we know that simple left->right layout mapping chars to glyphs
246 * 1:1 and accumulating advances is going to produce incorrect results,
247 * we want to know this so the caller can use a more intelligent layout
248 * approach. A caller who cares about optimum performance may want to
249 * check the first case and skip the method call if its in that range.
250 * Although there's a lot of tests in here, knowing you can skip
251 * CTL saves a great deal more. The rest of the checks are ordered
252 * so that rather than checking explicitly if (>= start & <= end)
253 * which would mean all ranges would need to be checked so be sure
254 * CTL is not needed, the method returns as soon as it recognises
255 * the code point is outside of a CTL ranges.
256 * NOTE: Since this method accepts an 'int' it is asssumed to properly
257 * represent a CHARACTER. ie it assumes the caller has already
258 * converted surrogate pairs into supplementary characters, and so
259 * can handle this case and doesn't need to be told such a case is
260 * 'complex'.
261 */
|