Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
126679fe
Commit
126679fe
authored
Aug 05, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text_style: render monospaced fonts
parent
e3189902
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
include/vlc_text_style.h
include/vlc_text_style.h
+1
-0
modules/text_renderer/freetype.c
modules/text_renderer/freetype.c
+9
-6
src/misc/text_style.c
src/misc/text_style.c
+1
-0
No files found.
include/vlc_text_style.h
View file @
126679fe
...
...
@@ -51,6 +51,7 @@ typedef struct
0xFF fully transparent */
int
i_style_flags
;
/**< Formatting style flags */
int
i_spacing
;
/**< The spaceing between glyphs in pixels */
bool
b_monospaced
;
/**< If font should be default monospaced font */
/* Outline */
int
i_outline_color
;
/**< The color of the outline 0xRRGGBB */
...
...
modules/text_renderer/freetype.c
View file @
126679fe
...
...
@@ -862,7 +862,8 @@ static inline int RenderAXYZ( filter_t *p_filter,
static
FT_Face
LoadEmbeddedFace
(
filter_sys_t
*
p_sys
,
const
text_style_t
*
p_style
)
static
FT_Face
LoadEmbeddedFace
(
filter_sys_t
*
p_sys
,
const
char
*
psz_fontname
,
const
text_style_t
*
p_style
)
{
for
(
int
k
=
0
;
k
<
p_sys
->
i_font_attachments
;
k
++
)
{
...
...
@@ -881,7 +882,7 @@ static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const text_style_t *p_styl
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
(
p_face
->
family_name
!=
NULL
&&
!
strcasecmp
(
p_face
->
family_name
,
p
_style
->
p
sz_fontname
)
&&
!
strcasecmp
(
p_face
->
family_name
,
psz_fontname
)
&&
(
p_style
->
i_style_flags
&
(
STYLE_BOLD
|
STYLE_ITALIC
))
==
i_style_received
)
return
p_face
;
...
...
@@ -1367,8 +1368,10 @@ FT_Face LoadFace( filter_t *p_filter,
&&
!
(
(
p_cache
->
p_styles
[
i
].
i_style_flags
^
p_style
->
i_style_flags
)
&
STYLE_HALFWIDTH
)
)
return
p_cache
->
p_faces
[
i
];
const
char
*
psz_fontname
=
(
p_style
->
b_monospaced
)
?
p_style
->
psz_monofontname
:
p_style
->
psz_fontname
;
/* Look for a match amongst our attachments first */
FT_Face
p_face
=
LoadEmbeddedFace
(
p_sys
,
p_style
);
FT_Face
p_face
=
LoadEmbeddedFace
(
p_sys
,
p
sz_fontname
,
p
_style
);
/* Load system wide font otheriwse */
if
(
!
p_face
)
...
...
@@ -1377,7 +1380,7 @@ FT_Face LoadFace( filter_t *p_filter,
char
*
psz_fontfile
=
NULL
;
if
(
p_sys
->
pf_select
)
psz_fontfile
=
p_sys
->
pf_select
(
p_filter
,
p
_style
->
p
sz_fontname
,
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
,
-
1
,
...
...
@@ -1393,7 +1396,7 @@ FT_Face LoadFace( filter_t *p_filter,
msg_Warn
(
p_filter
,
"We were not able to find a matching font:
\"
%s
\"
(%s %s),"
" so using default font"
,
p
_style
->
p
sz_fontname
,
psz_fontname
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
?
"Bold"
:
""
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
?
"Italic"
:
""
);
p_face
=
NULL
;
...
...
@@ -1455,7 +1458,7 @@ FT_Face LoadFace( filter_t *p_filter,
text_style_t
*
p_face_style
=
p_cache
->
p_styles
+
p_cache
->
i_faces_count
;
p_face_style
->
i_font_size
=
p_style
->
i_font_size
;
p_face_style
->
i_style_flags
=
p_style
->
i_style_flags
;
p_face_style
->
psz_fontname
=
strdup
(
p
_style
->
p
sz_fontname
);
p_face_style
->
psz_fontname
=
strdup
(
psz_fontname
);
p_cache
->
p_faces
[
p_cache
->
i_faces_count
]
=
p_face
;
++
p_cache
->
i_faces_count
;
...
...
src/misc/text_style.c
View file @
126679fe
...
...
@@ -53,6 +53,7 @@ text_style_t *text_style_New( void )
p_style
->
i_outline_width
=
1
;
p_style
->
i_shadow_width
=
0
;
p_style
->
i_spacing
=
-
1
;
p_style
->
b_monospaced
=
false
;
return
p_style
;
}
...
...
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