#include "freetype.hpp"
|
virtual Size | getTextSize (const String &text, int fontHeight, int thickness, int *baseLine)=0 |
| Calculates the width and height of a text string. More...
|
|
virtual void | loadFontData (String fontFileName, int id)=0 |
| Load font data. More...
|
|
virtual void | putText (InputOutputArray img, const String &text, Point org, int fontHeight, Scalar color, int thickness, int line_type, bool bottomLeftOrigin)=0 |
| Draws a text string. More...
|
|
virtual void | setSplitNumber (int num)=0 |
| Set Split Number from Bezier-curve to line. More...
|
|
| Algorithm () |
|
virtual | ~Algorithm () |
|
virtual void | clear () |
| Clears the algorithm state. More...
|
|
virtual bool | empty () const |
| Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
|
|
virtual String | getDefaultName () const |
|
virtual void | read (const FileNode &fn) |
| Reads algorithm parameters from a file storage. More...
|
|
virtual void | save (const String &filename) const |
|
virtual void | write (FileStorage &fs) const |
| Stores algorithm parameters in a file storage. More...
|
|
§ getTextSize()
virtual Size cv::freetype::FreeType2::getTextSize |
( |
const String & |
text, |
|
|
int |
fontHeight, |
|
|
int |
thickness, |
|
|
int * |
baseLine |
|
) |
| |
|
pure virtual |
Calculates the width and height of a text string.
The function getTextSize calculates and returns the approximate size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline: :
String text = "Funny text inside the box";
int fontHeight = 60;
int thickness = -1;
int linestyle = 8;
int baseline=0;
fontHeight,
thickness,
&baseline);
if(thickness > 0){
baseline += thickness;
}
Point textOrg((img.
cols - textSize.width) / 2,
(img.
rows + textSize.height) / 2);
textOrg +
Point(textSize.width, -textSize.height),
Scalar(0,255,0),1,8);
textOrg +
Point(textSize.width, thickness),
Scalar(0, 0, 255),1,8);
ft2->
putText(img, text, textOrg, fontHeight,
- Parameters
-
| text | Input text string. |
| fontHeight | Drawing font size by pixel unit. |
| thickness | Thickness of lines used to render the text. See putText for details. |
[out] | baseLine | y-coordinate of the baseline relative to the bottom-most text point. |
- Returns
- The size of a box that contains the specified text.
- See also
- cv::putText
§ loadFontData()
virtual void cv::freetype::FreeType2::loadFontData |
( |
String |
fontFileName, |
|
|
int |
id |
|
) |
| |
|
pure virtual |
Load font data.
The function loadFontData loads font data.
- Parameters
-
fontFileName | FontFile Name |
id | face_index to select a font faces in a single file. |
§ putText()
virtual void cv::freetype::FreeType2::putText |
( |
InputOutputArray |
img, |
|
|
const String & |
text, |
|
|
Point |
org, |
|
|
int |
fontHeight, |
|
|
Scalar |
color, |
|
|
int |
thickness, |
|
|
int |
line_type, |
|
|
bool |
bottomLeftOrigin |
|
) |
| |
|
pure virtual |
Draws a text string.
The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn.
- Parameters
-
img | Image. |
text | Text string to be drawn. |
org | Bottom-left/Top-left corner of the text string in the image. |
fontHeight | Drawing font size by pixel unit. |
color | Text color. |
thickness | Thickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness. |
line_type | Line type. See the line for details. |
bottomLeftOrigin | When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner. |
§ setSplitNumber()
virtual void cv::freetype::FreeType2::setSplitNumber |
( |
int |
num | ) |
|
|
pure virtual |
Set Split Number from Bezier-curve to line.
The function setSplitNumber set the number of split points from bezier-curve to line. If you want to draw large glyph, large is better. If you want to draw small glyph, small is better.
- Parameters
-
num | number of split points from bezier-curve to line |
The documentation for this class was generated from the following file:
- /build/master-contrib_docs-lin64/opencv_contrib/modules/freetype/include/opencv2/freetype.hpp