From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/analyzer.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 595d8806159..86d030b3738 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -513,22 +513,21 @@ static DWRITE_SCRIPT_ANALYSIS get_char_sa(WCHAR c) return sa; }
-static HRESULT analyze_script(const WCHAR *text, UINT32 position, UINT32 length, IDWriteTextAnalysisSink *sink) +static HRESULT analyze_script(struct text_source_context *context, IDWriteTextAnalysisSink *sink) { DWRITE_SCRIPT_ANALYSIS sa; - UINT32 pos, i, seq_length; + UINT32 pos, seq_length;
- if (!length) - return S_OK; + text_source_get_next_u32_char(context);
- sa = get_char_sa(*text); + sa = get_char_sa(context->ch);
- pos = position; + pos = context->position; seq_length = 1;
- for (i = 1; i < length; i++) + while (!text_source_get_next_u32_char(context)) { - DWRITE_SCRIPT_ANALYSIS cur_sa = get_char_sa(text[i]); + DWRITE_SCRIPT_ANALYSIS cur_sa = get_char_sa(context->ch);
/* Unknown type is ignored when preceded or followed by another script */ switch (sa.script) { @@ -554,7 +553,7 @@ static HRESULT analyze_script(const WCHAR *text, UINT32 position, UINT32 length,
hr = IDWriteTextAnalysisSink_SetScriptAnalysis(sink, pos, seq_length, &sa); if (FAILED(hr)) return hr; - pos = position + i; + pos += seq_length; seq_length = 1; sa = cur_sa; } @@ -1104,23 +1103,17 @@ static HRESULT get_text_source_ptr(IDWriteTextAnalysisSource *source, UINT32 pos static HRESULT WINAPI dwritetextanalyzer_AnalyzeScript(IDWriteTextAnalyzer2 *iface, IDWriteTextAnalysisSource* source, UINT32 position, UINT32 length, IDWriteTextAnalysisSink* sink) { - WCHAR *buff = NULL; - const WCHAR *text; + struct text_source_context context; HRESULT hr;
TRACE("%p, %u, %u, %p.\n", source, position, length, sink);
- if (length == 0) + if (!length) return S_OK;
- hr = get_text_source_ptr(source, position, length, &text, &buff); - if (FAILED(hr)) - return hr; - - hr = analyze_script(text, position, length, sink); - free(buff); + if (FAILED(hr = text_source_context_init(&context, source, position, length))) return hr;
- return hr; + return analyze_script(&context, sink); }
static HRESULT WINAPI dwritetextanalyzer_AnalyzeBidi(IDWriteTextAnalyzer2 *iface,
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/analyzer.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 86d030b3738..200ffc8da4c 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -501,15 +501,31 @@ static inline UINT16 get_char_script(WCHAR c) return script == Script_Inherited ? Script_Unknown : script; }
-static DWRITE_SCRIPT_ANALYSIS get_char_sa(WCHAR c) +static DWRITE_SCRIPT_ANALYSIS get_char_sa(UINT32 c) { DWRITE_SCRIPT_ANALYSIS sa; - WORD type;
- GetStringTypeW(CT_CTYPE1, &c, 1, &type); sa.script = get_char_script(c); - sa.shapes = (type & C1_CNTRL) || c == 0x2028 /* LINE SEPARATOR */ || c == 0x2029 /* PARAGRAPH SEPARATOR */ ? - DWRITE_SCRIPT_SHAPES_NO_VISUAL : DWRITE_SCRIPT_SHAPES_DEFAULT; + sa.shapes = DWRITE_SCRIPT_SHAPES_DEFAULT; + if ((c >= 0x0001 && c <= 0x001f) || + (c >= 0x007f && c <= 0x009f) || + (c == 0x00ad) /* SOFT HYPHEN */ || + (c >= 0x200b && c <= 0x200f) || + (c >= 0x2028 && c <= 0x202e) || + (c >= 0x2060 && c <= 0x2064) || + (c >= 0x2066 && c <= 0x206f) || + (c == 0xfeff) || + (c == 0xfff9) || + (c == 0xfffa) || + (c == 0xfffb)) + { + sa.shapes = DWRITE_SCRIPT_SHAPES_NO_VISUAL; + } + else + { + sa.shapes = DWRITE_SCRIPT_SHAPES_DEFAULT; + } + return sa; }
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/analyzer.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 200ffc8da4c..11cf66ce13c 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -222,6 +222,28 @@ system_fallback_config[] = { "0000-007F, 0080-00FF, 0100-017F, 0180-024F, " "0250-02AF, 02B0-02FF, 0300-036F", L"Tahoma" },
+ { "0590-05FF, FB1D-FB4F", L"Noto Sans Hebrew" }, + + { "0900-097F", L"Noto Sans Devanagari" }, + { "0980-09FF", L"Noto Sans Bengali" }, + { "0A00-0A7F", L"Noto Sans Gurmukhi" }, + { "0A80-0AFF", L"Noto Sans Gujarati" }, + { "0B00-0B7F", L"Noto Sans Oriya" }, + { "0B80-0BFF", L"Noto Sans Tamil" }, + { "0C00-0C7F", L"Noto Sans Telugu" }, + { "0C80-0CFF", L"Noto Sans Kannada" }, + { "0D00-0D7F", L"Noto Sans Malayalam" }, + { "0D80-0DFF", L"Noto Sans Sinhala" }, + + { "0E00-0E7F", L"Noto Sans Thai" }, + { "0E80-0EFF", L"Noto Sans Lao" }, + + { "1680-169F", L"Noto Sans Ogham" }, + + { "16A0-16FF", L"Noto Sans Runic" }, + + { "1800-18AF, 11660-1167F", L"Noto Sans Mongolian" }, + { "3000-30FF, 31F0-31FF, 4E00-9FFF", L"Meiryo" }, };
This merge request was approved by Nikolay Sivov.