diff --git a/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs b/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs index 1fee0fbf1b..f9c57f1873 100644 --- a/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs +++ b/src/Microsoft.Framework.WebEncoders/CodePointFilter.cs @@ -15,7 +15,7 @@ namespace Microsoft.Framework.WebEncoders private AllowedCharsBitmap _allowedCharsBitmap; /// - /// Instantiates an empty filter. + /// Instantiates an empty filter (allows no code points through by default). /// public CodePointFilter() { @@ -23,7 +23,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates the filter by cloning the allow list of another filter. + /// Instantiates the filter by cloning the allow list of another . /// public CodePointFilter([NotNull] ICodePointFilter other) { @@ -40,53 +40,17 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates the filter where only the provided Unicode character blocks are - /// allowed by the filter. + /// Instantiates the filter where only the character ranges specified by + /// are allowed by the filter. /// - /// - public CodePointFilter(params UnicodeBlock[] allowedBlocks) + public CodePointFilter(params UnicodeRange[] allowedRanges) { _allowedCharsBitmap = new AllowedCharsBitmap(); - AllowBlocks(allowedBlocks); + AllowRanges(allowedRanges); } /// - /// Allows all characters in the specified Unicode character block through the filter. - /// - /// - /// The 'this' instance. - /// - public CodePointFilter AllowBlock([NotNull] UnicodeBlock block) - { - int firstCodePoint = block.FirstCodePoint; - int blockSize = block.BlockSize; - for (int i = 0; i < blockSize; i++) - { - _allowedCharsBitmap.AllowCharacter((char)(firstCodePoint + i)); - } - return this; - } - - /// - /// Allows all characters in the specified Unicode character blocks through the filter. - /// - /// - /// The 'this' instance. - /// - public CodePointFilter AllowBlocks(params UnicodeBlock[] blocks) - { - if (blocks != null) - { - for (int i = 0; i < blocks.Length; i++) - { - AllowBlock(blocks[i]); - } - } - return this; - } - - /// - /// Allows the specified character through the filter. + /// Allows the character specified by through the filter. /// /// /// The 'this' instance. @@ -98,7 +62,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Allows the specified characters through the filter. + /// Allows all characters specified by through the filter. /// /// /// The 'this' instance. @@ -116,7 +80,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Allows all characters in the specified string through the filter. + /// Allows all characters in the string through the filter. /// /// /// The 'this' instance. @@ -131,7 +95,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Allows all characters approved by the specified filter through this filter. + /// Allows all characters specified by through the filter. /// /// /// The 'this' instance. @@ -151,7 +115,42 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Disallows all characters through the filter. + /// Allows all characters specified by through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowRange([NotNull] UnicodeRange range) + { + int firstCodePoint = range.FirstCodePoint; + int rangeSize = range.RangeSize; + for (int i = 0; i < rangeSize; i++) + { + _allowedCharsBitmap.AllowCharacter((char)(firstCodePoint + i)); + } + return this; + } + + /// + /// Allows all characters specified by through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter AllowRanges(params UnicodeRange[] ranges) + { + if (ranges != null) + { + for (int i = 0; i < ranges.Length; i++) + { + AllowRange(ranges[i]); + } + } + return this; + } + + /// + /// Resets this filter by disallowing all characters. /// /// /// The 'this' instance. @@ -163,42 +162,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Disallows all characters in the specified Unicode character block through the filter. - /// - /// - /// The 'this' instance. - /// - public CodePointFilter ForbidBlock([NotNull] UnicodeBlock block) - { - int firstCodePoint = block.FirstCodePoint; - int blockSize = block.BlockSize; - for (int i = 0; i < blockSize; i++) - { - _allowedCharsBitmap.ForbidCharacter((char)(firstCodePoint + i)); - } - return this; - } - - /// - /// Disallows all characters in the specified Unicode character blocks through the filter. - /// - /// - /// The 'this' instance. - /// - public CodePointFilter ForbidBlocks(params UnicodeBlock[] blocks) - { - if (blocks != null) - { - for (int i = 0; i < blocks.Length; i++) - { - ForbidBlock(blocks[i]); - } - } - return this; - } - - /// - /// Disallows the specified character through the filter. + /// Disallows the character through the filter. /// /// /// The 'this' instance. @@ -210,7 +174,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Disallows the specified characters through the filter. + /// Disallows all characters specified by through the filter. /// /// /// The 'this' instance. @@ -228,7 +192,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Disallows all characters in the specified string through the filter. + /// Disallows all characters in the string through the filter. /// /// /// The 'this' instance. @@ -242,6 +206,41 @@ namespace Microsoft.Framework.WebEncoders return this; } + /// + /// Disallows all characters specified by through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidRange([NotNull] UnicodeRange range) + { + int firstCodePoint = range.FirstCodePoint; + int rangeSize = range.RangeSize; + for (int i = 0; i < rangeSize; i++) + { + _allowedCharsBitmap.ForbidCharacter((char)(firstCodePoint + i)); + } + return this; + } + + /// + /// Disallows all characters specified by through the filter. + /// + /// + /// The 'this' instance. + /// + public CodePointFilter ForbidRanges(params UnicodeRange[] ranges) + { + if (ranges != null) + { + for (int i = 0; i < ranges.Length; i++) + { + ForbidRange(ranges[i]); + } + } + return this; + } + /// /// Retrieves the bitmap of allowed characters from this filter. /// The returned bitmap is a clone of the original bitmap to avoid unintentional modification. @@ -266,13 +265,13 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Returns a value stating whether the given character is allowed through the filter. + /// Returns a value stating whether the character is allowed through the filter. /// public bool IsCharacterAllowed(char c) { return _allowedCharsBitmap.IsCharacterAllowed(c); } - + /// /// Wraps the provided filter as a CodePointFilter, avoiding the clone if possible. /// diff --git a/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs b/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs index bea418b83f..4e30ba2505 100644 --- a/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/HtmlEncoder.cs @@ -26,7 +26,7 @@ namespace Microsoft.Framework.WebEncoders private readonly HtmlUnicodeEncoder _innerUnicodeEncoder; /// - /// Instantiates an encoder using the 'Basic Latin' code table as the allow list. + /// Instantiates an encoder using as its allow list. /// public HtmlEncoder() : this(HtmlUnicodeEncoder.BasicLatin) @@ -34,11 +34,11 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates an encoder specifying which Unicode character blocks are allowed to + /// Instantiates an encoder specifying which Unicode character ranges are allowed to /// pass through the encoder unescaped. /// - public HtmlEncoder(params UnicodeBlock[] allowedBlocks) - : this(new HtmlUnicodeEncoder(new CodePointFilter(allowedBlocks))) + public HtmlEncoder(params UnicodeRange[] allowedRanges) + : this(new HtmlUnicodeEncoder(new CodePointFilter(allowedRanges))) { } @@ -57,8 +57,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// A default instance of the HtmlEncoder, equivalent to allowing only - /// the 'Basic Latin' character range. + /// The default , which uses as its allow list. /// public static HtmlEncoder Default { @@ -120,7 +119,7 @@ namespace Microsoft.Framework.WebEncoders HtmlUnicodeEncoder encoder = Volatile.Read(ref _basicLatinSingleton); if (encoder == null) { - encoder = new HtmlUnicodeEncoder(new CodePointFilter(UnicodeBlocks.BasicLatin)); + encoder = new HtmlUnicodeEncoder(new CodePointFilter(UnicodeRanges.BasicLatin)); Volatile.Write(ref _basicLatinSingleton, encoder); } return encoder; diff --git a/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs b/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs index 3779c32801..1703a5447a 100644 --- a/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/JavaScriptStringEncoder.cs @@ -26,7 +26,7 @@ namespace Microsoft.Framework.WebEncoders private readonly JavaScriptStringUnicodeEncoder _innerUnicodeEncoder; /// - /// Instantiates an encoder using the 'Basic Latin' code table as the allow list. + /// Instantiates an encoder using as its allow list. /// public JavaScriptStringEncoder() : this(JavaScriptStringUnicodeEncoder.BasicLatin) @@ -34,11 +34,11 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates an encoder specifying which Unicode character blocks are allowed to + /// Instantiates an encoder specifying which Unicode character ranges are allowed to /// pass through the encoder unescaped. /// - public JavaScriptStringEncoder(params UnicodeBlock[] allowedBlocks) - : this(new JavaScriptStringUnicodeEncoder(new CodePointFilter(allowedBlocks))) + public JavaScriptStringEncoder(params UnicodeRange[] allowedRanges) + : this(new JavaScriptStringUnicodeEncoder(new CodePointFilter(allowedRanges))) { } @@ -57,8 +57,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// A default instance of the JavaScriptStringEncoder, equivalent to allowing only - /// the 'Basic Latin' character range. + /// The default , which uses as its allow list. /// public static JavaScriptStringEncoder Default { @@ -124,7 +123,7 @@ namespace Microsoft.Framework.WebEncoders JavaScriptStringUnicodeEncoder encoder = Volatile.Read(ref _basicLatinSingleton); if (encoder == null) { - encoder = new JavaScriptStringUnicodeEncoder(new CodePointFilter(UnicodeBlocks.BasicLatin)); + encoder = new JavaScriptStringUnicodeEncoder(new CodePointFilter(UnicodeRanges.BasicLatin)); Volatile.Write(ref _basicLatinSingleton, encoder); } return encoder; diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs b/src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs deleted file mode 100644 index 26f84d86a0..0000000000 --- a/src/Microsoft.Framework.WebEncoders/UnicodeBlock.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.Framework.WebEncoders -{ - /// - /// Represents a range of Unicode code points. - /// - /// - /// Currently only the Basic Multilingual Plane is supported. - /// - public sealed class UnicodeBlock - { - /// - /// Creates a new representation of a Unicode block given the first code point - /// in the block and the number of code points in the block. - /// - public UnicodeBlock(int firstCodePoint, int blockSize) - { - // Parameter checking: the first code point must be U+nnn0, the block size must - // be a multiple of 16 bytes, and we can't span planes. - // See http://unicode.org/faq/blocks_ranges.html for more info. - if (firstCodePoint < 0 || firstCodePoint > 0xFFFF || ((firstCodePoint & 0xF) != 0)) - { - throw new ArgumentOutOfRangeException(nameof(firstCodePoint)); - } - if (blockSize < 0 || (blockSize % 16 != 0) || ((long)firstCodePoint + (long)blockSize > 0x10000)) - { - throw new ArgumentOutOfRangeException(nameof(blockSize)); - } - - FirstCodePoint = firstCodePoint; - BlockSize = blockSize; - } - - /// - /// The number of code points in this block. - /// - public int BlockSize { get; } - - /// - /// The first code point in this block. - /// - public int FirstCodePoint { get; } - - public static UnicodeBlock FromCharacterRange(char firstChar, char lastChar) - { - // Parameter checking: the first code point must be U+nnn0 and the last - // code point must be U+nnnF. We already can't span planes since 'char' - // allows only Basic Multilingual Plane characters. - // See http://unicode.org/faq/blocks_ranges.html for more info. - if ((firstChar & 0xF) != 0) - { - throw new ArgumentOutOfRangeException(nameof(firstChar)); - } - if (lastChar < firstChar || (lastChar & 0xF) != 0xF) - { - throw new ArgumentOutOfRangeException(nameof(lastChar)); - } - - return new UnicodeBlock(firstChar, 1 + (int)(lastChar - firstChar)); - } - } -} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs b/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs deleted file mode 100644 index 2217e2db93..0000000000 --- a/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; - -namespace Microsoft.Framework.WebEncoders -{ - /// - /// Contains predefined Unicode code point filters. - /// - public static partial class UnicodeBlocks - { - /// - /// Represents an empty Unicode block. - /// - /// - /// This block contains no code points. - /// - public static UnicodeBlock None - { - get - { - return Volatile.Read(ref _none) ?? CreateEmptyBlock(ref _none); - } - } - private static UnicodeBlock _none; - - /// - /// Represents a block containing all characters in the Unicode Basic Multilingual Plane (U+0000..U+FFFF). - /// - public static UnicodeBlock All - { - get - { - return Volatile.Read(ref _all) ?? CreateBlock(ref _all, '\u0000', '\uFFFF'); - } - } - private static UnicodeBlock _all; - - [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method - private static UnicodeBlock CreateBlock(ref UnicodeBlock block, char first, char last) - { - // If the block hasn't been created, create it now. - // It's ok if two threads race and one overwrites the other's 'block' value. - Debug.Assert(last > first, "Code points were specified out of order."); - var newBlock = UnicodeBlock.FromCharacterRange(first, last); - Volatile.Write(ref block, newBlock); - return newBlock; - } - - [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method - private static UnicodeBlock CreateEmptyBlock(ref UnicodeBlock block) - { - // If the block hasn't been created, create it now. - // It's ok if two threads race and one overwrites the other's 'block' value. - var newBlock = new UnicodeBlock(0, 0); - Volatile.Write(ref block, newBlock); - return newBlock; - } - } -} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs b/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs deleted file mode 100644 index d3404759c5..0000000000 --- a/src/Microsoft.Framework.WebEncoders/UnicodeBlocks.generated.cs +++ /dev/null @@ -1,2336 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; - -namespace Microsoft.Framework.WebEncoders -{ - public static partial class UnicodeBlocks - { - /// - /// Represents the 'Basic Latin' Unicode block (U+0000..U+007F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0000.pdf for the full set of characters in this block. - /// - public static UnicodeBlock BasicLatin - { - get - { - return Volatile.Read(ref _basicLatin) ?? CreateBlock(ref _basicLatin, first: '\u0000', last: '\u007F'); - } - } - private static UnicodeBlock _basicLatin; - - /// - /// Represents the 'Latin-1 Supplement' Unicode block (U+0080..U+00FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0080.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Latin1Supplement - { - get - { - return Volatile.Read(ref _latin1Supplement) ?? CreateBlock(ref _latin1Supplement, first: '\u0080', last: '\u00FF'); - } - } - private static UnicodeBlock _latin1Supplement; - - /// - /// Represents the 'Latin Extended-A' Unicode block (U+0100..U+017F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0100.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LatinExtendedA - { - get - { - return Volatile.Read(ref _latinExtendedA) ?? CreateBlock(ref _latinExtendedA, first: '\u0100', last: '\u017F'); - } - } - private static UnicodeBlock _latinExtendedA; - - /// - /// Represents the 'Latin Extended-B' Unicode block (U+0180..U+024F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0180.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LatinExtendedB - { - get - { - return Volatile.Read(ref _latinExtendedB) ?? CreateBlock(ref _latinExtendedB, first: '\u0180', last: '\u024F'); - } - } - private static UnicodeBlock _latinExtendedB; - - /// - /// Represents the 'IPA Extensions' Unicode block (U+0250..U+02AF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0250.pdf for the full set of characters in this block. - /// - public static UnicodeBlock IPAExtensions - { - get - { - return Volatile.Read(ref _ipaExtensions) ?? CreateBlock(ref _ipaExtensions, first: '\u0250', last: '\u02AF'); - } - } - private static UnicodeBlock _ipaExtensions; - - /// - /// Represents the 'Spacing Modifier Letters' Unicode block (U+02B0..U+02FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U02B0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SpacingModifierLetters - { - get - { - return Volatile.Read(ref _spacingModifierLetters) ?? CreateBlock(ref _spacingModifierLetters, first: '\u02B0', last: '\u02FF'); - } - } - private static UnicodeBlock _spacingModifierLetters; - - /// - /// Represents the 'Combining Diacritical Marks' Unicode block (U+0300..U+036F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0300.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CombiningDiacriticalMarks - { - get - { - return Volatile.Read(ref _combiningDiacriticalMarks) ?? CreateBlock(ref _combiningDiacriticalMarks, first: '\u0300', last: '\u036F'); - } - } - private static UnicodeBlock _combiningDiacriticalMarks; - - /// - /// Represents the 'Greek and Coptic' Unicode block (U+0370..U+03FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0370.pdf for the full set of characters in this block. - /// - public static UnicodeBlock GreekandCoptic - { - get - { - return Volatile.Read(ref _greekandCoptic) ?? CreateBlock(ref _greekandCoptic, first: '\u0370', last: '\u03FF'); - } - } - private static UnicodeBlock _greekandCoptic; - - /// - /// Represents the 'Cyrillic' Unicode block (U+0400..U+04FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0400.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Cyrillic - { - get - { - return Volatile.Read(ref _cyrillic) ?? CreateBlock(ref _cyrillic, first: '\u0400', last: '\u04FF'); - } - } - private static UnicodeBlock _cyrillic; - - /// - /// Represents the 'Cyrillic Supplement' Unicode block (U+0500..U+052F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0500.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CyrillicSupplement - { - get - { - return Volatile.Read(ref _cyrillicSupplement) ?? CreateBlock(ref _cyrillicSupplement, first: '\u0500', last: '\u052F'); - } - } - private static UnicodeBlock _cyrillicSupplement; - - /// - /// Represents the 'Armenian' Unicode block (U+0530..U+058F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0530.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Armenian - { - get - { - return Volatile.Read(ref _armenian) ?? CreateBlock(ref _armenian, first: '\u0530', last: '\u058F'); - } - } - private static UnicodeBlock _armenian; - - /// - /// Represents the 'Hebrew' Unicode block (U+0590..U+05FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0590.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Hebrew - { - get - { - return Volatile.Read(ref _hebrew) ?? CreateBlock(ref _hebrew, first: '\u0590', last: '\u05FF'); - } - } - private static UnicodeBlock _hebrew; - - /// - /// Represents the 'Arabic' Unicode block (U+0600..U+06FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0600.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Arabic - { - get - { - return Volatile.Read(ref _arabic) ?? CreateBlock(ref _arabic, first: '\u0600', last: '\u06FF'); - } - } - private static UnicodeBlock _arabic; - - /// - /// Represents the 'Syriac' Unicode block (U+0700..U+074F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0700.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Syriac - { - get - { - return Volatile.Read(ref _syriac) ?? CreateBlock(ref _syriac, first: '\u0700', last: '\u074F'); - } - } - private static UnicodeBlock _syriac; - - /// - /// Represents the 'Arabic Supplement' Unicode block (U+0750..U+077F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0750.pdf for the full set of characters in this block. - /// - public static UnicodeBlock ArabicSupplement - { - get - { - return Volatile.Read(ref _arabicSupplement) ?? CreateBlock(ref _arabicSupplement, first: '\u0750', last: '\u077F'); - } - } - private static UnicodeBlock _arabicSupplement; - - /// - /// Represents the 'Thaana' Unicode block (U+0780..U+07BF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0780.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Thaana - { - get - { - return Volatile.Read(ref _thaana) ?? CreateBlock(ref _thaana, first: '\u0780', last: '\u07BF'); - } - } - private static UnicodeBlock _thaana; - - /// - /// Represents the 'NKo' Unicode block (U+07C0..U+07FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U07C0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock NKo - { - get - { - return Volatile.Read(ref _nKo) ?? CreateBlock(ref _nKo, first: '\u07C0', last: '\u07FF'); - } - } - private static UnicodeBlock _nKo; - - /// - /// Represents the 'Samaritan' Unicode block (U+0800..U+083F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0800.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Samaritan - { - get - { - return Volatile.Read(ref _samaritan) ?? CreateBlock(ref _samaritan, first: '\u0800', last: '\u083F'); - } - } - private static UnicodeBlock _samaritan; - - /// - /// Represents the 'Mandaic' Unicode block (U+0840..U+085F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0840.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Mandaic - { - get - { - return Volatile.Read(ref _mandaic) ?? CreateBlock(ref _mandaic, first: '\u0840', last: '\u085F'); - } - } - private static UnicodeBlock _mandaic; - - /// - /// Represents the 'Arabic Extended-A' Unicode block (U+08A0..U+08FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U08A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock ArabicExtendedA - { - get - { - return Volatile.Read(ref _arabicExtendedA) ?? CreateBlock(ref _arabicExtendedA, first: '\u08A0', last: '\u08FF'); - } - } - private static UnicodeBlock _arabicExtendedA; - - /// - /// Represents the 'Devanagari' Unicode block (U+0900..U+097F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0900.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Devanagari - { - get - { - return Volatile.Read(ref _devanagari) ?? CreateBlock(ref _devanagari, first: '\u0900', last: '\u097F'); - } - } - private static UnicodeBlock _devanagari; - - /// - /// Represents the 'Bengali' Unicode block (U+0980..U+09FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0980.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Bengali - { - get - { - return Volatile.Read(ref _bengali) ?? CreateBlock(ref _bengali, first: '\u0980', last: '\u09FF'); - } - } - private static UnicodeBlock _bengali; - - /// - /// Represents the 'Gurmukhi' Unicode block (U+0A00..U+0A7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0A00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Gurmukhi - { - get - { - return Volatile.Read(ref _gurmukhi) ?? CreateBlock(ref _gurmukhi, first: '\u0A00', last: '\u0A7F'); - } - } - private static UnicodeBlock _gurmukhi; - - /// - /// Represents the 'Gujarati' Unicode block (U+0A80..U+0AFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0A80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Gujarati - { - get - { - return Volatile.Read(ref _gujarati) ?? CreateBlock(ref _gujarati, first: '\u0A80', last: '\u0AFF'); - } - } - private static UnicodeBlock _gujarati; - - /// - /// Represents the 'Oriya' Unicode block (U+0B00..U+0B7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0B00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Oriya - { - get - { - return Volatile.Read(ref _oriya) ?? CreateBlock(ref _oriya, first: '\u0B00', last: '\u0B7F'); - } - } - private static UnicodeBlock _oriya; - - /// - /// Represents the 'Tamil' Unicode block (U+0B80..U+0BFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0B80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Tamil - { - get - { - return Volatile.Read(ref _tamil) ?? CreateBlock(ref _tamil, first: '\u0B80', last: '\u0BFF'); - } - } - private static UnicodeBlock _tamil; - - /// - /// Represents the 'Telugu' Unicode block (U+0C00..U+0C7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0C00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Telugu - { - get - { - return Volatile.Read(ref _telugu) ?? CreateBlock(ref _telugu, first: '\u0C00', last: '\u0C7F'); - } - } - private static UnicodeBlock _telugu; - - /// - /// Represents the 'Kannada' Unicode block (U+0C80..U+0CFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0C80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Kannada - { - get - { - return Volatile.Read(ref _kannada) ?? CreateBlock(ref _kannada, first: '\u0C80', last: '\u0CFF'); - } - } - private static UnicodeBlock _kannada; - - /// - /// Represents the 'Malayalam' Unicode block (U+0D00..U+0D7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0D00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Malayalam - { - get - { - return Volatile.Read(ref _malayalam) ?? CreateBlock(ref _malayalam, first: '\u0D00', last: '\u0D7F'); - } - } - private static UnicodeBlock _malayalam; - - /// - /// Represents the 'Sinhala' Unicode block (U+0D80..U+0DFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0D80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Sinhala - { - get - { - return Volatile.Read(ref _sinhala) ?? CreateBlock(ref _sinhala, first: '\u0D80', last: '\u0DFF'); - } - } - private static UnicodeBlock _sinhala; - - /// - /// Represents the 'Thai' Unicode block (U+0E00..U+0E7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0E00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Thai - { - get - { - return Volatile.Read(ref _thai) ?? CreateBlock(ref _thai, first: '\u0E00', last: '\u0E7F'); - } - } - private static UnicodeBlock _thai; - - /// - /// Represents the 'Lao' Unicode block (U+0E80..U+0EFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0E80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Lao - { - get - { - return Volatile.Read(ref _lao) ?? CreateBlock(ref _lao, first: '\u0E80', last: '\u0EFF'); - } - } - private static UnicodeBlock _lao; - - /// - /// Represents the 'Tibetan' Unicode block (U+0F00..U+0FFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U0F00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Tibetan - { - get - { - return Volatile.Read(ref _tibetan) ?? CreateBlock(ref _tibetan, first: '\u0F00', last: '\u0FFF'); - } - } - private static UnicodeBlock _tibetan; - - /// - /// Represents the 'Myanmar' Unicode block (U+1000..U+109F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1000.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Myanmar - { - get - { - return Volatile.Read(ref _myanmar) ?? CreateBlock(ref _myanmar, first: '\u1000', last: '\u109F'); - } - } - private static UnicodeBlock _myanmar; - - /// - /// Represents the 'Georgian' Unicode block (U+10A0..U+10FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U10A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Georgian - { - get - { - return Volatile.Read(ref _georgian) ?? CreateBlock(ref _georgian, first: '\u10A0', last: '\u10FF'); - } - } - private static UnicodeBlock _georgian; - - /// - /// Represents the 'Hangul Jamo' Unicode block (U+1100..U+11FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1100.pdf for the full set of characters in this block. - /// - public static UnicodeBlock HangulJamo - { - get - { - return Volatile.Read(ref _hangulJamo) ?? CreateBlock(ref _hangulJamo, first: '\u1100', last: '\u11FF'); - } - } - private static UnicodeBlock _hangulJamo; - - /// - /// Represents the 'Ethiopic' Unicode block (U+1200..U+137F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1200.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Ethiopic - { - get - { - return Volatile.Read(ref _ethiopic) ?? CreateBlock(ref _ethiopic, first: '\u1200', last: '\u137F'); - } - } - private static UnicodeBlock _ethiopic; - - /// - /// Represents the 'Ethiopic Supplement' Unicode block (U+1380..U+139F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1380.pdf for the full set of characters in this block. - /// - public static UnicodeBlock EthiopicSupplement - { - get - { - return Volatile.Read(ref _ethiopicSupplement) ?? CreateBlock(ref _ethiopicSupplement, first: '\u1380', last: '\u139F'); - } - } - private static UnicodeBlock _ethiopicSupplement; - - /// - /// Represents the 'Cherokee' Unicode block (U+13A0..U+13FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U13A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Cherokee - { - get - { - return Volatile.Read(ref _cherokee) ?? CreateBlock(ref _cherokee, first: '\u13A0', last: '\u13FF'); - } - } - private static UnicodeBlock _cherokee; - - /// - /// Represents the 'Unified Canadian Aboriginal Syllabics' Unicode block (U+1400..U+167F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1400.pdf for the full set of characters in this block. - /// - public static UnicodeBlock UnifiedCanadianAboriginalSyllabics - { - get - { - return Volatile.Read(ref _unifiedCanadianAboriginalSyllabics) ?? CreateBlock(ref _unifiedCanadianAboriginalSyllabics, first: '\u1400', last: '\u167F'); - } - } - private static UnicodeBlock _unifiedCanadianAboriginalSyllabics; - - /// - /// Represents the 'Ogham' Unicode block (U+1680..U+169F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1680.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Ogham - { - get - { - return Volatile.Read(ref _ogham) ?? CreateBlock(ref _ogham, first: '\u1680', last: '\u169F'); - } - } - private static UnicodeBlock _ogham; - - /// - /// Represents the 'Runic' Unicode block (U+16A0..U+16FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U16A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Runic - { - get - { - return Volatile.Read(ref _runic) ?? CreateBlock(ref _runic, first: '\u16A0', last: '\u16FF'); - } - } - private static UnicodeBlock _runic; - - /// - /// Represents the 'Tagalog' Unicode block (U+1700..U+171F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1700.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Tagalog - { - get - { - return Volatile.Read(ref _tagalog) ?? CreateBlock(ref _tagalog, first: '\u1700', last: '\u171F'); - } - } - private static UnicodeBlock _tagalog; - - /// - /// Represents the 'Hanunoo' Unicode block (U+1720..U+173F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1720.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Hanunoo - { - get - { - return Volatile.Read(ref _hanunoo) ?? CreateBlock(ref _hanunoo, first: '\u1720', last: '\u173F'); - } - } - private static UnicodeBlock _hanunoo; - - /// - /// Represents the 'Buhid' Unicode block (U+1740..U+175F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1740.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Buhid - { - get - { - return Volatile.Read(ref _buhid) ?? CreateBlock(ref _buhid, first: '\u1740', last: '\u175F'); - } - } - private static UnicodeBlock _buhid; - - /// - /// Represents the 'Tagbanwa' Unicode block (U+1760..U+177F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1760.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Tagbanwa - { - get - { - return Volatile.Read(ref _tagbanwa) ?? CreateBlock(ref _tagbanwa, first: '\u1760', last: '\u177F'); - } - } - private static UnicodeBlock _tagbanwa; - - /// - /// Represents the 'Khmer' Unicode block (U+1780..U+17FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1780.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Khmer - { - get - { - return Volatile.Read(ref _khmer) ?? CreateBlock(ref _khmer, first: '\u1780', last: '\u17FF'); - } - } - private static UnicodeBlock _khmer; - - /// - /// Represents the 'Mongolian' Unicode block (U+1800..U+18AF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1800.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Mongolian - { - get - { - return Volatile.Read(ref _mongolian) ?? CreateBlock(ref _mongolian, first: '\u1800', last: '\u18AF'); - } - } - private static UnicodeBlock _mongolian; - - /// - /// Represents the 'Unified Canadian Aboriginal Syllabics Extended' Unicode block (U+18B0..U+18FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U18B0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock UnifiedCanadianAboriginalSyllabicsExtended - { - get - { - return Volatile.Read(ref _unifiedCanadianAboriginalSyllabicsExtended) ?? CreateBlock(ref _unifiedCanadianAboriginalSyllabicsExtended, first: '\u18B0', last: '\u18FF'); - } - } - private static UnicodeBlock _unifiedCanadianAboriginalSyllabicsExtended; - - /// - /// Represents the 'Limbu' Unicode block (U+1900..U+194F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1900.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Limbu - { - get - { - return Volatile.Read(ref _limbu) ?? CreateBlock(ref _limbu, first: '\u1900', last: '\u194F'); - } - } - private static UnicodeBlock _limbu; - - /// - /// Represents the 'Tai Le' Unicode block (U+1950..U+197F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1950.pdf for the full set of characters in this block. - /// - public static UnicodeBlock TaiLe - { - get - { - return Volatile.Read(ref _taiLe) ?? CreateBlock(ref _taiLe, first: '\u1950', last: '\u197F'); - } - } - private static UnicodeBlock _taiLe; - - /// - /// Represents the 'New Tai Lue' Unicode block (U+1980..U+19DF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1980.pdf for the full set of characters in this block. - /// - public static UnicodeBlock NewTaiLue - { - get - { - return Volatile.Read(ref _newTaiLue) ?? CreateBlock(ref _newTaiLue, first: '\u1980', last: '\u19DF'); - } - } - private static UnicodeBlock _newTaiLue; - - /// - /// Represents the 'Khmer Symbols' Unicode block (U+19E0..U+19FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U19E0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock KhmerSymbols - { - get - { - return Volatile.Read(ref _khmerSymbols) ?? CreateBlock(ref _khmerSymbols, first: '\u19E0', last: '\u19FF'); - } - } - private static UnicodeBlock _khmerSymbols; - - /// - /// Represents the 'Buginese' Unicode block (U+1A00..U+1A1F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1A00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Buginese - { - get - { - return Volatile.Read(ref _buginese) ?? CreateBlock(ref _buginese, first: '\u1A00', last: '\u1A1F'); - } - } - private static UnicodeBlock _buginese; - - /// - /// Represents the 'Tai Tham' Unicode block (U+1A20..U+1AAF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1A20.pdf for the full set of characters in this block. - /// - public static UnicodeBlock TaiTham - { - get - { - return Volatile.Read(ref _taiTham) ?? CreateBlock(ref _taiTham, first: '\u1A20', last: '\u1AAF'); - } - } - private static UnicodeBlock _taiTham; - - /// - /// Represents the 'Combining Diacritical Marks Extended' Unicode block (U+1AB0..U+1AFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1AB0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CombiningDiacriticalMarksExtended - { - get - { - return Volatile.Read(ref _combiningDiacriticalMarksExtended) ?? CreateBlock(ref _combiningDiacriticalMarksExtended, first: '\u1AB0', last: '\u1AFF'); - } - } - private static UnicodeBlock _combiningDiacriticalMarksExtended; - - /// - /// Represents the 'Balinese' Unicode block (U+1B00..U+1B7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1B00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Balinese - { - get - { - return Volatile.Read(ref _balinese) ?? CreateBlock(ref _balinese, first: '\u1B00', last: '\u1B7F'); - } - } - private static UnicodeBlock _balinese; - - /// - /// Represents the 'Sundanese' Unicode block (U+1B80..U+1BBF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1B80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Sundanese - { - get - { - return Volatile.Read(ref _sundanese) ?? CreateBlock(ref _sundanese, first: '\u1B80', last: '\u1BBF'); - } - } - private static UnicodeBlock _sundanese; - - /// - /// Represents the 'Batak' Unicode block (U+1BC0..U+1BFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1BC0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Batak - { - get - { - return Volatile.Read(ref _batak) ?? CreateBlock(ref _batak, first: '\u1BC0', last: '\u1BFF'); - } - } - private static UnicodeBlock _batak; - - /// - /// Represents the 'Lepcha' Unicode block (U+1C00..U+1C4F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1C00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Lepcha - { - get - { - return Volatile.Read(ref _lepcha) ?? CreateBlock(ref _lepcha, first: '\u1C00', last: '\u1C4F'); - } - } - private static UnicodeBlock _lepcha; - - /// - /// Represents the 'Ol Chiki' Unicode block (U+1C50..U+1C7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1C50.pdf for the full set of characters in this block. - /// - public static UnicodeBlock OlChiki - { - get - { - return Volatile.Read(ref _olChiki) ?? CreateBlock(ref _olChiki, first: '\u1C50', last: '\u1C7F'); - } - } - private static UnicodeBlock _olChiki; - - /// - /// Represents the 'Sundanese Supplement' Unicode block (U+1CC0..U+1CCF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1CC0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SundaneseSupplement - { - get - { - return Volatile.Read(ref _sundaneseSupplement) ?? CreateBlock(ref _sundaneseSupplement, first: '\u1CC0', last: '\u1CCF'); - } - } - private static UnicodeBlock _sundaneseSupplement; - - /// - /// Represents the 'Vedic Extensions' Unicode block (U+1CD0..U+1CFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1CD0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock VedicExtensions - { - get - { - return Volatile.Read(ref _vedicExtensions) ?? CreateBlock(ref _vedicExtensions, first: '\u1CD0', last: '\u1CFF'); - } - } - private static UnicodeBlock _vedicExtensions; - - /// - /// Represents the 'Phonetic Extensions' Unicode block (U+1D00..U+1D7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1D00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock PhoneticExtensions - { - get - { - return Volatile.Read(ref _phoneticExtensions) ?? CreateBlock(ref _phoneticExtensions, first: '\u1D00', last: '\u1D7F'); - } - } - private static UnicodeBlock _phoneticExtensions; - - /// - /// Represents the 'Phonetic Extensions Supplement' Unicode block (U+1D80..U+1DBF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1D80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock PhoneticExtensionsSupplement - { - get - { - return Volatile.Read(ref _phoneticExtensionsSupplement) ?? CreateBlock(ref _phoneticExtensionsSupplement, first: '\u1D80', last: '\u1DBF'); - } - } - private static UnicodeBlock _phoneticExtensionsSupplement; - - /// - /// Represents the 'Combining Diacritical Marks Supplement' Unicode block (U+1DC0..U+1DFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1DC0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CombiningDiacriticalMarksSupplement - { - get - { - return Volatile.Read(ref _combiningDiacriticalMarksSupplement) ?? CreateBlock(ref _combiningDiacriticalMarksSupplement, first: '\u1DC0', last: '\u1DFF'); - } - } - private static UnicodeBlock _combiningDiacriticalMarksSupplement; - - /// - /// Represents the 'Latin Extended Additional' Unicode block (U+1E00..U+1EFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1E00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LatinExtendedAdditional - { - get - { - return Volatile.Read(ref _latinExtendedAdditional) ?? CreateBlock(ref _latinExtendedAdditional, first: '\u1E00', last: '\u1EFF'); - } - } - private static UnicodeBlock _latinExtendedAdditional; - - /// - /// Represents the 'Greek Extended' Unicode block (U+1F00..U+1FFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U1F00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock GreekExtended - { - get - { - return Volatile.Read(ref _greekExtended) ?? CreateBlock(ref _greekExtended, first: '\u1F00', last: '\u1FFF'); - } - } - private static UnicodeBlock _greekExtended; - - /// - /// Represents the 'General Punctuation' Unicode block (U+2000..U+206F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2000.pdf for the full set of characters in this block. - /// - public static UnicodeBlock GeneralPunctuation - { - get - { - return Volatile.Read(ref _generalPunctuation) ?? CreateBlock(ref _generalPunctuation, first: '\u2000', last: '\u206F'); - } - } - private static UnicodeBlock _generalPunctuation; - - /// - /// Represents the 'Superscripts and Subscripts' Unicode block (U+2070..U+209F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2070.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SuperscriptsandSubscripts - { - get - { - return Volatile.Read(ref _superscriptsandSubscripts) ?? CreateBlock(ref _superscriptsandSubscripts, first: '\u2070', last: '\u209F'); - } - } - private static UnicodeBlock _superscriptsandSubscripts; - - /// - /// Represents the 'Currency Symbols' Unicode block (U+20A0..U+20CF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U20A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CurrencySymbols - { - get - { - return Volatile.Read(ref _currencySymbols) ?? CreateBlock(ref _currencySymbols, first: '\u20A0', last: '\u20CF'); - } - } - private static UnicodeBlock _currencySymbols; - - /// - /// Represents the 'Combining Diacritical Marks for Symbols' Unicode block (U+20D0..U+20FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U20D0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CombiningDiacriticalMarksforSymbols - { - get - { - return Volatile.Read(ref _combiningDiacriticalMarksforSymbols) ?? CreateBlock(ref _combiningDiacriticalMarksforSymbols, first: '\u20D0', last: '\u20FF'); - } - } - private static UnicodeBlock _combiningDiacriticalMarksforSymbols; - - /// - /// Represents the 'Letterlike Symbols' Unicode block (U+2100..U+214F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2100.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LetterlikeSymbols - { - get - { - return Volatile.Read(ref _letterlikeSymbols) ?? CreateBlock(ref _letterlikeSymbols, first: '\u2100', last: '\u214F'); - } - } - private static UnicodeBlock _letterlikeSymbols; - - /// - /// Represents the 'Number Forms' Unicode block (U+2150..U+218F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2150.pdf for the full set of characters in this block. - /// - public static UnicodeBlock NumberForms - { - get - { - return Volatile.Read(ref _numberForms) ?? CreateBlock(ref _numberForms, first: '\u2150', last: '\u218F'); - } - } - private static UnicodeBlock _numberForms; - - /// - /// Represents the 'Arrows' Unicode block (U+2190..U+21FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2190.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Arrows - { - get - { - return Volatile.Read(ref _arrows) ?? CreateBlock(ref _arrows, first: '\u2190', last: '\u21FF'); - } - } - private static UnicodeBlock _arrows; - - /// - /// Represents the 'Mathematical Operators' Unicode block (U+2200..U+22FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2200.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MathematicalOperators - { - get - { - return Volatile.Read(ref _mathematicalOperators) ?? CreateBlock(ref _mathematicalOperators, first: '\u2200', last: '\u22FF'); - } - } - private static UnicodeBlock _mathematicalOperators; - - /// - /// Represents the 'Miscellaneous Technical' Unicode block (U+2300..U+23FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2300.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MiscellaneousTechnical - { - get - { - return Volatile.Read(ref _miscellaneousTechnical) ?? CreateBlock(ref _miscellaneousTechnical, first: '\u2300', last: '\u23FF'); - } - } - private static UnicodeBlock _miscellaneousTechnical; - - /// - /// Represents the 'Control Pictures' Unicode block (U+2400..U+243F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2400.pdf for the full set of characters in this block. - /// - public static UnicodeBlock ControlPictures - { - get - { - return Volatile.Read(ref _controlPictures) ?? CreateBlock(ref _controlPictures, first: '\u2400', last: '\u243F'); - } - } - private static UnicodeBlock _controlPictures; - - /// - /// Represents the 'Optical Character Recognition' Unicode block (U+2440..U+245F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2440.pdf for the full set of characters in this block. - /// - public static UnicodeBlock OpticalCharacterRecognition - { - get - { - return Volatile.Read(ref _opticalCharacterRecognition) ?? CreateBlock(ref _opticalCharacterRecognition, first: '\u2440', last: '\u245F'); - } - } - private static UnicodeBlock _opticalCharacterRecognition; - - /// - /// Represents the 'Enclosed Alphanumerics' Unicode block (U+2460..U+24FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2460.pdf for the full set of characters in this block. - /// - public static UnicodeBlock EnclosedAlphanumerics - { - get - { - return Volatile.Read(ref _enclosedAlphanumerics) ?? CreateBlock(ref _enclosedAlphanumerics, first: '\u2460', last: '\u24FF'); - } - } - private static UnicodeBlock _enclosedAlphanumerics; - - /// - /// Represents the 'Box Drawing' Unicode block (U+2500..U+257F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2500.pdf for the full set of characters in this block. - /// - public static UnicodeBlock BoxDrawing - { - get - { - return Volatile.Read(ref _boxDrawing) ?? CreateBlock(ref _boxDrawing, first: '\u2500', last: '\u257F'); - } - } - private static UnicodeBlock _boxDrawing; - - /// - /// Represents the 'Block Elements' Unicode block (U+2580..U+259F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2580.pdf for the full set of characters in this block. - /// - public static UnicodeBlock BlockElements - { - get - { - return Volatile.Read(ref _blockElements) ?? CreateBlock(ref _blockElements, first: '\u2580', last: '\u259F'); - } - } - private static UnicodeBlock _blockElements; - - /// - /// Represents the 'Geometric Shapes' Unicode block (U+25A0..U+25FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U25A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock GeometricShapes - { - get - { - return Volatile.Read(ref _geometricShapes) ?? CreateBlock(ref _geometricShapes, first: '\u25A0', last: '\u25FF'); - } - } - private static UnicodeBlock _geometricShapes; - - /// - /// Represents the 'Miscellaneous Symbols' Unicode block (U+2600..U+26FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2600.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MiscellaneousSymbols - { - get - { - return Volatile.Read(ref _miscellaneousSymbols) ?? CreateBlock(ref _miscellaneousSymbols, first: '\u2600', last: '\u26FF'); - } - } - private static UnicodeBlock _miscellaneousSymbols; - - /// - /// Represents the 'Dingbats' Unicode block (U+2700..U+27BF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2700.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Dingbats - { - get - { - return Volatile.Read(ref _dingbats) ?? CreateBlock(ref _dingbats, first: '\u2700', last: '\u27BF'); - } - } - private static UnicodeBlock _dingbats; - - /// - /// Represents the 'Miscellaneous Mathematical Symbols-A' Unicode block (U+27C0..U+27EF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U27C0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MiscellaneousMathematicalSymbolsA - { - get - { - return Volatile.Read(ref _miscellaneousMathematicalSymbolsA) ?? CreateBlock(ref _miscellaneousMathematicalSymbolsA, first: '\u27C0', last: '\u27EF'); - } - } - private static UnicodeBlock _miscellaneousMathematicalSymbolsA; - - /// - /// Represents the 'Supplemental Arrows-A' Unicode block (U+27F0..U+27FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U27F0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SupplementalArrowsA - { - get - { - return Volatile.Read(ref _supplementalArrowsA) ?? CreateBlock(ref _supplementalArrowsA, first: '\u27F0', last: '\u27FF'); - } - } - private static UnicodeBlock _supplementalArrowsA; - - /// - /// Represents the 'Braille Patterns' Unicode block (U+2800..U+28FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2800.pdf for the full set of characters in this block. - /// - public static UnicodeBlock BraillePatterns - { - get - { - return Volatile.Read(ref _braillePatterns) ?? CreateBlock(ref _braillePatterns, first: '\u2800', last: '\u28FF'); - } - } - private static UnicodeBlock _braillePatterns; - - /// - /// Represents the 'Supplemental Arrows-B' Unicode block (U+2900..U+297F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2900.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SupplementalArrowsB - { - get - { - return Volatile.Read(ref _supplementalArrowsB) ?? CreateBlock(ref _supplementalArrowsB, first: '\u2900', last: '\u297F'); - } - } - private static UnicodeBlock _supplementalArrowsB; - - /// - /// Represents the 'Miscellaneous Mathematical Symbols-B' Unicode block (U+2980..U+29FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2980.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MiscellaneousMathematicalSymbolsB - { - get - { - return Volatile.Read(ref _miscellaneousMathematicalSymbolsB) ?? CreateBlock(ref _miscellaneousMathematicalSymbolsB, first: '\u2980', last: '\u29FF'); - } - } - private static UnicodeBlock _miscellaneousMathematicalSymbolsB; - - /// - /// Represents the 'Supplemental Mathematical Operators' Unicode block (U+2A00..U+2AFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2A00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SupplementalMathematicalOperators - { - get - { - return Volatile.Read(ref _supplementalMathematicalOperators) ?? CreateBlock(ref _supplementalMathematicalOperators, first: '\u2A00', last: '\u2AFF'); - } - } - private static UnicodeBlock _supplementalMathematicalOperators; - - /// - /// Represents the 'Miscellaneous Symbols and Arrows' Unicode block (U+2B00..U+2BFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2B00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MiscellaneousSymbolsandArrows - { - get - { - return Volatile.Read(ref _miscellaneousSymbolsandArrows) ?? CreateBlock(ref _miscellaneousSymbolsandArrows, first: '\u2B00', last: '\u2BFF'); - } - } - private static UnicodeBlock _miscellaneousSymbolsandArrows; - - /// - /// Represents the 'Glagolitic' Unicode block (U+2C00..U+2C5F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2C00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Glagolitic - { - get - { - return Volatile.Read(ref _glagolitic) ?? CreateBlock(ref _glagolitic, first: '\u2C00', last: '\u2C5F'); - } - } - private static UnicodeBlock _glagolitic; - - /// - /// Represents the 'Latin Extended-C' Unicode block (U+2C60..U+2C7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2C60.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LatinExtendedC - { - get - { - return Volatile.Read(ref _latinExtendedC) ?? CreateBlock(ref _latinExtendedC, first: '\u2C60', last: '\u2C7F'); - } - } - private static UnicodeBlock _latinExtendedC; - - /// - /// Represents the 'Coptic' Unicode block (U+2C80..U+2CFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2C80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Coptic - { - get - { - return Volatile.Read(ref _coptic) ?? CreateBlock(ref _coptic, first: '\u2C80', last: '\u2CFF'); - } - } - private static UnicodeBlock _coptic; - - /// - /// Represents the 'Georgian Supplement' Unicode block (U+2D00..U+2D2F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2D00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock GeorgianSupplement - { - get - { - return Volatile.Read(ref _georgianSupplement) ?? CreateBlock(ref _georgianSupplement, first: '\u2D00', last: '\u2D2F'); - } - } - private static UnicodeBlock _georgianSupplement; - - /// - /// Represents the 'Tifinagh' Unicode block (U+2D30..U+2D7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2D30.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Tifinagh - { - get - { - return Volatile.Read(ref _tifinagh) ?? CreateBlock(ref _tifinagh, first: '\u2D30', last: '\u2D7F'); - } - } - private static UnicodeBlock _tifinagh; - - /// - /// Represents the 'Ethiopic Extended' Unicode block (U+2D80..U+2DDF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2D80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock EthiopicExtended - { - get - { - return Volatile.Read(ref _ethiopicExtended) ?? CreateBlock(ref _ethiopicExtended, first: '\u2D80', last: '\u2DDF'); - } - } - private static UnicodeBlock _ethiopicExtended; - - /// - /// Represents the 'Cyrillic Extended-A' Unicode block (U+2DE0..U+2DFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2DE0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CyrillicExtendedA - { - get - { - return Volatile.Read(ref _cyrillicExtendedA) ?? CreateBlock(ref _cyrillicExtendedA, first: '\u2DE0', last: '\u2DFF'); - } - } - private static UnicodeBlock _cyrillicExtendedA; - - /// - /// Represents the 'Supplemental Punctuation' Unicode block (U+2E00..U+2E7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2E00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SupplementalPunctuation - { - get - { - return Volatile.Read(ref _supplementalPunctuation) ?? CreateBlock(ref _supplementalPunctuation, first: '\u2E00', last: '\u2E7F'); - } - } - private static UnicodeBlock _supplementalPunctuation; - - /// - /// Represents the 'CJK Radicals Supplement' Unicode block (U+2E80..U+2EFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2E80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKRadicalsSupplement - { - get - { - return Volatile.Read(ref _cjkRadicalsSupplement) ?? CreateBlock(ref _cjkRadicalsSupplement, first: '\u2E80', last: '\u2EFF'); - } - } - private static UnicodeBlock _cjkRadicalsSupplement; - - /// - /// Represents the 'Kangxi Radicals' Unicode block (U+2F00..U+2FDF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2F00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock KangxiRadicals - { - get - { - return Volatile.Read(ref _kangxiRadicals) ?? CreateBlock(ref _kangxiRadicals, first: '\u2F00', last: '\u2FDF'); - } - } - private static UnicodeBlock _kangxiRadicals; - - /// - /// Represents the 'Ideographic Description Characters' Unicode block (U+2FF0..U+2FFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U2FF0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock IdeographicDescriptionCharacters - { - get - { - return Volatile.Read(ref _ideographicDescriptionCharacters) ?? CreateBlock(ref _ideographicDescriptionCharacters, first: '\u2FF0', last: '\u2FFF'); - } - } - private static UnicodeBlock _ideographicDescriptionCharacters; - - /// - /// Represents the 'CJK Symbols and Punctuation' Unicode block (U+3000..U+303F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3000.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKSymbolsandPunctuation - { - get - { - return Volatile.Read(ref _cjkSymbolsandPunctuation) ?? CreateBlock(ref _cjkSymbolsandPunctuation, first: '\u3000', last: '\u303F'); - } - } - private static UnicodeBlock _cjkSymbolsandPunctuation; - - /// - /// Represents the 'Hiragana' Unicode block (U+3040..U+309F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3040.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Hiragana - { - get - { - return Volatile.Read(ref _hiragana) ?? CreateBlock(ref _hiragana, first: '\u3040', last: '\u309F'); - } - } - private static UnicodeBlock _hiragana; - - /// - /// Represents the 'Katakana' Unicode block (U+30A0..U+30FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U30A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Katakana - { - get - { - return Volatile.Read(ref _katakana) ?? CreateBlock(ref _katakana, first: '\u30A0', last: '\u30FF'); - } - } - private static UnicodeBlock _katakana; - - /// - /// Represents the 'Bopomofo' Unicode block (U+3100..U+312F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3100.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Bopomofo - { - get - { - return Volatile.Read(ref _bopomofo) ?? CreateBlock(ref _bopomofo, first: '\u3100', last: '\u312F'); - } - } - private static UnicodeBlock _bopomofo; - - /// - /// Represents the 'Hangul Compatibility Jamo' Unicode block (U+3130..U+318F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3130.pdf for the full set of characters in this block. - /// - public static UnicodeBlock HangulCompatibilityJamo - { - get - { - return Volatile.Read(ref _hangulCompatibilityJamo) ?? CreateBlock(ref _hangulCompatibilityJamo, first: '\u3130', last: '\u318F'); - } - } - private static UnicodeBlock _hangulCompatibilityJamo; - - /// - /// Represents the 'Kanbun' Unicode block (U+3190..U+319F). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3190.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Kanbun - { - get - { - return Volatile.Read(ref _kanbun) ?? CreateBlock(ref _kanbun, first: '\u3190', last: '\u319F'); - } - } - private static UnicodeBlock _kanbun; - - /// - /// Represents the 'Bopomofo Extended' Unicode block (U+31A0..U+31BF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U31A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock BopomofoExtended - { - get - { - return Volatile.Read(ref _bopomofoExtended) ?? CreateBlock(ref _bopomofoExtended, first: '\u31A0', last: '\u31BF'); - } - } - private static UnicodeBlock _bopomofoExtended; - - /// - /// Represents the 'CJK Strokes' Unicode block (U+31C0..U+31EF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U31C0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKStrokes - { - get - { - return Volatile.Read(ref _cjkStrokes) ?? CreateBlock(ref _cjkStrokes, first: '\u31C0', last: '\u31EF'); - } - } - private static UnicodeBlock _cjkStrokes; - - /// - /// Represents the 'Katakana Phonetic Extensions' Unicode block (U+31F0..U+31FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U31F0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock KatakanaPhoneticExtensions - { - get - { - return Volatile.Read(ref _katakanaPhoneticExtensions) ?? CreateBlock(ref _katakanaPhoneticExtensions, first: '\u31F0', last: '\u31FF'); - } - } - private static UnicodeBlock _katakanaPhoneticExtensions; - - /// - /// Represents the 'Enclosed CJK Letters and Months' Unicode block (U+3200..U+32FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3200.pdf for the full set of characters in this block. - /// - public static UnicodeBlock EnclosedCJKLettersandMonths - { - get - { - return Volatile.Read(ref _enclosedCJKLettersandMonths) ?? CreateBlock(ref _enclosedCJKLettersandMonths, first: '\u3200', last: '\u32FF'); - } - } - private static UnicodeBlock _enclosedCJKLettersandMonths; - - /// - /// Represents the 'CJK Compatibility' Unicode block (U+3300..U+33FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3300.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKCompatibility - { - get - { - return Volatile.Read(ref _cjkCompatibility) ?? CreateBlock(ref _cjkCompatibility, first: '\u3300', last: '\u33FF'); - } - } - private static UnicodeBlock _cjkCompatibility; - - /// - /// Represents the 'CJK Unified Ideographs Extension A' Unicode block (U+3400..U+4DBF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U3400.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKUnifiedIdeographsExtensionA - { - get - { - return Volatile.Read(ref _cjkUnifiedIdeographsExtensionA) ?? CreateBlock(ref _cjkUnifiedIdeographsExtensionA, first: '\u3400', last: '\u4DBF'); - } - } - private static UnicodeBlock _cjkUnifiedIdeographsExtensionA; - - /// - /// Represents the 'Yijing Hexagram Symbols' Unicode block (U+4DC0..U+4DFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U4DC0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock YijingHexagramSymbols - { - get - { - return Volatile.Read(ref _yijingHexagramSymbols) ?? CreateBlock(ref _yijingHexagramSymbols, first: '\u4DC0', last: '\u4DFF'); - } - } - private static UnicodeBlock _yijingHexagramSymbols; - - /// - /// Represents the 'CJK Unified Ideographs' Unicode block (U+4E00..U+9FFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/U4E00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKUnifiedIdeographs - { - get - { - return Volatile.Read(ref _cjkUnifiedIdeographs) ?? CreateBlock(ref _cjkUnifiedIdeographs, first: '\u4E00', last: '\u9FFF'); - } - } - private static UnicodeBlock _cjkUnifiedIdeographs; - - /// - /// Represents the 'Yi Syllables' Unicode block (U+A000..U+A48F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA000.pdf for the full set of characters in this block. - /// - public static UnicodeBlock YiSyllables - { - get - { - return Volatile.Read(ref _yiSyllables) ?? CreateBlock(ref _yiSyllables, first: '\uA000', last: '\uA48F'); - } - } - private static UnicodeBlock _yiSyllables; - - /// - /// Represents the 'Yi Radicals' Unicode block (U+A490..U+A4CF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA490.pdf for the full set of characters in this block. - /// - public static UnicodeBlock YiRadicals - { - get - { - return Volatile.Read(ref _yiRadicals) ?? CreateBlock(ref _yiRadicals, first: '\uA490', last: '\uA4CF'); - } - } - private static UnicodeBlock _yiRadicals; - - /// - /// Represents the 'Lisu' Unicode block (U+A4D0..U+A4FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA4D0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Lisu - { - get - { - return Volatile.Read(ref _lisu) ?? CreateBlock(ref _lisu, first: '\uA4D0', last: '\uA4FF'); - } - } - private static UnicodeBlock _lisu; - - /// - /// Represents the 'Vai' Unicode block (U+A500..U+A63F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA500.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Vai - { - get - { - return Volatile.Read(ref _vai) ?? CreateBlock(ref _vai, first: '\uA500', last: '\uA63F'); - } - } - private static UnicodeBlock _vai; - - /// - /// Represents the 'Cyrillic Extended-B' Unicode block (U+A640..U+A69F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA640.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CyrillicExtendedB - { - get - { - return Volatile.Read(ref _cyrillicExtendedB) ?? CreateBlock(ref _cyrillicExtendedB, first: '\uA640', last: '\uA69F'); - } - } - private static UnicodeBlock _cyrillicExtendedB; - - /// - /// Represents the 'Bamum' Unicode block (U+A6A0..U+A6FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA6A0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Bamum - { - get - { - return Volatile.Read(ref _bamum) ?? CreateBlock(ref _bamum, first: '\uA6A0', last: '\uA6FF'); - } - } - private static UnicodeBlock _bamum; - - /// - /// Represents the 'Modifier Tone Letters' Unicode block (U+A700..U+A71F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA700.pdf for the full set of characters in this block. - /// - public static UnicodeBlock ModifierToneLetters - { - get - { - return Volatile.Read(ref _modifierToneLetters) ?? CreateBlock(ref _modifierToneLetters, first: '\uA700', last: '\uA71F'); - } - } - private static UnicodeBlock _modifierToneLetters; - - /// - /// Represents the 'Latin Extended-D' Unicode block (U+A720..U+A7FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA720.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LatinExtendedD - { - get - { - return Volatile.Read(ref _latinExtendedD) ?? CreateBlock(ref _latinExtendedD, first: '\uA720', last: '\uA7FF'); - } - } - private static UnicodeBlock _latinExtendedD; - - /// - /// Represents the 'Syloti Nagri' Unicode block (U+A800..U+A82F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA800.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SylotiNagri - { - get - { - return Volatile.Read(ref _sylotiNagri) ?? CreateBlock(ref _sylotiNagri, first: '\uA800', last: '\uA82F'); - } - } - private static UnicodeBlock _sylotiNagri; - - /// - /// Represents the 'Common Indic Number Forms' Unicode block (U+A830..U+A83F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA830.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CommonIndicNumberForms - { - get - { - return Volatile.Read(ref _commonIndicNumberForms) ?? CreateBlock(ref _commonIndicNumberForms, first: '\uA830', last: '\uA83F'); - } - } - private static UnicodeBlock _commonIndicNumberForms; - - /// - /// Represents the 'Phags-pa' Unicode block (U+A840..U+A87F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA840.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Phagspa - { - get - { - return Volatile.Read(ref _phagspa) ?? CreateBlock(ref _phagspa, first: '\uA840', last: '\uA87F'); - } - } - private static UnicodeBlock _phagspa; - - /// - /// Represents the 'Saurashtra' Unicode block (U+A880..U+A8DF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA880.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Saurashtra - { - get - { - return Volatile.Read(ref _saurashtra) ?? CreateBlock(ref _saurashtra, first: '\uA880', last: '\uA8DF'); - } - } - private static UnicodeBlock _saurashtra; - - /// - /// Represents the 'Devanagari Extended' Unicode block (U+A8E0..U+A8FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA8E0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock DevanagariExtended - { - get - { - return Volatile.Read(ref _devanagariExtended) ?? CreateBlock(ref _devanagariExtended, first: '\uA8E0', last: '\uA8FF'); - } - } - private static UnicodeBlock _devanagariExtended; - - /// - /// Represents the 'Kayah Li' Unicode block (U+A900..U+A92F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA900.pdf for the full set of characters in this block. - /// - public static UnicodeBlock KayahLi - { - get - { - return Volatile.Read(ref _kayahLi) ?? CreateBlock(ref _kayahLi, first: '\uA900', last: '\uA92F'); - } - } - private static UnicodeBlock _kayahLi; - - /// - /// Represents the 'Rejang' Unicode block (U+A930..U+A95F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA930.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Rejang - { - get - { - return Volatile.Read(ref _rejang) ?? CreateBlock(ref _rejang, first: '\uA930', last: '\uA95F'); - } - } - private static UnicodeBlock _rejang; - - /// - /// Represents the 'Hangul Jamo Extended-A' Unicode block (U+A960..U+A97F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA960.pdf for the full set of characters in this block. - /// - public static UnicodeBlock HangulJamoExtendedA - { - get - { - return Volatile.Read(ref _hangulJamoExtendedA) ?? CreateBlock(ref _hangulJamoExtendedA, first: '\uA960', last: '\uA97F'); - } - } - private static UnicodeBlock _hangulJamoExtendedA; - - /// - /// Represents the 'Javanese' Unicode block (U+A980..U+A9DF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA980.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Javanese - { - get - { - return Volatile.Read(ref _javanese) ?? CreateBlock(ref _javanese, first: '\uA980', last: '\uA9DF'); - } - } - private static UnicodeBlock _javanese; - - /// - /// Represents the 'Myanmar Extended-B' Unicode block (U+A9E0..U+A9FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UA9E0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MyanmarExtendedB - { - get - { - return Volatile.Read(ref _myanmarExtendedB) ?? CreateBlock(ref _myanmarExtendedB, first: '\uA9E0', last: '\uA9FF'); - } - } - private static UnicodeBlock _myanmarExtendedB; - - /// - /// Represents the 'Cham' Unicode block (U+AA00..U+AA5F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAA00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Cham - { - get - { - return Volatile.Read(ref _cham) ?? CreateBlock(ref _cham, first: '\uAA00', last: '\uAA5F'); - } - } - private static UnicodeBlock _cham; - - /// - /// Represents the 'Myanmar Extended-A' Unicode block (U+AA60..U+AA7F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAA60.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MyanmarExtendedA - { - get - { - return Volatile.Read(ref _myanmarExtendedA) ?? CreateBlock(ref _myanmarExtendedA, first: '\uAA60', last: '\uAA7F'); - } - } - private static UnicodeBlock _myanmarExtendedA; - - /// - /// Represents the 'Tai Viet' Unicode block (U+AA80..U+AADF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAA80.pdf for the full set of characters in this block. - /// - public static UnicodeBlock TaiViet - { - get - { - return Volatile.Read(ref _taiViet) ?? CreateBlock(ref _taiViet, first: '\uAA80', last: '\uAADF'); - } - } - private static UnicodeBlock _taiViet; - - /// - /// Represents the 'Meetei Mayek Extensions' Unicode block (U+AAE0..U+AAFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAAE0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MeeteiMayekExtensions - { - get - { - return Volatile.Read(ref _meeteiMayekExtensions) ?? CreateBlock(ref _meeteiMayekExtensions, first: '\uAAE0', last: '\uAAFF'); - } - } - private static UnicodeBlock _meeteiMayekExtensions; - - /// - /// Represents the 'Ethiopic Extended-A' Unicode block (U+AB00..U+AB2F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAB00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock EthiopicExtendedA - { - get - { - return Volatile.Read(ref _ethiopicExtendedA) ?? CreateBlock(ref _ethiopicExtendedA, first: '\uAB00', last: '\uAB2F'); - } - } - private static UnicodeBlock _ethiopicExtendedA; - - /// - /// Represents the 'Latin Extended-E' Unicode block (U+AB30..U+AB6F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAB30.pdf for the full set of characters in this block. - /// - public static UnicodeBlock LatinExtendedE - { - get - { - return Volatile.Read(ref _latinExtendedE) ?? CreateBlock(ref _latinExtendedE, first: '\uAB30', last: '\uAB6F'); - } - } - private static UnicodeBlock _latinExtendedE; - - /// - /// Represents the 'Meetei Mayek' Unicode block (U+ABC0..U+ABFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UABC0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock MeeteiMayek - { - get - { - return Volatile.Read(ref _meeteiMayek) ?? CreateBlock(ref _meeteiMayek, first: '\uABC0', last: '\uABFF'); - } - } - private static UnicodeBlock _meeteiMayek; - - /// - /// Represents the 'Hangul Syllables' Unicode block (U+AC00..U+D7AF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UAC00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock HangulSyllables - { - get - { - return Volatile.Read(ref _hangulSyllables) ?? CreateBlock(ref _hangulSyllables, first: '\uAC00', last: '\uD7AF'); - } - } - private static UnicodeBlock _hangulSyllables; - - /// - /// Represents the 'Hangul Jamo Extended-B' Unicode block (U+D7B0..U+D7FF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UD7B0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock HangulJamoExtendedB - { - get - { - return Volatile.Read(ref _hangulJamoExtendedB) ?? CreateBlock(ref _hangulJamoExtendedB, first: '\uD7B0', last: '\uD7FF'); - } - } - private static UnicodeBlock _hangulJamoExtendedB; - - /// - /// Represents the 'CJK Compatibility Ideographs' Unicode block (U+F900..U+FAFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UF900.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKCompatibilityIdeographs - { - get - { - return Volatile.Read(ref _cjkCompatibilityIdeographs) ?? CreateBlock(ref _cjkCompatibilityIdeographs, first: '\uF900', last: '\uFAFF'); - } - } - private static UnicodeBlock _cjkCompatibilityIdeographs; - - /// - /// Represents the 'Alphabetic Presentation Forms' Unicode block (U+FB00..U+FB4F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFB00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock AlphabeticPresentationForms - { - get - { - return Volatile.Read(ref _alphabeticPresentationForms) ?? CreateBlock(ref _alphabeticPresentationForms, first: '\uFB00', last: '\uFB4F'); - } - } - private static UnicodeBlock _alphabeticPresentationForms; - - /// - /// Represents the 'Arabic Presentation Forms-A' Unicode block (U+FB50..U+FDFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFB50.pdf for the full set of characters in this block. - /// - public static UnicodeBlock ArabicPresentationFormsA - { - get - { - return Volatile.Read(ref _arabicPresentationFormsA) ?? CreateBlock(ref _arabicPresentationFormsA, first: '\uFB50', last: '\uFDFF'); - } - } - private static UnicodeBlock _arabicPresentationFormsA; - - /// - /// Represents the 'Variation Selectors' Unicode block (U+FE00..U+FE0F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFE00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock VariationSelectors - { - get - { - return Volatile.Read(ref _variationSelectors) ?? CreateBlock(ref _variationSelectors, first: '\uFE00', last: '\uFE0F'); - } - } - private static UnicodeBlock _variationSelectors; - - /// - /// Represents the 'Vertical Forms' Unicode block (U+FE10..U+FE1F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFE10.pdf for the full set of characters in this block. - /// - public static UnicodeBlock VerticalForms - { - get - { - return Volatile.Read(ref _verticalForms) ?? CreateBlock(ref _verticalForms, first: '\uFE10', last: '\uFE1F'); - } - } - private static UnicodeBlock _verticalForms; - - /// - /// Represents the 'Combining Half Marks' Unicode block (U+FE20..U+FE2F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFE20.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CombiningHalfMarks - { - get - { - return Volatile.Read(ref _combiningHalfMarks) ?? CreateBlock(ref _combiningHalfMarks, first: '\uFE20', last: '\uFE2F'); - } - } - private static UnicodeBlock _combiningHalfMarks; - - /// - /// Represents the 'CJK Compatibility Forms' Unicode block (U+FE30..U+FE4F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFE30.pdf for the full set of characters in this block. - /// - public static UnicodeBlock CJKCompatibilityForms - { - get - { - return Volatile.Read(ref _cjkCompatibilityForms) ?? CreateBlock(ref _cjkCompatibilityForms, first: '\uFE30', last: '\uFE4F'); - } - } - private static UnicodeBlock _cjkCompatibilityForms; - - /// - /// Represents the 'Small Form Variants' Unicode block (U+FE50..U+FE6F). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFE50.pdf for the full set of characters in this block. - /// - public static UnicodeBlock SmallFormVariants - { - get - { - return Volatile.Read(ref _smallFormVariants) ?? CreateBlock(ref _smallFormVariants, first: '\uFE50', last: '\uFE6F'); - } - } - private static UnicodeBlock _smallFormVariants; - - /// - /// Represents the 'Arabic Presentation Forms-B' Unicode block (U+FE70..U+FEFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFE70.pdf for the full set of characters in this block. - /// - public static UnicodeBlock ArabicPresentationFormsB - { - get - { - return Volatile.Read(ref _arabicPresentationFormsB) ?? CreateBlock(ref _arabicPresentationFormsB, first: '\uFE70', last: '\uFEFF'); - } - } - private static UnicodeBlock _arabicPresentationFormsB; - - /// - /// Represents the 'Halfwidth and Fullwidth Forms' Unicode block (U+FF00..U+FFEF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFF00.pdf for the full set of characters in this block. - /// - public static UnicodeBlock HalfwidthandFullwidthForms - { - get - { - return Volatile.Read(ref _halfwidthandFullwidthForms) ?? CreateBlock(ref _halfwidthandFullwidthForms, first: '\uFF00', last: '\uFFEF'); - } - } - private static UnicodeBlock _halfwidthandFullwidthForms; - - /// - /// Represents the 'Specials' Unicode block (U+FFF0..U+FFFF). - /// - /// - /// See http://www.unicode.org/charts/PDF/UFFF0.pdf for the full set of characters in this block. - /// - public static UnicodeBlock Specials - { - get - { - return Volatile.Read(ref _specials) ?? CreateBlock(ref _specials, first: '\uFFF0', last: '\uFFFF'); - } - } - private static UnicodeBlock _specials; - } -} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeRange.cs b/src/Microsoft.Framework.WebEncoders/UnicodeRange.cs new file mode 100644 index 0000000000..04474ef759 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/UnicodeRange.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.Framework.WebEncoders +{ + /// + /// Represents a contiguous range of Unicode code points. + /// + /// + /// Currently only the Basic Multilingual Plane is supported. + /// + public sealed class UnicodeRange + { + /// + /// Creates a new . + /// + /// The first code point in the range. + /// The number of code points in the range. + public UnicodeRange(int firstCodePoint, int rangeSize) + { + // Parameter checking: the first code point and last code point must + // lie within the BMP. See http://unicode.org/faq/blocks_ranges.html for more info. + if (firstCodePoint < 0 || firstCodePoint > 0xFFFF) + { + throw new ArgumentOutOfRangeException(nameof(firstCodePoint)); + } + if (rangeSize < 0 || ((long)firstCodePoint + (long)rangeSize > 0x10000)) + { + throw new ArgumentOutOfRangeException(nameof(rangeSize)); + } + + FirstCodePoint = firstCodePoint; + RangeSize = rangeSize; + } + + /// + /// The first code point in this range. + /// + public int FirstCodePoint { get; } + + /// + /// The number of code points in this range. + /// + public int RangeSize { get; } + + /// + /// Creates a new from a span of characters. + /// + /// The first character in the range. + /// The last character in the range. + /// The representing this span. + public static UnicodeRange FromSpan(char firstChar, char lastChar) + { + if (lastChar < firstChar) + { + throw new ArgumentOutOfRangeException(nameof(lastChar)); + } + + return new UnicodeRange(firstChar, 1 + (int)(lastChar - firstChar)); + } + } +} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeRanges.cs b/src/Microsoft.Framework.WebEncoders/UnicodeRanges.cs new file mode 100644 index 0000000000..ccfac4b876 --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/UnicodeRanges.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Microsoft.Framework.WebEncoders +{ + /// + /// Contains predefined instances which correspond to blocks + /// from the Unicode 7.0 specification. + /// + public static partial class UnicodeRanges + { + /// + /// An empty . This range contains no code points. + /// + public static UnicodeRange None => Volatile.Read(ref _none) ?? CreateEmptyRange(ref _none); + private static UnicodeRange _none; + + /// + /// A which contains all characters in the Unicode Basic + /// Multilingual Plane (U+0000..U+FFFF). + /// + public static UnicodeRange All => Volatile.Read(ref _all) ?? CreateRange(ref _all, '\u0000', '\uFFFF'); + private static UnicodeRange _all; + + [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method + private static UnicodeRange CreateEmptyRange(ref UnicodeRange range) + { + // If the range hasn't been created, create it now. + // It's ok if two threads race and one overwrites the other's 'range' value. + var newRange = new UnicodeRange(0, 0); + Volatile.Write(ref range, newRange); + return newRange; + } + + [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method + private static UnicodeRange CreateRange(ref UnicodeRange range, char first, char last) + { + // If the range hasn't been created, create it now. + // It's ok if two threads race and one overwrites the other's 'range' value. + Debug.Assert(last > first, "Code points were specified out of order."); + var newRange = UnicodeRange.FromSpan(first, last); + Volatile.Write(ref range, newRange); + return newRange; + } + } +} diff --git a/src/Microsoft.Framework.WebEncoders/UnicodeRanges.generated.cs b/src/Microsoft.Framework.WebEncoders/UnicodeRanges.generated.cs new file mode 100644 index 0000000000..d5aced410b --- /dev/null +++ b/src/Microsoft.Framework.WebEncoders/UnicodeRanges.generated.cs @@ -0,0 +1,1406 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Threading; + +namespace Microsoft.Framework.WebEncoders +{ + public static partial class UnicodeRanges + { + /// + /// A corresponding to the 'Basic Latin' Unicode block (U+0000..U+007F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0000.pdf for the full set of characters in this block. + /// + public static UnicodeRange BasicLatin => Volatile.Read(ref _basicLatin) ?? CreateRange(ref _basicLatin, first: '\u0000', last: '\u007F'); + private static UnicodeRange _basicLatin; + + /// + /// A corresponding to the 'Latin-1 Supplement' Unicode block (U+0080..U+00FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0080.pdf for the full set of characters in this block. + /// + public static UnicodeRange Latin1Supplement => Volatile.Read(ref _latin1Supplement) ?? CreateRange(ref _latin1Supplement, first: '\u0080', last: '\u00FF'); + private static UnicodeRange _latin1Supplement; + + /// + /// A corresponding to the 'Latin Extended-A' Unicode block (U+0100..U+017F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0100.pdf for the full set of characters in this block. + /// + public static UnicodeRange LatinExtendedA => Volatile.Read(ref _latinExtendedA) ?? CreateRange(ref _latinExtendedA, first: '\u0100', last: '\u017F'); + private static UnicodeRange _latinExtendedA; + + /// + /// A corresponding to the 'Latin Extended-B' Unicode block (U+0180..U+024F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0180.pdf for the full set of characters in this block. + /// + public static UnicodeRange LatinExtendedB => Volatile.Read(ref _latinExtendedB) ?? CreateRange(ref _latinExtendedB, first: '\u0180', last: '\u024F'); + private static UnicodeRange _latinExtendedB; + + /// + /// A corresponding to the 'IPA Extensions' Unicode block (U+0250..U+02AF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0250.pdf for the full set of characters in this block. + /// + public static UnicodeRange IPAExtensions => Volatile.Read(ref _ipaExtensions) ?? CreateRange(ref _ipaExtensions, first: '\u0250', last: '\u02AF'); + private static UnicodeRange _ipaExtensions; + + /// + /// A corresponding to the 'Spacing Modifier Letters' Unicode block (U+02B0..U+02FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U02B0.pdf for the full set of characters in this block. + /// + public static UnicodeRange SpacingModifierLetters => Volatile.Read(ref _spacingModifierLetters) ?? CreateRange(ref _spacingModifierLetters, first: '\u02B0', last: '\u02FF'); + private static UnicodeRange _spacingModifierLetters; + + /// + /// A corresponding to the 'Combining Diacritical Marks' Unicode block (U+0300..U+036F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0300.pdf for the full set of characters in this block. + /// + public static UnicodeRange CombiningDiacriticalMarks => Volatile.Read(ref _combiningDiacriticalMarks) ?? CreateRange(ref _combiningDiacriticalMarks, first: '\u0300', last: '\u036F'); + private static UnicodeRange _combiningDiacriticalMarks; + + /// + /// A corresponding to the 'Greek and Coptic' Unicode block (U+0370..U+03FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0370.pdf for the full set of characters in this block. + /// + public static UnicodeRange GreekandCoptic => Volatile.Read(ref _greekandCoptic) ?? CreateRange(ref _greekandCoptic, first: '\u0370', last: '\u03FF'); + private static UnicodeRange _greekandCoptic; + + /// + /// A corresponding to the 'Cyrillic' Unicode block (U+0400..U+04FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0400.pdf for the full set of characters in this block. + /// + public static UnicodeRange Cyrillic => Volatile.Read(ref _cyrillic) ?? CreateRange(ref _cyrillic, first: '\u0400', last: '\u04FF'); + private static UnicodeRange _cyrillic; + + /// + /// A corresponding to the 'Cyrillic Supplement' Unicode block (U+0500..U+052F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0500.pdf for the full set of characters in this block. + /// + public static UnicodeRange CyrillicSupplement => Volatile.Read(ref _cyrillicSupplement) ?? CreateRange(ref _cyrillicSupplement, first: '\u0500', last: '\u052F'); + private static UnicodeRange _cyrillicSupplement; + + /// + /// A corresponding to the 'Armenian' Unicode block (U+0530..U+058F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0530.pdf for the full set of characters in this block. + /// + public static UnicodeRange Armenian => Volatile.Read(ref _armenian) ?? CreateRange(ref _armenian, first: '\u0530', last: '\u058F'); + private static UnicodeRange _armenian; + + /// + /// A corresponding to the 'Hebrew' Unicode block (U+0590..U+05FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0590.pdf for the full set of characters in this block. + /// + public static UnicodeRange Hebrew => Volatile.Read(ref _hebrew) ?? CreateRange(ref _hebrew, first: '\u0590', last: '\u05FF'); + private static UnicodeRange _hebrew; + + /// + /// A corresponding to the 'Arabic' Unicode block (U+0600..U+06FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0600.pdf for the full set of characters in this block. + /// + public static UnicodeRange Arabic => Volatile.Read(ref _arabic) ?? CreateRange(ref _arabic, first: '\u0600', last: '\u06FF'); + private static UnicodeRange _arabic; + + /// + /// A corresponding to the 'Syriac' Unicode block (U+0700..U+074F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0700.pdf for the full set of characters in this block. + /// + public static UnicodeRange Syriac => Volatile.Read(ref _syriac) ?? CreateRange(ref _syriac, first: '\u0700', last: '\u074F'); + private static UnicodeRange _syriac; + + /// + /// A corresponding to the 'Arabic Supplement' Unicode block (U+0750..U+077F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0750.pdf for the full set of characters in this block. + /// + public static UnicodeRange ArabicSupplement => Volatile.Read(ref _arabicSupplement) ?? CreateRange(ref _arabicSupplement, first: '\u0750', last: '\u077F'); + private static UnicodeRange _arabicSupplement; + + /// + /// A corresponding to the 'Thaana' Unicode block (U+0780..U+07BF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0780.pdf for the full set of characters in this block. + /// + public static UnicodeRange Thaana => Volatile.Read(ref _thaana) ?? CreateRange(ref _thaana, first: '\u0780', last: '\u07BF'); + private static UnicodeRange _thaana; + + /// + /// A corresponding to the 'NKo' Unicode block (U+07C0..U+07FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U07C0.pdf for the full set of characters in this block. + /// + public static UnicodeRange NKo => Volatile.Read(ref _nKo) ?? CreateRange(ref _nKo, first: '\u07C0', last: '\u07FF'); + private static UnicodeRange _nKo; + + /// + /// A corresponding to the 'Samaritan' Unicode block (U+0800..U+083F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0800.pdf for the full set of characters in this block. + /// + public static UnicodeRange Samaritan => Volatile.Read(ref _samaritan) ?? CreateRange(ref _samaritan, first: '\u0800', last: '\u083F'); + private static UnicodeRange _samaritan; + + /// + /// A corresponding to the 'Mandaic' Unicode block (U+0840..U+085F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0840.pdf for the full set of characters in this block. + /// + public static UnicodeRange Mandaic => Volatile.Read(ref _mandaic) ?? CreateRange(ref _mandaic, first: '\u0840', last: '\u085F'); + private static UnicodeRange _mandaic; + + /// + /// A corresponding to the 'Arabic Extended-A' Unicode block (U+08A0..U+08FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U08A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange ArabicExtendedA => Volatile.Read(ref _arabicExtendedA) ?? CreateRange(ref _arabicExtendedA, first: '\u08A0', last: '\u08FF'); + private static UnicodeRange _arabicExtendedA; + + /// + /// A corresponding to the 'Devanagari' Unicode block (U+0900..U+097F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0900.pdf for the full set of characters in this block. + /// + public static UnicodeRange Devanagari => Volatile.Read(ref _devanagari) ?? CreateRange(ref _devanagari, first: '\u0900', last: '\u097F'); + private static UnicodeRange _devanagari; + + /// + /// A corresponding to the 'Bengali' Unicode block (U+0980..U+09FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0980.pdf for the full set of characters in this block. + /// + public static UnicodeRange Bengali => Volatile.Read(ref _bengali) ?? CreateRange(ref _bengali, first: '\u0980', last: '\u09FF'); + private static UnicodeRange _bengali; + + /// + /// A corresponding to the 'Gurmukhi' Unicode block (U+0A00..U+0A7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0A00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Gurmukhi => Volatile.Read(ref _gurmukhi) ?? CreateRange(ref _gurmukhi, first: '\u0A00', last: '\u0A7F'); + private static UnicodeRange _gurmukhi; + + /// + /// A corresponding to the 'Gujarati' Unicode block (U+0A80..U+0AFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0A80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Gujarati => Volatile.Read(ref _gujarati) ?? CreateRange(ref _gujarati, first: '\u0A80', last: '\u0AFF'); + private static UnicodeRange _gujarati; + + /// + /// A corresponding to the 'Oriya' Unicode block (U+0B00..U+0B7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0B00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Oriya => Volatile.Read(ref _oriya) ?? CreateRange(ref _oriya, first: '\u0B00', last: '\u0B7F'); + private static UnicodeRange _oriya; + + /// + /// A corresponding to the 'Tamil' Unicode block (U+0B80..U+0BFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0B80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Tamil => Volatile.Read(ref _tamil) ?? CreateRange(ref _tamil, first: '\u0B80', last: '\u0BFF'); + private static UnicodeRange _tamil; + + /// + /// A corresponding to the 'Telugu' Unicode block (U+0C00..U+0C7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0C00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Telugu => Volatile.Read(ref _telugu) ?? CreateRange(ref _telugu, first: '\u0C00', last: '\u0C7F'); + private static UnicodeRange _telugu; + + /// + /// A corresponding to the 'Kannada' Unicode block (U+0C80..U+0CFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0C80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Kannada => Volatile.Read(ref _kannada) ?? CreateRange(ref _kannada, first: '\u0C80', last: '\u0CFF'); + private static UnicodeRange _kannada; + + /// + /// A corresponding to the 'Malayalam' Unicode block (U+0D00..U+0D7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0D00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Malayalam => Volatile.Read(ref _malayalam) ?? CreateRange(ref _malayalam, first: '\u0D00', last: '\u0D7F'); + private static UnicodeRange _malayalam; + + /// + /// A corresponding to the 'Sinhala' Unicode block (U+0D80..U+0DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0D80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Sinhala => Volatile.Read(ref _sinhala) ?? CreateRange(ref _sinhala, first: '\u0D80', last: '\u0DFF'); + private static UnicodeRange _sinhala; + + /// + /// A corresponding to the 'Thai' Unicode block (U+0E00..U+0E7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0E00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Thai => Volatile.Read(ref _thai) ?? CreateRange(ref _thai, first: '\u0E00', last: '\u0E7F'); + private static UnicodeRange _thai; + + /// + /// A corresponding to the 'Lao' Unicode block (U+0E80..U+0EFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0E80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Lao => Volatile.Read(ref _lao) ?? CreateRange(ref _lao, first: '\u0E80', last: '\u0EFF'); + private static UnicodeRange _lao; + + /// + /// A corresponding to the 'Tibetan' Unicode block (U+0F00..U+0FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U0F00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Tibetan => Volatile.Read(ref _tibetan) ?? CreateRange(ref _tibetan, first: '\u0F00', last: '\u0FFF'); + private static UnicodeRange _tibetan; + + /// + /// A corresponding to the 'Myanmar' Unicode block (U+1000..U+109F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1000.pdf for the full set of characters in this block. + /// + public static UnicodeRange Myanmar => Volatile.Read(ref _myanmar) ?? CreateRange(ref _myanmar, first: '\u1000', last: '\u109F'); + private static UnicodeRange _myanmar; + + /// + /// A corresponding to the 'Georgian' Unicode block (U+10A0..U+10FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U10A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Georgian => Volatile.Read(ref _georgian) ?? CreateRange(ref _georgian, first: '\u10A0', last: '\u10FF'); + private static UnicodeRange _georgian; + + /// + /// A corresponding to the 'Hangul Jamo' Unicode block (U+1100..U+11FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1100.pdf for the full set of characters in this block. + /// + public static UnicodeRange HangulJamo => Volatile.Read(ref _hangulJamo) ?? CreateRange(ref _hangulJamo, first: '\u1100', last: '\u11FF'); + private static UnicodeRange _hangulJamo; + + /// + /// A corresponding to the 'Ethiopic' Unicode block (U+1200..U+137F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1200.pdf for the full set of characters in this block. + /// + public static UnicodeRange Ethiopic => Volatile.Read(ref _ethiopic) ?? CreateRange(ref _ethiopic, first: '\u1200', last: '\u137F'); + private static UnicodeRange _ethiopic; + + /// + /// A corresponding to the 'Ethiopic Supplement' Unicode block (U+1380..U+139F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1380.pdf for the full set of characters in this block. + /// + public static UnicodeRange EthiopicSupplement => Volatile.Read(ref _ethiopicSupplement) ?? CreateRange(ref _ethiopicSupplement, first: '\u1380', last: '\u139F'); + private static UnicodeRange _ethiopicSupplement; + + /// + /// A corresponding to the 'Cherokee' Unicode block (U+13A0..U+13FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U13A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Cherokee => Volatile.Read(ref _cherokee) ?? CreateRange(ref _cherokee, first: '\u13A0', last: '\u13FF'); + private static UnicodeRange _cherokee; + + /// + /// A corresponding to the 'Unified Canadian Aboriginal Syllabics' Unicode block (U+1400..U+167F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1400.pdf for the full set of characters in this block. + /// + public static UnicodeRange UnifiedCanadianAboriginalSyllabics => Volatile.Read(ref _unifiedCanadianAboriginalSyllabics) ?? CreateRange(ref _unifiedCanadianAboriginalSyllabics, first: '\u1400', last: '\u167F'); + private static UnicodeRange _unifiedCanadianAboriginalSyllabics; + + /// + /// A corresponding to the 'Ogham' Unicode block (U+1680..U+169F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1680.pdf for the full set of characters in this block. + /// + public static UnicodeRange Ogham => Volatile.Read(ref _ogham) ?? CreateRange(ref _ogham, first: '\u1680', last: '\u169F'); + private static UnicodeRange _ogham; + + /// + /// A corresponding to the 'Runic' Unicode block (U+16A0..U+16FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U16A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Runic => Volatile.Read(ref _runic) ?? CreateRange(ref _runic, first: '\u16A0', last: '\u16FF'); + private static UnicodeRange _runic; + + /// + /// A corresponding to the 'Tagalog' Unicode block (U+1700..U+171F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1700.pdf for the full set of characters in this block. + /// + public static UnicodeRange Tagalog => Volatile.Read(ref _tagalog) ?? CreateRange(ref _tagalog, first: '\u1700', last: '\u171F'); + private static UnicodeRange _tagalog; + + /// + /// A corresponding to the 'Hanunoo' Unicode block (U+1720..U+173F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1720.pdf for the full set of characters in this block. + /// + public static UnicodeRange Hanunoo => Volatile.Read(ref _hanunoo) ?? CreateRange(ref _hanunoo, first: '\u1720', last: '\u173F'); + private static UnicodeRange _hanunoo; + + /// + /// A corresponding to the 'Buhid' Unicode block (U+1740..U+175F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1740.pdf for the full set of characters in this block. + /// + public static UnicodeRange Buhid => Volatile.Read(ref _buhid) ?? CreateRange(ref _buhid, first: '\u1740', last: '\u175F'); + private static UnicodeRange _buhid; + + /// + /// A corresponding to the 'Tagbanwa' Unicode block (U+1760..U+177F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1760.pdf for the full set of characters in this block. + /// + public static UnicodeRange Tagbanwa => Volatile.Read(ref _tagbanwa) ?? CreateRange(ref _tagbanwa, first: '\u1760', last: '\u177F'); + private static UnicodeRange _tagbanwa; + + /// + /// A corresponding to the 'Khmer' Unicode block (U+1780..U+17FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1780.pdf for the full set of characters in this block. + /// + public static UnicodeRange Khmer => Volatile.Read(ref _khmer) ?? CreateRange(ref _khmer, first: '\u1780', last: '\u17FF'); + private static UnicodeRange _khmer; + + /// + /// A corresponding to the 'Mongolian' Unicode block (U+1800..U+18AF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1800.pdf for the full set of characters in this block. + /// + public static UnicodeRange Mongolian => Volatile.Read(ref _mongolian) ?? CreateRange(ref _mongolian, first: '\u1800', last: '\u18AF'); + private static UnicodeRange _mongolian; + + /// + /// A corresponding to the 'Unified Canadian Aboriginal Syllabics Extended' Unicode block (U+18B0..U+18FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U18B0.pdf for the full set of characters in this block. + /// + public static UnicodeRange UnifiedCanadianAboriginalSyllabicsExtended => Volatile.Read(ref _unifiedCanadianAboriginalSyllabicsExtended) ?? CreateRange(ref _unifiedCanadianAboriginalSyllabicsExtended, first: '\u18B0', last: '\u18FF'); + private static UnicodeRange _unifiedCanadianAboriginalSyllabicsExtended; + + /// + /// A corresponding to the 'Limbu' Unicode block (U+1900..U+194F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1900.pdf for the full set of characters in this block. + /// + public static UnicodeRange Limbu => Volatile.Read(ref _limbu) ?? CreateRange(ref _limbu, first: '\u1900', last: '\u194F'); + private static UnicodeRange _limbu; + + /// + /// A corresponding to the 'Tai Le' Unicode block (U+1950..U+197F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1950.pdf for the full set of characters in this block. + /// + public static UnicodeRange TaiLe => Volatile.Read(ref _taiLe) ?? CreateRange(ref _taiLe, first: '\u1950', last: '\u197F'); + private static UnicodeRange _taiLe; + + /// + /// A corresponding to the 'New Tai Lue' Unicode block (U+1980..U+19DF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1980.pdf for the full set of characters in this block. + /// + public static UnicodeRange NewTaiLue => Volatile.Read(ref _newTaiLue) ?? CreateRange(ref _newTaiLue, first: '\u1980', last: '\u19DF'); + private static UnicodeRange _newTaiLue; + + /// + /// A corresponding to the 'Khmer Symbols' Unicode block (U+19E0..U+19FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U19E0.pdf for the full set of characters in this block. + /// + public static UnicodeRange KhmerSymbols => Volatile.Read(ref _khmerSymbols) ?? CreateRange(ref _khmerSymbols, first: '\u19E0', last: '\u19FF'); + private static UnicodeRange _khmerSymbols; + + /// + /// A corresponding to the 'Buginese' Unicode block (U+1A00..U+1A1F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1A00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Buginese => Volatile.Read(ref _buginese) ?? CreateRange(ref _buginese, first: '\u1A00', last: '\u1A1F'); + private static UnicodeRange _buginese; + + /// + /// A corresponding to the 'Tai Tham' Unicode block (U+1A20..U+1AAF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1A20.pdf for the full set of characters in this block. + /// + public static UnicodeRange TaiTham => Volatile.Read(ref _taiTham) ?? CreateRange(ref _taiTham, first: '\u1A20', last: '\u1AAF'); + private static UnicodeRange _taiTham; + + /// + /// A corresponding to the 'Combining Diacritical Marks Extended' Unicode block (U+1AB0..U+1AFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1AB0.pdf for the full set of characters in this block. + /// + public static UnicodeRange CombiningDiacriticalMarksExtended => Volatile.Read(ref _combiningDiacriticalMarksExtended) ?? CreateRange(ref _combiningDiacriticalMarksExtended, first: '\u1AB0', last: '\u1AFF'); + private static UnicodeRange _combiningDiacriticalMarksExtended; + + /// + /// A corresponding to the 'Balinese' Unicode block (U+1B00..U+1B7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1B00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Balinese => Volatile.Read(ref _balinese) ?? CreateRange(ref _balinese, first: '\u1B00', last: '\u1B7F'); + private static UnicodeRange _balinese; + + /// + /// A corresponding to the 'Sundanese' Unicode block (U+1B80..U+1BBF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1B80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Sundanese => Volatile.Read(ref _sundanese) ?? CreateRange(ref _sundanese, first: '\u1B80', last: '\u1BBF'); + private static UnicodeRange _sundanese; + + /// + /// A corresponding to the 'Batak' Unicode block (U+1BC0..U+1BFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1BC0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Batak => Volatile.Read(ref _batak) ?? CreateRange(ref _batak, first: '\u1BC0', last: '\u1BFF'); + private static UnicodeRange _batak; + + /// + /// A corresponding to the 'Lepcha' Unicode block (U+1C00..U+1C4F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1C00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Lepcha => Volatile.Read(ref _lepcha) ?? CreateRange(ref _lepcha, first: '\u1C00', last: '\u1C4F'); + private static UnicodeRange _lepcha; + + /// + /// A corresponding to the 'Ol Chiki' Unicode block (U+1C50..U+1C7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1C50.pdf for the full set of characters in this block. + /// + public static UnicodeRange OlChiki => Volatile.Read(ref _olChiki) ?? CreateRange(ref _olChiki, first: '\u1C50', last: '\u1C7F'); + private static UnicodeRange _olChiki; + + /// + /// A corresponding to the 'Sundanese Supplement' Unicode block (U+1CC0..U+1CCF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1CC0.pdf for the full set of characters in this block. + /// + public static UnicodeRange SundaneseSupplement => Volatile.Read(ref _sundaneseSupplement) ?? CreateRange(ref _sundaneseSupplement, first: '\u1CC0', last: '\u1CCF'); + private static UnicodeRange _sundaneseSupplement; + + /// + /// A corresponding to the 'Vedic Extensions' Unicode block (U+1CD0..U+1CFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1CD0.pdf for the full set of characters in this block. + /// + public static UnicodeRange VedicExtensions => Volatile.Read(ref _vedicExtensions) ?? CreateRange(ref _vedicExtensions, first: '\u1CD0', last: '\u1CFF'); + private static UnicodeRange _vedicExtensions; + + /// + /// A corresponding to the 'Phonetic Extensions' Unicode block (U+1D00..U+1D7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1D00.pdf for the full set of characters in this block. + /// + public static UnicodeRange PhoneticExtensions => Volatile.Read(ref _phoneticExtensions) ?? CreateRange(ref _phoneticExtensions, first: '\u1D00', last: '\u1D7F'); + private static UnicodeRange _phoneticExtensions; + + /// + /// A corresponding to the 'Phonetic Extensions Supplement' Unicode block (U+1D80..U+1DBF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1D80.pdf for the full set of characters in this block. + /// + public static UnicodeRange PhoneticExtensionsSupplement => Volatile.Read(ref _phoneticExtensionsSupplement) ?? CreateRange(ref _phoneticExtensionsSupplement, first: '\u1D80', last: '\u1DBF'); + private static UnicodeRange _phoneticExtensionsSupplement; + + /// + /// A corresponding to the 'Combining Diacritical Marks Supplement' Unicode block (U+1DC0..U+1DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1DC0.pdf for the full set of characters in this block. + /// + public static UnicodeRange CombiningDiacriticalMarksSupplement => Volatile.Read(ref _combiningDiacriticalMarksSupplement) ?? CreateRange(ref _combiningDiacriticalMarksSupplement, first: '\u1DC0', last: '\u1DFF'); + private static UnicodeRange _combiningDiacriticalMarksSupplement; + + /// + /// A corresponding to the 'Latin Extended Additional' Unicode block (U+1E00..U+1EFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1E00.pdf for the full set of characters in this block. + /// + public static UnicodeRange LatinExtendedAdditional => Volatile.Read(ref _latinExtendedAdditional) ?? CreateRange(ref _latinExtendedAdditional, first: '\u1E00', last: '\u1EFF'); + private static UnicodeRange _latinExtendedAdditional; + + /// + /// A corresponding to the 'Greek Extended' Unicode block (U+1F00..U+1FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U1F00.pdf for the full set of characters in this block. + /// + public static UnicodeRange GreekExtended => Volatile.Read(ref _greekExtended) ?? CreateRange(ref _greekExtended, first: '\u1F00', last: '\u1FFF'); + private static UnicodeRange _greekExtended; + + /// + /// A corresponding to the 'General Punctuation' Unicode block (U+2000..U+206F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2000.pdf for the full set of characters in this block. + /// + public static UnicodeRange GeneralPunctuation => Volatile.Read(ref _generalPunctuation) ?? CreateRange(ref _generalPunctuation, first: '\u2000', last: '\u206F'); + private static UnicodeRange _generalPunctuation; + + /// + /// A corresponding to the 'Superscripts and Subscripts' Unicode block (U+2070..U+209F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2070.pdf for the full set of characters in this block. + /// + public static UnicodeRange SuperscriptsandSubscripts => Volatile.Read(ref _superscriptsandSubscripts) ?? CreateRange(ref _superscriptsandSubscripts, first: '\u2070', last: '\u209F'); + private static UnicodeRange _superscriptsandSubscripts; + + /// + /// A corresponding to the 'Currency Symbols' Unicode block (U+20A0..U+20CF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U20A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange CurrencySymbols => Volatile.Read(ref _currencySymbols) ?? CreateRange(ref _currencySymbols, first: '\u20A0', last: '\u20CF'); + private static UnicodeRange _currencySymbols; + + /// + /// A corresponding to the 'Combining Diacritical Marks for Symbols' Unicode block (U+20D0..U+20FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U20D0.pdf for the full set of characters in this block. + /// + public static UnicodeRange CombiningDiacriticalMarksforSymbols => Volatile.Read(ref _combiningDiacriticalMarksforSymbols) ?? CreateRange(ref _combiningDiacriticalMarksforSymbols, first: '\u20D0', last: '\u20FF'); + private static UnicodeRange _combiningDiacriticalMarksforSymbols; + + /// + /// A corresponding to the 'Letterlike Symbols' Unicode block (U+2100..U+214F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2100.pdf for the full set of characters in this block. + /// + public static UnicodeRange LetterlikeSymbols => Volatile.Read(ref _letterlikeSymbols) ?? CreateRange(ref _letterlikeSymbols, first: '\u2100', last: '\u214F'); + private static UnicodeRange _letterlikeSymbols; + + /// + /// A corresponding to the 'Number Forms' Unicode block (U+2150..U+218F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2150.pdf for the full set of characters in this block. + /// + public static UnicodeRange NumberForms => Volatile.Read(ref _numberForms) ?? CreateRange(ref _numberForms, first: '\u2150', last: '\u218F'); + private static UnicodeRange _numberForms; + + /// + /// A corresponding to the 'Arrows' Unicode block (U+2190..U+21FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2190.pdf for the full set of characters in this block. + /// + public static UnicodeRange Arrows => Volatile.Read(ref _arrows) ?? CreateRange(ref _arrows, first: '\u2190', last: '\u21FF'); + private static UnicodeRange _arrows; + + /// + /// A corresponding to the 'Mathematical Operators' Unicode block (U+2200..U+22FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2200.pdf for the full set of characters in this block. + /// + public static UnicodeRange MathematicalOperators => Volatile.Read(ref _mathematicalOperators) ?? CreateRange(ref _mathematicalOperators, first: '\u2200', last: '\u22FF'); + private static UnicodeRange _mathematicalOperators; + + /// + /// A corresponding to the 'Miscellaneous Technical' Unicode block (U+2300..U+23FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2300.pdf for the full set of characters in this block. + /// + public static UnicodeRange MiscellaneousTechnical => Volatile.Read(ref _miscellaneousTechnical) ?? CreateRange(ref _miscellaneousTechnical, first: '\u2300', last: '\u23FF'); + private static UnicodeRange _miscellaneousTechnical; + + /// + /// A corresponding to the 'Control Pictures' Unicode block (U+2400..U+243F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2400.pdf for the full set of characters in this block. + /// + public static UnicodeRange ControlPictures => Volatile.Read(ref _controlPictures) ?? CreateRange(ref _controlPictures, first: '\u2400', last: '\u243F'); + private static UnicodeRange _controlPictures; + + /// + /// A corresponding to the 'Optical Character Recognition' Unicode block (U+2440..U+245F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2440.pdf for the full set of characters in this block. + /// + public static UnicodeRange OpticalCharacterRecognition => Volatile.Read(ref _opticalCharacterRecognition) ?? CreateRange(ref _opticalCharacterRecognition, first: '\u2440', last: '\u245F'); + private static UnicodeRange _opticalCharacterRecognition; + + /// + /// A corresponding to the 'Enclosed Alphanumerics' Unicode block (U+2460..U+24FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2460.pdf for the full set of characters in this block. + /// + public static UnicodeRange EnclosedAlphanumerics => Volatile.Read(ref _enclosedAlphanumerics) ?? CreateRange(ref _enclosedAlphanumerics, first: '\u2460', last: '\u24FF'); + private static UnicodeRange _enclosedAlphanumerics; + + /// + /// A corresponding to the 'Box Drawing' Unicode block (U+2500..U+257F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2500.pdf for the full set of characters in this block. + /// + public static UnicodeRange BoxDrawing => Volatile.Read(ref _boxDrawing) ?? CreateRange(ref _boxDrawing, first: '\u2500', last: '\u257F'); + private static UnicodeRange _boxDrawing; + + /// + /// A corresponding to the 'Block Elements' Unicode block (U+2580..U+259F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2580.pdf for the full set of characters in this block. + /// + public static UnicodeRange BlockElements => Volatile.Read(ref _blockElements) ?? CreateRange(ref _blockElements, first: '\u2580', last: '\u259F'); + private static UnicodeRange _blockElements; + + /// + /// A corresponding to the 'Geometric Shapes' Unicode block (U+25A0..U+25FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U25A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange GeometricShapes => Volatile.Read(ref _geometricShapes) ?? CreateRange(ref _geometricShapes, first: '\u25A0', last: '\u25FF'); + private static UnicodeRange _geometricShapes; + + /// + /// A corresponding to the 'Miscellaneous Symbols' Unicode block (U+2600..U+26FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2600.pdf for the full set of characters in this block. + /// + public static UnicodeRange MiscellaneousSymbols => Volatile.Read(ref _miscellaneousSymbols) ?? CreateRange(ref _miscellaneousSymbols, first: '\u2600', last: '\u26FF'); + private static UnicodeRange _miscellaneousSymbols; + + /// + /// A corresponding to the 'Dingbats' Unicode block (U+2700..U+27BF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2700.pdf for the full set of characters in this block. + /// + public static UnicodeRange Dingbats => Volatile.Read(ref _dingbats) ?? CreateRange(ref _dingbats, first: '\u2700', last: '\u27BF'); + private static UnicodeRange _dingbats; + + /// + /// A corresponding to the 'Miscellaneous Mathematical Symbols-A' Unicode block (U+27C0..U+27EF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U27C0.pdf for the full set of characters in this block. + /// + public static UnicodeRange MiscellaneousMathematicalSymbolsA => Volatile.Read(ref _miscellaneousMathematicalSymbolsA) ?? CreateRange(ref _miscellaneousMathematicalSymbolsA, first: '\u27C0', last: '\u27EF'); + private static UnicodeRange _miscellaneousMathematicalSymbolsA; + + /// + /// A corresponding to the 'Supplemental Arrows-A' Unicode block (U+27F0..U+27FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U27F0.pdf for the full set of characters in this block. + /// + public static UnicodeRange SupplementalArrowsA => Volatile.Read(ref _supplementalArrowsA) ?? CreateRange(ref _supplementalArrowsA, first: '\u27F0', last: '\u27FF'); + private static UnicodeRange _supplementalArrowsA; + + /// + /// A corresponding to the 'Braille Patterns' Unicode block (U+2800..U+28FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2800.pdf for the full set of characters in this block. + /// + public static UnicodeRange BraillePatterns => Volatile.Read(ref _braillePatterns) ?? CreateRange(ref _braillePatterns, first: '\u2800', last: '\u28FF'); + private static UnicodeRange _braillePatterns; + + /// + /// A corresponding to the 'Supplemental Arrows-B' Unicode block (U+2900..U+297F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2900.pdf for the full set of characters in this block. + /// + public static UnicodeRange SupplementalArrowsB => Volatile.Read(ref _supplementalArrowsB) ?? CreateRange(ref _supplementalArrowsB, first: '\u2900', last: '\u297F'); + private static UnicodeRange _supplementalArrowsB; + + /// + /// A corresponding to the 'Miscellaneous Mathematical Symbols-B' Unicode block (U+2980..U+29FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2980.pdf for the full set of characters in this block. + /// + public static UnicodeRange MiscellaneousMathematicalSymbolsB => Volatile.Read(ref _miscellaneousMathematicalSymbolsB) ?? CreateRange(ref _miscellaneousMathematicalSymbolsB, first: '\u2980', last: '\u29FF'); + private static UnicodeRange _miscellaneousMathematicalSymbolsB; + + /// + /// A corresponding to the 'Supplemental Mathematical Operators' Unicode block (U+2A00..U+2AFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2A00.pdf for the full set of characters in this block. + /// + public static UnicodeRange SupplementalMathematicalOperators => Volatile.Read(ref _supplementalMathematicalOperators) ?? CreateRange(ref _supplementalMathematicalOperators, first: '\u2A00', last: '\u2AFF'); + private static UnicodeRange _supplementalMathematicalOperators; + + /// + /// A corresponding to the 'Miscellaneous Symbols and Arrows' Unicode block (U+2B00..U+2BFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2B00.pdf for the full set of characters in this block. + /// + public static UnicodeRange MiscellaneousSymbolsandArrows => Volatile.Read(ref _miscellaneousSymbolsandArrows) ?? CreateRange(ref _miscellaneousSymbolsandArrows, first: '\u2B00', last: '\u2BFF'); + private static UnicodeRange _miscellaneousSymbolsandArrows; + + /// + /// A corresponding to the 'Glagolitic' Unicode block (U+2C00..U+2C5F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2C00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Glagolitic => Volatile.Read(ref _glagolitic) ?? CreateRange(ref _glagolitic, first: '\u2C00', last: '\u2C5F'); + private static UnicodeRange _glagolitic; + + /// + /// A corresponding to the 'Latin Extended-C' Unicode block (U+2C60..U+2C7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2C60.pdf for the full set of characters in this block. + /// + public static UnicodeRange LatinExtendedC => Volatile.Read(ref _latinExtendedC) ?? CreateRange(ref _latinExtendedC, first: '\u2C60', last: '\u2C7F'); + private static UnicodeRange _latinExtendedC; + + /// + /// A corresponding to the 'Coptic' Unicode block (U+2C80..U+2CFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2C80.pdf for the full set of characters in this block. + /// + public static UnicodeRange Coptic => Volatile.Read(ref _coptic) ?? CreateRange(ref _coptic, first: '\u2C80', last: '\u2CFF'); + private static UnicodeRange _coptic; + + /// + /// A corresponding to the 'Georgian Supplement' Unicode block (U+2D00..U+2D2F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2D00.pdf for the full set of characters in this block. + /// + public static UnicodeRange GeorgianSupplement => Volatile.Read(ref _georgianSupplement) ?? CreateRange(ref _georgianSupplement, first: '\u2D00', last: '\u2D2F'); + private static UnicodeRange _georgianSupplement; + + /// + /// A corresponding to the 'Tifinagh' Unicode block (U+2D30..U+2D7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2D30.pdf for the full set of characters in this block. + /// + public static UnicodeRange Tifinagh => Volatile.Read(ref _tifinagh) ?? CreateRange(ref _tifinagh, first: '\u2D30', last: '\u2D7F'); + private static UnicodeRange _tifinagh; + + /// + /// A corresponding to the 'Ethiopic Extended' Unicode block (U+2D80..U+2DDF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2D80.pdf for the full set of characters in this block. + /// + public static UnicodeRange EthiopicExtended => Volatile.Read(ref _ethiopicExtended) ?? CreateRange(ref _ethiopicExtended, first: '\u2D80', last: '\u2DDF'); + private static UnicodeRange _ethiopicExtended; + + /// + /// A corresponding to the 'Cyrillic Extended-A' Unicode block (U+2DE0..U+2DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2DE0.pdf for the full set of characters in this block. + /// + public static UnicodeRange CyrillicExtendedA => Volatile.Read(ref _cyrillicExtendedA) ?? CreateRange(ref _cyrillicExtendedA, first: '\u2DE0', last: '\u2DFF'); + private static UnicodeRange _cyrillicExtendedA; + + /// + /// A corresponding to the 'Supplemental Punctuation' Unicode block (U+2E00..U+2E7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2E00.pdf for the full set of characters in this block. + /// + public static UnicodeRange SupplementalPunctuation => Volatile.Read(ref _supplementalPunctuation) ?? CreateRange(ref _supplementalPunctuation, first: '\u2E00', last: '\u2E7F'); + private static UnicodeRange _supplementalPunctuation; + + /// + /// A corresponding to the 'CJK Radicals Supplement' Unicode block (U+2E80..U+2EFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2E80.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKRadicalsSupplement => Volatile.Read(ref _cjkRadicalsSupplement) ?? CreateRange(ref _cjkRadicalsSupplement, first: '\u2E80', last: '\u2EFF'); + private static UnicodeRange _cjkRadicalsSupplement; + + /// + /// A corresponding to the 'Kangxi Radicals' Unicode block (U+2F00..U+2FDF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2F00.pdf for the full set of characters in this block. + /// + public static UnicodeRange KangxiRadicals => Volatile.Read(ref _kangxiRadicals) ?? CreateRange(ref _kangxiRadicals, first: '\u2F00', last: '\u2FDF'); + private static UnicodeRange _kangxiRadicals; + + /// + /// A corresponding to the 'Ideographic Description Characters' Unicode block (U+2FF0..U+2FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U2FF0.pdf for the full set of characters in this block. + /// + public static UnicodeRange IdeographicDescriptionCharacters => Volatile.Read(ref _ideographicDescriptionCharacters) ?? CreateRange(ref _ideographicDescriptionCharacters, first: '\u2FF0', last: '\u2FFF'); + private static UnicodeRange _ideographicDescriptionCharacters; + + /// + /// A corresponding to the 'CJK Symbols and Punctuation' Unicode block (U+3000..U+303F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3000.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKSymbolsandPunctuation => Volatile.Read(ref _cjkSymbolsandPunctuation) ?? CreateRange(ref _cjkSymbolsandPunctuation, first: '\u3000', last: '\u303F'); + private static UnicodeRange _cjkSymbolsandPunctuation; + + /// + /// A corresponding to the 'Hiragana' Unicode block (U+3040..U+309F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3040.pdf for the full set of characters in this block. + /// + public static UnicodeRange Hiragana => Volatile.Read(ref _hiragana) ?? CreateRange(ref _hiragana, first: '\u3040', last: '\u309F'); + private static UnicodeRange _hiragana; + + /// + /// A corresponding to the 'Katakana' Unicode block (U+30A0..U+30FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U30A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Katakana => Volatile.Read(ref _katakana) ?? CreateRange(ref _katakana, first: '\u30A0', last: '\u30FF'); + private static UnicodeRange _katakana; + + /// + /// A corresponding to the 'Bopomofo' Unicode block (U+3100..U+312F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3100.pdf for the full set of characters in this block. + /// + public static UnicodeRange Bopomofo => Volatile.Read(ref _bopomofo) ?? CreateRange(ref _bopomofo, first: '\u3100', last: '\u312F'); + private static UnicodeRange _bopomofo; + + /// + /// A corresponding to the 'Hangul Compatibility Jamo' Unicode block (U+3130..U+318F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3130.pdf for the full set of characters in this block. + /// + public static UnicodeRange HangulCompatibilityJamo => Volatile.Read(ref _hangulCompatibilityJamo) ?? CreateRange(ref _hangulCompatibilityJamo, first: '\u3130', last: '\u318F'); + private static UnicodeRange _hangulCompatibilityJamo; + + /// + /// A corresponding to the 'Kanbun' Unicode block (U+3190..U+319F). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3190.pdf for the full set of characters in this block. + /// + public static UnicodeRange Kanbun => Volatile.Read(ref _kanbun) ?? CreateRange(ref _kanbun, first: '\u3190', last: '\u319F'); + private static UnicodeRange _kanbun; + + /// + /// A corresponding to the 'Bopomofo Extended' Unicode block (U+31A0..U+31BF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U31A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange BopomofoExtended => Volatile.Read(ref _bopomofoExtended) ?? CreateRange(ref _bopomofoExtended, first: '\u31A0', last: '\u31BF'); + private static UnicodeRange _bopomofoExtended; + + /// + /// A corresponding to the 'CJK Strokes' Unicode block (U+31C0..U+31EF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U31C0.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKStrokes => Volatile.Read(ref _cjkStrokes) ?? CreateRange(ref _cjkStrokes, first: '\u31C0', last: '\u31EF'); + private static UnicodeRange _cjkStrokes; + + /// + /// A corresponding to the 'Katakana Phonetic Extensions' Unicode block (U+31F0..U+31FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U31F0.pdf for the full set of characters in this block. + /// + public static UnicodeRange KatakanaPhoneticExtensions => Volatile.Read(ref _katakanaPhoneticExtensions) ?? CreateRange(ref _katakanaPhoneticExtensions, first: '\u31F0', last: '\u31FF'); + private static UnicodeRange _katakanaPhoneticExtensions; + + /// + /// A corresponding to the 'Enclosed CJK Letters and Months' Unicode block (U+3200..U+32FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3200.pdf for the full set of characters in this block. + /// + public static UnicodeRange EnclosedCJKLettersandMonths => Volatile.Read(ref _enclosedCJKLettersandMonths) ?? CreateRange(ref _enclosedCJKLettersandMonths, first: '\u3200', last: '\u32FF'); + private static UnicodeRange _enclosedCJKLettersandMonths; + + /// + /// A corresponding to the 'CJK Compatibility' Unicode block (U+3300..U+33FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3300.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKCompatibility => Volatile.Read(ref _cjkCompatibility) ?? CreateRange(ref _cjkCompatibility, first: '\u3300', last: '\u33FF'); + private static UnicodeRange _cjkCompatibility; + + /// + /// A corresponding to the 'CJK Unified Ideographs Extension A' Unicode block (U+3400..U+4DBF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U3400.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKUnifiedIdeographsExtensionA => Volatile.Read(ref _cjkUnifiedIdeographsExtensionA) ?? CreateRange(ref _cjkUnifiedIdeographsExtensionA, first: '\u3400', last: '\u4DBF'); + private static UnicodeRange _cjkUnifiedIdeographsExtensionA; + + /// + /// A corresponding to the 'Yijing Hexagram Symbols' Unicode block (U+4DC0..U+4DFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U4DC0.pdf for the full set of characters in this block. + /// + public static UnicodeRange YijingHexagramSymbols => Volatile.Read(ref _yijingHexagramSymbols) ?? CreateRange(ref _yijingHexagramSymbols, first: '\u4DC0', last: '\u4DFF'); + private static UnicodeRange _yijingHexagramSymbols; + + /// + /// A corresponding to the 'CJK Unified Ideographs' Unicode block (U+4E00..U+9FFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/U4E00.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKUnifiedIdeographs => Volatile.Read(ref _cjkUnifiedIdeographs) ?? CreateRange(ref _cjkUnifiedIdeographs, first: '\u4E00', last: '\u9FFF'); + private static UnicodeRange _cjkUnifiedIdeographs; + + /// + /// A corresponding to the 'Yi Syllables' Unicode block (U+A000..U+A48F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA000.pdf for the full set of characters in this block. + /// + public static UnicodeRange YiSyllables => Volatile.Read(ref _yiSyllables) ?? CreateRange(ref _yiSyllables, first: '\uA000', last: '\uA48F'); + private static UnicodeRange _yiSyllables; + + /// + /// A corresponding to the 'Yi Radicals' Unicode block (U+A490..U+A4CF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA490.pdf for the full set of characters in this block. + /// + public static UnicodeRange YiRadicals => Volatile.Read(ref _yiRadicals) ?? CreateRange(ref _yiRadicals, first: '\uA490', last: '\uA4CF'); + private static UnicodeRange _yiRadicals; + + /// + /// A corresponding to the 'Lisu' Unicode block (U+A4D0..U+A4FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA4D0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Lisu => Volatile.Read(ref _lisu) ?? CreateRange(ref _lisu, first: '\uA4D0', last: '\uA4FF'); + private static UnicodeRange _lisu; + + /// + /// A corresponding to the 'Vai' Unicode block (U+A500..U+A63F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA500.pdf for the full set of characters in this block. + /// + public static UnicodeRange Vai => Volatile.Read(ref _vai) ?? CreateRange(ref _vai, first: '\uA500', last: '\uA63F'); + private static UnicodeRange _vai; + + /// + /// A corresponding to the 'Cyrillic Extended-B' Unicode block (U+A640..U+A69F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA640.pdf for the full set of characters in this block. + /// + public static UnicodeRange CyrillicExtendedB => Volatile.Read(ref _cyrillicExtendedB) ?? CreateRange(ref _cyrillicExtendedB, first: '\uA640', last: '\uA69F'); + private static UnicodeRange _cyrillicExtendedB; + + /// + /// A corresponding to the 'Bamum' Unicode block (U+A6A0..U+A6FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA6A0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Bamum => Volatile.Read(ref _bamum) ?? CreateRange(ref _bamum, first: '\uA6A0', last: '\uA6FF'); + private static UnicodeRange _bamum; + + /// + /// A corresponding to the 'Modifier Tone Letters' Unicode block (U+A700..U+A71F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA700.pdf for the full set of characters in this block. + /// + public static UnicodeRange ModifierToneLetters => Volatile.Read(ref _modifierToneLetters) ?? CreateRange(ref _modifierToneLetters, first: '\uA700', last: '\uA71F'); + private static UnicodeRange _modifierToneLetters; + + /// + /// A corresponding to the 'Latin Extended-D' Unicode block (U+A720..U+A7FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA720.pdf for the full set of characters in this block. + /// + public static UnicodeRange LatinExtendedD => Volatile.Read(ref _latinExtendedD) ?? CreateRange(ref _latinExtendedD, first: '\uA720', last: '\uA7FF'); + private static UnicodeRange _latinExtendedD; + + /// + /// A corresponding to the 'Syloti Nagri' Unicode block (U+A800..U+A82F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA800.pdf for the full set of characters in this block. + /// + public static UnicodeRange SylotiNagri => Volatile.Read(ref _sylotiNagri) ?? CreateRange(ref _sylotiNagri, first: '\uA800', last: '\uA82F'); + private static UnicodeRange _sylotiNagri; + + /// + /// A corresponding to the 'Common Indic Number Forms' Unicode block (U+A830..U+A83F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA830.pdf for the full set of characters in this block. + /// + public static UnicodeRange CommonIndicNumberForms => Volatile.Read(ref _commonIndicNumberForms) ?? CreateRange(ref _commonIndicNumberForms, first: '\uA830', last: '\uA83F'); + private static UnicodeRange _commonIndicNumberForms; + + /// + /// A corresponding to the 'Phags-pa' Unicode block (U+A840..U+A87F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA840.pdf for the full set of characters in this block. + /// + public static UnicodeRange Phagspa => Volatile.Read(ref _phagspa) ?? CreateRange(ref _phagspa, first: '\uA840', last: '\uA87F'); + private static UnicodeRange _phagspa; + + /// + /// A corresponding to the 'Saurashtra' Unicode block (U+A880..U+A8DF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA880.pdf for the full set of characters in this block. + /// + public static UnicodeRange Saurashtra => Volatile.Read(ref _saurashtra) ?? CreateRange(ref _saurashtra, first: '\uA880', last: '\uA8DF'); + private static UnicodeRange _saurashtra; + + /// + /// A corresponding to the 'Devanagari Extended' Unicode block (U+A8E0..U+A8FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA8E0.pdf for the full set of characters in this block. + /// + public static UnicodeRange DevanagariExtended => Volatile.Read(ref _devanagariExtended) ?? CreateRange(ref _devanagariExtended, first: '\uA8E0', last: '\uA8FF'); + private static UnicodeRange _devanagariExtended; + + /// + /// A corresponding to the 'Kayah Li' Unicode block (U+A900..U+A92F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA900.pdf for the full set of characters in this block. + /// + public static UnicodeRange KayahLi => Volatile.Read(ref _kayahLi) ?? CreateRange(ref _kayahLi, first: '\uA900', last: '\uA92F'); + private static UnicodeRange _kayahLi; + + /// + /// A corresponding to the 'Rejang' Unicode block (U+A930..U+A95F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA930.pdf for the full set of characters in this block. + /// + public static UnicodeRange Rejang => Volatile.Read(ref _rejang) ?? CreateRange(ref _rejang, first: '\uA930', last: '\uA95F'); + private static UnicodeRange _rejang; + + /// + /// A corresponding to the 'Hangul Jamo Extended-A' Unicode block (U+A960..U+A97F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA960.pdf for the full set of characters in this block. + /// + public static UnicodeRange HangulJamoExtendedA => Volatile.Read(ref _hangulJamoExtendedA) ?? CreateRange(ref _hangulJamoExtendedA, first: '\uA960', last: '\uA97F'); + private static UnicodeRange _hangulJamoExtendedA; + + /// + /// A corresponding to the 'Javanese' Unicode block (U+A980..U+A9DF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA980.pdf for the full set of characters in this block. + /// + public static UnicodeRange Javanese => Volatile.Read(ref _javanese) ?? CreateRange(ref _javanese, first: '\uA980', last: '\uA9DF'); + private static UnicodeRange _javanese; + + /// + /// A corresponding to the 'Myanmar Extended-B' Unicode block (U+A9E0..U+A9FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UA9E0.pdf for the full set of characters in this block. + /// + public static UnicodeRange MyanmarExtendedB => Volatile.Read(ref _myanmarExtendedB) ?? CreateRange(ref _myanmarExtendedB, first: '\uA9E0', last: '\uA9FF'); + private static UnicodeRange _myanmarExtendedB; + + /// + /// A corresponding to the 'Cham' Unicode block (U+AA00..U+AA5F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAA00.pdf for the full set of characters in this block. + /// + public static UnicodeRange Cham => Volatile.Read(ref _cham) ?? CreateRange(ref _cham, first: '\uAA00', last: '\uAA5F'); + private static UnicodeRange _cham; + + /// + /// A corresponding to the 'Myanmar Extended-A' Unicode block (U+AA60..U+AA7F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAA60.pdf for the full set of characters in this block. + /// + public static UnicodeRange MyanmarExtendedA => Volatile.Read(ref _myanmarExtendedA) ?? CreateRange(ref _myanmarExtendedA, first: '\uAA60', last: '\uAA7F'); + private static UnicodeRange _myanmarExtendedA; + + /// + /// A corresponding to the 'Tai Viet' Unicode block (U+AA80..U+AADF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAA80.pdf for the full set of characters in this block. + /// + public static UnicodeRange TaiViet => Volatile.Read(ref _taiViet) ?? CreateRange(ref _taiViet, first: '\uAA80', last: '\uAADF'); + private static UnicodeRange _taiViet; + + /// + /// A corresponding to the 'Meetei Mayek Extensions' Unicode block (U+AAE0..U+AAFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAAE0.pdf for the full set of characters in this block. + /// + public static UnicodeRange MeeteiMayekExtensions => Volatile.Read(ref _meeteiMayekExtensions) ?? CreateRange(ref _meeteiMayekExtensions, first: '\uAAE0', last: '\uAAFF'); + private static UnicodeRange _meeteiMayekExtensions; + + /// + /// A corresponding to the 'Ethiopic Extended-A' Unicode block (U+AB00..U+AB2F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAB00.pdf for the full set of characters in this block. + /// + public static UnicodeRange EthiopicExtendedA => Volatile.Read(ref _ethiopicExtendedA) ?? CreateRange(ref _ethiopicExtendedA, first: '\uAB00', last: '\uAB2F'); + private static UnicodeRange _ethiopicExtendedA; + + /// + /// A corresponding to the 'Latin Extended-E' Unicode block (U+AB30..U+AB6F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAB30.pdf for the full set of characters in this block. + /// + public static UnicodeRange LatinExtendedE => Volatile.Read(ref _latinExtendedE) ?? CreateRange(ref _latinExtendedE, first: '\uAB30', last: '\uAB6F'); + private static UnicodeRange _latinExtendedE; + + /// + /// A corresponding to the 'Meetei Mayek' Unicode block (U+ABC0..U+ABFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UABC0.pdf for the full set of characters in this block. + /// + public static UnicodeRange MeeteiMayek => Volatile.Read(ref _meeteiMayek) ?? CreateRange(ref _meeteiMayek, first: '\uABC0', last: '\uABFF'); + private static UnicodeRange _meeteiMayek; + + /// + /// A corresponding to the 'Hangul Syllables' Unicode block (U+AC00..U+D7AF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UAC00.pdf for the full set of characters in this block. + /// + public static UnicodeRange HangulSyllables => Volatile.Read(ref _hangulSyllables) ?? CreateRange(ref _hangulSyllables, first: '\uAC00', last: '\uD7AF'); + private static UnicodeRange _hangulSyllables; + + /// + /// A corresponding to the 'Hangul Jamo Extended-B' Unicode block (U+D7B0..U+D7FF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UD7B0.pdf for the full set of characters in this block. + /// + public static UnicodeRange HangulJamoExtendedB => Volatile.Read(ref _hangulJamoExtendedB) ?? CreateRange(ref _hangulJamoExtendedB, first: '\uD7B0', last: '\uD7FF'); + private static UnicodeRange _hangulJamoExtendedB; + + /// + /// A corresponding to the 'CJK Compatibility Ideographs' Unicode block (U+F900..U+FAFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UF900.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKCompatibilityIdeographs => Volatile.Read(ref _cjkCompatibilityIdeographs) ?? CreateRange(ref _cjkCompatibilityIdeographs, first: '\uF900', last: '\uFAFF'); + private static UnicodeRange _cjkCompatibilityIdeographs; + + /// + /// A corresponding to the 'Alphabetic Presentation Forms' Unicode block (U+FB00..U+FB4F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFB00.pdf for the full set of characters in this block. + /// + public static UnicodeRange AlphabeticPresentationForms => Volatile.Read(ref _alphabeticPresentationForms) ?? CreateRange(ref _alphabeticPresentationForms, first: '\uFB00', last: '\uFB4F'); + private static UnicodeRange _alphabeticPresentationForms; + + /// + /// A corresponding to the 'Arabic Presentation Forms-A' Unicode block (U+FB50..U+FDFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFB50.pdf for the full set of characters in this block. + /// + public static UnicodeRange ArabicPresentationFormsA => Volatile.Read(ref _arabicPresentationFormsA) ?? CreateRange(ref _arabicPresentationFormsA, first: '\uFB50', last: '\uFDFF'); + private static UnicodeRange _arabicPresentationFormsA; + + /// + /// A corresponding to the 'Variation Selectors' Unicode block (U+FE00..U+FE0F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE00.pdf for the full set of characters in this block. + /// + public static UnicodeRange VariationSelectors => Volatile.Read(ref _variationSelectors) ?? CreateRange(ref _variationSelectors, first: '\uFE00', last: '\uFE0F'); + private static UnicodeRange _variationSelectors; + + /// + /// A corresponding to the 'Vertical Forms' Unicode block (U+FE10..U+FE1F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE10.pdf for the full set of characters in this block. + /// + public static UnicodeRange VerticalForms => Volatile.Read(ref _verticalForms) ?? CreateRange(ref _verticalForms, first: '\uFE10', last: '\uFE1F'); + private static UnicodeRange _verticalForms; + + /// + /// A corresponding to the 'Combining Half Marks' Unicode block (U+FE20..U+FE2F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE20.pdf for the full set of characters in this block. + /// + public static UnicodeRange CombiningHalfMarks => Volatile.Read(ref _combiningHalfMarks) ?? CreateRange(ref _combiningHalfMarks, first: '\uFE20', last: '\uFE2F'); + private static UnicodeRange _combiningHalfMarks; + + /// + /// A corresponding to the 'CJK Compatibility Forms' Unicode block (U+FE30..U+FE4F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE30.pdf for the full set of characters in this block. + /// + public static UnicodeRange CJKCompatibilityForms => Volatile.Read(ref _cjkCompatibilityForms) ?? CreateRange(ref _cjkCompatibilityForms, first: '\uFE30', last: '\uFE4F'); + private static UnicodeRange _cjkCompatibilityForms; + + /// + /// A corresponding to the 'Small Form Variants' Unicode block (U+FE50..U+FE6F). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE50.pdf for the full set of characters in this block. + /// + public static UnicodeRange SmallFormVariants => Volatile.Read(ref _smallFormVariants) ?? CreateRange(ref _smallFormVariants, first: '\uFE50', last: '\uFE6F'); + private static UnicodeRange _smallFormVariants; + + /// + /// A corresponding to the 'Arabic Presentation Forms-B' Unicode block (U+FE70..U+FEFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFE70.pdf for the full set of characters in this block. + /// + public static UnicodeRange ArabicPresentationFormsB => Volatile.Read(ref _arabicPresentationFormsB) ?? CreateRange(ref _arabicPresentationFormsB, first: '\uFE70', last: '\uFEFF'); + private static UnicodeRange _arabicPresentationFormsB; + + /// + /// A corresponding to the 'Halfwidth and Fullwidth Forms' Unicode block (U+FF00..U+FFEF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFF00.pdf for the full set of characters in this block. + /// + public static UnicodeRange HalfwidthandFullwidthForms => Volatile.Read(ref _halfwidthandFullwidthForms) ?? CreateRange(ref _halfwidthandFullwidthForms, first: '\uFF00', last: '\uFFEF'); + private static UnicodeRange _halfwidthandFullwidthForms; + + /// + /// A corresponding to the 'Specials' Unicode block (U+FFF0..U+FFFF). + /// + /// + /// See http://www.unicode.org/charts/PDF/UFFF0.pdf for the full set of characters in this block. + /// + public static UnicodeRange Specials => Volatile.Read(ref _specials) ?? CreateRange(ref _specials, first: '\uFFF0', last: '\uFFFF'); + private static UnicodeRange _specials; + } +} diff --git a/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs b/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs index 4497939c71..90f1bf2abc 100644 --- a/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs +++ b/src/Microsoft.Framework.WebEncoders/UrlEncoder.cs @@ -26,7 +26,7 @@ namespace Microsoft.Framework.WebEncoders private readonly UrlUnicodeEncoder _innerUnicodeEncoder; /// - /// Instantiates an encoder using the 'Basic Latin' code table as the allow list. + /// Instantiates an encoder using as its allow list. /// public UrlEncoder() : this(UrlUnicodeEncoder.BasicLatin) @@ -34,11 +34,11 @@ namespace Microsoft.Framework.WebEncoders } /// - /// Instantiates an encoder specifying which Unicode character blocks are allowed to + /// Instantiates an encoder specifying which Unicode character ranges are allowed to /// pass through the encoder unescaped. /// - public UrlEncoder(params UnicodeBlock[] allowedBlocks) - : this(new UrlUnicodeEncoder(new CodePointFilter(allowedBlocks))) + public UrlEncoder(params UnicodeRange[] allowedRanges) + : this(new UrlUnicodeEncoder(new CodePointFilter(allowedRanges))) { } @@ -57,8 +57,7 @@ namespace Microsoft.Framework.WebEncoders } /// - /// A default instance of the UrlEncoder, equivalent to allowing only - /// the 'Basic Latin' character range. + /// The default which uses as its allow list. /// public static UrlEncoder Default { @@ -133,8 +132,8 @@ namespace Microsoft.Framework.WebEncoders // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" // / "*" / "+" / "," / ";" / "=" // - // From this list, the base encoder blocks "&", "'", "+", - // and we'll additionally block "=" since it has special meaning + // From this list, the base encoder forbids "&", "'", "+", + // and we'll additionally forbid "=" since it has special meaning // in x-www-form-urlencoded representations. // // This means that the full list of allowed characters from the @@ -163,7 +162,7 @@ namespace Microsoft.Framework.WebEncoders UrlUnicodeEncoder encoder = Volatile.Read(ref _basicLatinSingleton); if (encoder == null) { - encoder = new UrlUnicodeEncoder(new CodePointFilter(UnicodeBlocks.BasicLatin)); + encoder = new UrlUnicodeEncoder(new CodePointFilter(UnicodeRanges.BasicLatin)); Volatile.Write(ref _basicLatinSingleton, encoder); } return encoder; diff --git a/test/Microsoft.Framework.WebEncoders.Tests/CodePointFilterTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/CodePointFilterTests.cs index e2fdf8dd7b..d8de51865d 100644 --- a/test/Microsoft.Framework.WebEncoders.Tests/CodePointFilterTests.cs +++ b/test/Microsoft.Framework.WebEncoders.Tests/CodePointFilterTests.cs @@ -43,7 +43,7 @@ namespace Microsoft.Framework.WebEncoders public void Ctor_OtherCodePointFilterAsConcreteType_Clones() { // Arrange - var originalFilter = new CodePointFilter(UnicodeBlocks.None).AllowChar('x'); + var originalFilter = new CodePointFilter().AllowChar('x'); // Act var newFilter = new CodePointFilter(originalFilter).AllowChar('y'); @@ -56,10 +56,10 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void Ctor_UnicodeBlocks() + public void Ctor_UnicodeRanges() { // Act - var filter = new CodePointFilter(UnicodeBlocks.LatinExtendedA, UnicodeBlocks.LatinExtendedC); + var filter = new CodePointFilter(UnicodeRanges.LatinExtendedA, UnicodeRanges.LatinExtendedC); // Assert for (int i = 0; i < 0x0100; i++) @@ -84,64 +84,6 @@ namespace Microsoft.Framework.WebEncoders } } - [Fact] - public void AllowBlock() - { - // Arrange - var filter = new CodePointFilter(UnicodeBlocks.None); - - // Act - var retVal = filter.AllowBlock(UnicodeBlocks.LatinExtendedA); - - // Assert - Assert.Same(filter, retVal); // returns 'this' instance - for (int i = 0; i < 0x0100; i++) - { - Assert.False(filter.IsCharacterAllowed((char)i)); - } - for (int i = 0x0100; i <= 0x017F; i++) - { - Assert.True(filter.IsCharacterAllowed((char)i)); - } - for (int i = 0x0180; i <= Char.MaxValue; i++) - { - Assert.False(filter.IsCharacterAllowed((char)i)); - } - } - - [Fact] - public void AllowBlocks() - { - // Arrange - var filter = new CodePointFilter(UnicodeBlocks.None); - - // Act - var retVal = filter.AllowBlocks(UnicodeBlocks.LatinExtendedA, UnicodeBlocks.LatinExtendedC); - - // Assert - Assert.Same(filter, retVal); // returns 'this' instance - for (int i = 0; i < 0x0100; i++) - { - Assert.False(filter.IsCharacterAllowed((char)i)); - } - for (int i = 0x0100; i <= 0x017F; i++) - { - Assert.True(filter.IsCharacterAllowed((char)i)); - } - for (int i = 0x0180; i < 0x2C60; i++) - { - Assert.False(filter.IsCharacterAllowed((char)i)); - } - for (int i = 0x2C60; i <= 0x2C7F; i++) - { - Assert.True(filter.IsCharacterAllowed((char)i)); - } - for (int i = 0x2C80; i <= Char.MaxValue; i++) - { - Assert.False(filter.IsCharacterAllowed((char)i)); - } - } - [Fact] public void AllowChar() { @@ -195,7 +137,7 @@ namespace Microsoft.Framework.WebEncoders public void AllowFilter() { // Arrange - var filter = new CodePointFilter(UnicodeBlocks.BasicLatin); + var filter = new CodePointFilter(UnicodeRanges.BasicLatin); // Act var retVal = filter.AllowFilter(new OddCodePointFilter()); @@ -212,6 +154,64 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void AllowRange() + { + // Arrange + var filter = new CodePointFilter(); + + // Act + var retVal = filter.AllowRange(UnicodeRanges.LatinExtendedA); + + // Assert + Assert.Same(filter, retVal); // returns 'this' instance + for (int i = 0; i < 0x0100; i++) + { + Assert.False(filter.IsCharacterAllowed((char)i)); + } + for (int i = 0x0100; i <= 0x017F; i++) + { + Assert.True(filter.IsCharacterAllowed((char)i)); + } + for (int i = 0x0180; i <= Char.MaxValue; i++) + { + Assert.False(filter.IsCharacterAllowed((char)i)); + } + } + + [Fact] + public void AllowRanges() + { + // Arrange + var filter = new CodePointFilter(); + + // Act + var retVal = filter.AllowRanges(UnicodeRanges.LatinExtendedA, UnicodeRanges.LatinExtendedC); + + // Assert + Assert.Same(filter, retVal); // returns 'this' instance + for (int i = 0; i < 0x0100; i++) + { + Assert.False(filter.IsCharacterAllowed((char)i)); + } + for (int i = 0x0100; i <= 0x017F; i++) + { + Assert.True(filter.IsCharacterAllowed((char)i)); + } + for (int i = 0x0180; i < 0x2C60; i++) + { + Assert.False(filter.IsCharacterAllowed((char)i)); + } + for (int i = 0x2C60; i <= 0x2C7F; i++) + { + Assert.True(filter.IsCharacterAllowed((char)i)); + } + for (int i = 0x2C80; i <= Char.MaxValue; i++) + { + Assert.False(filter.IsCharacterAllowed((char)i)); + } + } + [Fact] public void Clear() { @@ -234,13 +234,64 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void ForbidBlock() + public void ForbidChar() + { + // Arrange + var filter = new CodePointFilter(UnicodeRanges.BasicLatin); + + // Act + var retVal = filter.ForbidChar('x'); + + // Assert + Assert.Same(filter, retVal); // returns 'this' instance + Assert.True(filter.IsCharacterAllowed('w')); + Assert.False(filter.IsCharacterAllowed('x')); + Assert.True(filter.IsCharacterAllowed('y')); + Assert.True(filter.IsCharacterAllowed('z')); + } + + [Fact] + public void ForbidChars_Array() + { + // Arrange + var filter = new CodePointFilter(UnicodeRanges.BasicLatin); + + // Act + var retVal = filter.ForbidChars('x', 'z'); + + // Assert + Assert.Same(filter, retVal); // returns 'this' instance + Assert.True(filter.IsCharacterAllowed('w')); + Assert.False(filter.IsCharacterAllowed('x')); + Assert.True(filter.IsCharacterAllowed('y')); + Assert.False(filter.IsCharacterAllowed('z')); + } + + [Fact] + public void ForbidChars_String() + { + // Arrange + var filter = new CodePointFilter(UnicodeRanges.BasicLatin); + + // Act + var retVal = filter.ForbidChars("xz"); + + // Assert + Assert.Same(filter, retVal); // returns 'this' instance + Assert.True(filter.IsCharacterAllowed('w')); + Assert.False(filter.IsCharacterAllowed('x')); + Assert.True(filter.IsCharacterAllowed('y')); + Assert.False(filter.IsCharacterAllowed('z')); + } + + [Fact] + public void ForbidRange() { // Arrange var filter = new CodePointFilter(new OddCodePointFilter()); // Act - var retVal = filter.ForbidBlock(UnicodeBlocks.Specials); + var retVal = filter.ForbidRange(UnicodeRanges.Specials); // Assert Assert.Same(filter, retVal); // returns 'this' instance @@ -255,13 +306,13 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void ForbidBlocks() + public void ForbidRanges() { // Arrange var filter = new CodePointFilter(new OddCodePointFilter()); // Act - var retVal = filter.ForbidBlocks(UnicodeBlocks.BasicLatin, UnicodeBlocks.Specials); + var retVal = filter.ForbidRanges(UnicodeRanges.BasicLatin, UnicodeRanges.Specials); // Assert Assert.Same(filter, retVal); // returns 'this' instance @@ -279,68 +330,17 @@ namespace Microsoft.Framework.WebEncoders } } - [Fact] - public void ForbidChar() - { - // Arrange - var filter = new CodePointFilter(UnicodeBlocks.BasicLatin); - - // Act - var retVal = filter.ForbidChar('x'); - - // Assert - Assert.Same(filter, retVal); // returns 'this' instance - Assert.True(filter.IsCharacterAllowed('w')); - Assert.False(filter.IsCharacterAllowed('x')); - Assert.True(filter.IsCharacterAllowed('y')); - Assert.True(filter.IsCharacterAllowed('z')); - } - - [Fact] - public void ForbidChars_Array() - { - // Arrange - var filter = new CodePointFilter(UnicodeBlocks.BasicLatin); - - // Act - var retVal = filter.ForbidChars('x', 'z'); - - // Assert - Assert.Same(filter, retVal); // returns 'this' instance - Assert.True(filter.IsCharacterAllowed('w')); - Assert.False(filter.IsCharacterAllowed('x')); - Assert.True(filter.IsCharacterAllowed('y')); - Assert.False(filter.IsCharacterAllowed('z')); - } - - [Fact] - public void ForbidChars_String() - { - // Arrange - var filter = new CodePointFilter(UnicodeBlocks.BasicLatin); - - // Act - var retVal = filter.ForbidChars("xz"); - - // Assert - Assert.Same(filter, retVal); // returns 'this' instance - Assert.True(filter.IsCharacterAllowed('w')); - Assert.False(filter.IsCharacterAllowed('x')); - Assert.True(filter.IsCharacterAllowed('y')); - Assert.False(filter.IsCharacterAllowed('z')); - } - [Fact] public void GetAllowedCodePoints() { // Arrange - var expected = Enumerable.Range(UnicodeBlocks.BasicLatin.FirstCodePoint, UnicodeBlocks.BasicLatin.BlockSize) - .Concat(Enumerable.Range(UnicodeBlocks.Specials.FirstCodePoint, UnicodeBlocks.Specials.BlockSize)) + var expected = Enumerable.Range(UnicodeRanges.BasicLatin.FirstCodePoint, UnicodeRanges.BasicLatin.RangeSize) + .Concat(Enumerable.Range(UnicodeRanges.Specials.FirstCodePoint, UnicodeRanges.Specials.RangeSize)) .Except(new int[] { 'x' }) .OrderBy(i => i) .ToArray(); - var filter = new CodePointFilter(UnicodeBlocks.BasicLatin, UnicodeBlocks.Specials); + var filter = new CodePointFilter(UnicodeRanges.BasicLatin, UnicodeRanges.Specials); filter.ForbidChar('x'); // Act diff --git a/test/Microsoft.Framework.WebEncoders.Tests/EncoderExtensionsTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/EncoderExtensionsTests.cs index d4351a169e..8c5cfd83ac 100644 --- a/test/Microsoft.Framework.WebEncoders.Tests/EncoderExtensionsTests.cs +++ b/test/Microsoft.Framework.WebEncoders.Tests/EncoderExtensionsTests.cs @@ -19,7 +19,7 @@ namespace Microsoft.Framework.WebEncoders public void HtmlEncode_PositiveTestCase() { // Arrange - IHtmlEncoder encoder = new HtmlEncoder(UnicodeBlocks.All); + IHtmlEncoder encoder = new HtmlEncoder(UnicodeRanges.All); StringWriter writer = new StringWriter(); // Act @@ -39,7 +39,7 @@ namespace Microsoft.Framework.WebEncoders public void JavaScriptStringEncode_PositiveTestCase() { // Arrange - IJavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeBlocks.All); + IJavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeRanges.All); StringWriter writer = new StringWriter(); // Act @@ -59,7 +59,7 @@ namespace Microsoft.Framework.WebEncoders public void UrlEncode_PositiveTestCase() { // Arrange - IUrlEncoder encoder = new UrlEncoder(UnicodeBlocks.All); + IUrlEncoder encoder = new UrlEncoder(UnicodeRanges.All); StringWriter writer = new StringWriter(); // Act diff --git a/test/Microsoft.Framework.WebEncoders.Tests/HtmlEncoderTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/HtmlEncoderTests.cs index 6da944dc07..ee0c3231d9 100644 --- a/test/Microsoft.Framework.WebEncoders.Tests/HtmlEncoderTests.cs +++ b/test/Microsoft.Framework.WebEncoders.Tests/HtmlEncoderTests.cs @@ -14,7 +14,7 @@ namespace Microsoft.Framework.WebEncoders public void Ctor_WithCodePointFilter() { // Arrange - var filter = new CodePointFilter(UnicodeBlocks.None).AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); + var filter = new CodePointFilter().AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); HtmlEncoder encoder = new HtmlEncoder(filter); // Act & assert @@ -28,10 +28,10 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void Ctor_WithUnicodeBlocks() + public void Ctor_WithUnicodeRanges() { // Arrange - HtmlEncoder encoder = new HtmlEncoder(UnicodeBlocks.Latin1Supplement, UnicodeBlocks.MiscellaneousSymbols); + HtmlEncoder encoder = new HtmlEncoder(UnicodeRanges.Latin1Supplement, UnicodeRanges.MiscellaneousSymbols); // Act & assert Assert.Equal("a", encoder.HtmlEncode("a")); @@ -55,7 +55,7 @@ namespace Microsoft.Framework.WebEncoders public void Default_EquivalentToBasicLatin() { // Arrange - HtmlEncoder controlEncoder = new HtmlEncoder(UnicodeBlocks.BasicLatin); + HtmlEncoder controlEncoder = new HtmlEncoder(UnicodeRanges.BasicLatin); HtmlEncoder testEncoder = HtmlEncoder.Default; // Act & assert @@ -90,7 +90,7 @@ namespace Microsoft.Framework.WebEncoders public void HtmlEncode_AllRangesAllowed_StillEncodesForbiddenChars_Simple(string input, string expected) { // Arrange - HtmlEncoder encoder = new HtmlEncoder(UnicodeBlocks.All); + HtmlEncoder encoder = new HtmlEncoder(UnicodeRanges.All); // Act string retVal = encoder.HtmlEncode(input); @@ -103,7 +103,7 @@ namespace Microsoft.Framework.WebEncoders public void HtmlEncode_AllRangesAllowed_StillEncodesForbiddenChars_Extended() { // Arrange - HtmlEncoder encoder = new HtmlEncoder(UnicodeBlocks.All); + HtmlEncoder encoder = new HtmlEncoder(UnicodeRanges.All); // Act & assert - BMP chars for (int i = 0; i <= 0xFFFF; i++) @@ -165,7 +165,7 @@ namespace Microsoft.Framework.WebEncoders public void HtmlEncode_BadSurrogates_ReturnsUnicodeReplacementChar() { // Arrange - HtmlEncoder encoder = new HtmlEncoder(UnicodeBlocks.All); // allow all codepoints + HtmlEncoder encoder = new HtmlEncoder(UnicodeRanges.All); // allow all codepoints // "abcde" const string input = "a\uD800b\uDFFFc\uDFFF\uD800d\uDFFF\uD800\uDFFFe\uD800"; diff --git a/test/Microsoft.Framework.WebEncoders.Tests/JavaScriptStringEncoderTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/JavaScriptStringEncoderTests.cs index 470a5b2311..dbb9f91e68 100644 --- a/test/Microsoft.Framework.WebEncoders.Tests/JavaScriptStringEncoderTests.cs +++ b/test/Microsoft.Framework.WebEncoders.Tests/JavaScriptStringEncoderTests.cs @@ -14,7 +14,7 @@ namespace Microsoft.Framework.WebEncoders public void Ctor_WithCodePointFilter() { // Arrange - var filter = new CodePointFilter(UnicodeBlocks.None).AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); + var filter = new CodePointFilter().AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(filter); // Act & assert @@ -28,10 +28,10 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void Ctor_WithUnicodeBlocks() + public void Ctor_WithUnicodeRanges() { // Arrange - JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeBlocks.Latin1Supplement, UnicodeBlocks.MiscellaneousSymbols); + JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeRanges.Latin1Supplement, UnicodeRanges.MiscellaneousSymbols); // Act & assert Assert.Equal(@"\u0061", encoder.JavaScriptStringEncode("a")); @@ -55,7 +55,7 @@ namespace Microsoft.Framework.WebEncoders public void Default_EquivalentToBasicLatin() { // Arrange - JavaScriptStringEncoder controlEncoder = new JavaScriptStringEncoder(UnicodeBlocks.BasicLatin); + JavaScriptStringEncoder controlEncoder = new JavaScriptStringEncoder(UnicodeRanges.BasicLatin); JavaScriptStringEncoder testEncoder = JavaScriptStringEncoder.Default; // Act & assert @@ -97,7 +97,7 @@ namespace Microsoft.Framework.WebEncoders public void JavaScriptStringEncode_AllRangesAllowed_StillEncodesForbiddenChars_Simple(string input, string expected) { // Arrange - JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeBlocks.All); + JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeRanges.All); // Act string retVal = encoder.JavaScriptStringEncode(input); @@ -110,7 +110,7 @@ namespace Microsoft.Framework.WebEncoders public void JavaScriptStringEncode_AllRangesAllowed_StillEncodesForbiddenChars_Extended() { // Arrange - JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeBlocks.All); + JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeRanges.All); // Act & assert - BMP chars for (int i = 0; i <= 0xFFFF; i++) @@ -183,7 +183,7 @@ namespace Microsoft.Framework.WebEncoders public void JavaScriptStringEncode_BadSurrogates_ReturnsUnicodeReplacementChar() { // Arrange - JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeBlocks.All); // allow all codepoints + JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeRanges.All); // allow all codepoints // "abcde" const string input = "a\uD800b\uDFFFc\uDFFF\uD800d\uDFFF\uD800\uDFFFe\uD800"; @@ -290,7 +290,7 @@ namespace Microsoft.Framework.WebEncoders // \u-escape these characters instead of using \' and \". // Arrange - JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeBlocks.All); + JavaScriptStringEncoder encoder = new JavaScriptStringEncoder(UnicodeRanges.All); // Act string retVal = encoder.JavaScriptStringEncode(input); @@ -306,8 +306,8 @@ namespace Microsoft.Framework.WebEncoders // by never emitting HTML-sensitive characters unescaped. // Arrange - JavaScriptStringEncoder javaScriptStringEncoder = new JavaScriptStringEncoder(UnicodeBlocks.All); - HtmlEncoder htmlEncoder = new HtmlEncoder(UnicodeBlocks.All); + JavaScriptStringEncoder javaScriptStringEncoder = new JavaScriptStringEncoder(UnicodeRanges.All); + HtmlEncoder htmlEncoder = new HtmlEncoder(UnicodeRanges.All); // Act & assert for (int i = 0; i <= 0x10FFFF; i++) diff --git a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeBlockTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeBlockTests.cs deleted file mode 100644 index 5dee8d76bb..0000000000 --- a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeBlockTests.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Text; -using Xunit; - -namespace Microsoft.Framework.WebEncoders -{ - public class UnicodeBlockTests - { - [Theory] - [InlineData(-1, 16)] - [InlineData(1, 16)] - [InlineData(0x10000, 16)] - public void Ctor_FailureCase_FirstCodePoint(int firstCodePoint, int blockSize) - { - var ex = Assert.Throws(() => new UnicodeBlock(firstCodePoint, blockSize)); - Assert.Equal("firstCodePoint", ex.ParamName); - } - - [Theory] - [InlineData(0x0100, -1)] - [InlineData(0x0100, 15)] - [InlineData(0x0100, 0x10000)] - public void Ctor_FailureCase_BlockSize(int firstCodePoint, int blockSize) - { - var ex = Assert.Throws(() => new UnicodeBlock(firstCodePoint, blockSize)); - Assert.Equal("blockSize", ex.ParamName); - } - - [Fact] - public void Ctor_SuccessCase() - { - // Act - var block = new UnicodeBlock(0x0100, 128); // Latin Extended-A - - // Assert - Assert.Equal(0x0100, block.FirstCodePoint); - Assert.Equal(128, block.BlockSize); - } - - [Theory] - [InlineData('\u0001', '\u0002')] - public void FromCharacterRange_FailureCases_FirstChar(char firstChar, char lastChar) - { - var ex = Assert.Throws(() => UnicodeBlock.FromCharacterRange(firstChar, lastChar)); - Assert.Equal("firstChar", ex.ParamName); - } - - [Theory] - [InlineData('\u0100', '\u007F')] - [InlineData('\u0100', '\u0100')] - [InlineData('\u0100', '\u010E')] - public void FromCharacterRange_FailureCases_LastChar(char firstChar, char lastChar) - { - var ex = Assert.Throws(() => UnicodeBlock.FromCharacterRange(firstChar, lastChar)); - Assert.Equal("lastChar", ex.ParamName); - } - - [Fact] - public void FromCharacterRange_SuccessCase() - { - // Act - var block = UnicodeBlock.FromCharacterRange('\u0180', '\u024F'); // Latin Extended-B - - // Assert - Assert.Equal(0x0180, block.FirstCodePoint); - Assert.Equal(208, block.BlockSize); - } - - [Fact] - public void FromCharacterRange_SuccessCase_All() - { - // Act - var block = UnicodeBlock.FromCharacterRange('\u0000', '\uFFFF'); - - // Assert - Assert.Equal(0, block.FirstCodePoint); - Assert.Equal(0x10000, block.BlockSize); - } - } -} diff --git a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeBlocksTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeBlocksTests.cs deleted file mode 100644 index c4eb4591e3..0000000000 --- a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeBlocksTests.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Xunit; - -namespace Microsoft.Framework.WebEncoders -{ - public class UnicodeBlocksTests - { - [Fact] - public void Block_None() - { - UnicodeBlock block = UnicodeBlocks.None; - Assert.NotNull(block); - - // Test 1: the block should be empty - Assert.Equal(0, block.FirstCodePoint); - Assert.Equal(0, block.BlockSize); - - // Test 2: calling the property multiple times should cache and return the same block instance - UnicodeBlock block2 = UnicodeBlocks.None; - Assert.Same(block, block2); - } - - [Fact] - public void Block_All() - { - Block_Unicode('\u0000', '\uFFFF', nameof(UnicodeBlocks.All)); - } - - [Theory] - [InlineData('\u0000', '\u007F', nameof(UnicodeBlocks.BasicLatin))] - [InlineData('\u0080', '\u00FF', nameof(UnicodeBlocks.Latin1Supplement))] - [InlineData('\u0100', '\u017F', nameof(UnicodeBlocks.LatinExtendedA))] - [InlineData('\u0180', '\u024F', nameof(UnicodeBlocks.LatinExtendedB))] - [InlineData('\u0250', '\u02AF', nameof(UnicodeBlocks.IPAExtensions))] - [InlineData('\u02B0', '\u02FF', nameof(UnicodeBlocks.SpacingModifierLetters))] - [InlineData('\u0300', '\u036F', nameof(UnicodeBlocks.CombiningDiacriticalMarks))] - [InlineData('\u0370', '\u03FF', nameof(UnicodeBlocks.GreekandCoptic))] - [InlineData('\u0400', '\u04FF', nameof(UnicodeBlocks.Cyrillic))] - [InlineData('\u0500', '\u052F', nameof(UnicodeBlocks.CyrillicSupplement))] - [InlineData('\u0530', '\u058F', nameof(UnicodeBlocks.Armenian))] - [InlineData('\u0590', '\u05FF', nameof(UnicodeBlocks.Hebrew))] - [InlineData('\u0600', '\u06FF', nameof(UnicodeBlocks.Arabic))] - [InlineData('\u0700', '\u074F', nameof(UnicodeBlocks.Syriac))] - [InlineData('\u0750', '\u077F', nameof(UnicodeBlocks.ArabicSupplement))] - [InlineData('\u0780', '\u07BF', nameof(UnicodeBlocks.Thaana))] - [InlineData('\u07C0', '\u07FF', nameof(UnicodeBlocks.NKo))] - [InlineData('\u0800', '\u083F', nameof(UnicodeBlocks.Samaritan))] - [InlineData('\u0840', '\u085F', nameof(UnicodeBlocks.Mandaic))] - [InlineData('\u08A0', '\u08FF', nameof(UnicodeBlocks.ArabicExtendedA))] - [InlineData('\u0900', '\u097F', nameof(UnicodeBlocks.Devanagari))] - [InlineData('\u0980', '\u09FF', nameof(UnicodeBlocks.Bengali))] - [InlineData('\u0A00', '\u0A7F', nameof(UnicodeBlocks.Gurmukhi))] - [InlineData('\u0A80', '\u0AFF', nameof(UnicodeBlocks.Gujarati))] - [InlineData('\u0B00', '\u0B7F', nameof(UnicodeBlocks.Oriya))] - [InlineData('\u0B80', '\u0BFF', nameof(UnicodeBlocks.Tamil))] - [InlineData('\u0C00', '\u0C7F', nameof(UnicodeBlocks.Telugu))] - [InlineData('\u0C80', '\u0CFF', nameof(UnicodeBlocks.Kannada))] - [InlineData('\u0D00', '\u0D7F', nameof(UnicodeBlocks.Malayalam))] - [InlineData('\u0D80', '\u0DFF', nameof(UnicodeBlocks.Sinhala))] - [InlineData('\u0E00', '\u0E7F', nameof(UnicodeBlocks.Thai))] - [InlineData('\u0E80', '\u0EFF', nameof(UnicodeBlocks.Lao))] - [InlineData('\u0F00', '\u0FFF', nameof(UnicodeBlocks.Tibetan))] - [InlineData('\u1000', '\u109F', nameof(UnicodeBlocks.Myanmar))] - [InlineData('\u10A0', '\u10FF', nameof(UnicodeBlocks.Georgian))] - [InlineData('\u1100', '\u11FF', nameof(UnicodeBlocks.HangulJamo))] - [InlineData('\u1200', '\u137F', nameof(UnicodeBlocks.Ethiopic))] - [InlineData('\u1380', '\u139F', nameof(UnicodeBlocks.EthiopicSupplement))] - [InlineData('\u13A0', '\u13FF', nameof(UnicodeBlocks.Cherokee))] - [InlineData('\u1400', '\u167F', nameof(UnicodeBlocks.UnifiedCanadianAboriginalSyllabics))] - [InlineData('\u1680', '\u169F', nameof(UnicodeBlocks.Ogham))] - [InlineData('\u16A0', '\u16FF', nameof(UnicodeBlocks.Runic))] - [InlineData('\u1700', '\u171F', nameof(UnicodeBlocks.Tagalog))] - [InlineData('\u1720', '\u173F', nameof(UnicodeBlocks.Hanunoo))] - [InlineData('\u1740', '\u175F', nameof(UnicodeBlocks.Buhid))] - [InlineData('\u1760', '\u177F', nameof(UnicodeBlocks.Tagbanwa))] - [InlineData('\u1780', '\u17FF', nameof(UnicodeBlocks.Khmer))] - [InlineData('\u1800', '\u18AF', nameof(UnicodeBlocks.Mongolian))] - [InlineData('\u18B0', '\u18FF', nameof(UnicodeBlocks.UnifiedCanadianAboriginalSyllabicsExtended))] - [InlineData('\u1900', '\u194F', nameof(UnicodeBlocks.Limbu))] - [InlineData('\u1950', '\u197F', nameof(UnicodeBlocks.TaiLe))] - [InlineData('\u1980', '\u19DF', nameof(UnicodeBlocks.NewTaiLue))] - [InlineData('\u19E0', '\u19FF', nameof(UnicodeBlocks.KhmerSymbols))] - [InlineData('\u1A00', '\u1A1F', nameof(UnicodeBlocks.Buginese))] - [InlineData('\u1A20', '\u1AAF', nameof(UnicodeBlocks.TaiTham))] - [InlineData('\u1AB0', '\u1AFF', nameof(UnicodeBlocks.CombiningDiacriticalMarksExtended))] - [InlineData('\u1B00', '\u1B7F', nameof(UnicodeBlocks.Balinese))] - [InlineData('\u1B80', '\u1BBF', nameof(UnicodeBlocks.Sundanese))] - [InlineData('\u1BC0', '\u1BFF', nameof(UnicodeBlocks.Batak))] - [InlineData('\u1C00', '\u1C4F', nameof(UnicodeBlocks.Lepcha))] - [InlineData('\u1C50', '\u1C7F', nameof(UnicodeBlocks.OlChiki))] - [InlineData('\u1CC0', '\u1CCF', nameof(UnicodeBlocks.SundaneseSupplement))] - [InlineData('\u1CD0', '\u1CFF', nameof(UnicodeBlocks.VedicExtensions))] - [InlineData('\u1D00', '\u1D7F', nameof(UnicodeBlocks.PhoneticExtensions))] - [InlineData('\u1D80', '\u1DBF', nameof(UnicodeBlocks.PhoneticExtensionsSupplement))] - [InlineData('\u1DC0', '\u1DFF', nameof(UnicodeBlocks.CombiningDiacriticalMarksSupplement))] - [InlineData('\u1E00', '\u1EFF', nameof(UnicodeBlocks.LatinExtendedAdditional))] - [InlineData('\u1F00', '\u1FFF', nameof(UnicodeBlocks.GreekExtended))] - [InlineData('\u2000', '\u206F', nameof(UnicodeBlocks.GeneralPunctuation))] - [InlineData('\u2070', '\u209F', nameof(UnicodeBlocks.SuperscriptsandSubscripts))] - [InlineData('\u20A0', '\u20CF', nameof(UnicodeBlocks.CurrencySymbols))] - [InlineData('\u20D0', '\u20FF', nameof(UnicodeBlocks.CombiningDiacriticalMarksforSymbols))] - [InlineData('\u2100', '\u214F', nameof(UnicodeBlocks.LetterlikeSymbols))] - [InlineData('\u2150', '\u218F', nameof(UnicodeBlocks.NumberForms))] - [InlineData('\u2190', '\u21FF', nameof(UnicodeBlocks.Arrows))] - [InlineData('\u2200', '\u22FF', nameof(UnicodeBlocks.MathematicalOperators))] - [InlineData('\u2300', '\u23FF', nameof(UnicodeBlocks.MiscellaneousTechnical))] - [InlineData('\u2400', '\u243F', nameof(UnicodeBlocks.ControlPictures))] - [InlineData('\u2440', '\u245F', nameof(UnicodeBlocks.OpticalCharacterRecognition))] - [InlineData('\u2460', '\u24FF', nameof(UnicodeBlocks.EnclosedAlphanumerics))] - [InlineData('\u2500', '\u257F', nameof(UnicodeBlocks.BoxDrawing))] - [InlineData('\u2580', '\u259F', nameof(UnicodeBlocks.BlockElements))] - [InlineData('\u25A0', '\u25FF', nameof(UnicodeBlocks.GeometricShapes))] - [InlineData('\u2600', '\u26FF', nameof(UnicodeBlocks.MiscellaneousSymbols))] - [InlineData('\u2700', '\u27BF', nameof(UnicodeBlocks.Dingbats))] - [InlineData('\u27C0', '\u27EF', nameof(UnicodeBlocks.MiscellaneousMathematicalSymbolsA))] - [InlineData('\u27F0', '\u27FF', nameof(UnicodeBlocks.SupplementalArrowsA))] - [InlineData('\u2800', '\u28FF', nameof(UnicodeBlocks.BraillePatterns))] - [InlineData('\u2900', '\u297F', nameof(UnicodeBlocks.SupplementalArrowsB))] - [InlineData('\u2980', '\u29FF', nameof(UnicodeBlocks.MiscellaneousMathematicalSymbolsB))] - [InlineData('\u2A00', '\u2AFF', nameof(UnicodeBlocks.SupplementalMathematicalOperators))] - [InlineData('\u2B00', '\u2BFF', nameof(UnicodeBlocks.MiscellaneousSymbolsandArrows))] - [InlineData('\u2C00', '\u2C5F', nameof(UnicodeBlocks.Glagolitic))] - [InlineData('\u2C60', '\u2C7F', nameof(UnicodeBlocks.LatinExtendedC))] - [InlineData('\u2C80', '\u2CFF', nameof(UnicodeBlocks.Coptic))] - [InlineData('\u2D00', '\u2D2F', nameof(UnicodeBlocks.GeorgianSupplement))] - [InlineData('\u2D30', '\u2D7F', nameof(UnicodeBlocks.Tifinagh))] - [InlineData('\u2D80', '\u2DDF', nameof(UnicodeBlocks.EthiopicExtended))] - [InlineData('\u2DE0', '\u2DFF', nameof(UnicodeBlocks.CyrillicExtendedA))] - [InlineData('\u2E00', '\u2E7F', nameof(UnicodeBlocks.SupplementalPunctuation))] - [InlineData('\u2E80', '\u2EFF', nameof(UnicodeBlocks.CJKRadicalsSupplement))] - [InlineData('\u2F00', '\u2FDF', nameof(UnicodeBlocks.KangxiRadicals))] - [InlineData('\u2FF0', '\u2FFF', nameof(UnicodeBlocks.IdeographicDescriptionCharacters))] - [InlineData('\u3000', '\u303F', nameof(UnicodeBlocks.CJKSymbolsandPunctuation))] - [InlineData('\u3040', '\u309F', nameof(UnicodeBlocks.Hiragana))] - [InlineData('\u30A0', '\u30FF', nameof(UnicodeBlocks.Katakana))] - [InlineData('\u3100', '\u312F', nameof(UnicodeBlocks.Bopomofo))] - [InlineData('\u3130', '\u318F', nameof(UnicodeBlocks.HangulCompatibilityJamo))] - [InlineData('\u3190', '\u319F', nameof(UnicodeBlocks.Kanbun))] - [InlineData('\u31A0', '\u31BF', nameof(UnicodeBlocks.BopomofoExtended))] - [InlineData('\u31C0', '\u31EF', nameof(UnicodeBlocks.CJKStrokes))] - [InlineData('\u31F0', '\u31FF', nameof(UnicodeBlocks.KatakanaPhoneticExtensions))] - [InlineData('\u3200', '\u32FF', nameof(UnicodeBlocks.EnclosedCJKLettersandMonths))] - [InlineData('\u3300', '\u33FF', nameof(UnicodeBlocks.CJKCompatibility))] - [InlineData('\u3400', '\u4DBF', nameof(UnicodeBlocks.CJKUnifiedIdeographsExtensionA))] - [InlineData('\u4DC0', '\u4DFF', nameof(UnicodeBlocks.YijingHexagramSymbols))] - [InlineData('\u4E00', '\u9FFF', nameof(UnicodeBlocks.CJKUnifiedIdeographs))] - [InlineData('\uA000', '\uA48F', nameof(UnicodeBlocks.YiSyllables))] - [InlineData('\uA490', '\uA4CF', nameof(UnicodeBlocks.YiRadicals))] - [InlineData('\uA4D0', '\uA4FF', nameof(UnicodeBlocks.Lisu))] - [InlineData('\uA500', '\uA63F', nameof(UnicodeBlocks.Vai))] - [InlineData('\uA640', '\uA69F', nameof(UnicodeBlocks.CyrillicExtendedB))] - [InlineData('\uA6A0', '\uA6FF', nameof(UnicodeBlocks.Bamum))] - [InlineData('\uA700', '\uA71F', nameof(UnicodeBlocks.ModifierToneLetters))] - [InlineData('\uA720', '\uA7FF', nameof(UnicodeBlocks.LatinExtendedD))] - [InlineData('\uA800', '\uA82F', nameof(UnicodeBlocks.SylotiNagri))] - [InlineData('\uA830', '\uA83F', nameof(UnicodeBlocks.CommonIndicNumberForms))] - [InlineData('\uA840', '\uA87F', nameof(UnicodeBlocks.Phagspa))] - [InlineData('\uA880', '\uA8DF', nameof(UnicodeBlocks.Saurashtra))] - [InlineData('\uA8E0', '\uA8FF', nameof(UnicodeBlocks.DevanagariExtended))] - [InlineData('\uA900', '\uA92F', nameof(UnicodeBlocks.KayahLi))] - [InlineData('\uA930', '\uA95F', nameof(UnicodeBlocks.Rejang))] - [InlineData('\uA960', '\uA97F', nameof(UnicodeBlocks.HangulJamoExtendedA))] - [InlineData('\uA980', '\uA9DF', nameof(UnicodeBlocks.Javanese))] - [InlineData('\uA9E0', '\uA9FF', nameof(UnicodeBlocks.MyanmarExtendedB))] - [InlineData('\uAA00', '\uAA5F', nameof(UnicodeBlocks.Cham))] - [InlineData('\uAA60', '\uAA7F', nameof(UnicodeBlocks.MyanmarExtendedA))] - [InlineData('\uAA80', '\uAADF', nameof(UnicodeBlocks.TaiViet))] - [InlineData('\uAAE0', '\uAAFF', nameof(UnicodeBlocks.MeeteiMayekExtensions))] - [InlineData('\uAB00', '\uAB2F', nameof(UnicodeBlocks.EthiopicExtendedA))] - [InlineData('\uAB30', '\uAB6F', nameof(UnicodeBlocks.LatinExtendedE))] - [InlineData('\uABC0', '\uABFF', nameof(UnicodeBlocks.MeeteiMayek))] - [InlineData('\uAC00', '\uD7AF', nameof(UnicodeBlocks.HangulSyllables))] - [InlineData('\uD7B0', '\uD7FF', nameof(UnicodeBlocks.HangulJamoExtendedB))] - [InlineData('\uF900', '\uFAFF', nameof(UnicodeBlocks.CJKCompatibilityIdeographs))] - [InlineData('\uFB00', '\uFB4F', nameof(UnicodeBlocks.AlphabeticPresentationForms))] - [InlineData('\uFB50', '\uFDFF', nameof(UnicodeBlocks.ArabicPresentationFormsA))] - [InlineData('\uFE00', '\uFE0F', nameof(UnicodeBlocks.VariationSelectors))] - [InlineData('\uFE10', '\uFE1F', nameof(UnicodeBlocks.VerticalForms))] - [InlineData('\uFE20', '\uFE2F', nameof(UnicodeBlocks.CombiningHalfMarks))] - [InlineData('\uFE30', '\uFE4F', nameof(UnicodeBlocks.CJKCompatibilityForms))] - [InlineData('\uFE50', '\uFE6F', nameof(UnicodeBlocks.SmallFormVariants))] - [InlineData('\uFE70', '\uFEFF', nameof(UnicodeBlocks.ArabicPresentationFormsB))] - [InlineData('\uFF00', '\uFFEF', nameof(UnicodeBlocks.HalfwidthandFullwidthForms))] - [InlineData('\uFFF0', '\uFFFF', nameof(UnicodeBlocks.Specials))] - public void Block_Unicode(char first, char last, string blockName) - { - Assert.Equal(0x0, first & 0xF); // first char in any block should be U+nnn0 - Assert.Equal(0xF, last & 0xF); // last char in any block should be U+nnnF - Assert.True(first < last); // code point ranges should be ordered - - var propInfo = typeof(UnicodeBlocks).GetProperty(blockName, BindingFlags.Public | BindingFlags.Static); - Assert.NotNull(propInfo); - - UnicodeBlock block = (UnicodeBlock)propInfo.GetValue(null); - Assert.NotNull(block); - - // Test 1: the block should span the range first..last - Assert.Equal(first, block.FirstCodePoint); - Assert.Equal(last, block.FirstCodePoint + block.BlockSize - 1); - - // Test 2: calling the property multiple times should cache and return the same block instance - UnicodeBlock block2 = (UnicodeBlock)propInfo.GetValue(null); - Assert.Same(block, block2); - } - } -} diff --git a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeEncoderBaseTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeEncoderBaseTests.cs index 06e2fc0c73..07944d7c35 100644 --- a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeEncoderBaseTests.cs +++ b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeEncoderBaseTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.Framework.WebEncoders public void Ctor_WithCustomFilters() { // Arrange - var filter = new CodePointFilter(UnicodeBlocks.None).AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); + var filter = new CodePointFilter().AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(filter); // Act & assert @@ -30,10 +30,10 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void Ctor_WithUnicodeBlocks() + public void Ctor_WithUnicodeRanges() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(new CodePointFilter(UnicodeBlocks.Latin1Supplement, UnicodeBlocks.MiscellaneousSymbols)); + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(new CodePointFilter(UnicodeRanges.Latin1Supplement, UnicodeRanges.MiscellaneousSymbols)); // Act & assert Assert.Equal("[U+0061]", encoder.Encode("a")); @@ -45,7 +45,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_AllRangesAllowed_StillEncodesForbiddenChars_Simple() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); const string input = "Hello <>&\'\"+ there!"; const string expected = "Hello [U+003C][U+003E][U+0026][U+0027][U+0022][U+002B] there!"; @@ -57,7 +57,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_AllRangesAllowed_StillEncodesForbiddenChars_Extended() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); // Act & assert - BMP chars for (int i = 0; i <= 0xFFFF; i++) @@ -120,7 +120,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_BadSurrogates_ReturnsUnicodeReplacementChar() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); // allow all codepoints + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); // allow all codepoints // "abcde" const string input = "a\uD800b\uDFFFc\uDFFF\uD800d\uDFFF\uD800\uDFFFe\uD800"; @@ -137,7 +137,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_EmptyStringInput_ReturnsEmptyString() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); // Act & assert Assert.Equal("", encoder.Encode("")); @@ -147,7 +147,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_InputDoesNotRequireEncoding_ReturnsOriginalStringInstance() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); string input = "Hello, there!"; // Act & assert @@ -158,7 +158,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_NullInput_ReturnsNull() { // Arrange - UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + UnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); // Act & assert Assert.Null(encoder.Encode(null)); @@ -167,25 +167,25 @@ namespace Microsoft.Framework.WebEncoders [Fact] public void Encode_WithCharsRequiringEncodingAtBeginning() { - Assert.Equal("[U+0026]Hello, there!", new CustomUnicodeEncoderBase(UnicodeBlocks.All).Encode("&Hello, there!")); + Assert.Equal("[U+0026]Hello, there!", new CustomUnicodeEncoderBase(UnicodeRanges.All).Encode("&Hello, there!")); } [Fact] public void Encode_WithCharsRequiringEncodingAtEnd() { - Assert.Equal("Hello, there![U+0026]", new CustomUnicodeEncoderBase(UnicodeBlocks.All).Encode("Hello, there!&")); + Assert.Equal("Hello, there![U+0026]", new CustomUnicodeEncoderBase(UnicodeRanges.All).Encode("Hello, there!&")); } [Fact] public void Encode_WithCharsRequiringEncodingInMiddle() { - Assert.Equal("Hello, [U+0026]there!", new CustomUnicodeEncoderBase(UnicodeBlocks.All).Encode("Hello, &there!")); + Assert.Equal("Hello, [U+0026]there!", new CustomUnicodeEncoderBase(UnicodeRanges.All).Encode("Hello, &there!")); } [Fact] public void Encode_WithCharsRequiringEncodingInterspersed() { - Assert.Equal("Hello, [U+003C]there[U+003E]!", new CustomUnicodeEncoderBase(UnicodeBlocks.All).Encode("Hello, !")); + Assert.Equal("Hello, [U+003C]there[U+003E]!", new CustomUnicodeEncoderBase(UnicodeRanges.All).Encode("Hello, !")); } [Fact] @@ -222,7 +222,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_CharArray_AllCharsValid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); StringWriter output = new StringWriter(); // Act @@ -236,7 +236,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_CharArray_AllCharsInvalid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.None); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(); StringWriter output = new StringWriter(); // Act @@ -250,7 +250,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_CharArray_SomeCharsValid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); StringWriter output = new StringWriter(); // Act @@ -294,7 +294,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_StringSubstring_AllCharsValid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); StringWriter output = new StringWriter(); // Act @@ -308,7 +308,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_StringSubstring_EntireString_AllCharsValid_ForwardDirectlyToOutput() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); var mockWriter = new Mock(MockBehavior.Strict); mockWriter.Setup(o => o.Write("abc")).Verifiable(); @@ -323,7 +323,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_StringSubstring_AllCharsInvalid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.None); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(); StringWriter output = new StringWriter(); // Act @@ -337,7 +337,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_StringSubstring_SomeCharsValid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); StringWriter output = new StringWriter(); // Act @@ -351,7 +351,7 @@ namespace Microsoft.Framework.WebEncoders public void Encode_StringSubstring_EntireString_SomeCharsValid() { // Arrange - CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeBlocks.All); + CustomUnicodeEncoderBase encoder = new CustomUnicodeEncoderBase(UnicodeRanges.All); StringWriter output = new StringWriter(); // Act @@ -392,8 +392,8 @@ namespace Microsoft.Framework.WebEncoders { } - public CustomUnicodeEncoderBase(params UnicodeBlock[] allowedBlocks) - : this(new CodePointFilter(allowedBlocks)) + public CustomUnicodeEncoderBase(params UnicodeRange[] allowedRanges) + : this(new CodePointFilter(allowedRanges)) { } diff --git a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeRangeTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeRangeTests.cs new file mode 100644 index 0000000000..cb3197ae71 --- /dev/null +++ b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeRangeTests.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Xunit; + +namespace Microsoft.Framework.WebEncoders +{ + public class UnicodeRangeTests + { + [Theory] + [InlineData(-1, 16)] + [InlineData(0x10000, 16)] + public void Ctor_FailureCase_FirstCodePoint(int firstCodePoint, int rangeSize) + { + var ex = Assert.Throws(() => new UnicodeRange(firstCodePoint, rangeSize)); + Assert.Equal("firstCodePoint", ex.ParamName); + } + + [Theory] + [InlineData(0x0100, -1)] + [InlineData(0x0100, 0x10000)] + public void Ctor_FailureCase_RangeSize(int firstCodePoint, int rangeSize) + { + var ex = Assert.Throws(() => new UnicodeRange(firstCodePoint, rangeSize)); + Assert.Equal("rangeSize", ex.ParamName); + } + + [Fact] + public void Ctor_SuccessCase() + { + // Act + var range = new UnicodeRange(0x0100, 128); // Latin Extended-A + + // Assert + Assert.Equal(0x0100, range.FirstCodePoint); + Assert.Equal(128, range.RangeSize); + } + + [Fact] + public void FromSpan_FailureCase() + { + var ex = Assert.Throws(() => UnicodeRange.FromSpan('\u0020', '\u0010')); + Assert.Equal("lastChar", ex.ParamName); + } + + [Fact] + public void FromSpan_SuccessCase() + { + // Act + var range = UnicodeRange.FromSpan('\u0180', '\u024F'); // Latin Extended-B + + // Assert + Assert.Equal(0x0180, range.FirstCodePoint); + Assert.Equal(208, range.RangeSize); + } + + [Fact] + public void FromSpan_SuccessCase_All() + { + // Act + var range = UnicodeRange.FromSpan('\u0000', '\uFFFF'); + + // Assert + Assert.Equal(0, range.FirstCodePoint); + Assert.Equal(0x10000, range.RangeSize); + } + } +} diff --git a/test/Microsoft.Framework.WebEncoders.Tests/UnicodeRangesTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeRangesTests.cs new file mode 100644 index 0000000000..ac9e55bdac --- /dev/null +++ b/test/Microsoft.Framework.WebEncoders.Tests/UnicodeRangesTests.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Reflection; +using Xunit; + +namespace Microsoft.Framework.WebEncoders +{ + public class UnicodeRangesTests + { + [Fact] + public void Range_None() + { + UnicodeRange range = UnicodeRanges.None; + Assert.NotNull(range); + + // Test 1: the range should be empty + Assert.Equal(0, range.FirstCodePoint); + Assert.Equal(0, range.RangeSize); + + // Test 2: calling the property multiple times should cache and return the same range instance + UnicodeRange range2 = UnicodeRanges.None; + Assert.Same(range, range2); + } + + [Fact] + public void Range_All() + { + Range_Unicode('\u0000', '\uFFFF', nameof(UnicodeRanges.All)); + } + + [Theory] + [InlineData('\u0000', '\u007F', nameof(UnicodeRanges.BasicLatin))] + [InlineData('\u0080', '\u00FF', nameof(UnicodeRanges.Latin1Supplement))] + [InlineData('\u0100', '\u017F', nameof(UnicodeRanges.LatinExtendedA))] + [InlineData('\u0180', '\u024F', nameof(UnicodeRanges.LatinExtendedB))] + [InlineData('\u0250', '\u02AF', nameof(UnicodeRanges.IPAExtensions))] + [InlineData('\u02B0', '\u02FF', nameof(UnicodeRanges.SpacingModifierLetters))] + [InlineData('\u0300', '\u036F', nameof(UnicodeRanges.CombiningDiacriticalMarks))] + [InlineData('\u0370', '\u03FF', nameof(UnicodeRanges.GreekandCoptic))] + [InlineData('\u0400', '\u04FF', nameof(UnicodeRanges.Cyrillic))] + [InlineData('\u0500', '\u052F', nameof(UnicodeRanges.CyrillicSupplement))] + [InlineData('\u0530', '\u058F', nameof(UnicodeRanges.Armenian))] + [InlineData('\u0590', '\u05FF', nameof(UnicodeRanges.Hebrew))] + [InlineData('\u0600', '\u06FF', nameof(UnicodeRanges.Arabic))] + [InlineData('\u0700', '\u074F', nameof(UnicodeRanges.Syriac))] + [InlineData('\u0750', '\u077F', nameof(UnicodeRanges.ArabicSupplement))] + [InlineData('\u0780', '\u07BF', nameof(UnicodeRanges.Thaana))] + [InlineData('\u07C0', '\u07FF', nameof(UnicodeRanges.NKo))] + [InlineData('\u0800', '\u083F', nameof(UnicodeRanges.Samaritan))] + [InlineData('\u0840', '\u085F', nameof(UnicodeRanges.Mandaic))] + [InlineData('\u08A0', '\u08FF', nameof(UnicodeRanges.ArabicExtendedA))] + [InlineData('\u0900', '\u097F', nameof(UnicodeRanges.Devanagari))] + [InlineData('\u0980', '\u09FF', nameof(UnicodeRanges.Bengali))] + [InlineData('\u0A00', '\u0A7F', nameof(UnicodeRanges.Gurmukhi))] + [InlineData('\u0A80', '\u0AFF', nameof(UnicodeRanges.Gujarati))] + [InlineData('\u0B00', '\u0B7F', nameof(UnicodeRanges.Oriya))] + [InlineData('\u0B80', '\u0BFF', nameof(UnicodeRanges.Tamil))] + [InlineData('\u0C00', '\u0C7F', nameof(UnicodeRanges.Telugu))] + [InlineData('\u0C80', '\u0CFF', nameof(UnicodeRanges.Kannada))] + [InlineData('\u0D00', '\u0D7F', nameof(UnicodeRanges.Malayalam))] + [InlineData('\u0D80', '\u0DFF', nameof(UnicodeRanges.Sinhala))] + [InlineData('\u0E00', '\u0E7F', nameof(UnicodeRanges.Thai))] + [InlineData('\u0E80', '\u0EFF', nameof(UnicodeRanges.Lao))] + [InlineData('\u0F00', '\u0FFF', nameof(UnicodeRanges.Tibetan))] + [InlineData('\u1000', '\u109F', nameof(UnicodeRanges.Myanmar))] + [InlineData('\u10A0', '\u10FF', nameof(UnicodeRanges.Georgian))] + [InlineData('\u1100', '\u11FF', nameof(UnicodeRanges.HangulJamo))] + [InlineData('\u1200', '\u137F', nameof(UnicodeRanges.Ethiopic))] + [InlineData('\u1380', '\u139F', nameof(UnicodeRanges.EthiopicSupplement))] + [InlineData('\u13A0', '\u13FF', nameof(UnicodeRanges.Cherokee))] + [InlineData('\u1400', '\u167F', nameof(UnicodeRanges.UnifiedCanadianAboriginalSyllabics))] + [InlineData('\u1680', '\u169F', nameof(UnicodeRanges.Ogham))] + [InlineData('\u16A0', '\u16FF', nameof(UnicodeRanges.Runic))] + [InlineData('\u1700', '\u171F', nameof(UnicodeRanges.Tagalog))] + [InlineData('\u1720', '\u173F', nameof(UnicodeRanges.Hanunoo))] + [InlineData('\u1740', '\u175F', nameof(UnicodeRanges.Buhid))] + [InlineData('\u1760', '\u177F', nameof(UnicodeRanges.Tagbanwa))] + [InlineData('\u1780', '\u17FF', nameof(UnicodeRanges.Khmer))] + [InlineData('\u1800', '\u18AF', nameof(UnicodeRanges.Mongolian))] + [InlineData('\u18B0', '\u18FF', nameof(UnicodeRanges.UnifiedCanadianAboriginalSyllabicsExtended))] + [InlineData('\u1900', '\u194F', nameof(UnicodeRanges.Limbu))] + [InlineData('\u1950', '\u197F', nameof(UnicodeRanges.TaiLe))] + [InlineData('\u1980', '\u19DF', nameof(UnicodeRanges.NewTaiLue))] + [InlineData('\u19E0', '\u19FF', nameof(UnicodeRanges.KhmerSymbols))] + [InlineData('\u1A00', '\u1A1F', nameof(UnicodeRanges.Buginese))] + [InlineData('\u1A20', '\u1AAF', nameof(UnicodeRanges.TaiTham))] + [InlineData('\u1AB0', '\u1AFF', nameof(UnicodeRanges.CombiningDiacriticalMarksExtended))] + [InlineData('\u1B00', '\u1B7F', nameof(UnicodeRanges.Balinese))] + [InlineData('\u1B80', '\u1BBF', nameof(UnicodeRanges.Sundanese))] + [InlineData('\u1BC0', '\u1BFF', nameof(UnicodeRanges.Batak))] + [InlineData('\u1C00', '\u1C4F', nameof(UnicodeRanges.Lepcha))] + [InlineData('\u1C50', '\u1C7F', nameof(UnicodeRanges.OlChiki))] + [InlineData('\u1CC0', '\u1CCF', nameof(UnicodeRanges.SundaneseSupplement))] + [InlineData('\u1CD0', '\u1CFF', nameof(UnicodeRanges.VedicExtensions))] + [InlineData('\u1D00', '\u1D7F', nameof(UnicodeRanges.PhoneticExtensions))] + [InlineData('\u1D80', '\u1DBF', nameof(UnicodeRanges.PhoneticExtensionsSupplement))] + [InlineData('\u1DC0', '\u1DFF', nameof(UnicodeRanges.CombiningDiacriticalMarksSupplement))] + [InlineData('\u1E00', '\u1EFF', nameof(UnicodeRanges.LatinExtendedAdditional))] + [InlineData('\u1F00', '\u1FFF', nameof(UnicodeRanges.GreekExtended))] + [InlineData('\u2000', '\u206F', nameof(UnicodeRanges.GeneralPunctuation))] + [InlineData('\u2070', '\u209F', nameof(UnicodeRanges.SuperscriptsandSubscripts))] + [InlineData('\u20A0', '\u20CF', nameof(UnicodeRanges.CurrencySymbols))] + [InlineData('\u20D0', '\u20FF', nameof(UnicodeRanges.CombiningDiacriticalMarksforSymbols))] + [InlineData('\u2100', '\u214F', nameof(UnicodeRanges.LetterlikeSymbols))] + [InlineData('\u2150', '\u218F', nameof(UnicodeRanges.NumberForms))] + [InlineData('\u2190', '\u21FF', nameof(UnicodeRanges.Arrows))] + [InlineData('\u2200', '\u22FF', nameof(UnicodeRanges.MathematicalOperators))] + [InlineData('\u2300', '\u23FF', nameof(UnicodeRanges.MiscellaneousTechnical))] + [InlineData('\u2400', '\u243F', nameof(UnicodeRanges.ControlPictures))] + [InlineData('\u2440', '\u245F', nameof(UnicodeRanges.OpticalCharacterRecognition))] + [InlineData('\u2460', '\u24FF', nameof(UnicodeRanges.EnclosedAlphanumerics))] + [InlineData('\u2500', '\u257F', nameof(UnicodeRanges.BoxDrawing))] + [InlineData('\u2580', '\u259F', nameof(UnicodeRanges.BlockElements))] + [InlineData('\u25A0', '\u25FF', nameof(UnicodeRanges.GeometricShapes))] + [InlineData('\u2600', '\u26FF', nameof(UnicodeRanges.MiscellaneousSymbols))] + [InlineData('\u2700', '\u27BF', nameof(UnicodeRanges.Dingbats))] + [InlineData('\u27C0', '\u27EF', nameof(UnicodeRanges.MiscellaneousMathematicalSymbolsA))] + [InlineData('\u27F0', '\u27FF', nameof(UnicodeRanges.SupplementalArrowsA))] + [InlineData('\u2800', '\u28FF', nameof(UnicodeRanges.BraillePatterns))] + [InlineData('\u2900', '\u297F', nameof(UnicodeRanges.SupplementalArrowsB))] + [InlineData('\u2980', '\u29FF', nameof(UnicodeRanges.MiscellaneousMathematicalSymbolsB))] + [InlineData('\u2A00', '\u2AFF', nameof(UnicodeRanges.SupplementalMathematicalOperators))] + [InlineData('\u2B00', '\u2BFF', nameof(UnicodeRanges.MiscellaneousSymbolsandArrows))] + [InlineData('\u2C00', '\u2C5F', nameof(UnicodeRanges.Glagolitic))] + [InlineData('\u2C60', '\u2C7F', nameof(UnicodeRanges.LatinExtendedC))] + [InlineData('\u2C80', '\u2CFF', nameof(UnicodeRanges.Coptic))] + [InlineData('\u2D00', '\u2D2F', nameof(UnicodeRanges.GeorgianSupplement))] + [InlineData('\u2D30', '\u2D7F', nameof(UnicodeRanges.Tifinagh))] + [InlineData('\u2D80', '\u2DDF', nameof(UnicodeRanges.EthiopicExtended))] + [InlineData('\u2DE0', '\u2DFF', nameof(UnicodeRanges.CyrillicExtendedA))] + [InlineData('\u2E00', '\u2E7F', nameof(UnicodeRanges.SupplementalPunctuation))] + [InlineData('\u2E80', '\u2EFF', nameof(UnicodeRanges.CJKRadicalsSupplement))] + [InlineData('\u2F00', '\u2FDF', nameof(UnicodeRanges.KangxiRadicals))] + [InlineData('\u2FF0', '\u2FFF', nameof(UnicodeRanges.IdeographicDescriptionCharacters))] + [InlineData('\u3000', '\u303F', nameof(UnicodeRanges.CJKSymbolsandPunctuation))] + [InlineData('\u3040', '\u309F', nameof(UnicodeRanges.Hiragana))] + [InlineData('\u30A0', '\u30FF', nameof(UnicodeRanges.Katakana))] + [InlineData('\u3100', '\u312F', nameof(UnicodeRanges.Bopomofo))] + [InlineData('\u3130', '\u318F', nameof(UnicodeRanges.HangulCompatibilityJamo))] + [InlineData('\u3190', '\u319F', nameof(UnicodeRanges.Kanbun))] + [InlineData('\u31A0', '\u31BF', nameof(UnicodeRanges.BopomofoExtended))] + [InlineData('\u31C0', '\u31EF', nameof(UnicodeRanges.CJKStrokes))] + [InlineData('\u31F0', '\u31FF', nameof(UnicodeRanges.KatakanaPhoneticExtensions))] + [InlineData('\u3200', '\u32FF', nameof(UnicodeRanges.EnclosedCJKLettersandMonths))] + [InlineData('\u3300', '\u33FF', nameof(UnicodeRanges.CJKCompatibility))] + [InlineData('\u3400', '\u4DBF', nameof(UnicodeRanges.CJKUnifiedIdeographsExtensionA))] + [InlineData('\u4DC0', '\u4DFF', nameof(UnicodeRanges.YijingHexagramSymbols))] + [InlineData('\u4E00', '\u9FFF', nameof(UnicodeRanges.CJKUnifiedIdeographs))] + [InlineData('\uA000', '\uA48F', nameof(UnicodeRanges.YiSyllables))] + [InlineData('\uA490', '\uA4CF', nameof(UnicodeRanges.YiRadicals))] + [InlineData('\uA4D0', '\uA4FF', nameof(UnicodeRanges.Lisu))] + [InlineData('\uA500', '\uA63F', nameof(UnicodeRanges.Vai))] + [InlineData('\uA640', '\uA69F', nameof(UnicodeRanges.CyrillicExtendedB))] + [InlineData('\uA6A0', '\uA6FF', nameof(UnicodeRanges.Bamum))] + [InlineData('\uA700', '\uA71F', nameof(UnicodeRanges.ModifierToneLetters))] + [InlineData('\uA720', '\uA7FF', nameof(UnicodeRanges.LatinExtendedD))] + [InlineData('\uA800', '\uA82F', nameof(UnicodeRanges.SylotiNagri))] + [InlineData('\uA830', '\uA83F', nameof(UnicodeRanges.CommonIndicNumberForms))] + [InlineData('\uA840', '\uA87F', nameof(UnicodeRanges.Phagspa))] + [InlineData('\uA880', '\uA8DF', nameof(UnicodeRanges.Saurashtra))] + [InlineData('\uA8E0', '\uA8FF', nameof(UnicodeRanges.DevanagariExtended))] + [InlineData('\uA900', '\uA92F', nameof(UnicodeRanges.KayahLi))] + [InlineData('\uA930', '\uA95F', nameof(UnicodeRanges.Rejang))] + [InlineData('\uA960', '\uA97F', nameof(UnicodeRanges.HangulJamoExtendedA))] + [InlineData('\uA980', '\uA9DF', nameof(UnicodeRanges.Javanese))] + [InlineData('\uA9E0', '\uA9FF', nameof(UnicodeRanges.MyanmarExtendedB))] + [InlineData('\uAA00', '\uAA5F', nameof(UnicodeRanges.Cham))] + [InlineData('\uAA60', '\uAA7F', nameof(UnicodeRanges.MyanmarExtendedA))] + [InlineData('\uAA80', '\uAADF', nameof(UnicodeRanges.TaiViet))] + [InlineData('\uAAE0', '\uAAFF', nameof(UnicodeRanges.MeeteiMayekExtensions))] + [InlineData('\uAB00', '\uAB2F', nameof(UnicodeRanges.EthiopicExtendedA))] + [InlineData('\uAB30', '\uAB6F', nameof(UnicodeRanges.LatinExtendedE))] + [InlineData('\uABC0', '\uABFF', nameof(UnicodeRanges.MeeteiMayek))] + [InlineData('\uAC00', '\uD7AF', nameof(UnicodeRanges.HangulSyllables))] + [InlineData('\uD7B0', '\uD7FF', nameof(UnicodeRanges.HangulJamoExtendedB))] + [InlineData('\uF900', '\uFAFF', nameof(UnicodeRanges.CJKCompatibilityIdeographs))] + [InlineData('\uFB00', '\uFB4F', nameof(UnicodeRanges.AlphabeticPresentationForms))] + [InlineData('\uFB50', '\uFDFF', nameof(UnicodeRanges.ArabicPresentationFormsA))] + [InlineData('\uFE00', '\uFE0F', nameof(UnicodeRanges.VariationSelectors))] + [InlineData('\uFE10', '\uFE1F', nameof(UnicodeRanges.VerticalForms))] + [InlineData('\uFE20', '\uFE2F', nameof(UnicodeRanges.CombiningHalfMarks))] + [InlineData('\uFE30', '\uFE4F', nameof(UnicodeRanges.CJKCompatibilityForms))] + [InlineData('\uFE50', '\uFE6F', nameof(UnicodeRanges.SmallFormVariants))] + [InlineData('\uFE70', '\uFEFF', nameof(UnicodeRanges.ArabicPresentationFormsB))] + [InlineData('\uFF00', '\uFFEF', nameof(UnicodeRanges.HalfwidthandFullwidthForms))] + [InlineData('\uFFF0', '\uFFFF', nameof(UnicodeRanges.Specials))] + public void Range_Unicode(char first, char last, string blockName) + { + Assert.Equal(0x0, first & 0xF); // first char in any block should be U+nnn0 + Assert.Equal(0xF, last & 0xF); // last char in any block should be U+nnnF + Assert.True(first < last); // code point ranges should be ordered + + var propInfo = typeof(UnicodeRanges).GetProperty(blockName, BindingFlags.Public | BindingFlags.Static); + Assert.NotNull(propInfo); + + UnicodeRange range = (UnicodeRange)propInfo.GetValue(null); + Assert.NotNull(range); + + // Test 1: the range should span the range first..last + Assert.Equal(first, range.FirstCodePoint); + Assert.Equal(last, range.FirstCodePoint + range.RangeSize - 1); + + // Test 2: calling the property multiple times should cache and return the same range instance + UnicodeRange range2 = (UnicodeRange)propInfo.GetValue(null); + Assert.Same(range, range2); + } + } +} diff --git a/test/Microsoft.Framework.WebEncoders.Tests/UrlEncoderTests.cs b/test/Microsoft.Framework.WebEncoders.Tests/UrlEncoderTests.cs index fd649ffc08..2141bba7d7 100644 --- a/test/Microsoft.Framework.WebEncoders.Tests/UrlEncoderTests.cs +++ b/test/Microsoft.Framework.WebEncoders.Tests/UrlEncoderTests.cs @@ -18,7 +18,7 @@ namespace Microsoft.Framework.WebEncoders public void Ctor_WithCodePointFilter() { // Arrange - var filter = new CodePointFilter(UnicodeBlocks.None).AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); + var filter = new CodePointFilter().AllowChars("ab").AllowChars('\0', '&', '\uFFFF', 'd'); UrlEncoder encoder = new UrlEncoder(filter); // Act & assert @@ -32,10 +32,10 @@ namespace Microsoft.Framework.WebEncoders } [Fact] - public void Ctor_WithUnicodeBlocks() + public void Ctor_WithUnicodeRanges() { // Arrange - UrlEncoder encoder = new UrlEncoder(UnicodeBlocks.Latin1Supplement, UnicodeBlocks.MiscellaneousSymbols); + UrlEncoder encoder = new UrlEncoder(UnicodeRanges.Latin1Supplement, UnicodeRanges.MiscellaneousSymbols); // Act & assert Assert.Equal("%61", encoder.UrlEncode("a")); @@ -59,7 +59,7 @@ namespace Microsoft.Framework.WebEncoders public void Default_EquivalentToBasicLatin() { // Arrange - UrlEncoder controlEncoder = new UrlEncoder(UnicodeBlocks.BasicLatin); + UrlEncoder controlEncoder = new UrlEncoder(UnicodeRanges.BasicLatin); UrlEncoder testEncoder = UrlEncoder.Default; // Act & assert @@ -88,7 +88,7 @@ namespace Microsoft.Framework.WebEncoders public void UrlEncode_AllRangesAllowed_StillEncodesForbiddenChars() { // Arrange - UrlEncoder encoder = new UrlEncoder(UnicodeBlocks.All); + UrlEncoder encoder = new UrlEncoder(UnicodeRanges.All); // Act & assert - BMP chars for (int i = 0; i <= 0xFFFF; i++) @@ -168,7 +168,7 @@ namespace Microsoft.Framework.WebEncoders public void UrlEncode_BadSurrogates_ReturnsUnicodeReplacementChar() { // Arrange - UrlEncoder encoder = new UrlEncoder(UnicodeBlocks.All); // allow all codepoints + UrlEncoder encoder = new UrlEncoder(UnicodeRanges.All); // allow all codepoints // "abcde" const string input = "a\uD800b\uDFFFc\uDFFF\uD800d\uDFFF\uD800\uDFFFe\uD800"; @@ -271,8 +271,8 @@ namespace Microsoft.Framework.WebEncoders // by never emitting HTML-sensitive characters unescaped. // Arrange - UrlEncoder urlEncoder = new UrlEncoder(UnicodeBlocks.All); - HtmlEncoder htmlEncoder = new HtmlEncoder(UnicodeBlocks.All); + UrlEncoder urlEncoder = new UrlEncoder(UnicodeRanges.All); + HtmlEncoder htmlEncoder = new HtmlEncoder(UnicodeRanges.All); // Act & assert for (int i = 0; i <= 0x10FFFF; i++) diff --git a/unicode/Generators/UnicodeTablesGenerator/Program.cs b/unicode/Generators/UnicodeTablesGenerator/Program.cs index 02c740a785..76e4d7bd15 100644 --- a/unicode/Generators/UnicodeTablesGenerator/Program.cs +++ b/unicode/Generators/UnicodeTablesGenerator/Program.cs @@ -20,22 +20,16 @@ namespace UnicodeTablesGenerator { private const string _codePointFiltersGeneratedFormat = @" /// -/// Represents the '{0}' Unicode block (U+{1}..U+{2}). +/// A corresponding to the '{0}' Unicode block (U+{1}..U+{2}). /// /// /// See http://www.unicode.org/charts/PDF/U{1}.pdf for the full set of characters in this block. /// -public static UnicodeBlock {3} -{{ - get - {{ - return Volatile.Read(ref _{4}) ?? CreateBlock(ref _{4}, first: '\u{1}', last: '\u{2}'); - }} -}} -private static UnicodeBlock _{4}; +public static UnicodeRange {3} => Volatile.Read(ref _{4}) ?? CreateRange(ref _{4}, first: '\u{1}', last: '\u{2}'); +private static UnicodeRange _{4}; "; - private const string _codePointFiltersTestsGeneratedFormat = @"[InlineData('\u{1}', '\u{2}', nameof(UnicodeBlocks.{0}))]"; + private const string _codePointFiltersTestsGeneratedFormat = @"[InlineData('\u{1}', '\u{2}', nameof(UnicodeRanges.{0}))]"; private static void Main() { @@ -73,8 +67,8 @@ private static UnicodeBlock _{4}; testCodeBuilder.AppendLine(); } - File.WriteAllText("UnicodeBlocks.generated.txt", runtimeCodeBuilder.ToString()); - File.WriteAllText("UnicodeBlocksTests.generated.txt", testCodeBuilder.ToString()); + File.WriteAllText("UnicodeRanges.generated.txt", runtimeCodeBuilder.ToString()); + File.WriteAllText("UnicodeRangesTests.generated.txt", testCodeBuilder.ToString()); } private static string RemoveAllNonAlphanumeric(string blockName)