Files
NetUnicodeInfo/README.md
T

137 lines
3.6 KiB
Markdown
Raw Normal View History

.NET Unicode Information Library
========================
Summary
-------
This projects provides access to some of the data contained in the Unicode Character Database by the means of a portable .NET assembly.
Included, is a small WPF application allowing to inspect the Unicode code points composing a specified text.
Compiling and using the project
-------------------------------
### Using the UnicodeInformation library
Using the library is as easy as including it in your project. You will find all the good stuff in the System.Unicode namespace.
Let's see a simple example:
```csharp
using System;
using System.Text;
using System.Unicode;
namespace Example
{
internal static class Program
{
private static void Main()
{
Console.OutputEncoding = Encoding.Unicode;
PrintCodePointInfo('A');
PrintCodePointInfo('∞');
PrintCodePointInfo(0x1F600);
}
private static void PrintCodePointInfo(int codePoint)
{
var charInfo = UnicodeInfo.GetCharInfo(codePoint);
Console.WriteLine(UnicodeInfo.GetDisplayText(charInfo));
Console.WriteLine("U+" + codePoint.ToString("X4"));
Console.WriteLine(charInfo.Name ?? charInfo.OldName);
Console.WriteLine(charInfo.Category);
}
}
}
```
This example shows a few usages of the library. It gets information on a specific code point, queries the library for the text to display for the specific character (usually the character itself), and displays the character's name and category.
### Details
In its current state, the project is written in C# 6, compilable by [Roslyn](http://roslyn.codeplex.com/), and targets the .NET 4.5 framework.
The core of the project, UnicodeInformation.dll, is a portable class library usable for either regular .NET or Windows 8 applications.
This library includes a subset of the official [Unicode Character Database](http://www.unicode.org/Public/UCD/latest/) (Version 7.0 at the time of writing) stored in a custom file format.
### Included Properties
#### From UCD
* Name
* General_Category
* Canonical_Combining_Class
* Bidi_Class
* Decomposition_Type
* Decomposition_Mapping
* Numeric_Type (*)
* Numeric_Value
* Bidi_Mirrored
* Unicode_1_Name
* Simple_Uppercase_Maping
* Simple_Lowercase_Mapping
* Simple_Titlecase_Mapping
* Block
* ASCII_Hex_Digit
* Bidi_Control
* Dash
* Deprecated
* Diacritic
* Extender
* Hex_Digit
* Hyphen
* Ideographic
* IDS_Binary_Operator
* IDS_Trinary_Operator
* Join_Control
* Logical_Order_Exception
* Noncharacter_Code_Point
* Other_Alphabetic
* Other_Default_Ignorable_Code_Point
* Other_Grapheme_Extend
* Other_ID_Continue
* Other_ID_Start
* Other_Lowercase
* Other_Math
* Other_Uppercase
* Pattern_Syntax
* Pattern_White_Space
* Quotation_Mark
* Radical
* Soft_Dotted
* STerm
* Terminal_Punctuation
* Unified_Ideograph
* Variation_Selector
* White_Space
* Lowercase
* Uppercase
* Cased
* Case_Ignorable
* Changes_When_Lowercased
* Changes_When_Uppercased
* Changes_When_Titlecased
* Changes_When_Casefolded
* Changes_When_Casemapped
* Alphabetic
* Default_Ignorable_Code_Point
* Grapheme_Base
* Grapheme_Extend
* Grapheme_Link
* Math
* ID_Start
* ID_Continue
* XID_Start
* XID_Continue
NB: The UCD property ISO_Comment will never be included since this one is empty in all new Unicode versions.
#### From Unihan
* kAccountingNumeric
* kOtherNumeric
* kPrimaryNumeric
* kDefinition
* kMandarin
* kCantonese
* kJapaneseKun
* kJapaneseOn
* kKorean
* kHangul
* kVietnamese
* kSimplifiedVariant
* kTraditionalVariant
### Regenerating the data
The project UnicodeInformation.Builder takes cares of generating a file named ucd.dat. This file contains Unicode data compressed by .NET's deflate algorithm, and should be included in UnicodeInformation.dll at compilation.