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
5d3eaf57
Commit
5d3eaf57
authored
Sep 04, 2014
by
Aric Stewart
Committed by
Alexandre Julliard
Sep 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Shift to using localized string for family name.
parent
1d6147ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
17 deletions
+59
-17
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+27
-17
main.c
dlls/dwrite/main.c
+31
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
5d3eaf57
...
@@ -91,6 +91,7 @@ extern HRESULT create_trimmingsign(IDWriteInlineObject**) DECLSPEC_HIDDEN;
...
@@ -91,6 +91,7 @@ extern HRESULT create_trimmingsign(IDWriteInlineObject**) DECLSPEC_HIDDEN;
extern
HRESULT
get_gdiinterop
(
IDWriteGdiInterop
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_gdiinterop
(
IDWriteGdiInterop
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
add_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
add_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_system_fontcollection
(
IDWriteFontCollection
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_system_fontcollection
(
IDWriteFontCollection
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_textanalyzer
(
IDWriteTextAnalyzer
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_textanalyzer
(
IDWriteTextAnalyzer
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_font_file
(
IDWriteFontFileLoader
*
loader
,
const
void
*
reference_key
,
UINT32
key_size
,
IDWriteFontFile
**
font_file
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_font_file
(
IDWriteFontFileLoader
*
loader
,
const
void
*
reference_key
,
UINT32
key_size
,
IDWriteFontFile
**
font_file
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
5d3eaf57
...
@@ -77,7 +77,7 @@ struct dwrite_fontfamily {
...
@@ -77,7 +77,7 @@ struct dwrite_fontfamily {
IDWriteFontCollection
*
collection
;
IDWriteFontCollection
*
collection
;
WCHAR
*
familyname
;
IDWriteLocalizedStrings
*
familyname
;
};
};
struct
dwrite_font
{
struct
dwrite_font
{
...
@@ -123,7 +123,7 @@ struct dwrite_fontfile {
...
@@ -123,7 +123,7 @@ struct dwrite_fontfile {
IDWriteFontFileStream
*
stream
;
IDWriteFontFileStream
*
stream
;
};
};
static
HRESULT
create_fontfamily
(
const
WCHAR
*
familyname
,
IDWriteFontFamily
**
family
);
static
HRESULT
create_fontfamily
(
IDWriteLocalizedStrings
*
familyname
,
IDWriteFontFamily
**
family
);
static
HRESULT
create_font_base
(
IDWriteFont
**
font
);
static
HRESULT
create_font_base
(
IDWriteFont
**
font
);
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
data
,
IDWriteFont
**
font
);
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
data
,
IDWriteFont
**
font
);
...
@@ -744,7 +744,7 @@ static ULONG WINAPI dwritefontfamily_Release(IDWriteFontFamily *iface)
...
@@ -744,7 +744,7 @@ static ULONG WINAPI dwritefontfamily_Release(IDWriteFontFamily *iface)
if
(
!
ref
)
if
(
!
ref
)
{
{
int
i
;
int
i
;
heap_fre
e
(
This
->
familyname
);
IDWriteLocalizedStrings_Releas
e
(
This
->
familyname
);
if
(
This
->
collection
)
if
(
This
->
collection
)
IDWriteFontCollection_Release
(
This
->
collection
);
IDWriteFontCollection_Release
(
This
->
collection
);
...
@@ -803,15 +803,7 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily *iface, UINT32
...
@@ -803,15 +803,7 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily *iface, UINT32
static
HRESULT
WINAPI
dwritefontfamily_GetFamilyNames
(
IDWriteFontFamily
*
iface
,
IDWriteLocalizedStrings
**
names
)
static
HRESULT
WINAPI
dwritefontfamily_GetFamilyNames
(
IDWriteFontFamily
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
};
return
clone_localizedstring
(
This
->
familyname
,
names
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
names
);
hr
=
create_localizedstrings
(
names
);
if
(
FAILED
(
hr
))
return
hr
;
return
add_localizedstring
(
*
names
,
enusW
,
This
->
familyname
);
}
}
static
HRESULT
WINAPI
dwritefontfamily_GetFirstMatchingFont
(
IDWriteFontFamily
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
static
HRESULT
WINAPI
dwritefontfamily_GetFirstMatchingFont
(
IDWriteFontFamily
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
...
@@ -828,7 +820,7 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily *i
...
@@ -828,7 +820,7 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily *i
memset
(
&
lf
,
0
,
sizeof
(
lf
));
memset
(
&
lf
,
0
,
sizeof
(
lf
));
lf
.
lfWeight
=
weight
;
lf
.
lfWeight
=
weight
;
lf
.
lfItalic
=
style
==
DWRITE_FONT_STYLE_ITALIC
;
lf
.
lfItalic
=
style
==
DWRITE_FONT_STYLE_ITALIC
;
strcpyW
(
lf
.
lfFaceName
,
This
->
familyname
);
IDWriteLocalizedStrings_GetString
(
This
->
familyname
,
0
,
lf
.
lfFaceName
,
LF_FACESIZE
);
return
create_font_from_logfont
(
&
lf
,
font
);
return
create_font_from_logfont
(
&
lf
,
font
);
}
}
...
@@ -929,6 +921,9 @@ static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollecti
...
@@ -929,6 +921,9 @@ static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollecti
static
HRESULT
WINAPI
dwritefontcollection_GetFontFamily
(
IDWriteFontCollection
*
iface
,
UINT32
index
,
IDWriteFontFamily
**
family
)
static
HRESULT
WINAPI
dwritefontcollection_GetFontFamily
(
IDWriteFontCollection
*
iface
,
UINT32
index
,
IDWriteFontFamily
**
family
)
{
{
struct
dwrite_fontcollection
*
This
=
impl_from_IDWriteFontCollection
(
iface
);
struct
dwrite_fontcollection
*
This
=
impl_from_IDWriteFontCollection
(
iface
);
HRESULT
hr
;
IDWriteLocalizedStrings
*
familyname
;
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
};
TRACE
(
"(%p)->(%u %p)
\n
"
,
This
,
index
,
family
);
TRACE
(
"(%p)->(%u %p)
\n
"
,
This
,
index
,
family
);
...
@@ -938,7 +933,12 @@ static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *
...
@@ -938,7 +933,12 @@ static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *
return
E_FAIL
;
return
E_FAIL
;
}
}
return
create_fontfamily
(
This
->
families
[
index
],
family
);
hr
=
create_localizedstrings
(
&
familyname
);
if
(
FAILED
(
hr
))
return
hr
;
add_localizedstring
(
familyname
,
enusW
,
This
->
families
[
index
]);
return
create_fontfamily
(
familyname
,
family
);
}
}
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
)
...
@@ -1035,7 +1035,7 @@ HRESULT get_system_fontcollection(IDWriteFontCollection **collection)
...
@@ -1035,7 +1035,7 @@ HRESULT get_system_fontcollection(IDWriteFontCollection **collection)
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
create_fontfamily
(
const
WCHAR
*
familyname
,
IDWriteFontFamily
**
family
)
static
HRESULT
create_fontfamily
(
IDWriteLocalizedStrings
*
familyname
,
IDWriteFontFamily
**
family
)
{
{
struct
dwrite_fontfamily
*
This
;
struct
dwrite_fontfamily
*
This
;
...
@@ -1050,7 +1050,7 @@ static HRESULT create_fontfamily(const WCHAR *familyname, IDWriteFontFamily **fa
...
@@ -1050,7 +1050,7 @@ static HRESULT create_fontfamily(const WCHAR *familyname, IDWriteFontFamily **fa
This
->
alloc
=
2
;
This
->
alloc
=
2
;
This
->
fonts
=
heap_alloc
(
sizeof
(
*
This
->
fonts
)
*
2
);
This
->
fonts
=
heap_alloc
(
sizeof
(
*
This
->
fonts
)
*
2
);
This
->
collection
=
NULL
;
This
->
collection
=
NULL
;
This
->
familyname
=
heap_strdupW
(
familyname
)
;
This
->
familyname
=
familyname
;
*
family
=
&
This
->
IDWriteFontFamily_iface
;
*
family
=
&
This
->
IDWriteFontFamily_iface
;
...
@@ -1098,6 +1098,7 @@ static HRESULT create_font_base(IDWriteFont **font)
...
@@ -1098,6 +1098,7 @@ static HRESULT create_font_base(IDWriteFont **font)
HRESULT
create_font_from_logfont
(
const
LOGFONTW
*
logfont
,
IDWriteFont
**
font
)
HRESULT
create_font_from_logfont
(
const
LOGFONTW
*
logfont
,
IDWriteFont
**
font
)
{
{
const
WCHAR
*
facename
,
*
familyname
;
const
WCHAR
*
facename
,
*
familyname
;
IDWriteLocalizedStrings
*
name
;
struct
dwrite_font
*
This
;
struct
dwrite_font
*
This
;
IDWriteFontFamily
*
family
;
IDWriteFontFamily
*
family
;
OUTLINETEXTMETRICW
*
otm
;
OUTLINETEXTMETRICW
*
otm
;
...
@@ -1105,6 +1106,7 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font)
...
@@ -1105,6 +1106,7 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font)
HFONT
hfont
;
HFONT
hfont
;
HDC
hdc
;
HDC
hdc
;
int
ret
;
int
ret
;
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
};
LPVOID
tt_os2
=
NULL
;
LPVOID
tt_os2
=
NULL
;
LPVOID
tt_head
=
NULL
;
LPVOID
tt_head
=
NULL
;
LPVOID
tt_post
=
NULL
;
LPVOID
tt_post
=
NULL
;
...
@@ -1174,7 +1176,15 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font)
...
@@ -1174,7 +1176,15 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font)
familyname
=
(
WCHAR
*
)((
char
*
)
otm
+
(
ptrdiff_t
)
otm
->
otmpFamilyName
);
familyname
=
(
WCHAR
*
)((
char
*
)
otm
+
(
ptrdiff_t
)
otm
->
otmpFamilyName
);
TRACE
(
"facename=%s, familyname=%s
\n
"
,
debugstr_w
(
facename
),
debugstr_w
(
familyname
));
TRACE
(
"facename=%s, familyname=%s
\n
"
,
debugstr_w
(
facename
),
debugstr_w
(
familyname
));
hr
=
create_fontfamily
(
familyname
,
&
family
);
hr
=
create_localizedstrings
(
&
name
);
if
(
FAILED
(
hr
))
{
heap_free
(
This
);
return
hr
;
}
add_localizedstring
(
name
,
enusW
,
familyname
);
hr
=
create_fontfamily
(
name
,
&
family
);
heap_free
(
otm
);
heap_free
(
otm
);
if
(
hr
!=
S_OK
)
if
(
hr
!=
S_OK
)
{
{
...
...
dlls/dwrite/main.c
View file @
5d3eaf57
...
@@ -355,6 +355,37 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
...
@@ -355,6 +355,37 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
return
S_OK
;
return
S_OK
;
}
}
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
{
struct
localizedstrings
*
This
=
impl_from_IDWriteLocalizedStrings
(
iface
);
struct
localizedstrings
*
New
;
int
i
;
*
strings
=
NULL
;
New
=
heap_alloc
(
sizeof
(
struct
localizedstrings
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
New
->
IDWriteLocalizedStrings_iface
.
lpVtbl
=
&
localizedstringsvtbl
;
New
->
ref
=
1
;
New
->
count
=
This
->
count
;
New
->
data
=
heap_alloc
(
sizeof
(
struct
localizedpair
)
*
New
->
count
);
if
(
!
New
->
data
)
{
heap_free
(
New
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
New
->
count
;
i
++
)
{
New
->
data
[
i
].
locale
=
heap_strdupW
(
This
->
data
[
i
].
locale
);
New
->
data
[
i
].
string
=
heap_strdupW
(
This
->
data
[
i
].
string
);
}
New
->
alloc
=
New
->
count
;
*
strings
=
&
New
->
IDWriteLocalizedStrings_iface
;
return
S_OK
;
}
struct
dwritefactory
{
struct
dwritefactory
{
IDWriteFactory
IDWriteFactory_iface
;
IDWriteFactory
IDWriteFactory_iface
;
LONG
ref
;
LONG
ref
;
...
...
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