Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
2f038724
Commit
2f038724
authored
Jun 13, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved out FT_Face loading from ProcessLines() to its own function (freetype).
No functionnal changes.
parent
ca1265b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
100 deletions
+96
-100
modules/misc/text_renderer/freetype.c
modules/misc/text_renderer/freetype.c
+96
-100
No files found.
modules/misc/text_renderer/freetype.c
View file @
2f038724
...
@@ -1463,38 +1463,6 @@ static unsigned SetupText( filter_t *p_filter,
...
@@ -1463,38 +1463,6 @@ static unsigned SetupText( filter_t *p_filter,
return
i_string_length
;
return
i_string_length
;
}
}
static
int
CheckForEmbeddedFont
(
filter_sys_t
*
p_sys
,
FT_Face
*
pp_face
,
text_style_t
*
p_style
)
{
for
(
int
k
=
0
;
k
<
p_sys
->
i_font_attachments
;
k
++
)
{
input_attachment_t
*
p_attach
=
p_sys
->
pp_font_attachments
[
k
];
int
i_font_idx
=
0
;
FT_Face
p_face
=
NULL
;
while
(
0
==
FT_New_Memory_Face
(
p_sys
->
p_library
,
p_attach
->
p_data
,
p_attach
->
i_data
,
i_font_idx
,
&
p_face
))
{
if
(
p_face
)
{
int
i_style_received
=
((
p_face
->
style_flags
&
FT_STYLE_FLAG_BOLD
)
?
STYLE_BOLD
:
0
)
|
((
p_face
->
style_flags
&
FT_STYLE_FLAG_ITALIC
)
?
STYLE_ITALIC
:
0
);
if
(
!
strcasecmp
(
p_face
->
family_name
,
p_style
->
psz_fontname
)
&&
(
p_style
->
i_style_flags
&
(
STYLE_BOLD
|
STYLE_BOLD
))
==
i_style_received
)
{
*
pp_face
=
p_face
;
return
VLC_SUCCESS
;
}
FT_Done_Face
(
p_face
);
}
i_font_idx
++
;
}
}
return
VLC_EGENERIC
;
}
static
int
ProcessNodes
(
filter_t
*
p_filter
,
static
int
ProcessNodes
(
filter_t
*
p_filter
,
uint32_t
*
psz_text
,
uint32_t
*
psz_text
,
text_style_t
**
pp_styles
,
text_style_t
**
pp_styles
,
...
@@ -1885,6 +1853,99 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face,
...
@@ -1885,6 +1853,99 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
FT_Face
LoadEmbeddedFace
(
filter_sys_t
*
p_sys
,
const
text_style_t
*
p_style
)
{
for
(
int
k
=
0
;
k
<
p_sys
->
i_font_attachments
;
k
++
)
{
input_attachment_t
*
p_attach
=
p_sys
->
pp_font_attachments
[
k
];
int
i_font_idx
=
0
;
FT_Face
p_face
=
NULL
;
while
(
0
==
FT_New_Memory_Face
(
p_sys
->
p_library
,
p_attach
->
p_data
,
p_attach
->
i_data
,
i_font_idx
,
&
p_face
))
{
if
(
p_face
)
{
int
i_style_received
=
((
p_face
->
style_flags
&
FT_STYLE_FLAG_BOLD
)
?
STYLE_BOLD
:
0
)
|
((
p_face
->
style_flags
&
FT_STYLE_FLAG_ITALIC
)
?
STYLE_ITALIC
:
0
);
if
(
!
strcasecmp
(
p_face
->
family_name
,
p_style
->
psz_fontname
)
&&
(
p_style
->
i_style_flags
&
(
STYLE_BOLD
|
STYLE_BOLD
))
==
i_style_received
)
return
p_face
;
FT_Done_Face
(
p_face
);
}
i_font_idx
++
;
}
}
return
NULL
;
}
static
FT_Face
LoadFace
(
filter_t
*
p_filter
,
const
text_style_t
*
p_style
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
/* Look for a match amongst our attachments first */
FT_Face
p_face
=
LoadEmbeddedFace
(
p_sys
,
p_style
);
/* Load system wide font otheriwse */
if
(
!
p_face
)
{
int
i_idx
=
0
;
char
*
psz_fontfile
;
#ifdef HAVE_FONTCONFIG
psz_fontfile
=
FontConfig_Select
(
NULL
,
p_style
->
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
,
-
1
,
&
i_idx
);
#elif defined( WIN32 )
psz_fontfile
=
Win32_Select
(
p_filter
,
p_style
->
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
,
-
1
,
&
i_idx
);
#else
psz_fontfile
=
NULL
;
#endif
if
(
!
psz_fontfile
)
return
NULL
;
if
(
*
psz_fontfile
==
'\0'
)
{
msg_Warn
(
p_filter
,
"We were not able to find a matching font:
\"
%s
\"
(%s %s),"
" so using default font"
,
p_style
->
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
?
"Bold"
:
""
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
?
"Italic"
:
""
);
p_face
=
NULL
;
}
else
{
if
(
FT_New_Face
(
p_sys
->
p_library
,
psz_fontfile
,
i_idx
,
&
p_face
)
)
p_face
=
NULL
;
}
free
(
psz_fontfile
);
}
if
(
!
p_face
)
return
NULL
;
if
(
FT_Select_Charmap
(
p_face
,
ft_encoding_unicode
)
)
{
/* We've loaded a font face which is unhelpful for actually
* rendering text - fallback to the default one.
*/
FT_Done_Face
(
p_face
);
return
NULL
;
}
return
p_face
;
}
static
int
ProcessLines
(
filter_t
*
p_filter
,
static
int
ProcessLines
(
filter_t
*
p_filter
,
line_desc_t
**
pp_lines
,
line_desc_t
**
pp_lines
,
...
@@ -2021,74 +2082,9 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2021,74 +2082,9 @@ static int ProcessLines( filter_t *p_filter,
{
{
text_style_t
*
p_style
=
pp_styles
[
k
-
1
];
text_style_t
*
p_style
=
pp_styles
[
k
-
1
];
/* End of the current style run */
FT_Face
p_face
=
LoadFace
(
p_filter
,
p_style
);
FT_Face
p_face
=
NULL
;
if
(
FT_Set_Pixel_Sizes
(
p_face
?
p_face
:
p_sys
->
p_face
,
int
i_idx
=
0
;
0
,
p_style
->
i_font_size
)
)
/* Look for a match amongst our attachments first */
CheckForEmbeddedFont
(
p_sys
,
&
p_face
,
p_style
);
if
(
!
p_face
)
{
char
*
psz_fontfile
;
#ifdef HAVE_FONTCONFIG
psz_fontfile
=
FontConfig_Select
(
NULL
,
p_style
->
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
,
-
1
,
&
i_idx
);
#elif defined( WIN32 )
psz_fontfile
=
Win32_Select
(
p_filter
,
p_style
->
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
,
-
1
,
&
i_idx
);
#else
psz_fontfile
=
NULL
;
#endif
if
(
psz_fontfile
&&
!
*
psz_fontfile
)
{
msg_Warn
(
p_filter
,
"We were not able to find a matching font:
\"
%s
\"
(%s %s),"
" so using default font"
,
p_style
->
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
?
"Bold"
:
""
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
?
"Italic"
:
""
);
free
(
psz_fontfile
);
psz_fontfile
=
NULL
;
}
if
(
psz_fontfile
)
{
if
(
FT_New_Face
(
p_sys
->
p_library
,
psz_fontfile
,
i_idx
,
&
p_face
)
)
{
free
(
psz_fontfile
);
free
(
pp_fribidi_styles
);
free
(
p_fribidi_string
);
free
(
pi_karaoke_bar
);
return
VLC_EGENERIC
;
}
free
(
psz_fontfile
);
}
}
if
(
p_face
&&
FT_Select_Charmap
(
p_face
,
ft_encoding_unicode
)
)
{
/* We've loaded a font face which is unhelpful for actually
* rendering text - fallback to the default one.
*/
FT_Done_Face
(
p_face
);
p_face
=
NULL
;
}
if
(
FT_Select_Charmap
(
p_face
?
p_face
:
p_sys
->
p_face
,
ft_encoding_unicode
)
||
FT_Set_Pixel_Sizes
(
p_face
?
p_face
:
p_sys
->
p_face
,
0
,
p_style
->
i_font_size
)
)
{
{
if
(
p_face
)
FT_Done_Face
(
p_face
);
if
(
p_face
)
FT_Done_Face
(
p_face
);
free
(
pp_fribidi_styles
);
free
(
pp_fribidi_styles
);
...
...
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