Implemented character decomposition mapping propertu parsing.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Unicode
|
||||
{
|
||||
public enum CompatibilityFormattingTag : byte
|
||||
{
|
||||
Canonical = 0,
|
||||
[ValueName("font"), Display(Name = "font", Description = "Font variant (for example, a blackletter form)")]
|
||||
Font,
|
||||
[ValueName("noBreak"), Display(Name = "noBreak", Description = "No-break version of a space or hyphen")]
|
||||
NoBreak,
|
||||
[ValueName("initial"), Display(Name = "initial", Description = "Initial presentation form (Arabic)")]
|
||||
Initial,
|
||||
[ValueName("medial"), Display(Name = "medial", Description = "Medial presentation form (Arabic)")]
|
||||
Medial,
|
||||
[ValueName("final"), Display(Name = "final", Description = "Final presentation form (Arabic)")]
|
||||
Final,
|
||||
[ValueName("isolated"), Display(Name = "isolated", Description = "Isolated presentation form (Arabic)")]
|
||||
Isolated,
|
||||
[ValueName("circle"), Display(Name = "circle", Description = "Encircled form")]
|
||||
Circle,
|
||||
[ValueName("super"), Display(Name = "super", Description = "Superscript form")]
|
||||
Super,
|
||||
[ValueName("sub"), Display(Name = "sub", Description = "Subscript form")]
|
||||
Sub,
|
||||
[ValueName("vertical"), Display(Name = "vertical", Description = "Vertical layout presentation form")]
|
||||
Vertical,
|
||||
[ValueName("wide"), Display(Name = "wide", Description = "Wide (or zenkaku) compatibility character")]
|
||||
Wide,
|
||||
[ValueName("narrow"), Display(Name = "narrow", Description = "Narrow (or hankaku) compatibility character")]
|
||||
Narrow,
|
||||
[ValueName("small"), Display(Name = "small", Description = "Small variant form (CNS compatibility)")]
|
||||
Small,
|
||||
[ValueName("square"), Display(Name = "square", Description = "CJK squared font variant")]
|
||||
Square,
|
||||
[ValueName("fraction"), Display(Name = "fraction", Description = "Vulgar fraction form")]
|
||||
Fraction,
|
||||
[ValueName("compat"), Display(Name = "compat", Description = "Otherwise unspecified compatibility character")]
|
||||
Compat,
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace System.Unicode
|
||||
Category = 4,
|
||||
CanonicalCombiningClass = 8,
|
||||
BidirectionalClass = 16,
|
||||
DecompositionType = 32,
|
||||
DecompositionMapping = 32,
|
||||
|
||||
// NumericType / NumericValue : Not exactly a bit mask here… More like [0…3] << 6
|
||||
NumericDecimal = 64,
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace System.Unicode
|
||||
public readonly UnicodeCategory Category;
|
||||
public readonly CanonicalCombiningClass CanonicalCombiningClass;
|
||||
public readonly BidirectionalClass BidirectionalClass;
|
||||
public readonly string DecompositionType;
|
||||
public readonly CompatibilityFormattingTag DecompositionType;
|
||||
public readonly string DecompositionMapping;
|
||||
public readonly UnicodeNumericType NumericType;
|
||||
private readonly UnicodeRationalNumber numericValue;
|
||||
public readonly bool BidirectionalMirrored;
|
||||
@@ -33,7 +34,8 @@ namespace System.Unicode
|
||||
UnicodeCategory category,
|
||||
CanonicalCombiningClass canonicalCombiningClass,
|
||||
BidirectionalClass bidirectionalClass,
|
||||
string decompositionType,
|
||||
CompatibilityFormattingTag decompositionType,
|
||||
string decompositionMapping,
|
||||
UnicodeNumericType numericType,
|
||||
UnicodeRationalNumber numericValue,
|
||||
bool bidirectionalMirrored,
|
||||
@@ -51,6 +53,7 @@ namespace System.Unicode
|
||||
this.CanonicalCombiningClass = canonicalCombiningClass;
|
||||
this.BidirectionalClass = bidirectionalClass;
|
||||
this.DecompositionType = decompositionType;
|
||||
this.DecompositionMapping = decompositionMapping;
|
||||
this.NumericType = numericType;
|
||||
this.numericValue = numericValue;
|
||||
this.BidirectionalMirrored = bidirectionalMirrored;
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace System.Unicode
|
||||
var category = (fields & UcdFields.Category) != 0 ? (UnicodeCategory)reader.ReadByte() : UnicodeCategory.OtherNotAssigned;
|
||||
var canonicalCombiningClass = (fields & UcdFields.CanonicalCombiningClass) != 0 ? (CanonicalCombiningClass)reader.ReadByte() : CanonicalCombiningClass.NotReordered;
|
||||
var bidirectionalClass = (fields & UcdFields.BidirectionalClass) != 0 ? (BidirectionalClass)reader.ReadByte() : 0;
|
||||
string decompositionType = (fields & UcdFields.DecompositionType) != 0 ? reader.ReadString() : null;
|
||||
CompatibilityFormattingTag decompositionType = (fields & UcdFields.DecompositionMapping) != 0 ? (CompatibilityFormattingTag)reader.ReadByte() : CompatibilityFormattingTag.Canonical;
|
||||
string decompositionMapping = (fields & UcdFields.DecompositionMapping) != 0 ? reader.ReadString() : null;
|
||||
var numericType = (UnicodeNumericType)((int)(fields & UcdFields.NumericNumeric) >> 6);
|
||||
UnicodeRationalNumber numericValue = numericType != UnicodeNumericType.None ?
|
||||
new UnicodeRationalNumber(reader.ReadInt64(), reader.ReadByte()) :
|
||||
@@ -83,6 +84,7 @@ namespace System.Unicode
|
||||
canonicalCombiningClass,
|
||||
bidirectionalClass,
|
||||
decompositionType,
|
||||
decompositionMapping,
|
||||
numericType,
|
||||
numericValue,
|
||||
(fields & UcdFields.BidirectionalMirrored) != 0,
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -56,6 +57,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BidirectionalClass.cs" />
|
||||
<Compile Include="CompatibilityFormattingTag.cs" />
|
||||
<Compile Include="ContributoryProperties.cs" />
|
||||
<Compile Include="CanonicalCombiningClass.cs" />
|
||||
<Compile Include="CodePointEnumerable.cs" />
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user