Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
d2c52a32
Commit
d2c52a32
authored
Jul 20, 2003
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/misc/freetype.c: compilation fix for windows
parent
e9e2c245
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
117 deletions
+117
-117
modules/misc/freetype.c
modules/misc/freetype.c
+117
-117
No files found.
modules/misc/freetype.c
View file @
d2c52a32
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* freetype.c : Put text on the video, using freetype2
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
* Copyright (C) 2002, 2003 VideoLAN
* $Id: freetype.c,v 1.
4 2003/07/20 16:26:33 sigmunau
Exp $
* $Id: freetype.c,v 1.
5 2003/07/20 16:56:58 ipkiss
Exp $
*
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
*
...
@@ -36,20 +36,18 @@
...
@@ -36,20 +36,18 @@
#include FT_FREETYPE_H
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_GLYPH_H
#define FT_RENDER_MODE_NORMAL 0
/* Why do we have to do that ? */
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
);
static
int
Create
(
vlc_object_t
*
);
static
void
Destroy
(
vlc_object_t
*
);
static
void
Destroy
(
vlc_object_t
*
);
static
void
Render
(
vout_thread_t
*
,
picture_t
*
,
static
void
Render
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
);
const
subpicture_t
*
);
static
void
RenderI420
(
vout_thread_t
*
,
picture_t
*
,
static
void
RenderI420
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
);
const
subpicture_t
*
);
static
int
AddText
(
vout_thread_t
*
,
byte_t
*
,
text_style_t
*
,
int
,
static
int
AddText
(
vout_thread_t
*
,
byte_t
*
,
text_style_t
*
,
int
,
int
,
int
,
mtime_t
,
mtime_t
);
int
,
int
,
mtime_t
,
mtime_t
);
static
int
GetUnicodeCharFromUTF8
(
byte_t
**
);
static
int
GetUnicodeCharFromUTF8
(
byte_t
**
);
/*****************************************************************************
/*****************************************************************************
...
@@ -119,7 +117,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -119,7 +117,7 @@ static int Create( vlc_object_t *p_this )
char
*
psz_fontfile
;
char
*
psz_fontfile
;
int
i
,
i_error
;
int
i
,
i_error
;
double
gamma_inv
=
1
.
0
f
/
gamma_value
;
double
gamma_inv
=
1
.
0
f
/
gamma_value
;
/* Allocate structure */
/* Allocate structure */
p_vout
->
p_text_renderer_data
=
malloc
(
sizeof
(
text_renderer_sys_t
)
);
p_vout
->
p_text_renderer_data
=
malloc
(
sizeof
(
text_renderer_sys_t
)
);
if
(
p_vout
->
p_text_renderer_data
==
NULL
)
if
(
p_vout
->
p_text_renderer_data
==
NULL
)
...
@@ -131,7 +129,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -131,7 +129,7 @@ static int Create( vlc_object_t *p_this )
for
(
i
=
0
;
i
<
256
;
i
++
)
{
for
(
i
=
0
;
i
<
256
;
i
++
)
{
p_vout
->
p_text_renderer_data
->
pi_gamma
[
i
]
=
p_vout
->
p_text_renderer_data
->
pi_gamma
[
i
]
=
(
uint8_t
)(
pow
(
(
double
)
i
/
255
.
0
f
,
gamma_inv
)
*
255
.
0
f
);
(
uint8_t
)(
pow
(
(
double
)
i
/
255
.
0
f
,
gamma_inv
)
*
255
.
0
f
);
//msg_Dbg( p_vout, "%d", p_vout->p_text_renderer_data->pi_gamma[i]);
//msg_Dbg( p_vout, "%d", p_vout->p_text_renderer_data->pi_gamma[i]);
}
}
/* Look what method was requested */
/* Look what method was requested */
...
@@ -144,37 +142,38 @@ static int Create( vlc_object_t *p_this )
...
@@ -144,37 +142,38 @@ static int Create( vlc_object_t *p_this )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
i_error
=
FT_New_Face
(
p_vout
->
p_text_renderer_data
->
p_library
,
i_error
=
FT_New_Face
(
p_vout
->
p_text_renderer_data
->
p_library
,
psz_fontfile
,
0
,
psz_fontfile
,
0
,
&
p_vout
->
p_text_renderer_data
->
p_face
);
&
p_vout
->
p_text_renderer_data
->
p_face
);
if
(
i_error
==
FT_Err_Unknown_File_Format
)
if
(
i_error
==
FT_Err_Unknown_File_Format
)
{
{
msg_Err
(
p_vout
,
"file %s have unknown format"
,
psz_fontfile
);
msg_Err
(
p_vout
,
"file %s have unknown format"
,
psz_fontfile
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
free
(
p_vout
->
p_text_renderer_data
);
free
(
p_vout
->
p_text_renderer_data
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
else
if
(
i_error
)
else
if
(
i_error
)
{
{
msg_Err
(
p_vout
,
"failed to load font file"
);
msg_Err
(
p_vout
,
"failed to load font file"
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
free
(
p_vout
->
p_text_renderer_data
);
free
(
p_vout
->
p_text_renderer_data
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
i_error
=
FT_Select_Charmap
(
p_vout
->
p_text_renderer_data
->
p_face
,
i_error
=
FT_Select_Charmap
(
p_vout
->
p_text_renderer_data
->
p_face
,
FT_ENCODING_UNICODE
);
ft_encoding_unicode
);
if
(
i_error
)
if
(
i_error
)
{
{
msg_Err
(
p_vout
,
"Font has no unicode translation table"
);
msg_Err
(
p_vout
,
"Font has no unicode translation table"
);
FT_Done_Face
(
p_vout
->
p_text_renderer_data
->
p_face
);
FT_Done_Face
(
p_vout
->
p_text_renderer_data
->
p_face
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
free
(
p_vout
->
p_text_renderer_data
);
free
(
p_vout
->
p_text_renderer_data
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
p_vout
->
p_text_renderer_data
->
i_use_kerning
=
FT_HAS_KERNING
(
p_vout
->
p_text_renderer_data
->
p_face
);
p_vout
->
p_text_renderer_data
->
i_use_kerning
=
FT_HAS_KERNING
(
p_vout
->
p_text_renderer_data
->
p_face
);
i_error
=
FT_Set_Pixel_Sizes
(
p_vout
->
p_text_renderer_data
->
p_face
,
0
,
config_GetInt
(
p_vout
,
"freetype-fontsize"
)
);
i_error
=
FT_Set_Pixel_Sizes
(
p_vout
->
p_text_renderer_data
->
p_face
,
0
,
config_GetInt
(
p_vout
,
"freetype-fontsize"
)
);
if
(
i_error
)
if
(
i_error
)
{
{
msg_Err
(
p_vout
,
"couldn't set font size to %d"
,
msg_Err
(
p_vout
,
"couldn't set font size to %d"
,
...
@@ -192,7 +191,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -192,7 +191,7 @@ static int Create( vlc_object_t *p_this )
* Clean up all data and library connections
* Clean up all data and library connections
*****************************************************************************/
*****************************************************************************/
static
void
Destroy
(
vlc_object_t
*
p_this
)
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
FT_Done_Face
(
p_vout
->
p_text_renderer_data
->
p_face
);
FT_Done_Face
(
p_vout
->
p_text_renderer_data
->
p_face
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
FT_Done_FreeType
(
p_vout
->
p_text_renderer_data
->
p_library
);
...
@@ -204,8 +203,8 @@ static void Destroy( vlc_object_t *p_this )
...
@@ -204,8 +203,8 @@ static void Destroy( vlc_object_t *p_this )
*****************************************************************************
*****************************************************************************
* This function merges the previously rendered freetype glyphs into a picture
* This function merges the previously rendered freetype glyphs into a picture
*****************************************************************************/
*****************************************************************************/
static
void
Render
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
static
void
Render
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_subpic
)
const
subpicture_t
*
p_subpic
)
{
{
switch
(
p_vout
->
output
.
i_chroma
)
switch
(
p_vout
->
output
.
i_chroma
)
{
{
...
@@ -238,13 +237,13 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -238,13 +237,13 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic,
}
}
}
}
static
void
RenderI420
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
static
void
RenderI420
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_subpic
)
const
subpicture_t
*
p_subpic
)
{
{
subpicture_sys_t
*
p_string
=
p_subpic
->
p_sys
;
subpicture_sys_t
*
p_string
=
p_subpic
->
p_sys
;
int
i_plane
,
x
,
y
,
pen_x
,
pen_y
;
int
i_plane
,
x
,
y
,
pen_x
,
pen_y
;
unsigned
int
i
;
unsigned
int
i
;
for
(
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
for
(
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
{
{
uint8_t
*
p_in
;
uint8_t
*
p_in
;
...
@@ -253,90 +252,90 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -253,90 +252,90 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
p_in
=
p_pic
->
p
[
i_plane
].
p_pixels
;
p_in
=
p_pic
->
p
[
i_plane
].
p_pixels
;
if
(
i_plane
==
0
)
if
(
i_plane
==
0
)
{
{
if
(
p_string
->
i_flags
&
OSD_ALIGN_BOTTOM
)
if
(
p_string
->
i_flags
&
OSD_ALIGN_BOTTOM
)
{
{
pen_y
=
p_pic
->
p
[
i_plane
].
i_lines
-
p_string
->
i_height
-
pen_y
=
p_pic
->
p
[
i_plane
].
i_lines
-
p_string
->
i_height
-
p_string
->
i_y_margin
;
p_string
->
i_y_margin
;
}
}
else
else
{
{
pen_y
=
p_string
->
i_y_margin
;
pen_y
=
p_string
->
i_y_margin
;
}
}
if
(
p_string
->
i_flags
&
OSD_ALIGN_RIGHT
)
if
(
p_string
->
i_flags
&
OSD_ALIGN_RIGHT
)
{
{
pen_x
=
i_pitch
-
p_string
->
i_width
pen_x
=
i_pitch
-
p_string
->
i_width
-
p_string
->
i_x_margin
;
-
p_string
->
i_x_margin
;
}
}
else
else
{
{
pen_x
=
p_string
->
i_x_margin
;
pen_x
=
p_string
->
i_x_margin
;
}
}
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
{
{
if
(
p_string
->
pp_glyphs
[
i
]
)
if
(
p_string
->
pp_glyphs
[
i
]
)
{
{
FT_BitmapGlyph
p_glyph
=
p_string
->
pp_glyphs
[
i
];
FT_BitmapGlyph
p_glyph
=
p_string
->
pp_glyphs
[
i
];
#define alpha p_vout->p_text_renderer_data->pi_gamma[ p_glyph->bitmap.buffer[ x + y * p_glyph->bitmap.width ] ]
#define alpha p_vout->p_text_renderer_data->pi_gamma[ p_glyph->bitmap.buffer[ x + y * p_glyph->bitmap.width ] ]
#define pixel p_in[ ( p_string->p_glyph_pos[ i ].y + pen_y + y - p_glyph->top ) * i_pitch+x + pen_x + p_string->p_glyph_pos[ i ].x + p_glyph->left ]
#define pixel p_in[ ( p_string->p_glyph_pos[ i ].y + pen_y + y - p_glyph->top ) * i_pitch+x + pen_x + p_string->p_glyph_pos[ i ].x + p_glyph->left ]
for
(
y
=
0
;
y
<
p_glyph
->
bitmap
.
rows
;
y
++
)
for
(
y
=
0
;
y
<
p_glyph
->
bitmap
.
rows
;
y
++
)
{
{
for
(
x
=
0
;
x
<
p_glyph
->
bitmap
.
width
;
x
++
)
for
(
x
=
0
;
x
<
p_glyph
->
bitmap
.
width
;
x
++
)
{
{
//
pixel = alpha;
//
pixel = alpha;
//
pixel = (pixel^alpha)^pixel;
//
pixel = (pixel^alpha)^pixel;
pixel
=
(
(
pixel
*
(
255
-
alpha
)
)
>>
8
)
+
pixel
=
(
(
pixel
*
(
255
-
alpha
)
)
>>
8
)
+
(
255
*
alpha
>>
8
);
(
255
*
alpha
>>
8
);
#undef alpha
#undef alpha
#undef pixel
#undef pixel
}
}
}
}
}
}
}
}
}
}
else
else
{
{
if
(
p_string
->
i_flags
&
OSD_ALIGN_BOTTOM
)
if
(
p_string
->
i_flags
&
OSD_ALIGN_BOTTOM
)
{
{
pen_y
=
p_pic
->
p
[
i_plane
].
i_lines
-
(
p_string
->
i_height
>>
1
)
-
pen_y
=
p_pic
->
p
[
i_plane
].
i_lines
-
(
p_string
->
i_height
>>
1
)
-
(
p_string
->
i_y_margin
>>
1
);
(
p_string
->
i_y_margin
>>
1
);
}
}
else
else
{
{
pen_y
=
p_string
->
i_y_margin
>>
1
;
pen_y
=
p_string
->
i_y_margin
>>
1
;
}
}
if
(
p_string
->
i_flags
&
OSD_ALIGN_RIGHT
)
if
(
p_string
->
i_flags
&
OSD_ALIGN_RIGHT
)
{
{
pen_x
=
i_pitch
-
(
p_string
->
i_width
>>
1
)
pen_x
=
i_pitch
-
(
p_string
->
i_width
>>
1
)
-
(
p_string
->
i_x_margin
>>
1
);
-
(
p_string
->
i_x_margin
>>
1
);
}
}
else
else
{
{
pen_x
=
p_string
->
i_x_margin
>>
1
;
pen_x
=
p_string
->
i_x_margin
>>
1
;
}
}
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
{
{
if
(
p_string
->
pp_glyphs
[
i
]
)
if
(
p_string
->
pp_glyphs
[
i
]
)
{
{
FT_BitmapGlyph
p_glyph
=
p_string
->
pp_glyphs
[
i
];
FT_BitmapGlyph
p_glyph
=
p_string
->
pp_glyphs
[
i
];
#define alpha p_vout->p_text_renderer_data->pi_gamma[ p_glyph->bitmap.buffer[ ( x + y * p_glyph->bitmap.width ) ] ]
#define alpha p_vout->p_text_renderer_data->pi_gamma[ p_glyph->bitmap.buffer[ ( x + y * p_glyph->bitmap.width ) ] ]
#define pixel p_in[ ( (p_string->p_glyph_pos[ i ].y>>1) + pen_y + (y>>1) - ( p_glyph->top >> 1 ) ) * i_pitch + ( x >> 1 ) + pen_x + ( p_string->p_glyph_pos[ i ].x >> 1 ) + ( p_glyph->left >>1) ]
#define pixel p_in[ ( (p_string->p_glyph_pos[ i ].y>>1) + pen_y + (y>>1) - ( p_glyph->top >> 1 ) ) * i_pitch + ( x >> 1 ) + pen_x + ( p_string->p_glyph_pos[ i ].x >> 1 ) + ( p_glyph->left >>1) ]
for
(
y
=
0
;
y
<
p_glyph
->
bitmap
.
rows
;
y
+=
2
)
for
(
y
=
0
;
y
<
p_glyph
->
bitmap
.
rows
;
y
+=
2
)
{
{
for
(
x
=
0
;
x
<
p_glyph
->
bitmap
.
width
;
x
+=
2
)
for
(
x
=
0
;
x
<
p_glyph
->
bitmap
.
width
;
x
+=
2
)
{
{
//
pixel = alpha;
//
pixel = alpha;
//
pixel = (pixel^alpha)^pixel;
//
pixel = (pixel^alpha)^pixel;
pixel
=
(
(
pixel
*
(
0xFF
-
alpha
)
)
>>
8
)
+
pixel
=
(
(
pixel
*
(
0xFF
-
alpha
)
)
>>
8
)
+
(
0x80
*
alpha
>>
8
);
(
0x80
*
alpha
>>
8
);
#undef alpha
#undef alpha
#undef pixel
#undef pixel
}
}
}
}
}
}
}
}
}
}
}
}
}
}
...
@@ -348,8 +347,8 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
...
@@ -348,8 +347,8 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
* the vout method by this module
* the vout method by this module
*/
*/
static
int
AddText
(
vout_thread_t
*
p_vout
,
byte_t
*
psz_string
,
static
int
AddText
(
vout_thread_t
*
p_vout
,
byte_t
*
psz_string
,
text_style_t
*
p_style
,
int
i_flags
,
int
i_hmargin
,
text_style_t
*
p_style
,
int
i_flags
,
int
i_hmargin
,
int
i_vmargin
,
mtime_t
i_start
,
mtime_t
i_stop
)
int
i_vmargin
,
mtime_t
i_start
,
mtime_t
i_stop
)
{
{
subpicture_sys_t
*
p_string
;
subpicture_sys_t
*
p_string
;
int
i
,
i_pen_y
,
i_pen_x
,
i_error
,
i_glyph_index
,
i_previous
,
i_char
;
int
i
,
i_pen_y
,
i_pen_x
,
i_error
,
i_glyph_index
,
i_previous
,
i_char
;
...
@@ -370,7 +369,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
...
@@ -370,7 +369,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
p_subpic
=
vout_CreateSubPicture
(
p_vout
,
MEMORY_SUBPICTURE
);
p_subpic
=
vout_CreateSubPicture
(
p_vout
,
MEMORY_SUBPICTURE
);
if
(
p_subpic
==
NULL
)
if
(
p_subpic
==
NULL
)
{
{
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
p_subpic
->
pf_render
=
Render
;
p_subpic
->
pf_render
=
Render
;
p_subpic
->
pf_destroy
=
FreeString
;
p_subpic
->
pf_destroy
=
FreeString
;
...
@@ -378,19 +377,19 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
...
@@ -378,19 +377,19 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
p_subpic
->
i_stop
=
i_stop
;
p_subpic
->
i_stop
=
i_stop
;
if
(
i_stop
==
0
)
if
(
i_stop
==
0
)
{
{
p_subpic
->
b_ephemer
=
VLC_TRUE
;
p_subpic
->
b_ephemer
=
VLC_TRUE
;
}
}
else
else
{
{
p_subpic
->
b_ephemer
=
VLC_FALSE
;
p_subpic
->
b_ephemer
=
VLC_FALSE
;
}
}
/* Create and initialize private data for the subpicture */
/* Create and initialize private data for the subpicture */
p_string
=
malloc
(
sizeof
(
subpicture_sys_t
)
);
p_string
=
malloc
(
sizeof
(
subpicture_sys_t
)
);
if
(
p_string
==
NULL
)
if
(
p_string
==
NULL
)
{
{
vout_DestroySubPicture
(
p_vout
,
p_subpic
);
vout_DestroySubPicture
(
p_vout
,
p_subpic
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
p_subpic
->
p_sys
=
p_string
;
p_subpic
->
p_sys
=
p_string
;
p_string
->
i_flags
=
i_flags
;
p_string
->
i_flags
=
i_flags
;
...
@@ -444,7 +443,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
...
@@ -444,7 +443,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
FT_Get_Kerning
(
face
,
i_previous
,
i_glyph_index
,
FT_Get_Kerning
(
face
,
i_previous
,
i_glyph_index
,
ft_kerning_default
,
&
delta
);
ft_kerning_default
,
&
delta
);
i_pen_x
+=
delta
.
x
>>
6
;
i_pen_x
+=
delta
.
x
>>
6
;
}
}
p_string
->
p_glyph_pos
[
i
].
x
=
i_pen_x
;
p_string
->
p_glyph_pos
[
i
].
x
=
i_pen_x
;
p_string
->
p_glyph_pos
[
i
].
y
=
i_pen_y
;
p_string
->
p_glyph_pos
[
i
].
y
=
i_pen_y
;
...
@@ -462,27 +461,28 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
...
@@ -462,27 +461,28 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
}
}
FT_Glyph_Get_CBox
(
tmp_glyph
,
ft_glyph_bbox_pixels
,
&
glyph_size
);
FT_Glyph_Get_CBox
(
tmp_glyph
,
ft_glyph_bbox_pixels
,
&
glyph_size
);
i_error
=
FT_Glyph_To_Bitmap
(
&
tmp_glyph
,
i_error
=
FT_Glyph_To_Bitmap
(
&
tmp_glyph
,
FT_RENDER_MODE_NORMAL
,
ft_render_mode_normal
,
&
p_string
->
p_glyph_pos
[
i
],
&
p_string
->
p_glyph_pos
[
i
],
1
);
1
);
if
(
i_error
)
continue
;
if
(
i_error
)
continue
;
p_string
->
pp_glyphs
[
i
]
=
(
FT_BitmapGlyph
)
tmp_glyph
;
p_string
->
pp_glyphs
[
i
]
=
(
FT_BitmapGlyph
)
tmp_glyph
;
/* Do rest */
/* Do rest */
line
.
xMax
=
p_string
->
p_glyph_pos
[
i
].
x
+
glyph_size
.
xMax
-
glyph_size
.
xMin
;
line
.
xMax
=
p_string
->
p_glyph_pos
[
i
].
x
+
glyph_size
.
xMax
-
glyph_size
.
xMin
;
line
.
yMax
=
__MAX
(
line
.
yMax
,
glyph_size
.
yMax
);
line
.
yMax
=
__MAX
(
line
.
yMax
,
glyph_size
.
yMax
);
line
.
yMin
=
__MIN
(
line
.
yMin
,
glyph_size
.
yMin
);
line
.
yMin
=
__MIN
(
line
.
yMin
,
glyph_size
.
yMin
);
i_previous
=
i_glyph_index
;
i_previous
=
i_glyph_index
;
i_pen_x
+=
glyph
->
advance
.
x
>>
6
;
i_pen_x
+=
glyph
->
advance
.
x
>>
6
;
i
++
;
i
++
;
}
}
p_string
->
pp_glyphs
[
i
]
=
NULL
;
p_string
->
pp_glyphs
[
i
]
=
NULL
;
result
.
x
=
__MAX
(
result
.
x
,
line
.
xMax
);
result
.
x
=
__MAX
(
result
.
x
,
line
.
xMax
);
result
.
y
+=
line
.
yMax
-
line
.
yMin
;
result
.
y
+=
line
.
yMax
-
line
.
yMin
;
p_string
->
i_height
=
result
.
y
;
p_string
->
i_height
=
result
.
y
;
p_string
->
i_width
=
result
.
x
;
p_string
->
i_width
=
result
.
x
;
msg_Dbg
(
p_vout
,
"string height is %d, width is %d"
,
p_string
->
i_height
,
p_string
->
i_width
);
msg_Dbg
(
p_vout
,
"string height is %d, width is %d"
,
p_string
->
i_height
,
p_string
->
i_width
);
msg_Dbg
(
p_vout
,
"adding string
\"
%s
\"
at (%d,%d) start_date "
I64Fd
msg_Dbg
(
p_vout
,
"adding string
\"
%s
\"
at (%d,%d) start_date "
I64Fd
" end_date"
I64Fd
,
p_string
->
psz_text
,
p_string
->
i_x_margin
,
" end_date"
I64Fd
,
p_string
->
psz_text
,
p_string
->
i_x_margin
,
p_string
->
i_y_margin
,
i_start
,
i_stop
);
p_string
->
i_y_margin
,
i_start
,
i_stop
);
...
@@ -496,7 +496,7 @@ static void FreeString( subpicture_t *p_subpic )
...
@@ -496,7 +496,7 @@ static void FreeString( subpicture_t *p_subpic )
subpicture_sys_t
*
p_string
=
p_subpic
->
p_sys
;
subpicture_sys_t
*
p_string
=
p_subpic
->
p_sys
;
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
{
{
FT_Done_Glyph
(
(
FT_Glyph
)
p_string
->
pp_glyphs
[
i
]
);
FT_Done_Glyph
(
(
FT_Glyph
)
p_string
->
pp_glyphs
[
i
]
);
}
}
free
(
p_string
->
psz_text
);
free
(
p_string
->
psz_text
);
free
(
p_string
->
p_glyph_pos
);
free
(
p_string
->
p_glyph_pos
);
...
...
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