AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
NTV2CCFont Class Reference

This is the font used when rendering CEA-608 captions into a frame buffer. I define a "dot" map having a fixed width and height, plus a fixed set of glyphs, each with a particular dot pattern. Each glyph corresponds to an NTV2_CC608_CodePoint. More...

#include <ccfont.h>

Public Member Functions

virtual bool HasGlyphFor608CodePoint (const NTV2_CC608_CodePoint in608CodePoint) const
 Returns true if there is a glyph available for the given CEA-608 code point. More...
 
virtual UWordGetGlyphFor608CodePoint (const NTV2_CC608_CodePoint in608CodePoint) const
 Returns a pointer to the "dot" bitmap of the glyph that represents the given CEA-608 code point. More...
 
virtual UWord GetGlyphRowDots (const NTV2GlyphIndex inGlyphIndex, const unsigned inRow) const
 Returns the 16-bit "dot" bitmap of the row of the character glyph having the given offset. More...
 
virtual UByte GetCCFontCharCode (const NTV2_CC608_CodePoint in608CodePoint) const
 Returns the "ASCII-like" character code that best represents the given CEA-608 code point. More...
 
virtual NTV2CodePointSet GetCodePointsForCCFontCharCode (const UByte inCharCode) const
 Returns the set of codepoints that map to a given CCFont character code. More...
 
virtual bool IsValidGlyphIndex (const NTV2GlyphIndex inGlyphIndex) const
 Returns true if the given glyph index is valid. More...
 
virtual UWord GetGlyphCount (void) const
 Returns the number of glyphs available in this caption font. More...
 
virtual std::string GetName (void) const
 Returns the name of this caption font. More...
 
virtual NTV2GlyphIndex GetUnderlineGlyphIndex (void) const
 Returns the underline character's zero-based glyph index number. More...
 
virtual NTV2GlyphIndex GetNoUnderlineSpaceGlyphIndex (void) const
 Returns the "no underline space" character's zero-based glyph index number. More...
 
virtual UByte GetUnderlineCharacterCode (void) const
 Returns the character code of the special underline glyph. More...
 
virtual UByte GetNoUnderlineSpaceCharacterCode (void) const
 Returns the character code of the special "underline space" glyph. More...
 
virtual UWord GetUnderlineStartingDotRow (void) const
 Returns the starting row position of the underline, which is below the dot map. Also takes into account the top margin, if any. More...
 
virtual UWord GetDotMapWidth (void) const
 Returns the width of the dot map, in dots. More...
 
virtual UWord GetLeftMarginDotCount (void) const
 Returns the number of dots of space to appear to the left of each blitted glyph. More...
 
virtual UWord GetRightMarginDotCount (void) const
 Returns the number of dots of space to appear to the right of each blitted glyph. More...
 
virtual UWord GetTotalWidthInDots (void) const
 Returns the total width, in dots, a blitted glyph will consume, including any left and/or right margin space. More...
 
virtual UWord GetDotMapRowCount (void) const
 Returns the height of the dot map, in dot rows. More...
 
virtual UWord GetDotMapHeight (void) const
 Returns the height of the dot map, in dots. More...
 
virtual UWord GetTopMarginDotCount (void) const
 Returns the number of dots of space to appear above each blitted glyph. More...
 
virtual UWord GetBottomMarginDotCount (void) const
 Returns the number of dots of space to appear below each blitted glyph. More...
 
virtual UWord GetTotalHeightInDots (void) const
 Returns the total height, in dots, a blitted glyph will consume, including any top and/or bottom margin space. More...
 
virtual std::string GetGlyphRowDotsAsString (const NTV2GlyphIndex inGlyphIndex, const unsigned inRow) const
 Returns a UTF-8 encoded string that contains the dot pattern for the given zero-based row number and zero-based glyph index. Each opaque (black) dot is rendered as a "full block" character (u2588), whereas each transparent (white) dot is rendered as a simple space character. More...
 
virtual std::ostream & PrintGlyphs (std::ostream &inOutStream, const NTV2GlyphIndex inFirstGlyph, const NTV2GlyphIndex inLastGlyph) const
 Renders all glyphs in the given range (inclusive) into the specified output stream as multiple rows of UTF-8 encoded strings. When displayed in a terminal using a monospaced font, it shows what the glyphs actually look like. Each black dot is rendered as a "full block" character (u2588), while white dots are rendered as spaces. More...
 
virtual bool RenderGlyph8BitYCbCr (UByte *pDestBuffer, const ULWord inBytesPerRow, const NTV2GlyphIndex inGlyphIndex, const NTV2Line21Attrs &inAttribs, const ULWord inScaledDotWidth=1, const ULWord inScaledDotHeight=1) const
 Renders the given glyph with the given display attributes into the specified 8-bit YCbCr '2vuy' destination buffer. More...
 
virtual bool RenderGlyph8BitRGB (const NTV2PixelFormat inPixelFormat, UByte *pDestBuffer, const ULWord inBytesPerRow, const NTV2GlyphIndex inGlyphIndex, const NTV2Line21Attrs &inAttribs, const ULWord inScaledDotWidth, const ULWord inScaledDotHeight, const bool inIsHD=false) const
 Renders the given glyph with the given display attributes into the specified 8-bit NTV2_FBF_ARGB destination buffer. More...
 
 NTV2CCFont ()
 
virtual ~NTV2CCFont ()
 

Static Public Member Functions

static const NTV2CCFontGetInstance (void)
 Returns a constant reference to the NTV2CCFont singleton. More...
 
static UByte GlyphIndexToCharacterCode (const NTV2GlyphIndex inGlyphIndex)
 Returns the character code that corresponds to the given glyph. More...
 
static NTV2GlyphIndex CharacterCodeToGlyphIndex (const UByte inCharacterCode)
 Returns the zero-based glyph index number that corresponds to the given character code. More...
 
static UByte UnicodeCodePointToCharacterCode (const ULWord inCodePoint)
 Returns the character code that corresponds to the given unicode codepoint. More...
 
static std::string Utf8ToCCFontByteArray (const std::string &inUtf8Str)
 Converts the given UTF-8 encoded string into a string of CCFont character codes. More...
 

Detailed Description

This is the font used when rendering CEA-608 captions into a frame buffer. I define a "dot" map having a fixed width and height, plus a fixed set of glyphs, each with a particular dot pattern. Each glyph corresponds to an NTV2_CC608_CodePoint.

Definition at line 27 of file ccfont.h.

Constructor & Destructor Documentation

◆ NTV2CCFont()

NTV2CCFont::NTV2CCFont ( )
explicit

◆ ~NTV2CCFont()

virtual NTV2CCFont::~NTV2CCFont ( )
virtual

Member Function Documentation

◆ CharacterCodeToGlyphIndex()

static NTV2GlyphIndex NTV2CCFont::CharacterCodeToGlyphIndex ( const UByte  inCharacterCode)
static

Returns the zero-based glyph index number that corresponds to the given character code.

Parameters
[in]inCharacterCodeSpecifies the character code of interest.
Returns
The zero-based glyph index number that corresponds to the given character code.

◆ GetBottomMarginDotCount()

virtual UWord NTV2CCFont::GetBottomMarginDotCount ( void  ) const
inlinevirtual

Returns the number of dots of space to appear below each blitted glyph.

Returns
The number of dots of space to appear below each blitted glyph.

Definition at line 204 of file ccfont.h.

◆ GetCCFontCharCode()

virtual UByte NTV2CCFont::GetCCFontCharCode ( const NTV2_CC608_CodePoint  in608CodePoint) const
virtual

Returns the "ASCII-like" character code that best represents the given CEA-608 code point.

Parameters
[in]in608CodePointSpecifies the CEA-608 code point for which a CCFont character code is being requested.
Returns
The "ASCII-like" character code that best represents the given CEA-608 code point; otherwise, 0x0.

◆ GetCodePointsForCCFontCharCode()

virtual NTV2CodePointSet NTV2CCFont::GetCodePointsForCCFontCharCode ( const UByte  inCharCode) const
virtual

Returns the set of codepoints that map to a given CCFont character code.

Parameters
[in]inCharCodeSpecifies the CCFont character code of interest. Valid values are from 0x20 and less than NTV2_CCFont_NumChars+0x20.
Returns
The set of NTV2_CC608_CodePoint values that map to the given CCFont character code.

◆ GetDotMapHeight()

virtual UWord NTV2CCFont::GetDotMapHeight ( void  ) const
inlinevirtual

Returns the height of the dot map, in dots.

Returns
The height of the dot map, in dots.

Definition at line 192 of file ccfont.h.

◆ GetDotMapRowCount()

virtual UWord NTV2CCFont::GetDotMapRowCount ( void  ) const
inlinevirtual

Returns the height of the dot map, in dot rows.

Returns
The height of the dot map, in dot rows.

Definition at line 186 of file ccfont.h.

◆ GetDotMapWidth()

virtual UWord NTV2CCFont::GetDotMapWidth ( void  ) const
inlinevirtual

Returns the width of the dot map, in dots.

Returns
The width of the dot map, in dots.

Definition at line 162 of file ccfont.h.

◆ GetGlyphCount()

virtual UWord NTV2CCFont::GetGlyphCount ( void  ) const
inlinevirtual

Returns the number of glyphs available in this caption font.

Returns
The number of glyphs in this caption font.

Definition at line 119 of file ccfont.h.

◆ GetGlyphFor608CodePoint()

virtual UWord* NTV2CCFont::GetGlyphFor608CodePoint ( const NTV2_CC608_CodePoint  in608CodePoint) const
virtual

Returns a pointer to the "dot" bitmap of the glyph that represents the given CEA-608 code point.

Parameters
[in]in608CodePointSpecifies the CEA-608 code point for which a glyph is being requested.
Returns
If available, a valid non-NULL pointer to the character "dot" bitmap for the given codepoint; otherwise, NULL.

◆ GetGlyphRowDots()

virtual UWord NTV2CCFont::GetGlyphRowDots ( const NTV2GlyphIndex  inGlyphIndex,
const unsigned  inRow 
) const
virtual

Returns the 16-bit "dot" bitmap of the row of the character glyph having the given offset.

Parameters
[in]inGlyphIndexSpecifies the glyph index, which must be less than the value returned from GetGlyphCount().
[in]inRowSpecifies the row of interest in the "dot" bitmap, which must be less than the value returned from GetDotMapHeight().
Returns
The 16-bit "dot" bitmap of the row of the character glyph having the given offset.

◆ GetGlyphRowDotsAsString()

virtual std::string NTV2CCFont::GetGlyphRowDotsAsString ( const NTV2GlyphIndex  inGlyphIndex,
const unsigned  inRow 
) const
virtual

Returns a UTF-8 encoded string that contains the dot pattern for the given zero-based row number and zero-based glyph index. Each opaque (black) dot is rendered as a "full block" character (u2588), whereas each transparent (white) dot is rendered as a simple space character.

Parameters
[in]inGlyphIndexSpecifies the glyph of interest, expressed as a zero-based index number. This must be less than the value returned from GetGlyphCount.
[in]inRowSpecifies the zero-based row of interest in the glyph's dot map. This must be less than the value returned from GetDotMapHeight.
Returns
The UTF-8 encoded string.

◆ GetInstance()

static const NTV2CCFont& NTV2CCFont::GetInstance ( void  )
static

Returns a constant reference to the NTV2CCFont singleton.

◆ GetLeftMarginDotCount()

virtual UWord NTV2CCFont::GetLeftMarginDotCount ( void  ) const
inlinevirtual

Returns the number of dots of space to appear to the left of each blitted glyph.

Returns
The number of dots of space to appear to the left of each blitted glyph.

Definition at line 168 of file ccfont.h.

◆ GetName()

virtual std::string NTV2CCFont::GetName ( void  ) const
inlinevirtual

Returns the name of this caption font.

Returns
A string containing the name of this caption font.

Definition at line 125 of file ccfont.h.

◆ GetNoUnderlineSpaceCharacterCode()

virtual UByte NTV2CCFont::GetNoUnderlineSpaceCharacterCode ( void  ) const
inlinevirtual

Returns the character code of the special "underline space" glyph.

Returns
The character code of the special "underline space" glyph.

Definition at line 149 of file ccfont.h.

◆ GetNoUnderlineSpaceGlyphIndex()

virtual NTV2GlyphIndex NTV2CCFont::GetNoUnderlineSpaceGlyphIndex ( void  ) const
inlinevirtual

Returns the "no underline space" character's zero-based glyph index number.

Returns
The zero-based glyph index of the special "no underline space" character.

Definition at line 137 of file ccfont.h.

◆ GetRightMarginDotCount()

virtual UWord NTV2CCFont::GetRightMarginDotCount ( void  ) const
inlinevirtual

Returns the number of dots of space to appear to the right of each blitted glyph.

Returns
The number of dots of space to appear to the right of each blitted glyph.

Definition at line 174 of file ccfont.h.

◆ GetTopMarginDotCount()

virtual UWord NTV2CCFont::GetTopMarginDotCount ( void  ) const
inlinevirtual

Returns the number of dots of space to appear above each blitted glyph.

Returns
The number of dots of space to appear above each blitted glyph.

Definition at line 198 of file ccfont.h.

◆ GetTotalHeightInDots()

virtual UWord NTV2CCFont::GetTotalHeightInDots ( void  ) const
inlinevirtual

Returns the total height, in dots, a blitted glyph will consume, including any top and/or bottom margin space.

Returns
The total height, in dots, a blitted glyph will consume.

Definition at line 210 of file ccfont.h.

◆ GetTotalWidthInDots()

virtual UWord NTV2CCFont::GetTotalWidthInDots ( void  ) const
inlinevirtual

Returns the total width, in dots, a blitted glyph will consume, including any left and/or right margin space.

Returns
The total width, in dots, a blitted glyph will consume.

Definition at line 180 of file ccfont.h.

◆ GetUnderlineCharacterCode()

virtual UByte NTV2CCFont::GetUnderlineCharacterCode ( void  ) const
inlinevirtual

Returns the character code of the special underline glyph.

Returns
The character code of the special underline glyph.

Definition at line 143 of file ccfont.h.

◆ GetUnderlineGlyphIndex()

virtual NTV2GlyphIndex NTV2CCFont::GetUnderlineGlyphIndex ( void  ) const
inlinevirtual

Returns the underline character's zero-based glyph index number.

Returns
The zero-based glyph index of the underline character.

Definition at line 131 of file ccfont.h.

◆ GetUnderlineStartingDotRow()

virtual UWord NTV2CCFont::GetUnderlineStartingDotRow ( void  ) const
inlinevirtual

Returns the starting row position of the underline, which is below the dot map. Also takes into account the top margin, if any.

Returns
The underline row offset, taking into account the top margin (if any) and the dot map height.

Definition at line 156 of file ccfont.h.

◆ GlyphIndexToCharacterCode()

static UByte NTV2CCFont::GlyphIndexToCharacterCode ( const NTV2GlyphIndex  inGlyphIndex)
static

Returns the character code that corresponds to the given glyph.

Parameters
[in]inGlyphIndexSpecifies the zero-based index number of the glyph of interest.
Returns
The character code that corresponds to the given glyph.

◆ HasGlyphFor608CodePoint()

virtual bool NTV2CCFont::HasGlyphFor608CodePoint ( const NTV2_CC608_CodePoint  in608CodePoint) const
virtual

Returns true if there is a glyph available for the given CEA-608 code point.

Parameters
[in]in608CodePointSpecifies the CEA-608 code point of interest.
Returns
True if there is a glyph available for the given CEA-608 code point; otherwise false.

◆ IsValidGlyphIndex()

virtual bool NTV2CCFont::IsValidGlyphIndex ( const NTV2GlyphIndex  inGlyphIndex) const
inlinevirtual

Returns true if the given glyph index is valid.

Parameters
[in]inGlyphIndexSpecifies the glyph index of interest.
Returns
True if there is a glyph available for the given index; otherwise false.

Definition at line 113 of file ccfont.h.

◆ PrintGlyphs()

virtual std::ostream& NTV2CCFont::PrintGlyphs ( std::ostream &  inOutStream,
const NTV2GlyphIndex  inFirstGlyph,
const NTV2GlyphIndex  inLastGlyph 
) const
virtual

Renders all glyphs in the given range (inclusive) into the specified output stream as multiple rows of UTF-8 encoded strings. When displayed in a terminal using a monospaced font, it shows what the glyphs actually look like. Each black dot is rendered as a "full block" character (u2588), while white dots are rendered as spaces.

Parameters
inOutStreamSpecifies the output stream to use.
[in]inFirstGlyphSpecifies the zero-based index of the first glyph to be printed into the output stream. This must be less than the value returned from GetGlyphCount, and also must be less than the value used in "inLastGlyph".
[in]inLastGlyphSpecifies the zero-based index of the last glyph to be printed into the output stream. This must be less than the value returned from GetGlyphCount.
Returns
The output stream that was passed into the "inOutStream" parameter.

◆ RenderGlyph8BitRGB()

virtual bool NTV2CCFont::RenderGlyph8BitRGB ( const NTV2PixelFormat  inPixelFormat,
UByte pDestBuffer,
const ULWord  inBytesPerRow,
const NTV2GlyphIndex  inGlyphIndex,
const NTV2Line21Attrs inAttribs,
const ULWord  inScaledDotWidth,
const ULWord  inScaledDotHeight,
const bool  inIsHD = false 
) const
virtual

Renders the given glyph with the given display attributes into the specified 8-bit NTV2_FBF_ARGB destination buffer.

Parameters
[in]inPixelFormatSpecifies which 8-bit RGB pixel format the destination buffer has. Must be one of NTV2_FBF_ARGB, NTV2_FBF_RGBA or NTV2_FBF_ABGR.
pDestBufferSpecifies the destination buffer that is to receive the "blitted" glyph.
[in]inBytesPerRowSpecifies the number of bytes per row in the destination buffer.
[in]inGlyphIndexSpecifies the glyph to be blitted. Must be less than the given font's glyph count.
[in]inAttribsSpecifies the attributes the blitted glyph should be rendered with (color, italic, underline, etc.).
[in]inScaledDotWidthSpecifies the number of horizontal pixels per glyph "dot".
[in]inScaledDotHeightSpecifies the number of vertical pixels (lines) per glyph "dot".
[in]inIsHDUse true for Rec709 color translation; otherwise false for Rec601. Defaults to false (Rec601).

◆ RenderGlyph8BitYCbCr()

virtual bool NTV2CCFont::RenderGlyph8BitYCbCr ( UByte pDestBuffer,
const ULWord  inBytesPerRow,
const NTV2GlyphIndex  inGlyphIndex,
const NTV2Line21Attrs inAttribs,
const ULWord  inScaledDotWidth = 1,
const ULWord  inScaledDotHeight = 1 
) const
virtual

Renders the given glyph with the given display attributes into the specified 8-bit YCbCr '2vuy' destination buffer.

Parameters
pDestBufferSpecifies the destination buffer that is to receive the "blitted" glyph.
[in]inBytesPerRowSpecifies the number of bytes per row in the destination buffer.
[in]inGlyphIndexSpecifies the glyph to be blitted. Must be less than the given font's glyph count.
[in]inAttribsSpecifies the attributes the blitted glyph should be rendered with (color, italic, underline, etc.).
[in]inScaledDotWidthSpecifies the number of horizontal pixels per glyph "dot".
[in]inScaledDotHeightSpecifies the number of vertical pixels (lines) per glyph "dot".

◆ UnicodeCodePointToCharacterCode()

static UByte NTV2CCFont::UnicodeCodePointToCharacterCode ( const ULWord  inCodePoint)
static

Returns the character code that corresponds to the given unicode codepoint.

Parameters
[in]inCodePointSpecifies the unicode code point to be converted.
Returns
The character code that corresponds to the given unicode codepoint.

◆ Utf8ToCCFontByteArray()

static std::string NTV2CCFont::Utf8ToCCFontByteArray ( const std::string &  inUtf8Str)
static

Converts the given UTF-8 encoded string into a string of CCFont character codes.

Parameters
[in]inUtf8StrSpecifies the UTF-8 encoded string to be converted.
Returns
A string of equivalent CCFont-compatible character codes.

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