code_app/modules/imgproc/CvxText.hpp

33 lines
958 B
C++
Raw Normal View History

2022-06-13 11:56:43 +00:00
#ifndef __CVXTEXT_H__
#define __CVXTEXT_H__
#include "HGImgProc.h"
#include <ft2build.h>
#include <freetype/freetype.h>
class CvxText
{
public:
CvxText();
~CvxText();
bool Create(const HGChar *fontPath);
bool Destroy();
bool MeasureString(const HGChar *text, HGInt x, HGInt y, HGUInt size,
HGBool bold, HGBool underline, HGBool italic, HGBool strikeout, HGRect *pos);
bool DrawString(HGImage image, const HGChar *text, HGInt x, HGInt y, HGColor color, HGUInt size,
HGBool bold, HGBool underline, HGBool italic, HGBool strikeout);
private:
void MeasureChar(HGUInt wc, HGUInt size, HGBool bold, HGBool underline, HGBool italic, HGBool strikeout,
HGUInt &width, HGUInt &height);
void DrawChar(HGImage image, HGUInt wc, HGInt x, HGInt y, HGColor color,
HGUInt size, HGBool bold, HGBool italic, HGBool angle, HGBool underline, HGUInt &width, HGUInt &height);
private:
FT_Library m_library;
FT_Face m_face;
};
#endif /* __CVXTEXT_H__ */