public void CodePointIsWhiteSpaceBmp() { for (uint i = 0x7Fu + 1u; i <= 0xFFFFu; i++) { Assert.True(UnicodeUtility.IsBmpCodePoint(i)); Assert.Equal(CodePoint.IsWhiteSpace(new CodePoint(i)), char.IsWhiteSpace((char)i)); } }
public readonly bool IsCodePointAllowed(uint value) { if (!UnicodeUtility.IsBmpCodePoint(value)) { return(false); } // we only understand BMP _GetIndexAndOffset(value, out nuint index, out int offset); if ((Bitmap[index] & (1u << offset)) != 0) { return(true); } else { return(false); } }
/// <summary> /// Allows all code points specified by <paramref name="codePoints"/>. /// </summary> public virtual void AllowCodePoints(IEnumerable <int> codePoints) { if (codePoints is null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.codePoints); } foreach (var allowedCodePoint in codePoints) { // If the code point can't be represented as a BMP character, skip it. if (UnicodeUtility.IsBmpCodePoint((uint)allowedCodePoint)) { _allowedCodePointsBitmap.AllowChar((char)allowedCodePoint); } } }