This class is the base class for all font implementations.
More...
|
class | Character |
| This class stores font-specific layout information about each individual character. More...
|
|
|
virtual | ~Font ()=default |
| Destructs the font object. More...
|
|
virtual bool | drawText (Frame &frame, const std::string &text, const int left, const int top, const uint8_t *foregroundColor, const uint8_t *backgroundColor=nullptr) const =0 |
| Draws a text into a given frame. More...
|
|
virtual bool | textExtent (const std::string &text, unsigned int &width, unsigned int &height, int *left=nullptr, int *top=nullptr) const =0 |
| Returns the bounding box in which a given text will fit. More...
|
|
virtual bool | textExtent (const std::string &text, PixelBoundingBoxesI &lineBoundingBoxes) const =0 |
| Returns the bounding boxes in which each individual line of a given text will fit. More...
|
|
virtual bool | characterFrame (Frame &frame, SharedCharacters *characters=nullptr) const =0 |
| Returns a frame containing all characters. More...
|
|
unsigned int | size () const |
| Returns the size of the font in dots. More...
|
|
unsigned int | height () const |
| Returns the height of the font in pixels. More...
|
|
unsigned int | dpi () const |
| Returns the dpi of the font. More...
|
|
bool | isValid () const |
| Returns whether the font is valid and whether it can be used. More...
|
|
|
unsigned int | size_ |
| The font's size in dots, with range [0, infinity). More...
|
|
unsigned int | height_ |
| The font's height in pixel, with range [0, infinity). More...
|
|
unsigned int | dpi_ |
| The font's dots per inch, with range [0, infinity). More...
|
|
bool | isValid_ |
| True, if the font is valid. More...
|
|
This class is the base class for all font implementations.
Each font object must be acquired via the FontManager
singleton.
- See also
- FontManager.
◆ Characters
Definition of a vector holding information about characters.
◆ SharedCharacters
Definition of a shared pointers holding characters.
◆ ~Font()
virtual Ocean::CV::Fonts::Font::~Font |
( |
| ) |
|
|
virtualdefault |
Destructs the font object.
◆ Font()
Ocean::CV::Fonts::Font::Font |
( |
| ) |
|
|
inlineprotected |
◆ characterFrame()
virtual bool Ocean::CV::Fonts::Font::characterFrame |
( |
Frame & |
frame, |
|
|
SharedCharacters * |
characters = nullptr |
|
) |
| const |
|
pure virtual |
Returns a frame containing all characters.
- Parameters
-
frame | The resulting frame containing all characters, the frame will own the memory |
characters | Optional resulting layout information for each individual character |
- Returns
- True, if succeeded
Implemented in Ocean::CV::Fonts::FTFont.
◆ dpi()
unsigned int Ocean::CV::Fonts::Font::dpi |
( |
| ) |
const |
|
inline |
Returns the dpi of the font.
- Returns
- The font's dots per inch, with range [0, infinity)
◆ drawText()
virtual bool Ocean::CV::Fonts::Font::drawText |
( |
Frame & |
frame, |
|
|
const std::string & |
text, |
|
|
const int |
left, |
|
|
const int |
top, |
|
|
const uint8_t * |
foregroundColor, |
|
|
const uint8_t * |
backgroundColor = nullptr |
|
) |
| const |
|
pure virtual |
Draws a text into a given frame.
- Parameters
-
frame | The frame in which the text will be drawn, must have dataType() == DT_UNSIGNED_INTEGER_8 , must be valid |
text | The text to be drawn, can be empty |
left | The horizontal start position of the text, with range (-infinity, infinity) |
top | The vertical start positoin of the text, with range (-infinity, infinity) |
foregroundColor | The foreground color to be used, must match with the pixel format of the given frame |
backgroundColor | Optional explicit background color of the text, nullptr to draw the text without background color |
- Returns
- True, if succeeded
Implemented in Ocean::CV::Fonts::FTFont.
◆ height()
unsigned int Ocean::CV::Fonts::Font::height |
( |
| ) |
const |
|
inline |
Returns the height of the font in pixels.
- Returns
- The font's height in pixel, with range [0, infinity)
◆ isValid()
bool Ocean::CV::Fonts::Font::isValid |
( |
| ) |
const |
|
inline |
Returns whether the font is valid and whether it can be used.
- Returns
- True, if so
◆ size()
unsigned int Ocean::CV::Fonts::Font::size |
( |
| ) |
const |
|
inline |
Returns the size of the font in dots.
- Returns
- The font's size in dots, with range [0, infinity)
◆ textExtent() [1/2]
virtual bool Ocean::CV::Fonts::Font::textExtent |
( |
const std::string & |
text, |
|
|
PixelBoundingBoxesI & |
lineBoundingBoxes |
|
) |
| const |
|
pure virtual |
Returns the bounding boxes in which each individual line of a given text will fit.
- Parameters
-
text | The text for which the individual line extents will be determined, can be empty |
lineBoundingBoxes | The resulting bounding boxes, one for each text line |
- Returns
- True, if succeeded
Implemented in Ocean::CV::Fonts::FTFont.
◆ textExtent() [2/2]
virtual bool Ocean::CV::Fonts::Font::textExtent |
( |
const std::string & |
text, |
|
|
unsigned int & |
width, |
|
|
unsigned int & |
height, |
|
|
int * |
left = nullptr , |
|
|
int * |
top = nullptr |
|
) |
| const |
|
pure virtual |
Returns the bounding box in which a given text will fit.
In case the text contains multiple lines, the maximal bounding box is determined.
- Parameters
-
text | The text for which the extent will be determined, can be empty |
width | The width of the bounding box, in pixel, with range [0, infinity) |
height | The height of the bounding box, in pixel, with range [0, infinity) |
left | Optional resulting explicit horizontal start location of the bounding box (e.g., if parts of a character are drawn to the left of character's origin), nullptr otherwise |
top | Optional resulting explicit vertical start location of the bounding box, nullptr otherwise |
- Returns
- True, if succeeded
Implemented in Ocean::CV::Fonts::FTFont.
◆ dpi_
unsigned int Ocean::CV::Fonts::Font::dpi_ |
|
protected |
The font's dots per inch, with range [0, infinity).
◆ height_
unsigned int Ocean::CV::Fonts::Font::height_ |
|
protected |
The font's height in pixel, with range [0, infinity).
◆ isValid_
bool Ocean::CV::Fonts::Font::isValid_ |
|
protected |
True, if the font is valid.
◆ size_
unsigned int Ocean::CV::Fonts::Font::size_ |
|
protected |
The font's size in dots, with range [0, infinity).
The documentation for this class was generated from the following file: