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
c76af0d3
Commit
c76af0d3
authored
Apr 05, 2006
by
Huw Davies
Committed by
Alexandre Julliard
Apr 05, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move a few functions around. Should be a nop.
parent
152541b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
205 additions
and
204 deletions
+205
-204
freetype.c
dlls/gdi/freetype.c
+205
-204
No files found.
dlls/gdi/freetype.c
View file @
c76af0d3
...
@@ -440,6 +440,211 @@ static inline FT_Fixed FT_FixedFromFIXED(FIXED f)
...
@@ -440,6 +440,211 @@ static inline FT_Fixed FT_FixedFromFIXED(FIXED f)
return
(
FT_Fixed
)((
long
)
f
.
value
<<
16
|
(
unsigned
long
)
f
.
fract
);
return
(
FT_Fixed
)((
long
)
f
.
value
<<
16
|
(
unsigned
long
)
f
.
fract
);
}
}
static
Face
*
find_face_from_filename
(
const
WCHAR
*
name
)
{
Family
*
family
;
Face
*
face
;
char
*
file
;
DWORD
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
name
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
char
*
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
Face
*
ret
=
NULL
;
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
name
,
-
1
,
nameA
,
len
,
NULL
,
NULL
);
TRACE
(
"looking for %s
\n
"
,
debugstr_a
(
nameA
));
LIST_FOR_EACH_ENTRY
(
family
,
&
font_list
,
Family
,
entry
)
{
LIST_FOR_EACH_ENTRY
(
face
,
&
family
->
faces
,
Face
,
entry
)
{
file
=
strrchr
(
face
->
file
,
'/'
);
if
(
!
file
)
file
=
face
->
file
;
else
file
++
;
if
(
!
strcmp
(
file
,
nameA
))
ret
=
face
;
break
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
return
ret
;
}
static
Family
*
find_family_from_name
(
const
WCHAR
*
name
)
{
Family
*
family
;
LIST_FOR_EACH_ENTRY
(
family
,
&
font_list
,
Family
,
entry
)
{
if
(
!
strcmpiW
(
family
->
FamilyName
,
name
))
return
family
;
}
return
NULL
;
}
static
void
DumpSubstList
(
void
)
{
FontSubst
*
psub
;
LIST_FOR_EACH_ENTRY
(
psub
,
&
font_subst_list
,
FontSubst
,
entry
)
{
if
(
psub
->
from
.
charset
!=
-
1
||
psub
->
to
.
charset
!=
-
1
)
TRACE
(
"%s:%d -> %s:%d
\n
"
,
debugstr_w
(
psub
->
from
.
name
),
psub
->
from
.
charset
,
debugstr_w
(
psub
->
to
.
name
),
psub
->
to
.
charset
);
else
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
psub
->
from
.
name
),
debugstr_w
(
psub
->
to
.
name
));
}
return
;
}
static
LPWSTR
strdupW
(
LPCWSTR
p
)
{
LPWSTR
ret
;
DWORD
len
=
(
strlenW
(
p
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
memcpy
(
ret
,
p
,
len
);
return
ret
;
}
static
LPSTR
strdupA
(
LPCSTR
p
)
{
LPSTR
ret
;
DWORD
len
=
(
strlen
(
p
)
+
1
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
memcpy
(
ret
,
p
,
len
);
return
ret
;
}
static
FontSubst
*
get_font_subst
(
const
struct
list
*
subst_list
,
const
WCHAR
*
from_name
,
INT
from_charset
)
{
FontSubst
*
element
;
LIST_FOR_EACH_ENTRY
(
element
,
subst_list
,
FontSubst
,
entry
)
{
if
(
!
strcmpiW
(
element
->
from
.
name
,
from_name
)
&&
(
element
->
from
.
charset
==
from_charset
||
element
->
from
.
charset
==
-
1
))
return
element
;
}
return
NULL
;
}
#define ADD_FONT_SUBST_FORCE 1
static
BOOL
add_font_subst
(
struct
list
*
subst_list
,
FontSubst
*
subst
,
INT
flags
)
{
FontSubst
*
from_exist
,
*
to_exist
;
from_exist
=
get_font_subst
(
subst_list
,
subst
->
from
.
name
,
subst
->
from
.
charset
);
if
(
from_exist
&&
(
flags
&
ADD_FONT_SUBST_FORCE
))
{
list_remove
(
&
from_exist
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
&
from_exist
->
from
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
&
from_exist
->
to
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
from_exist
);
from_exist
=
NULL
;
}
if
(
!
from_exist
)
{
to_exist
=
get_font_subst
(
subst_list
,
subst
->
to
.
name
,
subst
->
to
.
charset
);
if
(
to_exist
)
{
HeapFree
(
GetProcessHeap
(),
0
,
subst
->
to
.
name
);
subst
->
to
.
name
=
strdupW
(
to_exist
->
to
.
name
);
}
list_add_tail
(
subst_list
,
&
subst
->
entry
);
return
TRUE
;
}
return
FALSE
;
}
static
void
split_subst_info
(
NameCs
*
nc
,
LPSTR
str
)
{
CHAR
*
p
=
strrchr
(
str
,
','
);
DWORD
len
;
nc
->
charset
=
-
1
;
if
(
p
&&
*
(
p
+
1
))
{
nc
->
charset
=
strtol
(
p
+
1
,
NULL
,
10
);
*
p
=
'\0'
;
}
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
nc
->
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
nc
->
name
,
len
);
}
static
void
LoadSubstList
(
void
)
{
FontSubst
*
psub
;
HKEY
hkey
;
DWORD
valuelen
,
datalen
,
i
=
0
,
type
,
dlen
,
vlen
;
LPSTR
value
;
LPVOID
data
;
if
(
!
list_empty
(
&
font_subst_list
))
{
FontSubst
*
cursor2
;
LIST_FOR_EACH_ENTRY_SAFE
(
psub
,
cursor2
,
&
font_subst_list
,
FontSubst
,
entry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
to
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
from
.
name
);
list_remove
(
&
psub
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
);
}
}
if
(
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
FontSubstitutes"
,
&
hkey
)
==
ERROR_SUCCESS
)
{
RegQueryInfoKeyA
(
hkey
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
valuelen
,
&
datalen
,
NULL
,
NULL
);
valuelen
++
;
/* returned value doesn't include room for '\0' */
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
valuelen
*
sizeof
(
CHAR
));
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datalen
);
dlen
=
datalen
;
vlen
=
valuelen
;
while
(
RegEnumValueA
(
hkey
,
i
++
,
value
,
&
vlen
,
NULL
,
&
type
,
data
,
&
dlen
)
==
ERROR_SUCCESS
)
{
TRACE
(
"Got %s=%s
\n
"
,
debugstr_a
(
value
),
debugstr_a
(
data
));
psub
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
psub
));
split_subst_info
(
&
psub
->
from
,
value
);
split_subst_info
(
&
psub
->
to
,
data
);
/* Win 2000 doesn't allow mapping between different charsets
or mapping of DEFAULT_CHARSET */
if
((
psub
->
to
.
charset
!=
psub
->
from
.
charset
)
||
psub
->
to
.
charset
==
DEFAULT_CHARSET
)
{
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
to
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
from
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
);
}
else
{
add_font_subst
(
&
font_subst_list
,
psub
,
0
);
}
/* reset dlen and vlen */
dlen
=
datalen
;
vlen
=
valuelen
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
value
);
RegCloseKey
(
hkey
);
}
}
#define ADDFONT_EXTERNAL_FONT 0x01
#define ADDFONT_EXTERNAL_FONT 0x01
#define ADDFONT_FORCE_BITMAP 0x02
#define ADDFONT_FORCE_BITMAP 0x02
static
BOOL
AddFontFileToList
(
const
char
*
file
,
char
*
fake_family
,
DWORD
flags
)
static
BOOL
AddFontFileToList
(
const
char
*
file
,
char
*
fake_family
,
DWORD
flags
)
...
@@ -677,210 +882,6 @@ static void DumpFontList(void)
...
@@ -677,210 +882,6 @@ static void DumpFontList(void)
return
;
return
;
}
}
static
Face
*
find_face_from_filename
(
const
WCHAR
*
name
)
{
Family
*
family
;
Face
*
face
;
char
*
file
;
DWORD
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
name
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
char
*
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
Face
*
ret
=
NULL
;
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
name
,
-
1
,
nameA
,
len
,
NULL
,
NULL
);
TRACE
(
"looking for %s
\n
"
,
debugstr_a
(
nameA
));
LIST_FOR_EACH_ENTRY
(
family
,
&
font_list
,
Family
,
entry
)
{
LIST_FOR_EACH_ENTRY
(
face
,
&
family
->
faces
,
Face
,
entry
)
{
file
=
strrchr
(
face
->
file
,
'/'
);
if
(
!
file
)
file
=
face
->
file
;
else
file
++
;
if
(
!
strcmp
(
file
,
nameA
))
ret
=
face
;
break
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
return
ret
;
}
static
Family
*
find_family_from_name
(
const
WCHAR
*
name
)
{
Family
*
family
;
LIST_FOR_EACH_ENTRY
(
family
,
&
font_list
,
Family
,
entry
)
{
if
(
!
strcmpiW
(
family
->
FamilyName
,
name
))
return
family
;
}
return
NULL
;
}
static
void
DumpSubstList
(
void
)
{
FontSubst
*
psub
;
LIST_FOR_EACH_ENTRY
(
psub
,
&
font_subst_list
,
FontSubst
,
entry
)
{
if
(
psub
->
from
.
charset
!=
-
1
||
psub
->
to
.
charset
!=
-
1
)
TRACE
(
"%s:%d -> %s:%d
\n
"
,
debugstr_w
(
psub
->
from
.
name
),
psub
->
from
.
charset
,
debugstr_w
(
psub
->
to
.
name
),
psub
->
to
.
charset
);
else
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
psub
->
from
.
name
),
debugstr_w
(
psub
->
to
.
name
));
}
return
;
}
static
LPWSTR
strdupW
(
LPCWSTR
p
)
{
LPWSTR
ret
;
DWORD
len
=
(
strlenW
(
p
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
memcpy
(
ret
,
p
,
len
);
return
ret
;
}
static
LPSTR
strdupA
(
LPCSTR
p
)
{
LPSTR
ret
;
DWORD
len
=
(
strlen
(
p
)
+
1
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
memcpy
(
ret
,
p
,
len
);
return
ret
;
}
static
FontSubst
*
get_font_subst
(
const
struct
list
*
subst_list
,
const
WCHAR
*
from_name
,
INT
from_charset
)
{
FontSubst
*
element
;
LIST_FOR_EACH_ENTRY
(
element
,
subst_list
,
FontSubst
,
entry
)
{
if
(
!
strcmpiW
(
element
->
from
.
name
,
from_name
)
&&
(
element
->
from
.
charset
==
from_charset
||
element
->
from
.
charset
==
-
1
))
return
element
;
}
return
NULL
;
}
#define ADD_FONT_SUBST_FORCE 1
static
BOOL
add_font_subst
(
struct
list
*
subst_list
,
FontSubst
*
subst
,
INT
flags
)
{
FontSubst
*
from_exist
,
*
to_exist
;
from_exist
=
get_font_subst
(
subst_list
,
subst
->
from
.
name
,
subst
->
from
.
charset
);
if
(
from_exist
&&
(
flags
&
ADD_FONT_SUBST_FORCE
))
{
list_remove
(
&
from_exist
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
&
from_exist
->
from
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
&
from_exist
->
to
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
from_exist
);
from_exist
=
NULL
;
}
if
(
!
from_exist
)
{
to_exist
=
get_font_subst
(
subst_list
,
subst
->
to
.
name
,
subst
->
to
.
charset
);
if
(
to_exist
)
{
HeapFree
(
GetProcessHeap
(),
0
,
subst
->
to
.
name
);
subst
->
to
.
name
=
strdupW
(
to_exist
->
to
.
name
);
}
list_add_tail
(
subst_list
,
&
subst
->
entry
);
return
TRUE
;
}
return
FALSE
;
}
static
void
split_subst_info
(
NameCs
*
nc
,
LPSTR
str
)
{
CHAR
*
p
=
strrchr
(
str
,
','
);
DWORD
len
;
nc
->
charset
=
-
1
;
if
(
p
&&
*
(
p
+
1
))
{
nc
->
charset
=
strtol
(
p
+
1
,
NULL
,
10
);
*
p
=
'\0'
;
}
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
nc
->
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
nc
->
name
,
len
);
}
static
void
LoadSubstList
(
void
)
{
FontSubst
*
psub
;
HKEY
hkey
;
DWORD
valuelen
,
datalen
,
i
=
0
,
type
,
dlen
,
vlen
;
LPSTR
value
;
LPVOID
data
;
if
(
!
list_empty
(
&
font_subst_list
))
{
FontSubst
*
cursor2
;
LIST_FOR_EACH_ENTRY_SAFE
(
psub
,
cursor2
,
&
font_subst_list
,
FontSubst
,
entry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
to
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
from
.
name
);
list_remove
(
&
psub
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
);
}
}
if
(
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
FontSubstitutes"
,
&
hkey
)
==
ERROR_SUCCESS
)
{
RegQueryInfoKeyA
(
hkey
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
valuelen
,
&
datalen
,
NULL
,
NULL
);
valuelen
++
;
/* returned value doesn't include room for '\0' */
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
valuelen
*
sizeof
(
CHAR
));
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datalen
);
dlen
=
datalen
;
vlen
=
valuelen
;
while
(
RegEnumValueA
(
hkey
,
i
++
,
value
,
&
vlen
,
NULL
,
&
type
,
data
,
&
dlen
)
==
ERROR_SUCCESS
)
{
TRACE
(
"Got %s=%s
\n
"
,
debugstr_a
(
value
),
debugstr_a
(
data
));
psub
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
psub
));
split_subst_info
(
&
psub
->
from
,
value
);
split_subst_info
(
&
psub
->
to
,
data
);
/* Win 2000 doesn't allow mapping between different charsets
or mapping of DEFAULT_CHARSET */
if
((
psub
->
to
.
charset
!=
psub
->
from
.
charset
)
||
psub
->
to
.
charset
==
DEFAULT_CHARSET
)
{
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
to
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
->
from
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
psub
);
}
else
{
add_font_subst
(
&
font_subst_list
,
psub
,
0
);
}
/* reset dlen and vlen */
dlen
=
datalen
;
vlen
=
valuelen
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
value
);
RegCloseKey
(
hkey
);
}
}
/***********************************************************
/***********************************************************
* The replacement list is a way to map an entire font
* The replacement list is a way to map an entire font
* family onto another family. For example adding
* family onto another family. For example adding
...
...
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