Project

General

Profile

BitmapToolkit Scol plugin
freetypeFont.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25#ifndef __BTK_FREETYPEFONT_H__
26#define __BTK_FREETYPEFONT_H__
27
28#include <opencv2/core.hpp>
29#include <opencv2/imgproc.hpp>
30#include <opencv2/imgproc/imgproc_c.h> // for CV_AA
31#include "opencv2/opencv_modules.hpp"
32
33#include <iostream>
34#include <cstdio>
35#include <vector>
36
37#include <ft2build.h>
38#include FT_CACHE_H
39#include FT_GLYPH_H
40#include FT_BITMAP_H
41
42#include FT_FREETYPE_H
43#include FT_OUTLINE_H
44#include FT_IMAGE_H
45#include FT_BBOX_H
46
47#include <hb.h>
48#include <hb-ft.h>
49
50namespace cv {
51 namespace freetype {
54 class FreeTypeFont : public Algorithm
55 {
56 public:
65 virtual bool loadFontData(String fontFileName, int idx) = 0;
66
67 virtual bool loadFontData(const FT_Byte* fontData, FT_Long fontDataSize, int idx) = 0;
68
78 virtual void setSplitNumber(int num) = 0;
79
94 virtual void putText(
95 InputOutputArray img, const String& text, Point org,
96 int fontHeight, Scalar color,
97 int thickness, int line_type, bool bottomLeftOrigin
98 ) = 0;
99
155 virtual Size getTextSize(const String& text,
156 int fontHeight, int thickness,
157 CV_OUT int* baseLine) = 0;
158
159 };
160
166 Ptr<FreeTypeFont> createFreeTypeFont();
167
169 }
170} // namespace freetype
171
172#endif //__BTK_FREETYPEFONT_H__
virtual bool loadFontData(String fontFileName, int idx)=0
Load font data.
virtual void setSplitNumber(int num)=0
Set Split Number from Bezier-curve to line.
virtual Size getTextSize(const String &text, int fontHeight, int thickness, CV_OUT int *baseLine)=0
Calculates the width and height of a text string.
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.
virtual bool loadFontData(const FT_Byte *fontData, FT_Long fontDataSize, int idx)=0
Ptr< FreeTypeFont > createFreeTypeFont()
Create FreeType2 Instance.