8#ifndef META_OCEAN_CV_FONTS_FONT_H
9#define META_OCEAN_CV_FONTS_FONT_H
42class OCEAN_CV_FONTS_EXPORT
Font
103 inline unsigned int width()
const;
109 inline unsigned int height()
const;
127 inline unsigned int advanceX()
const;
189 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;
201 virtual bool textExtent(
const std::string& text,
unsigned int& width,
unsigned int&
height,
int* left =
nullptr,
int* top =
nullptr)
const = 0;
223 inline unsigned int size()
const;
229 inline unsigned int height()
const;
235 inline unsigned int dpi()
const;
unsigned int framePositionX_
The character's left pixel in 'charactersFrame', in pixels, with range [0, charactersFrame_....
Definition Font.h:142
unsigned int framePositionY_
The character's top pixel in 'charactersFrame', in pixels, with range [0, charactersFrame_....
Definition Font.h:145
void setPositionY(const unsigned int framePositionY, const unsigned int linePositionY)
Sets the vertical start pixel of the character inside 'charactersFrame'.
Definition Font.h:330
unsigned int height_
The character's hieght, in pixels, with rang [0, charactersFrame_.height()].
Definition Font.h:154
Character()
Creates a new invalid character object.
Definition Font.h:265
unsigned int advanceX() const
Returns the horizontal distance between this character and the next character (between the origins of...
Definition Font.h:325
unsigned int width_
The character's width, in pixels, with rang [0, charactersFrame_.width()].
Definition Font.h:151
int bearingX() const
Returns the horizontal offset of the character in relation to the origin.
Definition Font.h:315
unsigned int advanceX_
The horizontal distance between this character and the next character (between the origins of both ch...
Definition Font.h:163
unsigned int height() const
The height of the character.
Definition Font.h:310
unsigned int width() const
The width of the character.
Definition Font.h:305
int bearingX_
The character's horizontal offset, in pixels, with range (-infinity, infinity).
Definition Font.h:157
unsigned int characterIndex_
The character's index, with range [0, infinity).
Definition Font.h:139
unsigned int framePositionX() const
Returns the horizontal start pixel of the character inside 'charactersFrame'.
Definition Font.h:290
unsigned int framePositionY() const
Returns the vertical start pixel of the character inside 'charactersFrame'.
Definition Font.h:295
int bearingY() const
Returns the vertical offset of the character in relation to the origin.
Definition Font.h:320
unsigned int linePositionY() const
Returns the vertical start pixel of the character inside the target text line.
Definition Font.h:300
int bearingY_
Definition Font.h:160
unsigned int linePositionY_
The character's top pixel in the target text line, in pixel, with range [0, font.height() - 1].
Definition Font.h:148
unsigned int characterIndex() const
Returns the index of this character.
Definition Font.h:284
This class is the base class for all font implementations.
Definition Font.h:43
unsigned int dpi_
The font's dots per inch, with range [0, infinity).
Definition Font.h:259
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.
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.
unsigned int size() const
Returns the size of the font in dots.
Definition Font.h:343
virtual bool characterFrame(Frame &frame, SharedCharacters *characters=nullptr) const =0
Returns a frame containing all characters.
bool isValid_
True, if the font is valid.
Definition Font.h:262
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.
bool isValid() const
Returns whether the font is valid and whether it can be used.
Definition Font.h:364
virtual ~Font()=default
Destructs the font object.
std::vector< Character > Characters
Definition of a vector holding information about characters.
Definition Font.h:167
unsigned int height() const
Returns the height of the font in pixels.
Definition Font.h:350
Font()
Creates a new font.
Definition Font.h:338
unsigned int size_
The font's size in dots, with range [0, infinity).
Definition Font.h:253
unsigned int height_
The font's height in pixel, with range [0, infinity).
Definition Font.h:256
std::shared_ptr< Characters > SharedCharacters
Definition of a shared pointers holding characters.
Definition Font.h:170
unsigned int dpi() const
Returns the dpi of the font.
Definition Font.h:357
This class implements Ocean's image class.
Definition Frame.h:1969
std::vector< PixelBoundingBoxI > PixelBoundingBoxesI
Definition of a vector holding bounding box objects with positive and negative coordinate values.
Definition PixelBoundingBox.h:49
std::shared_ptr< Font > SharedFont
Definition of a shared font pointer.
Definition Font.h:34
Namespace of the CV Fonts library.
Definition Font.h:24
Namespace of the CV library.
Definition Advanced.h:17
The namespace covering the entire Ocean framework.
Definition Accessor.h:15