Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
77189de8
Commit
77189de8
authored
Feb 04, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Simplify collection_find_family().
parent
008a2b46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
26 deletions
+17
-26
font.c
dlls/dwrite/font.c
+17
-26
No files found.
dlls/dwrite/font.c
View file @
77189de8
...
@@ -1424,40 +1424,33 @@ static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *
...
@@ -1424,40 +1424,33 @@ static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *
return
create_fontfamily
(
This
->
family_data
[
index
],
iface
,
family
);
return
create_fontfamily
(
This
->
family_data
[
index
],
iface
,
family
);
}
}
static
HRESULT
collection_find_family
(
struct
dwrite_fontcollection
*
collection
,
const
WCHAR
*
name
,
UINT32
*
index
,
BOOL
*
exists
)
static
UINT32
collection_find_family
(
struct
dwrite_fontcollection
*
collection
,
const
WCHAR
*
name
)
{
{
UINT32
i
;
UINT32
i
;
if
(
collection
->
family_count
)
{
for
(
i
=
0
;
i
<
collection
->
family_count
;
i
++
)
{
for
(
i
=
0
;
i
<
collection
->
family_count
;
i
++
)
{
IDWriteLocalizedStrings
*
family_name
=
collection
->
family_data
[
i
]
->
familyname
;
IDWriteLocalizedStrings
*
family_name
=
collection
->
family_data
[
i
]
->
familyname
;
HRESULT
hr
;
HRESULT
hr
;
int
j
;
int
j
;
for
(
j
=
0
;
j
<
IDWriteLocalizedStrings_GetCount
(
family_name
);
j
++
)
{
for
(
j
=
0
;
j
<
IDWriteLocalizedStrings_GetCount
(
family_name
);
j
++
)
{
WCHAR
buffer
[
255
];
WCHAR
buffer
[
255
];
hr
=
IDWriteLocalizedStrings_GetString
(
family_name
,
j
,
buffer
,
255
);
hr
=
IDWriteLocalizedStrings_GetString
(
family_name
,
j
,
buffer
,
255
);
if
(
SUCCEEDED
(
hr
)
&&
!
strcmpW
(
buffer
,
name
))
if
(
SUCCEEDED
(
hr
))
{
return
i
;
if
(
!
strcmpW
(
buffer
,
name
))
{
*
index
=
i
;
*
exists
=
TRUE
;
return
S_OK
;
}
}
}
}
}
*
index
=
(
UINT32
)
-
1
;
*
exists
=
FALSE
;
}
}
return
S_OK
;
return
~
0u
;
}
}
static
HRESULT
WINAPI
dwritefontcollection_FindFamilyName
(
IDWriteFontCollection
*
iface
,
const
WCHAR
*
name
,
UINT32
*
index
,
BOOL
*
exists
)
static
HRESULT
WINAPI
dwritefontcollection_FindFamilyName
(
IDWriteFontCollection
*
iface
,
const
WCHAR
*
name
,
UINT32
*
index
,
BOOL
*
exists
)
{
{
struct
dwrite_fontcollection
*
This
=
impl_from_IDWriteFontCollection
(
iface
);
struct
dwrite_fontcollection
*
This
=
impl_from_IDWriteFontCollection
(
iface
);
TRACE
(
"(%p)->(%s %p %p)
\n
"
,
This
,
debugstr_w
(
name
),
index
,
exists
);
TRACE
(
"(%p)->(%s %p %p)
\n
"
,
This
,
debugstr_w
(
name
),
index
,
exists
);
return
collection_find_family
(
This
,
name
,
index
,
exists
);
*
index
=
collection_find_family
(
This
,
name
);
*
exists
=
*
index
!=
~
0u
;
return
S_OK
;
}
}
static
BOOL
is_same_fontfile
(
IDWriteFontFile
*
left
,
IDWriteFontFile
*
right
)
static
BOOL
is_same_fontfile
(
IDWriteFontFile
*
left
,
IDWriteFontFile
*
right
)
...
@@ -1728,7 +1721,6 @@ HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerat
...
@@ -1728,7 +1721,6 @@ HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerat
IDWriteFontFileStream
*
stream
;
IDWriteFontFileStream
*
stream
;
WCHAR
buffer
[
255
];
WCHAR
buffer
[
255
];
UINT32
index
;
UINT32
index
;
BOOL
exists
;
/* alloc and init new font data structure */
/* alloc and init new font data structure */
font_data
=
heap_alloc_zero
(
sizeof
(
struct
dwrite_font_data
));
font_data
=
heap_alloc_zero
(
sizeof
(
struct
dwrite_font_data
));
...
@@ -1755,9 +1747,8 @@ HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerat
...
@@ -1755,9 +1747,8 @@ HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerat
buffer
[
0
]
=
0
;
buffer
[
0
]
=
0
;
IDWriteLocalizedStrings_GetString
(
family_name
,
0
,
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
));
IDWriteLocalizedStrings_GetString
(
family_name
,
0
,
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
));
exists
=
FALSE
;
index
=
collection_find_family
(
collection
,
buffer
);
hr
=
collection_find_family
(
collection
,
buffer
,
&
index
,
&
exists
);
if
(
index
!=
~
0u
)
if
(
exists
)
fontfamily_add_font
(
collection
->
family_data
[
index
],
font_data
);
fontfamily_add_font
(
collection
->
family_data
[
index
],
font_data
);
else
{
else
{
struct
dwrite_fontfamily_data
*
family_data
;
struct
dwrite_fontfamily_data
*
family_data
;
...
...
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