Commit 59bdda00 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Implement GetScriptProperties().

parent db2e44a9
......@@ -4,7 +4,7 @@
enum unicode_script_id {
Script_Unknown = 0,
Script_Control = 1,
Script_Common = 1,
Script_Arabic = 2,
Script_Armenian = 3,
Script_Avestan = 4,
......@@ -128,4 +128,5 @@ enum unicode_script_id {
Script_Vai = 122,
Script_Warang_Citi = 123,
Script_Yi = 124,
Script_LastId = 124
};
......@@ -908,6 +908,38 @@ static void test_AnalyzeLineBreakpoints(void)
IDWriteTextAnalyzer_Release(analyzer);
}
static void test_GetScriptProperties(void)
{
IDWriteTextAnalyzer1 *analyzer1;
IDWriteTextAnalyzer *analyzer;
DWRITE_SCRIPT_ANALYSIS sa;
DWRITE_SCRIPT_PROPERTIES props;
HRESULT hr;
hr = IDWriteFactory_CreateTextAnalyzer(factory, &analyzer);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDWriteTextAnalyzer_QueryInterface(analyzer, &IID_IDWriteTextAnalyzer1, (void**)&analyzer1);
IDWriteTextAnalyzer_Release(analyzer);
if (hr != S_OK) {
win_skip("IDWriteTextAnalyzer1 is not supported.\n");
return;
}
sa.script = 1000;
hr = IDWriteTextAnalyzer1_GetScriptProperties(analyzer1, sa, &props);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
if (0) /* crashes on native */
hr = IDWriteTextAnalyzer1_GetScriptProperties(analyzer1, sa, NULL);
sa.script = 0;
hr = IDWriteTextAnalyzer1_GetScriptProperties(analyzer1, sa, &props);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDWriteTextAnalyzer1_Release(analyzer1);
}
START_TEST(analyzer)
{
HRESULT hr;
......@@ -925,6 +957,7 @@ START_TEST(analyzer)
test_AnalyzeScript();
test_AnalyzeLineBreakpoints();
test_GetScriptProperties();
IDWriteFactory_Release(factory);
}
......@@ -1301,7 +1301,7 @@ sub dump_scripts($)
my $filename = shift;
my $header = $filename;
my @scripts_table = (0) x 65536; # 0 means unknown script
my $next_group = 0;
my $script_index;
my %scripts;
my $i;
......@@ -1335,10 +1335,9 @@ sub dump_scripts($)
$scripts{$type} = -1;
}
$i = 2;
$script_index = 1;
foreach my $script (sort keys %scripts) {
$scripts{$script} = $i;
$i++;
$scripts{$script} = ++$script_index;
}
# now fill a table
......@@ -1382,14 +1381,15 @@ sub dump_scripts($)
print OUTPUT "/* generated from $UNIDATA/Scripts.txt */\n";
print OUTPUT "/* DO NOT EDIT!! */\n\n";
# reserve Unknown and Control ids
# reserve Unknown and Common ids
print OUTPUT "enum unicode_script_id {\n";
print OUTPUT " Script_Unknown = 0,\n";
print OUTPUT " Script_Control = 1,\n";
print OUTPUT " Script_Common = 1,\n";
foreach my $script (sort keys %scripts)
{
print OUTPUT " Script_$script = $scripts{$script},\n";
}
print OUTPUT " Script_LastId = $script_index\n";
print OUTPUT "};\n";
close OUTPUT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment