사용자 도구

사이트 도구


사이드바

카테고리

winapi:unicode

유니코드 한글 문자표

  • 한글자모 : U1100 ~ U11FF
    4352 ~ 4607
  • 한글완성 : UAC00 ~ UD7A3
    44032 ~ 55203

API로 지원되는 문자 영역 정보 확인

GetTextCharsetInfo(), 'Malgun Gothic' 정보를 얻어온 경우,

// 이런 값을 받아 왔다면, (한글 맑은 굴림의 문자셋 정보)
&_fontsig	0x0039edbc {fsUsb=0x0039edbc fsCsb=0x0039edcc }	tagFONTSIGNATURE *
	fsUsb	0x0039edbc	unsigned long [4]
		[0x0]	0x900002af	unsigned long
		[0x1]	0x01d77cfb	unsigned long
		[0x2]	0x00000012	unsigned long
		[0x3]	0x00000000	unsigned long
	fsCsb	0x0039edcc	unsigned long [2]
		[0x0]	0x00080001	unsigned long
		[0x1]	0x00000000	unsigned long

fsUsb 각 비트를 체크하면 된다.

  • 126 ~ 128bit 유니코드 서브셋 비트정보.
  • 왼쪽2비트는 무시.
  • 가장 왼쪽 1비트는 항상 1. 가장 기본이 되는 알파벳이라서.
  • 두번째 왼쪽비트는 예약, 그리고 항상 0. 그런데 꼭 0은 아닌듯.
  • 유니코드의 ISO 10646 standard 에 의해 범위가 정해져 있다.

각 비트를 체크해서 해당 문자열이 지원되는지 알아보는 예제 코드

void CfontCharViewDlg::OnBnClicked_GetInfo()
{
    for (int i=0;i < this->mCharsetList.GetCount();i++)
    {
        this->mCharsetList.DeleteString( i );
    }
 
    //FontCharsetTest _font;
    //mFont.getFontInfo();
    CClientDC _dc( AfxGetMainWnd() );
 
    int _charsetinfo;
    FONTSIGNATURE _fontsig;
    _dc.SelectObject( mFont.font() );
    _charsetinfo = GetTextCharsetInfo( _dc.m_hDC, &_fontsig, 0 );
 
    // codepage : http://scripts.sil.org/cms/scripts/page.php?item_id=WindowsCodepages
    WCHAR* _charsetSubset[] = 
    {
        L"Basic Latin",
        L"Latin-1 Supplement",
        L"Latin Extended-A",
        L"Latin Extended-B",
        L"IPA Extensions",
        L"Spacing Modifier Letters",
        L"Combining Diacritical Marks",
        L"Basic Greek",
        L"Greek Symbols and Coptic",
        L"Cyrillic",
        L"Armenian",
        L"Basic Hebrew",
        L"Hebrew Extended",
        L"Basic Arabic",
        L"Arabic Extended",
        L"Devanagari",
        L"Bengali",
        L"Gurmukhi",
        L"Gujarati",
        L"Oriya",
        L"Tamil",
        L"Telugu",
        L"Kannada",
        L"Malayalam",
        L"Thai",
        L"Lao",
        L"Basic Georgian",
        L"Georgian Extended",
        L"Hangul Jamo",
        L"Latin Extended Additional",
        L"Greek Extended",
        L"General Punctuation",
        L"Subscripts and Superscripts",
        L"Currency Symbols",
        L"Combining Diacritical Marks for Symbols",
        L"Letter-like Symbols",
        L"Number Forms",
        L"Arrows",
        L"Mathematical Operators",
        L"Miscellaneous Technical",
        L"Control Pictures",
        L"Optical Character Recognition",
        L"Enclosed Alphanumerics",
        L"Box Drawing",
        L"Block Elements",
        L"Geometric Shapes",
        L"Miscellaneous Symbols",
        L"Dingbats",
        L"Chinese, Japanese, and Korean (CJK) Symbols and Punctuation",
        L"Hiragana",
        L"Katakana",
        L"Bopomofo",
        L"Hangul Compatibility Jamo",
        L"CJK Miscellaneous",
        L"Enclosed CJK",
        L"CJK Compatibility",
        L"Hangul",
        L"Reserved for Unicode Subranges",
        L"Reserved for Unicode Subranges",
        L"CJK Unified Ideographs",
        L"Private Use Area",
        L"CJK Compatibility Ideographs",
        L"Alphabetic Presentation Forms",
        L"Arabic Presentation Forms-A",
        L"Combining Half Marks",
        L"CJK Compatibility Forms",
        L"Small Form Variants",
        L"Arabic Presentation Forms-B",
        L"Halfwidth and Fullwidth Forms",
        L"Specials"
    };
    //70-127	Reserved for Unicode Subranges
 
    int _index = 0;
    // 일단 70개만 확인할거라.
    for( _index = 0; _index <= 69; )
    {
        // DWORD 4개에 대해서 체크할 것이므로 4번 돌자.
        for( int j = 0; j < 4; ++j )
        {
            // 4바이트의 비트수 (32비트)만큼 반복
            DWORD _sample = _fontsig.fsUsb[j];
            for( int i = 0; i < 32; ++i )
            {
                // 가장 왼쪽의 비트가 1인지 확인해서
                DWORD _result = (_sample & 0x80000000);
                if( _result & 0x80000000 )
                {
                    // 1이면, 여기에 해당하는 문자셋을 지원하므로 어딘가에 저장.
                    this->mCharsetList.InsertString( this->mCharsetList.GetCount(), _charsetSubset[_index] );
                }
                _sample = _sample << 1;
 
                ++_index;
                if( _index > 69 ) break;
            }
            if( _index > 69 ) break;
        }
    }
}
winapi/unicode.txt · 마지막으로 수정됨: 2021/04/30 11:16 저자 kieuns