[DEV] add reverse height to size for font height
This commit is contained in:
parent
a2a70607c3
commit
5e3974f59d
@ -29,6 +29,14 @@ ewol::compositing::TextDF::~TextDF(void) {
|
|||||||
ewol::resource::DistanceFieldFont::release(m_fontDF);
|
ewol::resource::DistanceFieldFont::release(m_fontDF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::compositing::TextDF::updateSizeToRender(const vec2& _size) {
|
||||||
|
float minSize = etk_min(_size.x(), _size.y());
|
||||||
|
if (m_fontDF != NULL) {
|
||||||
|
setFontSize(m_fontDF->getSize(minSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _enableDepthTest) {
|
void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _enableDepthTest) {
|
||||||
|
|
||||||
// draw BG in any case:
|
// draw BG in any case:
|
||||||
|
@ -38,6 +38,13 @@ namespace ewol {
|
|||||||
* @brief generic destructor
|
* @brief generic destructor
|
||||||
*/
|
*/
|
||||||
virtual ~TextDF(void);
|
virtual ~TextDF(void);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Calculate size to be at the best size for a render in this special size.
|
||||||
|
* @note special for Distance field mode.
|
||||||
|
* @param[in] _size request dimention.
|
||||||
|
*/
|
||||||
|
void updateSizeToRender(const vec2& _size);
|
||||||
public:
|
public:
|
||||||
virtual void clear(void);
|
virtual void clear(void);
|
||||||
virtual void drawD(bool _disableDepthTest);
|
virtual void drawD(bool _disableDepthTest);
|
||||||
|
@ -43,6 +43,14 @@ namespace ewol {
|
|||||||
float getHeight(float _size) {
|
float getHeight(float _size) {
|
||||||
return ((float)m_font->getHeight(_size));
|
return ((float)m_font->getHeight(_size));
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @brief get the font size with a specific display size
|
||||||
|
* @param[in] _fontHeight Request font height
|
||||||
|
* @return Dimention of the font for this compleate line size.
|
||||||
|
*/
|
||||||
|
float getSize(float _fontHeight) {
|
||||||
|
return m_font->getSizeWithHeight(_fontHeight);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief get the ID of a unicode charcode
|
* @brief get the ID of a unicode charcode
|
||||||
* @param[in] _charcode The unicodeValue
|
* @param[in] _charcode The unicodeValue
|
||||||
|
@ -119,6 +119,9 @@ vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const std::string&
|
|||||||
int32_t ewol::resource::FontFreeType::getHeight(int32_t _fontSize) {
|
int32_t ewol::resource::FontFreeType::getHeight(int32_t _fontSize) {
|
||||||
return _fontSize*1.43f; // this is a really "magic" number ...
|
return _fontSize*1.43f; // this is a really "magic" number ...
|
||||||
}
|
}
|
||||||
|
float ewol::resource::FontFreeType::getSizeWithHeight(float _fontHeight) {
|
||||||
|
return _fontHeight*0.6993f; // this is a really "magic" number ...
|
||||||
|
}
|
||||||
|
|
||||||
bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) {
|
bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) {
|
||||||
if(false == m_init) {
|
if(false == m_init) {
|
||||||
|
@ -50,6 +50,7 @@ namespace ewol {
|
|||||||
vec2 getSize(int32_t _fontSize, const std::string& _unicodeString);
|
vec2 getSize(int32_t _fontSize, const std::string& _unicodeString);
|
||||||
|
|
||||||
int32_t getHeight(int32_t _fontSize);
|
int32_t getHeight(int32_t _fontSize);
|
||||||
|
float getSizeWithHeight(float _fontHeight);
|
||||||
|
|
||||||
void generateKerning(int32_t _fontSize, std::vector<ewol::GlyphProperty>& _listGlyph);
|
void generateKerning(int32_t _fontSize, std::vector<ewol::GlyphProperty>& _listGlyph);
|
||||||
public:
|
public:
|
||||||
|
@ -41,6 +41,7 @@ namespace ewol {
|
|||||||
int32_t _borderSize = 0) = 0;
|
int32_t _borderSize = 0) = 0;
|
||||||
|
|
||||||
virtual vec2 getSize(int32_t _fontSize, const std::string& _unicodeString) = 0;
|
virtual vec2 getSize(int32_t _fontSize, const std::string& _unicodeString) = 0;
|
||||||
|
virtual float getSizeWithHeight(float _fontHeight) = 0;
|
||||||
|
|
||||||
virtual int32_t getHeight(int32_t _fontSize) = 0;
|
virtual int32_t getHeight(int32_t _fontSize) = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user