OpenCV  5.0.0-pre
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
cv::FontFace Class Reference

Wrapper on top of a truetype/opentype/etc font, i.e. Freetype's FT_Face. More...

#include <opencv2/imgproc.hpp>

Public Member Functions

 FontFace ()
 loads default font More...
 
 FontFace (const String &fontPathOrName)
 loads font at the specified path or with specified name. More...
 
 ~FontFace ()
 
bool getInstance (std::vector< int > &params) const
 
String getName () const
 
Impl * operator-> ()
 
bool set (const String &fontPathOrName)
 loads new font face More...
 
bool setInstance (const std::vector< int > &params)
 sets the current variable font instance. More...
 

Static Public Member Functions

static bool getBuiltinFontData (const String &fontName, const uchar *&data, size_t &datasize)
 

Protected Attributes

Ptr< Impl > impl
 

Detailed Description

Wrapper on top of a truetype/opentype/etc font, i.e. Freetype's FT_Face.

The class is used to store the loaded fonts; the font can then be passed to the functions putText and getTextSize.

Constructor & Destructor Documentation

◆ FontFace() [1/2]

cv::FontFace::FontFace ( )

loads default font

◆ FontFace() [2/2]

cv::FontFace::FontFace ( const String fontPathOrName)

loads font at the specified path or with specified name.

Parameters
fontPathOrNameeither path to the custom font or the name of embedded font: "sans", "italic" or "uni". Empty fontPathOrName means the default embedded font.

◆ ~FontFace()

cv::FontFace::~FontFace ( )

Member Function Documentation

◆ getBuiltinFontData()

static bool cv::FontFace::getBuiltinFontData ( const String fontName,
const uchar *&  data,
size_t &  datasize 
)
static

◆ getInstance()

bool cv::FontFace::getInstance ( std::vector< int > &  params) const
Python:
cv.FontFace.getInstance([, ]) -> retval, params

◆ getName()

String cv::FontFace::getName ( ) const
Python:
cv.FontFace.getName([, ]) -> retval

◆ operator->()

Impl* cv::FontFace::operator-> ( )

◆ set()

bool cv::FontFace::set ( const String fontPathOrName)
Python:
cv.FontFace.set(fontPathOrName[, ]) -> retval

loads new font face

◆ setInstance()

bool cv::FontFace::setInstance ( const std::vector< int > &  params)
Python:
cv.FontFace.setInstance(params[, ]) -> retval

sets the current variable font instance.

Parameters
paramsThe list of pairs key1, value1, key2, value2, ..., e.g. `myfont.setInstance({CV_FOURCC('w','g','h','t'), 400<<16, CV_FOURCC('s','l','n','t'), -(15<<16)});` Note that the parameter values are specified in 16.16 fixed-point format, that is, integer values need to be shifted by 16 (or multiplied by 65536).

Member Data Documentation

◆ impl

Ptr<Impl> cv::FontFace::impl
protected

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