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
fdd8e011
Commit
fdd8e011
authored
Jan 06, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Create fontface instance for each run.
parent
25f24f2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
7 deletions
+50
-7
layout.c
dlls/dwrite/layout.c
+50
-7
No files found.
dlls/dwrite/layout.c
View file @
fdd8e011
...
...
@@ -229,6 +229,8 @@ static void free_layout_runs(struct dwrite_textlayout *layout)
struct
layout_run
*
cur
,
*
cur2
;
LIST_FOR_EACH_ENTRY_SAFE
(
cur
,
cur2
,
&
layout
->
runs
,
struct
layout_run
,
entry
)
{
list_remove
(
&
cur
->
entry
);
if
(
cur
->
run
.
fontFace
)
IDWriteFontFace_Release
(
cur
->
run
.
fontFace
);
heap_free
(
cur
);
}
}
...
...
@@ -297,11 +299,14 @@ static HRESULT layout_update_breakpoints_range(struct dwrite_textlayout *layout,
return
S_OK
;
}
static
struct
layout_range
*
get_layout_range_by_pos
(
struct
dwrite_textlayout
*
layout
,
UINT32
pos
);
static
HRESULT
layout_compute_runs
(
struct
dwrite_textlayout
*
layout
)
{
IDWriteTextAnalyzer
*
analyzer
;
struct
layout_range
*
cur
;
HRESULT
hr
=
S_OK
;
struct
layout_range
*
range
;
struct
layout_run
*
run
;
HRESULT
hr
;
free_layout_runs
(
layout
);
...
...
@@ -309,10 +314,10 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout)
if
(
FAILED
(
hr
))
return
hr
;
LIST_FOR_EACH_ENTRY
(
cur
,
&
layout
->
ranges
,
struct
layout_range
,
entry
)
{
LIST_FOR_EACH_ENTRY
(
range
,
&
layout
->
ranges
,
struct
layout_range
,
entry
)
{
/* inline objects override actual text in a range */
if
(
cur
->
object
)
{
hr
=
layout_update_breakpoints_range
(
layout
,
cur
);
if
(
range
->
object
)
{
hr
=
layout_update_breakpoints_range
(
layout
,
range
);
if
(
FAILED
(
hr
))
return
hr
;
continue
;
...
...
@@ -320,17 +325,55 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout)
/* initial splitting by script */
hr
=
IDWriteTextAnalyzer_AnalyzeScript
(
analyzer
,
&
layout
->
IDWriteTextAnalysisSource_iface
,
cur
->
range
.
startPosition
,
cur
->
range
.
length
,
&
layout
->
IDWriteTextAnalysisSink_iface
);
range
->
range
.
startPosition
,
range
->
range
.
length
,
&
layout
->
IDWriteTextAnalysisSink_iface
);
if
(
FAILED
(
hr
))
break
;
/* this splits it further */
hr
=
IDWriteTextAnalyzer_AnalyzeBidi
(
analyzer
,
&
layout
->
IDWriteTextAnalysisSource_iface
,
cur
->
range
.
startPosition
,
cur
->
range
.
length
,
&
layout
->
IDWriteTextAnalysisSink_iface
);
range
->
range
.
startPosition
,
range
->
range
.
length
,
&
layout
->
IDWriteTextAnalysisSink_iface
);
if
(
FAILED
(
hr
))
break
;
}
/* fill run info */
LIST_FOR_EACH_ENTRY
(
run
,
&
layout
->
runs
,
struct
layout_run
,
entry
)
{
IDWriteFontFamily
*
family
;
IDWriteFont
*
font
;
BOOL
exists
=
TRUE
;
UINT32
index
;
range
=
get_layout_range_by_pos
(
layout
,
run
->
descr
.
textPosition
);
hr
=
IDWriteFontCollection_FindFamilyName
(
range
->
collection
,
range
->
fontfamily
,
&
index
,
&
exists
);
if
(
FAILED
(
hr
)
||
!
exists
)
{
WARN
(
"[%u,%u]: family %s not found in collection %p
\n
"
,
run
->
descr
.
textPosition
,
run
->
descr
.
textPosition
+
run
->
descr
.
stringLength
,
debugstr_w
(
range
->
fontfamily
),
range
->
collection
);
continue
;
}
hr
=
IDWriteFontCollection_GetFontFamily
(
range
->
collection
,
index
,
&
family
);
if
(
FAILED
(
hr
))
continue
;
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
range
->
weight
,
range
->
stretch
,
range
->
style
,
&
font
);
IDWriteFontFamily_Release
(
family
);
if
(
FAILED
(
hr
))
{
WARN
(
"[%u,%u]: failed to get a matching font
\n
"
,
run
->
descr
.
textPosition
,
run
->
descr
.
textPosition
+
run
->
descr
.
stringLength
);
continue
;
}
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
run
->
run
.
fontFace
);
IDWriteFont_Release
(
font
);
if
(
FAILED
(
hr
))
continue
;
run
->
run
.
fontEmSize
=
range
->
fontsize
;
run
->
descr
.
localeName
=
range
->
locale
;
/* FIXME: set glyph indices, cluster map, advances */
}
IDWriteTextAnalyzer_Release
(
analyzer
);
return
hr
;
}
...
...
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