From: Byeongsik Jeon Subject: Re: [PATCH v2 7/7] gdi32: Improve the determine code whether the chracter is the fullwidth. Message-Id: <850ba54d-6ff9-69a5-9ec6-312f18dcb71c@hanmail.net> Date: Sat, 2 Feb 2019 05:11:58 +0900 In-Reply-To: References: <20190129171241.31570-1-bsjeon@hanmail.net> <20190129171241.31570-7-bsjeon@hanmail.net> <20190130234204.6851.375B48EC@gmail.com> Byeongsik Jeon wrote: > Akihiro Sagawa wrote: >> >> >> In my opinion, why don't we test the following condition for fixed_pitch_full? >> fixed_pitch_full = avg_advance > 0 >> && (base_advance + 63) >> 6 >> >= pFT_MulFix(MulDiv(incoming_font->ntmAvgWidth, x, y), em_scale); >> The x and y are heuristic ratio. I think they will be 1.5~1.8. >> >> Because base_advance can be based on linked font, i.e. another font >> replaced by get_glyph_index_linked(), the glyph might be a proportional >> typeface. In that case, "(base_advance + 63) >> 6 != avg_advance" is >> very loose restriction. A narrow character may be treated as a >> Full-width character in that case. >> >> Regards, >> Akihiro Sagawa >> >> > Yes. It's absolutely correct. > I looked at the behavior on Windows with a test font that manipulated the OS/2 table(Panose, AvgCharWidth). It didn't work as I thought. IMO, Windows seems to be doing something related to the following document. Surprisingly, Wine already has the scripts needed for conversion, so I can work easily. https://www.unicode.org/Public/11.0/udd/EasasianWidth.txt This is a temporary patch. Please review if possible. It is also good to post more improved patch directly. Thank you. From a476dfbc13945532fdfbe7f54aba911e3de70111 Mon Sep 17 00:00:00 2001 From: Byeongsik Jeon Date: Sat, 2 Feb 2019 04:29:32 +0900 Subject: [PATCH] gdi32: Improve the determine code whether the chracter is the fullwidth. To: wine-devel Signed-off-by: Byeongsik Jeon --- dlls/gdi32/Makefile.in | 3 +- dlls/gdi32/freetype.c | 35 +++-- dlls/gdi32/width.c | 324 +++++++++++++++++++++++++++++++++++++++++ tools/make_unicode | 61 ++++++++ 4 files changed, 412 insertions(+), 11 deletions(-) create mode 100644 dlls/gdi32/width.c diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index 9e5464de2d..28a6e6a328 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -47,7 +47,8 @@ C_SRCS = \ printdrv.c \ region.c \ vertical.c \ - vulkan.c + vulkan.c \ + width.c RC_SRCS = gdi32.rc diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index c38108eece..b6410f1438 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6628,6 +6628,7 @@ static inline BYTE get_max_level( UINT format ) } extern const unsigned short vertical_orientation_table[] DECLSPEC_HIDDEN; +extern const unsigned short east_asian_width_table[] DECLSPEC_HIDDEN; static BOOL check_unicode_tategaki(WCHAR uchar) { @@ -6638,13 +6639,21 @@ static BOOL check_unicode_tategaki(WCHAR uchar) return (orientation == 1 || orientation == 3); } +static BOOL check_unicode_full_width(WCHAR uchar) +{ + unsigned short width_type = east_asian_width_table[east_asian_width_table[east_asian_width_table[uchar >> 8]+((uchar >> 4) & 0x0f)]+ (uchar & 0xf)]; + + /* Type: W */ + return (width_type == 5); +} + static FT_Vector get_advance_metric(GdiFont *incoming_font, GdiFont *font, const FT_Glyph_Metrics *metrics, - const FT_Matrix *transMat, BOOL vertical_metrics) + const FT_Matrix *transMat, BOOL vertical_metrics, + BOOL fixed_pitch_full ) { FT_Vector adv; FT_Fixed base_advance, em_scale = 0; - BOOL fixed_pitch_full = FALSE; if (vertical_metrics) base_advance = metrics->vertAdvance; @@ -6658,17 +6667,14 @@ static FT_Vector get_advance_metric(GdiFont *incoming_font, GdiFont *font, they have double halfwidth character width. E.g. if the font is 19 ppem, we return 20 (not 19) for fullwidth characters as we return 10 for halfwidth characters. */ - if(FT_IS_SCALABLE(incoming_font->ft_face) && + if(fixed_pitch_full && FT_IS_SCALABLE(incoming_font->ft_face) && (incoming_font->potm || get_outline_text_metrics(incoming_font)) && !(incoming_font->potm->otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) { UINT avg_advance; em_scale = MulDiv(incoming_font->ppem, 1 << 16, incoming_font->ft_face->units_per_EM); avg_advance = pFT_MulFix(incoming_font->ntmAvgWidth, em_scale); - fixed_pitch_full = (avg_advance > 0 && - (base_advance + 63) >> 6 == - pFT_MulFix(incoming_font->ntmAvgWidth*2, em_scale)); - if (fixed_pitch_full && !transMat) + if (!transMat) adv.x = (avg_advance * 2) << 6; } @@ -6954,6 +6960,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, FT_Matrix transMatTategaki; BOOL needsTransform = FALSE; BOOL tategaki = (font->name[0] == '@'); + BOOL fixed_pitch_full = FALSE; BOOL vertical_metrics; UINT original_index; @@ -6984,6 +6991,14 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, original_index = glyph_index; if (!vert && tategaki) tategaki = check_unicode_tategaki(glyph); + + if (FT_IS_SCALABLE(incoming_font->ft_face) && + (incoming_font->potm || get_outline_text_metrics(incoming_font)) && + !(incoming_font->potm->otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) + { + fixed_pitch_full = check_unicode_full_width( glyph ); + } + } format &= ~GGO_UNHINTED; @@ -7158,7 +7173,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, right = (INT)((metrics.horiBearingX + metrics.width) + 63) & -64; top = (metrics.horiBearingY + 63) & -64; bottom = (metrics.horiBearingY - metrics.height) & -64; - adv = get_advance_metric(incoming_font, font, &metrics, NULL, vertical_metrics); + adv = get_advance_metric(incoming_font, font, &metrics, NULL, vertical_metrics, fixed_pitch_full ); gm.gmCellIncX = adv.x >> 6; gm.gmCellIncY = 0; origin_x = left; @@ -7216,11 +7231,11 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, } TRACE("transformed box: (%d,%d - %d,%d)\n", left, top, right, bottom); - adv = get_advance_metric(incoming_font, font, &metrics, &transMat, vertical_metrics); + adv = get_advance_metric(incoming_font, font, &metrics, &transMat, vertical_metrics, fixed_pitch_full ); gm.gmCellIncX = adv.x >> 6; gm.gmCellIncY = adv.y >> 6; - adv = get_advance_metric(incoming_font, font, &metrics, &transMatUnrotated, vertical_metrics); + adv = get_advance_metric(incoming_font, font, &metrics, &transMatUnrotated, vertical_metrics, fixed_pitch_full ); adv.x = pFT_Vector_Length(&adv); adv.y = 0; diff --git a/dlls/gdi32/width.c b/dlls/gdi32/width.c new file mode 100644 index 0000000000..8ca5515069 --- /dev/null +++ b/dlls/gdi32/width.c @@ -0,0 +1,324 @@ +/* Unicode East Asian Width */ +/* generated from http://www.unicode.org/Public/11.0.0/ucd/EastAsianWidth.txt */ +/* DO NOT EDIT!! */ + +#include "wine/unicode.h" + +const unsigned short DECLSPEC_HIDDEN east_asian_width_table[2496] = +{ + /* level 1 offsets */ + 0x0100, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0150, 0x0150, + 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, + 0x0150, 0x0160, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, + 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, + 0x0170, 0x0180, 0x0190, 0x01a0, 0x01b0, 0x01c0, 0x01d0, 0x01e0, + 0x0150, 0x01f0, 0x0150, 0x0200, 0x0150, 0x0150, 0x0210, 0x0220, + 0x0230, 0x0240, 0x0250, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0270, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0280, 0x0150, 0x0150, 0x0150, + 0x0150, 0x0290, 0x0150, 0x0150, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, + 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x0260, 0x02a0, + 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, 0x0150, + 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, + 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, + 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, 0x02b0, + 0x02b0, 0x0260, 0x0260, 0x0150, 0x0150, 0x0150, 0x02c0, 0x02d0, + /* level 2 offsets */ + 0x02e0, 0x02e0, 0x02f0, 0x02f0, 0x02f0, 0x02f0, 0x02f0, 0x0300, + 0x02e0, 0x02e0, 0x0310, 0x0320, 0x0330, 0x0340, 0x0350, 0x0360, + 0x0370, 0x0380, 0x0390, 0x03a0, 0x03b0, 0x03c0, 0x0390, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x03d0, 0x03e0, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x0370, 0x0370, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x03f0, 0x0400, 0x02e0, 0x02e0, + 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x02e0, + 0x02e0, 0x0420, 0x0430, 0x0420, 0x0430, 0x02e0, 0x02e0, 0x02e0, + 0x0370, 0x0410, 0x0410, 0x0410, 0x0410, 0x0370, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x0450, 0x0460, 0x0470, 0x02e0, 0x02e0, 0x02e0, 0x0480, + 0x0490, 0x02e0, 0x04a0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x04b0, 0x04c0, 0x04d0, 0x02e0, 0x02e0, 0x04e0, 0x04f0, 0x0500, + 0x0510, 0x0500, 0x02e0, 0x0520, 0x02e0, 0x0530, 0x0540, 0x02e0, + 0x0550, 0x0560, 0x0570, 0x0580, 0x0590, 0x05a0, 0x05b0, 0x02e0, + 0x05c0, 0x05d0, 0x05e0, 0x05f0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x0600, 0x0610, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x0620, 0x0630, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x0410, 0x0410, + 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0640, 0x0410, + 0x0410, 0x0410, 0x0410, 0x0410, 0x04f0, 0x0410, 0x0410, 0x0650, + 0x0410, 0x0660, 0x0430, 0x0670, 0x0680, 0x0690, 0x06a0, 0x06b0, + 0x06c0, 0x06d0, 0x02e0, 0x02e0, 0x06e0, 0x06f0, 0x0700, 0x0710, + 0x02e0, 0x0720, 0x0730, 0x0740, 0x0750, 0x0760, 0x0770, 0x0780, + 0x0790, 0x02e0, 0x07a0, 0x07b0, 0x07c0, 0x07d0, 0x02e0, 0x07e0, + 0x02e0, 0x07f0, 0x02e0, 0x0800, 0x02e0, 0x02e0, 0x0810, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0820, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x0830, 0x02e0, 0x02e0, 0x02e0, 0x0840, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0440, 0x0850, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x06f0, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0860, 0x02e0, 0x0870, + 0x0880, 0x0440, 0x0440, 0x0890, 0x08a0, 0x0440, 0x0440, 0x0440, + 0x0440, 0x08b0, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x08c0, 0x0440, 0x0440, 0x08a0, 0x0440, 0x0440, 0x0440, 0x0440, + 0x0890, 0x0440, 0x0440, 0x08d0, 0x0440, 0x0440, 0x06f0, 0x0440, + 0x0440, 0x0890, 0x0440, 0x0440, 0x08e0, 0x0440, 0x0440, 0x0440, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0890, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x0440, 0x0440, 0x0440, 0x0440, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x08f0, 0x0440, 0x0440, 0x0440, 0x0900, 0x02e0, 0x02e0, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x0440, 0x08f0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, 0x0440, + 0x0440, 0x0440, 0x06f0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, + 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, 0x0410, + 0x0410, 0x0910, 0x02e0, 0x0440, 0x0440, 0x0920, 0x0930, 0x02e0, + 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, 0x02e0, + 0x0940, 0x0950, 0x0950, 0x0950, 0x0950, 0x0950, 0x0960, 0x0970, + 0x0970, 0x0970, 0x0970, 0x0980, 0x0990, 0x09a0, 0x09b0, 0x07b0, + /* values */ + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, + 0x0003, 0x0000, 0x0004, 0x0004, 0x0000, 0x0004, 0x0004, 0x0000, + 0x0000, 0x0003, 0x0000, 0x0003, 0x0004, 0x0000, 0x0000, 0x0004, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, + 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0000, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, + 0x0000, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, + 0x0000, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0000, + 0x0003, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0000, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0002, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0000, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0000, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0003, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0003, 0x0003, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0000, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, 0x0003, + 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0000, 0x0003, + 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0000, 0x0003, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, + 0x0003, 0x0003, 0x0003, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0003, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0005, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0000, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0005, 0x0005, 0x0000, 0x0005, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0005, 0x0000, 0x0000, 0x0005, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0003, 0x0005, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0005, 0x0003, 0x0005, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0005, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004, + 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0003, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0001, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, + 0x0003, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, + 0x0003, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, + 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0003, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, + 0x0005, 0x0005, 0x0005, 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, + 0x0003, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, + 0x0001, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0003, + 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0003, 0x0003, 0x0003, + 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0003 +}; diff --git a/tools/make_unicode b/tools/make_unicode index 56d1905656..44206fc08d 100755 --- a/tools/make_unicode +++ b/tools/make_unicode @@ -258,6 +258,16 @@ my %vertical_types = "Tu" => 0x0003, ); +my %width_types = +( + "A" => 0x0000, + "F" => 0x0001, + "H" => 0x0002, + "N" => 0x0003, + "Na" => 0x0004, + "W" => 0x0005, +); + my %categories = ( "Lu" => $ctype{"defin"}|$ctype{"alpha"}|$ctype{"upper"}, # Letter, Uppercase @@ -1721,6 +1731,56 @@ sub dump_vertical($) save_file($filename); } +################################################################ +# dump the East Asian Width table +sub dump_width($) +{ + my $filename = shift; + my @width_table; + + my $INPUT = open_data_file( $UNIDATA, "EastAsianWidth.txt" ); + while (<$INPUT>) + { + next if /^\#/; # skip comments + next if /^\s*$/; # skip empty lines + next if /\x1a/; # skip ^Z + if (/^\s*([0-9a-fA-F]+)\s*;\s*([a-zA-Z_]+)\s*/) + { + my $type = $2; + die "unknown width $type" unless defined $width_types{$type}; + if (hex $1 < 65536) + { + $width_table[hex $1] = $width_types{$type}; + } + next; + } + elsif (/^\s*([0-9a-fA-F]+)..\s*([0-9a-fA-F]+)\s*;\s*([A-Za-z_]+)\s*/) + { + my $type = $3; + die "unknown width $type" unless defined $width_types{$type}; + foreach my $i (hex $1 .. hex $2) + { + $width_table[$i] = $width_types{$type}; + } + next; + } + die "malformed line $_"; + } + close $INPUT; + + open OUTPUT,">$filename.new" or die "Cannot create $filename"; + print "Building $filename\n"; + print OUTPUT "/* Unicode East Asian Width */\n"; + print OUTPUT "/* generated from $UNIDATA/EastAsianWidth.txt */\n"; + print OUTPUT "/* DO NOT EDIT!! */\n\n"; + print OUTPUT "#include \"wine/unicode.h\"\n\n"; + + dump_two_level_mapping( "east_asian_width_table", $width_types{'N'}, @width_table ); + + close OUTPUT; + save_file($filename); +} + ################################################################ # dump the digit folding tables sub dump_digit_folding($) @@ -2616,6 +2676,7 @@ dump_indic( "dlls/usp10/indicsyllable.c" ); dump_intl_nls("loader/l_intl.nls"); dump_vertical( "dlls/gdi32/vertical.c" ); dump_vertical( "dlls/wineps.drv/vertical.c" ); +dump_width( "dlls/gdi32/width.c" ); dump_nameprep( "dlls/kernel32/nameprep.c" ); foreach my $file (@allfiles) { HANDLE_FILE( @{$file} ); } -- 2.20.1