LiVES  3.2.0
pangotext.h
Go to the documentation of this file.
1 // pangotext.h
2 // text handling code
3 // (c) A. Penkov 2010
4 // pieces of code taken and modified from scribbler.c
5 // released under the GNU GPL 3 or later
6 // see file COPYING or www.gnu.org for details
7 
8 // (c) G. Finch 2002 - 2015
9 
10 #ifndef LIVES_PANGOTEXT_H
11 #define LIVES_PANGOTEXT_H
12 
13 #define SUB_OPACITY 20480 // TODO
14 
15 typedef enum {
20 
21 // for future use
22 typedef struct {
26 
27 typedef struct _lives_subtitle_t xlives_subtitle_t;
28 
29 typedef struct _lives_subtitle_t {
30  double start_time;
31  double end_time;
33  long textpos;
37 
38 typedef struct {
40  int tfile;
41  char *text;
45  int offset;
46  double last_time;
48 
49 typedef enum {
55 
56 char **get_font_list(void);
57 
58 weed_plant_t *render_text_overlay(weed_layer_t *layer, const char *text);
59 
60 weed_plant_t *render_text_to_layer(weed_layer_t *layer, const char *text, const char *fontname,
61  double size, lives_text_mode_t mode, lives_colRGBA64_t *fg_col,
62  lives_colRGBA64_t *bg_col, boolean center, boolean rising, double top);
63 
64 LingoLayout *render_text_to_cr(LiVESWidget *widget, lives_painter_t *, const char *text, const char *fontname,
65  double size, lives_text_mode_t mode, lives_colRGBA64_t *fg_col, lives_colRGBA64_t *bg_col,
66  boolean center, boolean rising, double *top, int *start, int dwidth, int *dheight);
67 
68 void layout_to_lives_painter(LingoLayout *layout, lives_painter_t *cr, lives_text_mode_t mode, lives_colRGBA64_t *fg,
69  lives_colRGBA64_t *bg, int dwidth, int dheight, double x_bg, double y_bg, double x_text, double y_text);
70 
71 LingoLayout *layout_nth_message_at_bottom(int n, int width, int height, LiVESWidget *widget, int *linecount);
72 
74 
75 #define SRT_DEF_CHARSET "Windows-1252"
76 #define LIVES_CHARSET_UTF8 "UTF-8"
77 
78 typedef struct _lives_clip_t lives_clip_t;
79 
80 boolean subtitles_init(lives_clip_t *sfile, char *fname, lives_subtitle_type_t);
81 void subtitles_free(lives_clip_t *sfile);
82 boolean get_subt_text(lives_clip_t *sfile, double xtime);
83 boolean save_sub_subtitles(lives_clip_t *sfile, double start_time, double end_time, double offset_time, const char *filename);
84 boolean save_srt_subtitles(lives_clip_t *sfile, double start_time, double end_time, double offset_time, const char *filename);
85 
86 boolean lives_parse_font_string(const char *string, char **font, int *size, char **stretch,
87  char **style, char **weight);
88 
89 #endif
90 
layout_to_lives_painter
void layout_to_lives_painter(LingoLayout *layout, lives_painter_t *cr, lives_text_mode_t mode, lives_colRGBA64_t *fg, lives_colRGBA64_t *bg, int dwidth, int dheight, double x_bg, double y_bg, double x_text, double y_text)
Definition: pangotext.c:165
lives_subtitle_t::style
lives_subtitle_style_t * style
for future use
Definition: pangotext.h:32
lives_subtitle_t::textpos
long textpos
Definition: pangotext.h:33
lives_subtitle_type_t
lives_subtitle_type_t
Definition: pangotext.h:15
xlives_subtitle_t
struct _lives_subtitle_t xlives_subtitle_t
Definition: pangotext.h:27
lives_subtitle_style_t
Definition: pangotext.h:22
lives_subtitle_t::prev
xlives_subtitle_t * prev
for future use
Definition: pangotext.h:34
save_sub_subtitles
boolean save_sub_subtitles(lives_clip_t *sfile, double start_time, double end_time, double offset_time, const char *filename)
Definition: pangotext.c:1101
lives_subtitles_t::first
lives_subtitle_t * first
Definition: pangotext.h:43
LIVES_TEXT_MODE_FOREGROUND_ONLY
@ LIVES_TEXT_MODE_FOREGROUND_ONLY
Definition: pangotext.h:50
subtitles_free
void subtitles_free(lives_clip_t *sfile)
Definition: pangotext.c:976
get_font_list
char ** get_font_list(void)
Definition: pangotext.c:416
subtitles_init
boolean subtitles_init(lives_clip_t *sfile, char *fname, lives_subtitle_type_t)
Definition: pangotext.c:996
layout_nth_message_at_bottom
LingoLayout * layout_nth_message_at_bottom(int n, int width, int height, LiVESWidget *widget, int *linecount)
Definition: pangotext.c:193
lives_parse_font_string
boolean lives_parse_font_string(const char *string, char **font, int *size, char **stretch, char **style, char **weight)
Definition: pangotext.c:1182
lives_subtitles_t::last_time
double last_time
Definition: pangotext.h:46
SUBTITLE_TYPE_SUB
@ SUBTITLE_TYPE_SUB
Definition: pangotext.h:18
lives_subtitles_t::tfile
int tfile
Definition: pangotext.h:40
save_srt_subtitles
boolean save_srt_subtitles(lives_clip_t *sfile, double start_time, double end_time, double offset_time, const char *filename)
Definition: pangotext.c:1039
lives_subtitle_t::end_time
double end_time
Definition: pangotext.h:31
LIVES_TEXT_MODE_BACKGROUND_ONLY
@ LIVES_TEXT_MODE_BACKGROUND_ONLY
Definition: pangotext.h:52
weed_layer_t
weed_plant_t weed_layer_t
Definition: colourspace.h:71
LIVES_TEXT_MODE_FOREGROUND_AND_BACKGROUND
@ LIVES_TEXT_MODE_FOREGROUND_AND_BACKGROUND
Definition: pangotext.h:51
lives_colRGB48_t
Definition: main.h:316
SUBTITLE_TYPE_NONE
@ SUBTITLE_TYPE_NONE
Definition: pangotext.h:16
lives_subtitles_t::offset
int offset
offset in frames (default 0)
Definition: pangotext.h:45
render_text_to_layer
weed_plant_t * render_text_to_layer(weed_layer_t *layer, const char *text, const char *fontname, double size, lives_text_mode_t mode, lives_colRGBA64_t *fg_col, lives_colRGBA64_t *bg_col, boolean center, boolean rising, double top)
Definition: pangotext.c:570
lives_colRGBA64_t
Definition: main.h:322
lives_subtitles_t::type
lives_subtitle_type_t type
Definition: pangotext.h:39
get_subt_text
boolean get_subt_text(lives_clip_t *sfile, double xtime)
Definition: pangotext.c:930
lives_text_mode_t
lives_text_mode_t
Definition: pangotext.h:49
render_text_to_cr
LingoLayout * render_text_to_cr(LiVESWidget *widget, lives_painter_t *, const char *text, const char *fontname, double size, lives_text_mode_t mode, lives_colRGBA64_t *fg_col, lives_colRGBA64_t *bg_col, boolean center, boolean rising, double *top, int *start, int dwidth, int *dheight)
Definition: pangotext.c:468
lives_subtitle_style_t::bg
lives_colRGB48_t bg
Definition: pangotext.h:24
lives_subtitles_t::current
lives_subtitle_t * current
pointer to current entry in index
Definition: pangotext.h:42
lives_subtitles_t::text
char * text
Definition: pangotext.h:41
lives_clip_t
corresponds to one clip in the GUI
Definition: main.h:877
lives_subtitle_t
Definition: pangotext.h:29
lives_subtitle_t::start_time
double start_time
Definition: pangotext.h:30
lives_subtitles_t::last
lives_subtitle_t * last
Definition: pangotext.h:44
lives_subtitles_t
Definition: pangotext.h:38
render_text_overlay
weed_plant_t * render_text_overlay(weed_layer_t *layer, const char *text)
Definition: pangotext.c:543
lives_subtitle_style_t::fg
lives_colRGB48_t fg
Definition: pangotext.h:23
LIVES_TEXT_MODE_PRECALCULATE
@ LIVES_TEXT_MODE_PRECALCULATE
Definition: pangotext.h:53
lives_subtitle_t::next
xlives_subtitle_t * next
Definition: pangotext.h:35
SUBTITLE_TYPE_SRT
@ SUBTITLE_TYPE_SRT
Definition: pangotext.h:17