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
19869997
Commit
19869997
authored
Nov 05, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added a separate helper to fill font metrics structure.
parent
3fd93c0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
26 deletions
+35
-26
dwrite_private.h
dlls/dwrite/dwrite_private.h
+2
-1
font.c
dlls/dwrite/font.c
+4
-2
opentype.c
dlls/dwrite/opentype.c
+29
-23
No files found.
dlls/dwrite/dwrite_private.h
View file @
19869997
...
...
@@ -113,7 +113,8 @@ extern HRESULT opentype_analyze_font(IDWriteFontFileStream*,UINT32*,DWRITE_FONT_
extern
HRESULT
opentype_get_font_table
(
IDWriteFontFileStream
*
,
DWRITE_FONT_FACE_TYPE
,
UINT32
,
UINT32
,
const
void
**
,
void
**
,
UINT32
*
,
BOOL
*
)
DECLSPEC_HIDDEN
;
extern
void
opentype_cmap_get_glyphindex
(
void
*
,
UINT32
,
UINT16
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_cmap_get_unicode_ranges
(
void
*
,
UINT32
,
DWRITE_UNICODE_RANGE
*
,
UINT32
*
)
DECLSPEC_HIDDEN
;
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
void
opentype_get_font_properties
(
const
void
*
,
const
void
*
,
DWRITE_FONT_STRETCH
*
,
DWRITE_FONT_WEIGHT
*
,
DWRITE_FONT_STYLE
*
)
DECLSPEC_HIDDEN
;
extern
void
opentype_get_font_metrics
(
const
void
*
,
const
void
*
,
const
void
*
,
DWRITE_FONT_METRICS
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_font_strings_from_id
(
const
void
*
,
DWRITE_INFORMATIONAL_STRING_ID
,
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
bidi_computelevels
(
const
WCHAR
*
,
UINT32
,
UINT8
,
UINT8
*
,
UINT8
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
19869997
...
...
@@ -646,7 +646,8 @@ static void get_font_properties_from_stream(IDWriteFontFileStream *stream, DWRIT
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_HEAD_TAG
,
&
tt_head
,
&
head_context
,
NULL
,
NULL
);
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_POST_TAG
,
&
tt_post
,
&
post_context
,
NULL
,
NULL
);
get_font_properties
(
tt_os2
,
tt_head
,
tt_post
,
metrics
,
stretch
,
weight
,
style
);
opentype_get_font_properties
(
tt_os2
,
tt_head
,
stretch
,
weight
,
style
);
opentype_get_font_metrics
(
tt_os2
,
tt_head
,
tt_post
,
metrics
);
if
(
tt_os2
)
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
os2_context
);
...
...
@@ -1489,7 +1490,8 @@ static HRESULT init_font_data(IDWriteFactory *factory, IDWriteFontFile *file, UI
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_HEAD_TAG
,
&
tt_head
,
&
head_context
,
NULL
,
NULL
);
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_POST_TAG
,
&
tt_post
,
&
post_context
,
NULL
,
NULL
);
get_font_properties
(
tt_os2
,
tt_head
,
tt_post
,
&
data
->
metrics
,
&
data
->
stretch
,
&
data
->
weight
,
&
data
->
style
);
opentype_get_font_properties
(
tt_os2
,
tt_head
,
&
data
->
stretch
,
&
data
->
weight
,
&
data
->
style
);
opentype_get_font_metrics
(
tt_os2
,
tt_head
,
tt_post
,
&
data
->
metrics
);
if
(
tt_os2
)
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
os2_context
);
...
...
dlls/dwrite/opentype.c
View file @
19869997
...
...
@@ -858,28 +858,15 @@ HRESULT opentype_cmap_get_unicode_ranges(void *data, UINT32 max_count, DWRITE_UN
return
*
count
>
max_count
?
E_NOT_SUFFICIENT_BUFFER
:
S_OK
;
}
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
)
void
opentype_get_font_metrics
(
const
void
*
os2
,
const
void
*
head
,
const
void
*
post
,
DWRITE_FONT_METRICS
*
metrics
)
{
TT_OS2_V2
*
tt_os2
=
(
TT_OS2_V2
*
)
os2
;
TT_HEAD
*
tt_head
=
(
TT_HEAD
*
)
head
;
TT_POST
*
tt_post
=
(
TT_POST
*
)
post
;
/* default stretch, weight and style to normal */
*
stretch
=
DWRITE_FONT_STRETCH_NORMAL
;
*
weight
=
DWRITE_FONT_WEIGHT_NORMAL
;
*
style
=
DWRITE_FONT_STYLE_NORMAL
;
memset
(
metrics
,
0
,
sizeof
(
*
metrics
));
/* DWRITE_FONT_STRETCH enumeration values directly match font data values */
if
(
tt_os2
)
{
if
(
GET_BE_WORD
(
tt_os2
->
usWidthClass
)
<=
DWRITE_FONT_STRETCH_ULTRA_EXPANDED
)
*
stretch
=
GET_BE_WORD
(
tt_os2
->
usWidthClass
);
*
weight
=
GET_BE_WORD
(
tt_os2
->
usWeightClass
);
TRACE
(
"stretch=%d, weight=%d
\n
"
,
*
stretch
,
*
weight
);
if
(
tt_os2
)
{
metrics
->
ascent
=
GET_BE_WORD
(
tt_os2
->
sTypoAscender
);
metrics
->
descent
=
GET_BE_WORD
(
tt_os2
->
sTypoDescender
);
metrics
->
lineGap
=
GET_BE_WORD
(
tt_os2
->
sTypoLineGap
);
...
...
@@ -890,21 +877,40 @@ VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_ME
}
if
(
tt_head
)
{
USHORT
macStyle
=
GET_BE_WORD
(
tt_head
->
macStyle
);
metrics
->
designUnitsPerEm
=
GET_BE_WORD
(
tt_head
->
unitsPerEm
);
if
(
macStyle
&
0x0002
)
*
style
=
DWRITE_FONT_STYLE_ITALIC
;
}
if
(
tt_post
)
{
if
(
tt_post
)
{
metrics
->
underlinePosition
=
GET_BE_WORD
(
tt_post
->
underlinePosition
);
metrics
->
underlineThickness
=
GET_BE_WORD
(
tt_post
->
underlineThickness
);
}
}
void
opentype_get_font_properties
(
const
void
*
os2
,
const
void
*
head
,
DWRITE_FONT_STRETCH
*
stretch
,
DWRITE_FONT_WEIGHT
*
weight
,
DWRITE_FONT_STYLE
*
style
)
{
TT_OS2_V2
*
tt_os2
=
(
TT_OS2_V2
*
)
os2
;
TT_HEAD
*
tt_head
=
(
TT_HEAD
*
)
head
;
/* default stretch, weight and style to normal */
*
stretch
=
DWRITE_FONT_STRETCH_NORMAL
;
*
weight
=
DWRITE_FONT_WEIGHT_NORMAL
;
*
style
=
DWRITE_FONT_STYLE_NORMAL
;
/* DWRITE_FONT_STRETCH enumeration values directly match font data values */
if
(
tt_os2
)
{
if
(
GET_BE_WORD
(
tt_os2
->
usWidthClass
)
<=
DWRITE_FONT_STRETCH_ULTRA_EXPANDED
)
*
stretch
=
GET_BE_WORD
(
tt_os2
->
usWidthClass
);
*
weight
=
GET_BE_WORD
(
tt_os2
->
usWeightClass
);
TRACE
(
"stretch=%d, weight=%d
\n
"
,
*
stretch
,
*
weight
);
}
if
(
tt_head
)
{
USHORT
macStyle
=
GET_BE_WORD
(
tt_head
->
macStyle
);
if
(
macStyle
&
0x0002
)
*
style
=
DWRITE_FONT_STYLE_ITALIC
;
}
}
static
UINT
get_name_record_codepage
(
enum
OPENTYPE_PLATFORM_ID
platform
,
USHORT
encoding
)
{
UINT
codepage
=
0
;
...
...
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