Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1843972e
Commit
1843972e
authored
Oct 05, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Initial implementation of GetGlyphs().
parent
fd342cce
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
382 additions
and
28 deletions
+382
-28
Makefile.in
dlls/dwrite/Makefile.in
+2
-1
analyzer.c
dlls/dwrite/analyzer.c
+111
-5
dwrite_private.h
dlls/dwrite/dwrite_private.h
+32
-0
shape.c
dlls/dwrite/shape.c
+147
-0
analyzer.c
dlls/dwrite/tests/analyzer.c
+90
-22
No files found.
dlls/dwrite/Makefile.in
View file @
1843972e
...
...
@@ -12,4 +12,5 @@ C_SRCS = \
linebreak.c
\
main.c
\
opentype.c
\
scripts.c
scripts.c
\
shape.c
dlls/dwrite/analyzer.c
View file @
1843972e
...
...
@@ -34,6 +34,7 @@ extern const unsigned short wine_scripts_table[];
struct
dwritescript_properties
{
DWRITE_SCRIPT_PROPERTIES
props
;
BOOL
is_complex
;
const
struct
scriptshaping_ops
*
ops
;
};
/* NOTE: keep this array synced with script ids from scripts.h */
...
...
@@ -94,7 +95,7 @@ static const struct dwritescript_properties dwritescripts_properties[Script_Last
{
/* Khoj */
{
0x6a6f684b
,
322
,
1
,
0x0020
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
},
{
/* Sind */
{
0x646e6953
,
318
,
1
,
0x0020
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
},
{
/* Laoo */
{
0x6f6f614c
,
356
,
8
,
0x0020
,
1
,
0
,
1
,
0
,
1
,
0
,
0
},
TRUE
},
{
/* Latn */
{
0x6e74614c
,
215
,
1
,
0x0020
,
0
,
1
,
1
,
0
,
0
,
0
,
0
}
},
{
/* Latn */
{
0x6e74614c
,
215
,
1
,
0x0020
,
0
,
1
,
1
,
0
,
0
,
0
,
0
}
,
FALSE
,
&
latn_shaping_ops
},
{
/* Lepc */
{
0x6370654c
,
335
,
8
,
0x0020
,
1
,
1
,
1
,
0
,
0
,
0
,
0
}
},
{
/* Limb */
{
0x626d694c
,
336
,
8
,
0x0020
,
1
,
1
,
1
,
0
,
0
,
0
,
0
}
},
{
/* Lina */
{
0x616e694c
,
400
,
1
,
0x0020
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
},
...
...
@@ -179,6 +180,16 @@ static inline struct dwrite_numbersubstitution *impl_from_IDWriteNumberSubstitut
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_numbersubstitution
,
IDWriteNumberSubstitution_iface
);
}
static
inline
UINT32
decode_surrogate_pair
(
const
WCHAR
*
str
,
UINT32
index
,
UINT32
end
)
{
if
(
index
<
end
-
1
&&
IS_SURROGATE_PAIR
(
str
[
index
],
str
[
index
+
1
]))
{
UINT32
ch
=
0x10000
+
((
str
[
index
]
-
0xd800
)
<<
10
)
+
(
str
[
index
+
1
]
-
0xdc00
);
TRACE
(
"surrogate pair (%x %x) => %x
\n
"
,
str
[
index
],
str
[
index
+
1
],
ch
);
return
ch
;
}
return
0
;
}
static
inline
UINT16
get_char_script
(
WCHAR
c
)
{
UINT16
script
=
get_table_entry
(
wine_scripts_table
,
c
);
...
...
@@ -827,17 +838,112 @@ done:
}
static
HRESULT
WINAPI
dwritetextanalyzer_GetGlyphs
(
IDWriteTextAnalyzer2
*
iface
,
WCHAR
const
*
text
,
UINT32
length
,
IDWriteFontFace
*
font
_
face
,
BOOL
is_sideways
,
WCHAR
const
*
text
,
UINT32
length
,
IDWriteFontFace
*
fontface
,
BOOL
is_sideways
,
BOOL
is_rtl
,
DWRITE_SCRIPT_ANALYSIS
const
*
analysis
,
WCHAR
const
*
locale
,
IDWriteNumberSubstitution
*
substitution
,
DWRITE_TYPOGRAPHIC_FEATURES
const
**
features
,
UINT32
const
*
feature_range_len
,
UINT32
feature_ranges
,
UINT32
max_glyph_count
,
UINT16
*
clustermap
,
DWRITE_SHAPING_TEXT_PROPERTIES
*
text_props
,
UINT16
*
glyph_indices
,
DWRITE_SHAPING_GLYPH_PROPERTIES
*
glyph_props
,
UINT32
*
actual_glyph_count
)
{
FIXME
(
"(%s:%u %p %d %d %p %s %p %p %p %u %u %p %p %p %p %p): stub
\n
"
,
debugstr_wn
(
text
,
length
),
length
,
font_face
,
is_sideways
,
is_rtl
,
analysis
,
debugstr_w
(
locale
),
substitution
,
features
,
feature_range_len
,
const
struct
dwritescript_properties
*
scriptprops
;
WCHAR
*
string
;
BOOL
update_cluster
;
UINT32
i
,
g
;
HRESULT
hr
=
S_OK
;
UINT16
script
;
TRACE
(
"(%s:%u %p %d %d %p %s %p %p %p %u %u %p %p %p %p %p)
\n
"
,
debugstr_wn
(
text
,
length
),
length
,
fontface
,
is_sideways
,
is_rtl
,
analysis
,
debugstr_w
(
locale
),
substitution
,
features
,
feature_range_len
,
feature_ranges
,
max_glyph_count
,
clustermap
,
text_props
,
glyph_indices
,
glyph_props
,
actual_glyph_count
);
return
E_NOTIMPL
;
script
=
analysis
->
script
>
Script_LastId
?
Script_Unknown
:
analysis
->
script
;
if
(
max_glyph_count
<
length
)
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
if
(
substitution
)
FIXME
(
"number substitution is not supported.
\n
"
);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
/* FIXME: set to better values */
glyph_props
[
i
].
justification
=
text
[
i
]
==
' '
?
SCRIPT_JUSTIFY_BLANK
:
SCRIPT_JUSTIFY_CHARACTER
;
glyph_props
[
i
].
isClusterStart
=
1
;
glyph_props
[
i
].
isDiacritic
=
0
;
glyph_props
[
i
].
isZeroWidthSpace
=
0
;
glyph_props
[
i
].
reserved
=
0
;
/* FIXME: have the shaping engine set this */
text_props
[
i
].
isShapedAlone
=
0
;
text_props
[
i
].
reserved
=
0
;
clustermap
[
i
]
=
i
;
}
for
(;
i
<
max_glyph_count
;
i
++
)
{
glyph_props
[
i
].
justification
=
SCRIPT_JUSTIFY_NONE
;
glyph_props
[
i
].
isClusterStart
=
0
;
glyph_props
[
i
].
isDiacritic
=
0
;
glyph_props
[
i
].
isZeroWidthSpace
=
0
;
glyph_props
[
i
].
reserved
=
0
;
}
string
=
heap_alloc
(
sizeof
(
WCHAR
)
*
length
);
if
(
!
string
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
,
g
=
0
,
update_cluster
=
FALSE
;
i
<
length
;
i
++
)
{
UINT32
codepoint
;
if
(
!
update_cluster
)
{
codepoint
=
decode_surrogate_pair
(
text
,
i
,
length
);
if
(
!
codepoint
)
{
/* FIXME: mirror in RTL case */
codepoint
=
text
[
i
];
string
[
i
]
=
codepoint
;
}
else
{
string
[
i
]
=
text
[
i
];
string
[
i
+
1
]
=
text
[
i
+
1
];
update_cluster
=
TRUE
;
}
hr
=
IDWriteFontFace_GetGlyphIndices
(
fontface
,
&
codepoint
,
1
,
&
glyph_indices
[
g
]);
if
(
FAILED
(
hr
))
goto
done
;
g
++
;
}
else
{
INT32
k
;
update_cluster
=
FALSE
;
/* mark surrogate halves with same cluster */
clustermap
[
i
]
=
clustermap
[
i
-
1
];
/* update following clusters */
for
(
k
=
i
+
1
;
k
>=
0
&&
k
<
length
;
k
++
)
clustermap
[
k
]
--
;
}
}
*
actual_glyph_count
=
g
;
scriptprops
=
&
dwritescripts_properties
[
script
];
if
(
scriptprops
->
ops
&&
scriptprops
->
ops
->
contextual_shaping
)
{
hr
=
scriptprops
->
ops
->
contextual_shaping
(
fontface
,
is_rtl
,
string
,
length
,
max_glyph_count
,
clustermap
,
glyph_indices
,
actual_glyph_count
);
if
(
FAILED
(
hr
))
goto
done
;
}
/* FIXME: apply default features */
if
(
scriptprops
->
ops
&&
scriptprops
->
ops
->
set_text_glyphs_props
)
hr
=
scriptprops
->
ops
->
set_text_glyphs_props
(
fontface
,
string
,
length
,
clustermap
,
glyph_indices
,
*
actual_glyph_count
,
text_props
,
glyph_props
);
else
hr
=
default_shaping_ops
.
set_text_glyphs_props
(
fontface
,
string
,
length
,
clustermap
,
glyph_indices
,
*
actual_glyph_count
,
text_props
,
glyph_props
);
done:
heap_free
(
string
);
return
hr
;
}
static
HRESULT
WINAPI
dwritetextanalyzer_GetGlyphPlacements
(
IDWriteTextAnalyzer2
*
iface
,
...
...
dlls/dwrite/dwrite_private.h
View file @
1843972e
...
...
@@ -112,3 +112,35 @@ extern VOID OpenType_CMAP_GetGlyphIndex(LPVOID data, DWORD utf32c, LPWORD pgi, D
extern
VOID
get_font_properties
(
LPCVOID
os2
,
LPCVOID
head
,
LPCVOID
post
,
DWRITE_FONT_METRICS
*
metrics
,
DWRITE_FONT_STRETCH
*
stretch
,
DWRITE_FONT_WEIGHT
*
weight
,
DWRITE_FONT_STYLE
*
style
)
DECLSPEC_HIDDEN
;
extern
HRESULT
bidi_computelevels
(
const
WCHAR
*
,
UINT32
,
UINT8
,
UINT8
*
,
UINT8
*
);
/* Glyph shaping */
enum
SCRIPT_JUSTIFY
{
SCRIPT_JUSTIFY_NONE
,
SCRIPT_JUSTIFY_ARABIC_BLANK
,
SCRIPT_JUSTIFY_CHARACTER
,
SCRIPT_JUSTIFY_RESERVED1
,
SCRIPT_JUSTIFY_BLANK
,
SCRIPT_JUSTIFY_RESERVED2
,
SCRIPT_JUSTIFY_RESERVED3
,
SCRIPT_JUSTIFY_ARABIC_NORMAL
,
SCRIPT_JUSTIFY_ARABIC_KASHIDA
,
SCRIPT_JUSTIFY_ARABIC_ALEF
,
SCRIPT_JUSTIFY_ARABIC_HA
,
SCRIPT_JUSTIFY_ARABIC_RA
,
SCRIPT_JUSTIFY_ARABIC_BA
,
SCRIPT_JUSTIFY_ARABIC_BARA
,
SCRIPT_JUSTIFY_ARABIC_SEEN
,
SCRIPT_JUSTIFY_ARABIC_SEEN_M
};
struct
scriptshaping_ops
{
HRESULT
(
*
contextual_shaping
)(
IDWriteFontFace
*
fontface
,
BOOL
is_rtl
,
const
WCHAR
*
text
,
UINT32
len
,
UINT32
max_glyph_count
,
UINT16
*
clustermap
,
UINT16
*
glyph_indices
,
UINT32
*
actual_glyph_count
);
HRESULT
(
*
set_text_glyphs_props
)(
IDWriteFontFace
*
fontface
,
const
WCHAR
*
text
,
UINT32
len
,
UINT16
*
clustermap
,
UINT16
*
glyph_indices
,
UINT32
glyphcount
,
DWRITE_SHAPING_TEXT_PROPERTIES
*
text_props
,
DWRITE_SHAPING_GLYPH_PROPERTIES
*
glyph_props
);
};
extern
const
struct
scriptshaping_ops
default_shaping_ops
DECLSPEC_HIDDEN
;
extern
const
struct
scriptshaping_ops
latn_shaping_ops
DECLSPEC_HIDDEN
;
dlls/dwrite/shape.c
0 → 100644
View file @
1843972e
/*
* Glyph shaping support
*
* Copyright 2010 Aric Stewart for CodeWeavers
* Copyright 2014 Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "dwrite.h"
#include "dwrite_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dwrite
);
static
void
shape_update_clusters_from_glyphprop
(
UINT32
glyphcount
,
UINT32
text_len
,
UINT16
*
clustermap
,
DWRITE_SHAPING_GLYPH_PROPERTIES
*
glyph_props
)
{
UINT32
i
;
for
(
i
=
0
;
i
<
glyphcount
;
i
++
)
{
if
(
!
glyph_props
[
i
].
isClusterStart
)
{
UINT32
j
;
for
(
j
=
0
;
j
<
text_len
;
j
++
)
{
if
(
clustermap
[
j
]
==
i
)
{
int
k
=
j
;
while
(
k
>=
0
&&
k
<
text_len
&&
!
glyph_props
[
clustermap
[
k
]].
isClusterStart
)
k
--
;
if
(
k
>=
0
&&
k
<
text_len
&&
glyph_props
[
clustermap
[
k
]].
isClusterStart
)
clustermap
[
j
]
=
clustermap
[
k
];
}
}
}
}
}
static
int
compare_clustersearch
(
const
void
*
a
,
const
void
*
b
)
{
UINT16
target
=
*
(
UINT16
*
)
a
;
UINT16
index
=
*
(
UINT16
*
)
b
;
int
ret
=
0
;
if
(
target
>
index
)
ret
=
1
;
else
if
(
target
<
index
)
ret
=
-
1
;
return
ret
;
}
/* Maps given glyph position in glyph indices array to text index this glyph represents.
Lowest possible index is returned.
clustermap [I] Text index to index in glyph indices array map
len [I] Clustermap size
target [I] Index in glyph indices array to map
*/
static
INT32
map_glyph_to_text_pos
(
const
UINT16
*
clustermap
,
UINT32
len
,
UINT16
target
)
{
UINT16
*
ptr
;
INT32
k
;
ptr
=
bsearch
(
&
target
,
clustermap
,
len
,
sizeof
(
UINT16
),
compare_clustersearch
);
if
(
!
ptr
)
return
-
1
;
/* get to the beginning */
for
(
k
=
(
ptr
-
clustermap
)
-
1
;
k
>=
0
&&
clustermap
[
k
]
==
target
;
k
--
)
;
k
++
;
return
k
;
}
static
HRESULT
default_set_text_glyphs_props
(
IDWriteFontFace
*
fontface
,
const
WCHAR
*
text
,
UINT32
len
,
UINT16
*
clustermap
,
UINT16
*
glyph_indices
,
UINT32
glyphcount
,
DWRITE_SHAPING_TEXT_PROPERTIES
*
text_props
,
DWRITE_SHAPING_GLYPH_PROPERTIES
*
glyph_props
)
{
UINT32
i
;
for
(
i
=
0
;
i
<
glyphcount
;
i
++
)
{
UINT32
char_index
[
20
];
UINT32
char_count
=
0
;
INT32
k
;
k
=
map_glyph_to_text_pos
(
clustermap
,
len
,
i
);
if
(
k
>=
0
)
{
for
(;
k
<
len
&&
clustermap
[
k
]
==
i
;
k
++
)
char_index
[
char_count
++
]
=
k
;
}
if
(
char_count
==
0
)
continue
;
if
(
char_count
==
1
&&
isspaceW
(
text
[
char_index
[
0
]]))
{
glyph_props
[
i
].
justification
=
SCRIPT_JUSTIFY_BLANK
;
text_props
[
char_index
[
0
]].
isShapedAlone
=
text
[
char_index
[
0
]]
==
' '
;
}
else
glyph_props
[
i
].
justification
=
SCRIPT_JUSTIFY_CHARACTER
;
}
/* FIXME: update properties using GDEF table */
shape_update_clusters_from_glyphprop
(
glyphcount
,
len
,
clustermap
,
glyph_props
);
return
S_OK
;
}
static
HRESULT
latn_set_text_glyphs_props
(
IDWriteFontFace
*
fontface
,
const
WCHAR
*
text
,
UINT32
len
,
UINT16
*
clustermap
,
UINT16
*
glyph_indices
,
UINT32
glyphcount
,
DWRITE_SHAPING_TEXT_PROPERTIES
*
text_props
,
DWRITE_SHAPING_GLYPH_PROPERTIES
*
glyph_props
)
{
HRESULT
hr
;
UINT32
i
;
hr
=
default_set_text_glyphs_props
(
fontface
,
text
,
len
,
clustermap
,
glyph_indices
,
glyphcount
,
text_props
,
glyph_props
);
for
(
i
=
0
;
i
<
glyphcount
;
i
++
)
if
(
glyph_props
[
i
].
isZeroWidthSpace
)
glyph_props
[
i
].
justification
=
SCRIPT_JUSTIFY_NONE
;
return
hr
;
}
const
struct
scriptshaping_ops
latn_shaping_ops
=
{
NULL
,
latn_set_text_glyphs_props
};
const
struct
scriptshaping_ops
default_shaping_ops
=
{
NULL
,
default_set_text_glyphs_props
};
dlls/dwrite/tests/analyzer.c
View file @
1843972e
...
...
@@ -392,6 +392,37 @@ static IDWriteTextAnalysisSourceVtbl analysissourcevtbl = {
static
IDWriteTextAnalysisSource
analysissource
=
{
&
analysissourcevtbl
};
static
IDWriteFontFace
*
create_fontface
(
void
)
{
static
const
WCHAR
tahomaW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
0
};
IDWriteGdiInterop
*
interop
;
IDWriteFontFace
*
fontface
;
IDWriteFont
*
font
;
LOGFONTW
logfont
;
HRESULT
hr
;
hr
=
IDWriteFactory_GetGdiInterop
(
factory
,
&
interop
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
1
;
lstrcpyW
(
logfont
.
lfFaceName
,
tahomaW
);
hr
=
IDWriteGdiInterop_CreateFontFromLOGFONT
(
interop
,
&
logfont
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFont_Release
(
font
);
IDWriteGdiInterop_Release
(
interop
);
return
fontface
;
}
struct
sa_test
{
const
WCHAR
string
[
50
];
int
item_count
;
...
...
@@ -966,15 +997,11 @@ static const struct textcomplexity_test textcomplexity_tests[] = {
static
void
test_GetTextComplexity
(
void
)
{
static
const
WCHAR
tahomaW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
0
};
static
const
WCHAR
textW
[]
=
{
'A'
,
'B'
,
'C'
,
0
};
IDWriteTextAnalyzer1
*
analyzer1
;
IDWriteTextAnalyzer
*
analyzer
;
IDWriteGdiInterop
*
interop
;
IDWriteFontFace
*
fontface
;
UINT16
indices
[
10
];
IDWriteFont
*
font
;
LOGFONTW
logfont
;
BOOL
simple
;
HRESULT
hr
;
UINT32
len
;
...
...
@@ -1014,22 +1041,7 @@ if (0) { /* crashes on native */
ok
(
simple
==
FALSE
,
"got %d
\n
"
,
simple
);
ok
(
indices
[
0
]
==
1
,
"got %d
\n
"
,
indices
[
0
]);
/* so font face is required, create one */
hr
=
IDWriteFactory_GetGdiInterop
(
factory
,
&
interop
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
1
;
lstrcpyW
(
logfont
.
lfFaceName
,
tahomaW
);
hr
=
IDWriteGdiInterop_CreateFontFromLOGFONT
(
interop
,
&
logfont
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
fontface
=
create_fontface
();
for
(
i
=
0
;
i
<
sizeof
(
textcomplexity_tests
)
/
sizeof
(
struct
textcomplexity_test
);
i
++
)
{
const
struct
textcomplexity_test
*
ptr
=
&
textcomplexity_tests
[
i
];
...
...
@@ -1046,9 +1058,7 @@ if (0) { /* crashes on native */
ok
(
indices
[
0
]
==
0
,
"%d: got %d
\n
"
,
i
,
indices
[
0
]);
}
IDWriteFont_Release
(
font
);
IDWriteFontFace_Release
(
fontface
);
IDWriteGdiInterop_Release
(
interop
);
IDWriteTextAnalyzer1_Release
(
analyzer1
);
}
...
...
@@ -1086,6 +1096,63 @@ static void test_numbersubstitution(void)
IDWriteNumberSubstitution_Release
(
substitution
);
}
static
void
test_GetGlyphs
(
void
)
{
static
const
WCHAR
test1W
[]
=
{
'<'
,
'B'
,
' '
,
'C'
,
0
};
static
const
WCHAR
test2W
[]
=
{
'<'
,
'B'
,
'\t'
,
'C'
,
0
};
DWRITE_SHAPING_GLYPH_PROPERTIES
shapingprops
[
20
];
DWRITE_SHAPING_TEXT_PROPERTIES
props
[
20
];
UINT32
maxglyphcount
,
actual_count
;
IDWriteTextAnalyzer
*
analyzer
;
IDWriteFontFace
*
fontface
;
DWRITE_SCRIPT_ANALYSIS
sa
;
UINT16
clustermap
[
10
];
UINT16
glyphs1
[
10
];
UINT16
glyphs2
[
10
];
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTextAnalyzer
(
factory
,
&
analyzer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
fontface
=
create_fontface
();
maxglyphcount
=
1
;
sa
.
script
=
0
;
sa
.
shapes
=
DWRITE_SCRIPT_SHAPES_DEFAULT
;
hr
=
IDWriteTextAnalyzer_GetGlyphs
(
analyzer
,
test1W
,
lstrlenW
(
test1W
),
fontface
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
maxglyphcount
,
clustermap
,
props
,
glyphs1
,
shapingprops
,
&
actual_count
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
"got 0x%08x
\n
"
,
hr
);
/* invalid script id */
maxglyphcount
=
10
;
actual_count
=
0
;
sa
.
script
=
999
;
sa
.
shapes
=
DWRITE_SCRIPT_SHAPES_DEFAULT
;
hr
=
IDWriteTextAnalyzer_GetGlyphs
(
analyzer
,
test1W
,
lstrlenW
(
test1W
),
fontface
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
maxglyphcount
,
clustermap
,
props
,
glyphs1
,
shapingprops
,
&
actual_count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
actual_count
==
4
,
"got %d
\n
"
,
actual_count
);
ok
(
sa
.
script
==
999
,
"got %u
\n
"
,
sa
.
script
);
/* no '\t' -> ' ' replacement */
maxglyphcount
=
10
;
actual_count
=
0
;
hr
=
IDWriteTextAnalyzer_GetGlyphs
(
analyzer
,
test1W
,
lstrlenW
(
test1W
),
fontface
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
maxglyphcount
,
clustermap
,
props
,
glyphs1
,
shapingprops
,
&
actual_count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
actual_count
==
4
,
"got %d
\n
"
,
actual_count
);
actual_count
=
0
;
hr
=
IDWriteTextAnalyzer_GetGlyphs
(
analyzer
,
test2W
,
lstrlenW
(
test2W
),
fontface
,
FALSE
,
FALSE
,
&
sa
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
maxglyphcount
,
clustermap
,
props
,
glyphs2
,
shapingprops
,
&
actual_count
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
actual_count
==
4
,
"got %d
\n
"
,
actual_count
);
ok
(
glyphs1
[
2
]
!=
glyphs2
[
2
],
"got %d
\n
"
,
glyphs1
[
2
]);
IDWriteTextAnalyzer_Release
(
analyzer
);
IDWriteFontFace_Release
(
fontface
);
}
START_TEST
(
analyzer
)
{
HRESULT
hr
;
...
...
@@ -1105,6 +1172,7 @@ START_TEST(analyzer)
test_AnalyzeLineBreakpoints
();
test_GetScriptProperties
();
test_GetTextComplexity
();
test_GetGlyphs
();
test_numbersubstitution
();
IDWriteFactory_Release
(
factory
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment