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
e31c51b6
Commit
e31c51b6
authored
Oct 20, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Implement GetFontData as a standard driver entry point.
parent
441d6cfc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
60 deletions
+59
-60
font.c
dlls/gdi32/font.c
+4
-4
freetype.c
dlls/gdi32/freetype.c
+55
-55
gdi_private.h
dlls/gdi32/gdi_private.h
+0
-1
No files found.
dlls/gdi32/font.c
View file @
e31c51b6
...
...
@@ -2759,13 +2759,13 @@ DWORD WINAPI GetFontData(HDC hdc, DWORD table, DWORD offset,
LPVOID
buffer
,
DWORD
length
)
{
DC
*
dc
=
get_dc_ptr
(
hdc
);
DWORD
ret
=
GDI_ERROR
;
PHYSDEV
dev
;
DWORD
ret
;
if
(
!
dc
)
return
GDI_ERROR
;
if
(
dc
->
gdiFont
)
ret
=
WineEngGetFontData
(
dc
->
gdiFont
,
table
,
offset
,
buffer
,
length
);
dev
=
GET_DC_PHYSDEV
(
dc
,
pGetFontData
);
ret
=
dev
->
funcs
->
pGetFontData
(
dev
,
table
,
offset
,
buffer
,
length
);
release_dc_ptr
(
dc
);
return
ret
;
}
...
...
dlls/gdi32/freetype.c
View file @
e31c51b6
...
...
@@ -3440,6 +3440,40 @@ static void free_font(GdiFont *font)
}
static
DWORD
get_font_data
(
GdiFont
*
font
,
DWORD
table
,
DWORD
offset
,
LPVOID
buf
,
DWORD
cbData
)
{
FT_Face
ft_face
=
font
->
ft_face
;
FT_ULong
len
;
FT_Error
err
;
if
(
!
FT_IS_SFNT
(
ft_face
))
return
GDI_ERROR
;
if
(
!
buf
)
len
=
0
;
else
len
=
cbData
;
table
=
RtlUlongByteSwap
(
table
);
/* MS tags differ in endianness from FT ones */
/* make sure value of len is the value freetype says it needs */
if
(
buf
&&
len
)
{
FT_ULong
needed
=
0
;
err
=
pFT_Load_Sfnt_Table
(
ft_face
,
table
,
offset
,
NULL
,
&
needed
);
if
(
!
err
&&
needed
<
len
)
len
=
needed
;
}
err
=
pFT_Load_Sfnt_Table
(
ft_face
,
table
,
offset
,
buf
,
&
len
);
if
(
err
)
{
TRACE
(
"Can't find table %c%c%c%c
\n
"
,
/* bytes were reversed */
HIBYTE
(
HIWORD
(
table
)),
LOBYTE
(
HIWORD
(
table
)),
HIBYTE
(
LOWORD
(
table
)),
LOBYTE
(
LOWORD
(
table
)));
return
GDI_ERROR
;
}
return
len
;
}
/*************************************************************
* load_VDMX
*
...
...
@@ -3477,7 +3511,7 @@ static LONG load_VDMX(GdiFont *font, LONG height)
LONG
ppem
=
0
;
int
i
;
result
=
WineEngGetFontD
ata
(
font
,
MS_VDMX_TAG
,
0
,
hdr
,
6
);
result
=
get_font_d
ata
(
font
,
MS_VDMX_TAG
,
0
,
hdr
,
6
);
if
(
result
==
GDI_ERROR
)
/* no vdmx table present, use linear scaling */
return
ppem
;
...
...
@@ -3494,7 +3528,7 @@ static LONG load_VDMX(GdiFont *font, LONG height)
Ratios
ratio
;
offset
=
(
3
*
2
)
+
(
i
*
sizeof
(
Ratios
));
WineEngGetFontD
ata
(
font
,
MS_VDMX_TAG
,
offset
,
&
ratio
,
sizeof
(
Ratios
));
get_font_d
ata
(
font
,
MS_VDMX_TAG
,
offset
,
&
ratio
,
sizeof
(
Ratios
));
offset
=
-
1
;
TRACE
(
"Ratios[%d] %d %d : %d -> %d
\n
"
,
i
,
ratio
.
bCharSet
,
ratio
.
xRatio
,
ratio
.
yStartRatio
,
ratio
.
yEndRatio
);
...
...
@@ -3507,7 +3541,7 @@ static LONG load_VDMX(GdiFont *font, LONG height)
devYRatio
<=
ratio
.
yEndRatio
))
{
offset
=
(
3
*
2
)
+
(
numRatios
*
4
)
+
(
i
*
2
);
WineEngGetFontD
ata
(
font
,
MS_VDMX_TAG
,
offset
,
&
tmp
,
2
);
get_font_d
ata
(
font
,
MS_VDMX_TAG
,
offset
,
&
tmp
,
2
);
offset
=
GET_BE_WORD
(
tmp
);
break
;
}
...
...
@@ -3518,7 +3552,7 @@ static LONG load_VDMX(GdiFont *font, LONG height)
return
ppem
;
}
if
(
WineEngGetFontD
ata
(
font
,
MS_VDMX_TAG
,
offset
,
&
group
,
4
)
!=
GDI_ERROR
)
{
if
(
get_font_d
ata
(
font
,
MS_VDMX_TAG
,
offset
,
&
group
,
4
)
!=
GDI_ERROR
)
{
USHORT
recs
;
BYTE
startsz
,
endsz
;
WORD
*
vTable
;
...
...
@@ -3530,7 +3564,7 @@ static LONG load_VDMX(GdiFont *font, LONG height)
TRACE
(
"recs=%d startsz=%d endsz=%d
\n
"
,
recs
,
startsz
,
endsz
);
vTable
=
HeapAlloc
(
GetProcessHeap
(),
0
,
recs
*
6
);
result
=
WineEngGetFontD
ata
(
font
,
MS_VDMX_TAG
,
offset
+
4
,
vTable
,
recs
*
6
);
result
=
get_font_d
ata
(
font
,
MS_VDMX_TAG
,
offset
+
4
,
vTable
,
recs
*
6
);
if
(
result
==
GDI_ERROR
)
{
FIXME
(
"Failed to retrieve vTable
\n
"
);
goto
end
;
...
...
@@ -4217,11 +4251,11 @@ found_face:
if
(
lf
.
lfFaceName
[
0
]
==
'@'
)
/* We need to try to load the GSUB table */
{
int
length
=
WineEngGetFontData
(
ret
,
GSUB_TAG
,
0
,
NULL
,
0
);
int
length
=
get_font_data
(
ret
,
GSUB_TAG
,
0
,
NULL
,
0
);
if
(
length
!=
GDI_ERROR
)
{
ret
->
GSUB_Table
=
HeapAlloc
(
GetProcessHeap
(),
0
,
length
);
WineEngGetFontD
ata
(
ret
,
GSUB_TAG
,
0
,
ret
->
GSUB_Table
,
length
);
get_font_d
ata
(
ret
,
GSUB_TAG
,
0
,
ret
->
GSUB_Table
,
length
);
TRACE
(
"Loaded GSUB table of %i bytes
\n
"
,
length
);
}
}
...
...
@@ -6548,50 +6582,23 @@ static BOOL freetype_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, IN
}
/*************************************************************
* WineEngGetFontData
*
* freetype_GetFontData
*/
DWORD
WineEngGetFontData
(
GdiFont
*
font
,
DWORD
table
,
DWORD
offset
,
LPVOID
buf
,
DWORD
cbData
)
static
DWORD
freetype_GetFontData
(
PHYSDEV
dev
,
DWORD
table
,
DWORD
offset
,
LPVOID
buf
,
DWORD
cbData
)
{
FT_Face
ft_face
=
font
->
ft_face
;
FT_ULong
len
;
FT_Error
err
;
TRACE
(
"font=%p, table=%c%c%c%c, offset=0x%x, buf=%p, cbData=0x%x
\n
"
,
font
,
LOBYTE
(
LOWORD
(
table
)),
HIBYTE
(
LOWORD
(
table
)),
LOBYTE
(
HIWORD
(
table
)),
HIBYTE
(
HIWORD
(
table
)),
offset
,
buf
,
cbData
);
if
(
!
FT_IS_SFNT
(
ft_face
))
return
GDI_ERROR
;
if
(
!
buf
)
len
=
0
;
else
len
=
cbData
;
if
(
table
)
{
/* MS tags differ in endianness from FT ones */
table
=
table
>>
24
|
table
<<
24
|
(
table
>>
8
&
0xff00
)
|
(
table
<<
8
&
0xff0000
);
}
struct
freetype_physdev
*
physdev
=
get_freetype_dev
(
dev
);
/* make sure value of len is the value freetype says it needs */
if
(
buf
&&
len
)
if
(
!
physdev
->
font
)
{
FT_ULong
needed
=
0
;
err
=
pFT_Load_Sfnt_Table
(
ft_face
,
table
,
offset
,
NULL
,
&
needed
);
if
(
!
err
&&
needed
<
len
)
len
=
needed
;
dev
=
GET_NEXT_PHYSDEV
(
dev
,
pGetFontData
);
return
dev
->
funcs
->
pGetFontData
(
dev
,
table
,
offset
,
buf
,
cbData
);
}
err
=
pFT_Load_Sfnt_Table
(
ft_face
,
table
,
offset
,
buf
,
&
len
);
if
(
err
)
{
TRACE
(
"Can't find table %c%c%c%c
\n
"
,
/* bytes were reversed */
HIBYTE
(
HIWORD
(
table
)),
LOBYTE
(
HIWORD
(
table
)),
HIBYTE
(
LOWORD
(
table
)),
LOBYTE
(
LOWORD
(
table
)));
return
GDI_ERROR
;
}
return
len
;
TRACE
(
"font=%p, table=%c%c%c%c, offset=0x%x, buf=%p, cbData=0x%x
\n
"
,
physdev
->
font
,
LOBYTE
(
LOWORD
(
table
)),
HIBYTE
(
LOWORD
(
table
)),
LOBYTE
(
HIWORD
(
table
)),
HIBYTE
(
HIWORD
(
table
)),
offset
,
buf
,
cbData
);
return
get_font_data
(
physdev
->
font
,
table
,
offset
,
buf
,
cbData
);
}
/*************************************************************
...
...
@@ -6963,7 +6970,7 @@ static DWORD freetype_GetKerningPairs( PHYSDEV dev, DWORD cPairs, KERNINGPAIR *k
font
->
total_kern_pairs
=
0
;
length
=
WineEngGetFontD
ata
(
font
,
MS_KERN_TAG
,
0
,
NULL
,
0
);
length
=
get_font_d
ata
(
font
,
MS_KERN_TAG
,
0
,
NULL
,
0
);
if
(
length
==
GDI_ERROR
)
{
...
...
@@ -6980,7 +6987,7 @@ static DWORD freetype_GetKerningPairs( PHYSDEV dev, DWORD cPairs, KERNINGPAIR *k
return
0
;
}
WineEngGetFontD
ata
(
font
,
MS_KERN_TAG
,
0
,
buf
,
length
);
get_font_d
ata
(
font
,
MS_KERN_TAG
,
0
,
buf
,
length
);
/* build a glyph index to char code map */
glyph_to_char
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
USHORT
)
*
65536
);
...
...
@@ -7132,7 +7139,7 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_GetCharWidth
,
/* pGetCharWidth */
NULL
,
/* pGetDeviceCaps */
NULL
,
/* pGetDeviceGammaRamp */
NULL
,
/* pGetFontData */
freetype_GetFontData
,
/* pGetFontData */
freetype_GetFontUnicodeRanges
,
/* pGetFontUnicodeRanges */
freetype_GetGlyphIndices
,
/* pGetGlyphIndices */
freetype_GetGlyphOutline
,
/* pGetGlyphOutline */
...
...
@@ -7236,13 +7243,6 @@ BOOL WineEngDestroyFontInstance(HFONT hfont)
return
FALSE
;
}
DWORD
WineEngGetFontData
(
GdiFont
*
font
,
DWORD
table
,
DWORD
offset
,
LPVOID
buf
,
DWORD
cbData
)
{
ERR
(
"called but we don't have FreeType
\n
"
);
return
GDI_ERROR
;
}
INT
WineEngAddFontResourceEx
(
LPCWSTR
file
,
DWORD
flags
,
PVOID
pdv
)
{
FIXME
(
"(%s, %x, %p): stub
\n
"
,
debugstr_w
(
file
),
flags
,
pdv
);
...
...
dlls/gdi32/gdi_private.h
View file @
e31c51b6
...
...
@@ -292,7 +292,6 @@ typedef struct
extern
INT
WineEngAddFontResourceEx
(
LPCWSTR
,
DWORD
,
PVOID
)
DECLSPEC_HIDDEN
;
extern
HANDLE
WineEngAddFontMemResourceEx
(
PVOID
,
DWORD
,
PVOID
,
LPDWORD
)
DECLSPEC_HIDDEN
;
extern
BOOL
WineEngDestroyFontInstance
(
HFONT
handle
)
DECLSPEC_HIDDEN
;
extern
DWORD
WineEngGetFontData
(
GdiFont
*
,
DWORD
,
DWORD
,
LPVOID
,
DWORD
)
DECLSPEC_HIDDEN
;
extern
BOOL
WineEngGetLinkedHFont
(
DC
*
dc
,
WCHAR
c
,
HFONT
*
new_hfont
,
UINT
*
glyph
)
DECLSPEC_HIDDEN
;
extern
BOOL
WineEngFontIsLinked
(
GdiFont
*
)
DECLSPEC_HIDDEN
;
extern
BOOL
WineEngInit
(
void
)
DECLSPEC_HIDDEN
;
...
...
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