You.i Engine
CYIClosedCaptionsStylingBridge Class Referenceabstract

Detailed Description

A bridge which reports operating system closed captions style.

Can be used to access the user's closed captioning style from the operating system settings.

#include <player/YiClosedCaptionsStylingBridge.h>

Classes

struct  Style
 

Public Types

enum  Mode {
  Mode::UseStyleFromContent,
  Mode::UseStyleFromUser,
  Mode::Unknown
}
 
enum  FontType {
  FontType::Default,
  FontType::MonospaceSansSerif,
  FontType::ProportionalSansSerif,
  FontType::MonospaceWithSerif,
  FontType::ProportionalWithSerif,
  FontType::Casual,
  FontType::Cursive,
  FontType::SmallCapitals,
  FontType::Custom
}
 
enum  EdgeStyle {
  EdgeStyle::Default,
  EdgeStyle::NoEdges,
  EdgeStyle::Raised,
  EdgeStyle::Depressed,
  EdgeStyle::Uniform,
  EdgeStyle::DropShadowed
}
 

Public Member Functions

 CYIClosedCaptionsStylingBridge ()
 
virtual ~CYIClosedCaptionsStylingBridge ()
 
ssize_t GetFontIdForFontType (FontType fontType) const
 
bool SetFontIdForFontType (FontType fontType, ssize_t fontId)
 
virtual Style GetClosedCaptionsStyle () const =0
 

Static Public Member Functions

static const StyleGetDefaultStyle ()
 

Member Enumeration Documentation

◆ EdgeStyle

An enum that defines the style with which the edge of the closed caption characters should be rendered. EdgeStyle::Default indicates that the edge style from the content (or from the player) should be used.

Enumerator
Default 
NoEdges 
Raised 
Depressed 
Uniform 
DropShadowed 

◆ FontType

An enum that identifies the font type to use to render closed captions. CYIClosedCaptionsStylingBridge::FontType::Default indicates that the default font from the content (or from the player) should be used.

The following table displays the font family which will be used by default for each font type.

Font Type Font Family
Default Andale Mono
MonospaceSansSerif Andale Mono
ProportionalSansSerif Helvetica
MonospaceWithSerif Courier
ProportionalWithSerif Times
Casual Comic Sans
Cursive Zapfino
SmallCapitals Andada
Custom Not Applicable

If You.i Engine is rendering the captions and the styling mode is CYIClosedCaptionsStylingBridge::Mode::UseStyleFromUser a font of this family will be used to render the captions. The application must have a font of this family loaded into CYITextEngine for the family to be used. If a font of the family is not available a computed alternative from the currently loaded fonts will be used. If no appropriate alternative exists the first available font will be used.

The application can override the above completely by using SetFontIdForFontType to map a specific loaded font to a font type.

Enumerator
Default 
MonospaceSansSerif 
ProportionalSansSerif 
MonospaceWithSerif 
ProportionalWithSerif 
Casual 
Cursive 
SmallCapitals 
Custom 

◆ Mode

An enum that defines whether the style information provided by this bridge should be used to render captions.

Enumerator
UseStyleFromContent 

Indicates that the captions should be rendered using the style provided in the captions themselves.

UseStyleFromUser 

Indicates that the captions should be rendered using the styles provided by the user.

Unknown 

Indicates that the styling data source is unknown. The captions renderer may use either the styling information from the captions, or from the user.

Constructor & Destructor Documentation

◆ CYIClosedCaptionsStylingBridge()

CYIClosedCaptionsStylingBridge::CYIClosedCaptionsStylingBridge ( )

◆ ~CYIClosedCaptionsStylingBridge()

virtual CYIClosedCaptionsStylingBridge::~CYIClosedCaptionsStylingBridge ( )
virtual

Member Function Documentation

◆ GetClosedCaptionsStyle()

virtual Style CYIClosedCaptionsStylingBridge::GetClosedCaptionsStyle ( ) const
pure virtual

Returns the closed captioning style as configured on the operating system.

◆ GetDefaultStyle()

static const Style& CYIClosedCaptionsStylingBridge::GetDefaultStyle ( )
static

Returns a closed captioning style with default configuration that is not associated with the platform configuration.

◆ GetFontIdForFontType()

ssize_t CYIClosedCaptionsStylingBridge::GetFontIdForFontType ( FontType  fontType) const

Returns the current font id associated with a given fontType.

Note
CYIClosedCaptionsStylingBridge::FontType::Custom will always return -1 as the font for custom font type is dicated by CYIClosedCaptionsStylingBridge::Style::customFontFamily.
See also
CYIApp::LoadFont
CYITextEngine::AddFont

◆ SetFontIdForFontType()

bool CYIClosedCaptionsStylingBridge::SetFontIdForFontType ( FontType  fontType,
ssize_t  fontId 
)

Sets the fontId that is associated with the given fontType. This may be used by the application when the application has specific fonts to use for captions. Specify fontId as -1 to reset the associated font to default.

Returns false if fontId does not reference a valid font loaded in CYITextEngine.

Note
CYIClosedCaptionsStylingBridge::FontType::Custom cannot be set as this is dicated by CYIClosedCaptionsStylingBridge::Style::customFontFamily and not a font determined internally.

The documentation for this class was generated from the following file: