VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_text_style.h File Reference
Include dependency graph for vlc_text_style.h:

Go to the source code of this file.

Data Structures

struct  text_style_t
 Text style. More...
 
struct  text_segment_ruby_t
 Text segment ruby for subtitles Each ruby has an anchor to the segment char. More...
 
struct  text_segment_t
 Text segment for subtitles. More...
 

Macros

#define STYLE_ALPHA_OPAQUE   0xFF
 
#define STYLE_ALPHA_TRANSPARENT   0x00
 
#define STYLE_NO_DEFAULTS   0x0
 
#define STYLE_FULLY_SET   0xFFFF
 
#define STYLE_HAS_FONT_COLOR   (1 << 0)
 
#define STYLE_HAS_FONT_ALPHA   (1 << 1)
 
#define STYLE_HAS_FLAGS   (1 << 2)
 
#define STYLE_HAS_OUTLINE_COLOR   (1 << 3)
 
#define STYLE_HAS_OUTLINE_ALPHA   (1 << 4)
 
#define STYLE_HAS_SHADOW_COLOR   (1 << 5)
 
#define STYLE_HAS_SHADOW_ALPHA   (1 << 6)
 
#define STYLE_HAS_BACKGROUND_COLOR   (1 << 7)
 
#define STYLE_HAS_BACKGROUND_ALPHA   (1 << 8)
 
#define STYLE_HAS_WRAP_INFO   (1 << 9)
 
#define STYLE_BOLD   (1 << 0)
 
#define STYLE_ITALIC   (1 << 1)
 
#define STYLE_OUTLINE   (1 << 2)
 
#define STYLE_SHADOW   (1 << 3)
 
#define STYLE_BACKGROUND   (1 << 4)
 
#define STYLE_UNDERLINE   (1 << 5)
 
#define STYLE_STRIKEOUT   (1 << 6)
 
#define STYLE_HALFWIDTH   (1 << 7)
 
#define STYLE_MONOSPACED   (1 << 8)
 
#define STYLE_DOUBLEWIDTH   (1 << 9)
 
#define STYLE_BLINK_FOREGROUND   (1 << 10)
 
#define STYLE_BLINK_BACKGROUND   (1 << 11)
 
#define STYLE_DEFAULT_FONT_SIZE   20
 
#define STYLE_DEFAULT_REL_FONT_SIZE   6.25
 

Typedefs

typedef struct text_segment_t text_segment_t
 
typedef struct text_segment_ruby_t text_segment_ruby_t
 

Functions

text_style_ttext_style_New (void)
 Create a default text style.
 
text_style_ttext_style_Create (int)
 Create a text style.
 
text_style_ttext_style_Copy (text_style_t *, const text_style_t *)
 Copy a text style into another.
 
text_style_ttext_style_Duplicate (const text_style_t *)
 Duplicate a text style.
 
void text_style_Merge (text_style_t *, const text_style_t *, bool b_override)
 Merge two styles using non default values.
 
void text_style_Delete (text_style_t *)
 Delete a text style created by text_style_New or text_style_Duplicate.
 
text_segment_ttext_segment_New (const char *)
 This function will create a new text segment.
 
text_segment_ttext_segment_NewInheritStyle (const text_style_t *p_style)
 This function will create a new text segment and duplicates the style passed as argument.
 
void text_segment_Delete (text_segment_t *)
 Delete a text segment and its content.
 
void text_segment_ChainDelete (text_segment_t *)
 This function will destroy a list of text segments allocated by text_segment_New.
 
text_segment_ttext_segment_Copy (text_segment_t *)
 This function will copy a text_segment and its chain into a new one.
 
text_segment_ruby_ttext_segment_ruby_New (const char *psz_base, const char *psz_rt)
 This function will create a ruby section for a text_segment.
 
void text_segment_ruby_ChainDelete (text_segment_ruby_t *p_ruby)
 Deletes a ruby sections chain.
 
text_segment_ttext_segment_FromRuby (text_segment_ruby_t *p_ruby)
 This function creates a text segment from a ruby section, and creates fallback string.
 
unsigned int vlc_html_color (const char *psz_value, bool *ok)
 Returns an integer representation of an HTML color.
 

Macro Definition Documentation

◆ STYLE_ALPHA_OPAQUE

#define STYLE_ALPHA_OPAQUE   0xFF

◆ STYLE_ALPHA_TRANSPARENT

#define STYLE_ALPHA_TRANSPARENT   0x00

◆ STYLE_BACKGROUND

#define STYLE_BACKGROUND   (1 << 4)

◆ STYLE_BLINK_BACKGROUND

#define STYLE_BLINK_BACKGROUND   (1 << 11)

◆ STYLE_BLINK_FOREGROUND

#define STYLE_BLINK_FOREGROUND   (1 << 10)

◆ STYLE_BOLD

#define STYLE_BOLD   (1 << 0)

◆ STYLE_DEFAULT_FONT_SIZE

#define STYLE_DEFAULT_FONT_SIZE   20

◆ STYLE_DEFAULT_REL_FONT_SIZE

#define STYLE_DEFAULT_REL_FONT_SIZE   6.25

◆ STYLE_DOUBLEWIDTH

#define STYLE_DOUBLEWIDTH   (1 << 9)

◆ STYLE_FULLY_SET

#define STYLE_FULLY_SET   0xFFFF

◆ STYLE_HALFWIDTH

#define STYLE_HALFWIDTH   (1 << 7)

◆ STYLE_HAS_BACKGROUND_ALPHA

#define STYLE_HAS_BACKGROUND_ALPHA   (1 << 8)

◆ STYLE_HAS_BACKGROUND_COLOR

#define STYLE_HAS_BACKGROUND_COLOR   (1 << 7)

◆ STYLE_HAS_FLAGS

#define STYLE_HAS_FLAGS   (1 << 2)

◆ STYLE_HAS_FONT_ALPHA

#define STYLE_HAS_FONT_ALPHA   (1 << 1)

◆ STYLE_HAS_FONT_COLOR

#define STYLE_HAS_FONT_COLOR   (1 << 0)

◆ STYLE_HAS_OUTLINE_ALPHA

#define STYLE_HAS_OUTLINE_ALPHA   (1 << 4)

◆ STYLE_HAS_OUTLINE_COLOR

#define STYLE_HAS_OUTLINE_COLOR   (1 << 3)

◆ STYLE_HAS_SHADOW_ALPHA

#define STYLE_HAS_SHADOW_ALPHA   (1 << 6)

◆ STYLE_HAS_SHADOW_COLOR

#define STYLE_HAS_SHADOW_COLOR   (1 << 5)

◆ STYLE_HAS_WRAP_INFO

#define STYLE_HAS_WRAP_INFO   (1 << 9)

◆ STYLE_ITALIC

#define STYLE_ITALIC   (1 << 1)

◆ STYLE_MONOSPACED

#define STYLE_MONOSPACED   (1 << 8)

◆ STYLE_NO_DEFAULTS

#define STYLE_NO_DEFAULTS   0x0

◆ STYLE_OUTLINE

#define STYLE_OUTLINE   (1 << 2)

◆ STYLE_SHADOW

#define STYLE_SHADOW   (1 << 3)

◆ STYLE_STRIKEOUT

#define STYLE_STRIKEOUT   (1 << 6)

◆ STYLE_UNDERLINE

#define STYLE_UNDERLINE   (1 << 5)

Typedef Documentation

◆ text_segment_ruby_t

◆ text_segment_t

Function Documentation

◆ text_segment_ChainDelete()

void text_segment_ChainDelete ( text_segment_t segment)

This function will destroy a list of text segments allocated by text_segment_New.

You may pass it NULL.

References text_segment_t::p_next, and text_segment_Delete().

Referenced by subpicture_region_Delete().

◆ text_segment_Copy()

text_segment_t * text_segment_Copy ( text_segment_t p_src)

This function will copy a text_segment and its chain into a new one.

You may give it NULL, but it will return NULL.

References text_segment_t::p_next, text_segment_t::p_ruby, text_segment_t::psz_text, text_segment_t::style, text_segment_New(), text_segment_ruby_Duplicate(), text_style_Duplicate(), and unlikely.

◆ text_segment_Delete()

void text_segment_Delete ( text_segment_t segment)

Delete a text segment and its content.

This assumes the segment is not part of a chain

References text_segment_t::p_ruby, text_segment_t::psz_text, text_segment_t::style, text_segment_ruby_ChainDelete(), and text_style_Delete().

Referenced by text_segment_ChainDelete(), text_segment_NewInheritStyle(), and vout_OSDSegment().

◆ text_segment_FromRuby()

text_segment_t * text_segment_FromRuby ( text_segment_ruby_t p_ruby)

This function creates a text segment from a ruby section, and creates fallback string.

References p, text_segment_ruby_t::p_next, text_segment_t::p_ruby, text_segment_t::psz_text, and text_segment_New().

◆ text_segment_New()

text_segment_t * text_segment_New ( const char *  psz_text)

This function will create a new text segment.

You should use text_segment_ChainDelete to destroy it, to clean all the linked segments, or text_segment_Delete to free a specific one

This duplicates the string passed as argument

References text_segment_t::psz_text, and strdup().

Referenced by OSDTextUpdate(), text_segment_Copy(), text_segment_FromRuby(), text_segment_NewInheritStyle(), and vout_OSDSegment().

◆ text_segment_NewInheritStyle()

text_segment_t * text_segment_NewInheritStyle ( const text_style_t p_style)

This function will create a new text segment and duplicates the style passed as argument.

You should use text_segment_ChainDelete to destroy it, to clean all the linked segments, or text_segment_Delete to free a specific one

This doesn't initialize the text.

References text_segment_t::style, text_segment_Delete(), text_segment_New(), text_style_Duplicate(), and unlikely.

◆ text_segment_ruby_ChainDelete()

void text_segment_ruby_ChainDelete ( text_segment_ruby_t p_ruby)

◆ text_segment_ruby_New()

text_segment_ruby_t * text_segment_ruby_New ( const char *  psz_base,
const char *  psz_rt 
)

This function will create a ruby section for a text_segment.

References text_segment_ruby_t::p_next, text_segment_ruby_t::psz_base, text_segment_ruby_t::psz_rt, strdup(), and text_segment_ruby_ChainDelete().

Referenced by text_segment_ruby_Duplicate().

◆ text_style_Copy()

text_style_t * text_style_Copy ( text_style_t p_dst,
const text_style_t p_src 
)

Copy a text style into another.

References text_style_t::psz_fontname, text_style_t::psz_monofontname, and strdup().

Referenced by text_style_Duplicate().

◆ text_style_Create()

text_style_t * text_style_Create ( int  i_defaults)

◆ text_style_Delete()

void text_style_Delete ( text_style_t p_style)

Delete a text style created by text_style_New or text_style_Duplicate.

References text_style_t::psz_fontname, and text_style_t::psz_monofontname.

Referenced by text_segment_Delete().

◆ text_style_Duplicate()

text_style_t * text_style_Duplicate ( const text_style_t p_src)

Duplicate a text style.

References text_style_Copy().

Referenced by text_segment_Copy(), and text_segment_NewInheritStyle().

◆ text_style_Merge()

◆ text_style_New()

text_style_t * text_style_New ( void  )

Create a default text style.

References STYLE_FULLY_SET, and text_style_Create().

◆ vlc_html_color()

unsigned int vlc_html_color ( const char *  psz_value,
bool *  ok 
)

Returns an integer representation of an HTML color.

Parameters
psz_valueAn HTML color, which can be either:
  • A standard HTML color (red, cyan, ...) as defined in p_html_colors
  • An hexadecimal color, of the form [#]RRGGBB[AA]
  • A decimal-based color, of the form rgb(RRR,GGG,BBB) or rgba(RRR,GGG,BBB,AAA)
okIf non-null, true will be stored in this pointer to signal a successful conversion

References i_value, p_html_colors, psz_name, psz_value, and strcasecmp().