OpenCV  5.0.0alpha
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::FontFace Class Reference

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

#include <opencv2/imgproc.hpp>

Collaboration diagram for cv::FontFace:

Public Member Functions

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

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.

Examples
samples/dnn/classification.cpp, samples/dnn/object_detection.cpp, samples/dnn/segmentation.cpp, and samples/dnn/text_detection.cpp.

Constructor & Destructor Documentation

◆ FontFace() [1/2]

cv::FontFace::FontFace ( )
Python:
cv.FontFace() -> <FontFace object>
cv.FontFace(fontPathOrName) -> <FontFace object>

loads default font

◆ FontFace() [2/2]

cv::FontFace::FontFace ( const String & fontPathOrName)
Python:
cv.FontFace() -> <FontFace object>
cv.FontFace(fontPathOrName) -> <FontFace object>

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: