From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/analyzer.c | 2 +- dlls/dwrite/dwrite_private.h | 3 +++ dlls/dwrite/opentype.c | 20 ++++++++++++++++++++ dlls/dwrite/shape.c | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 6e9a9d0caa5..107a7c1f531 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -921,7 +921,7 @@ static HRESULT analyze_linebreaks(IDWriteTextAnalysisSource *source, UINT32 posi
breakpoints[index].breakConditionBefore = DWRITE_BREAK_CONDITION_NEUTRAL; breakpoints[index].breakConditionAfter = DWRITE_BREAK_CONDITION_NEUTRAL; - breakpoints[index].isWhitespace = context.ch < 0xffff ? !!iswspace(context.ch) : 0; + breakpoints[index].isWhitespace = opentype_is_whitespace(context.ch); breakpoints[index].isSoftHyphen = context.ch == 0x00ad /* Unicode Soft Hyphen */; breakpoints[index].padding = 0; ++index; diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 0ce0984b23b..2d7987d5159 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -19,6 +19,8 @@ #ifndef __WINE_DWRITE_PRIVATE_H #define __WINE_DWRITE_PRIVATE_H
+#include <stdbool.h> + #include "dwrite_3.h" #include "d2d1.h" #include "winternl.h" @@ -540,6 +542,7 @@ extern HRESULT opentype_get_kerning_pairs(struct dwrite_fontface *fontface, unsi extern BOOL opentype_has_kerning_pairs(struct dwrite_fontface *fontface); extern HRESULT opentype_get_font_var_axis(const struct file_stream_desc *stream_desc, struct dwrite_var_axis **axis, unsigned int *axis_count); +extern bool opentype_is_whitespace(unsigned int codepoint);
struct dwrite_colorglyph { USHORT layer; /* [0, num_layers) index indicating current layer */ diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index c36f7ba1f77..37361582d90 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -6004,6 +6004,26 @@ static unsigned int opentype_is_default_ignorable(unsigned int codepoint) (codepoint >= 0xe0000 && codepoint <= 0xe0fff); }
+/* + * 0009..000D # TABs, FF, CR + * 0020 # SPACE + * 0085 # NL + * 00A0 # NBSP + * 1680 # OGHAM SPACE MARK + * 2000..200A # NQSP, MQSP, ENSP, EMSP, 3/MSP, 4/MSP, 6/MSP, FSP, PSP, THSP, HSP + * 2028..202F # LSEP, PSEP, NNBSP + * 205F # MMSP + * 3000 # IDSP +*/ +bool opentype_is_whitespace(unsigned int codepoint) +{ + return (codepoint >= 0x9 && codepoint <= 0xd) || + codepoint == 0x20 || codepoint == 0x85 || codepoint == 0xa0 || + codepoint == 0x1680 || (codepoint >= 0x2000 && codepoint <= 0x200a) || + (codepoint >= 0x2028 && codepoint <= 0x202f) || codepoint == 0x205f || + codepoint == 0x3000; +} + static unsigned int opentype_is_diacritic(unsigned int codepoint) { WCHAR ch = codepoint; diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c index 6dfd1b15176..240807565e8 100644 --- a/dlls/dwrite/shape.c +++ b/dlls/dwrite/shape.c @@ -207,7 +207,7 @@ static void default_shaper_setup_masks(struct scriptshaping_context *context,
for (i = 0; i < context->glyph_count; ++i) { - context->u.buffer.glyph_props[i].justification = iswspace(context->glyph_infos[i].codepoint) ? + context->u.buffer.glyph_props[i].justification = opentype_is_whitespace(context->glyph_infos[i].codepoint) ? SCRIPT_JUSTIFY_BLANK : SCRIPT_JUSTIFY_CHARACTER; } }