add max advance to fontInfo
This commit is contained in:
parent
292b021e0e
commit
c13e53153f
@ -165,6 +165,7 @@ FontInfo TrueTypeFont::getFontInfo()
|
|||||||
outFontInfo.ascender = metrics.ascender / 64.0f;
|
outFontInfo.ascender = metrics.ascender / 64.0f;
|
||||||
outFontInfo.descender = metrics.descender / 64.0f;
|
outFontInfo.descender = metrics.descender / 64.0f;
|
||||||
outFontInfo.lineGap = (metrics.height - metrics.ascender + metrics.descender) / 64.0f;
|
outFontInfo.lineGap = (metrics.height - metrics.ascender + metrics.descender) / 64.0f;
|
||||||
|
outFontInfo.maxAdvanceWidth = metrics.max_advance/ 64.0f;
|
||||||
|
|
||||||
outFontInfo.underlinePosition = FT_MulFix(holder->face->underline_position, metrics.y_scale) / 64.0f;
|
outFontInfo.underlinePosition = FT_MulFix(holder->face->underline_position, metrics.y_scale) / 64.0f;
|
||||||
outFontInfo.underlineThickness = FT_MulFix(holder->face->underline_thickness, metrics.y_scale) / 64.0f;
|
outFontInfo.underlineThickness = FT_MulFix(holder->face->underline_thickness, metrics.y_scale) / 64.0f;
|
||||||
@ -647,6 +648,7 @@ FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle,
|
|||||||
newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
|
newFontInfo.ascender = (newFontInfo.ascender * newFontInfo.scale);
|
||||||
newFontInfo.descender = (newFontInfo.descender * newFontInfo.scale);
|
newFontInfo.descender = (newFontInfo.descender * newFontInfo.scale);
|
||||||
newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
|
newFontInfo.lineGap = (newFontInfo.lineGap * newFontInfo.scale);
|
||||||
|
newFontInfo.maxAdvanceWidth = (newFontInfo.maxAdvanceWidth * newFontInfo.scale);
|
||||||
newFontInfo.underlineThickness = (newFontInfo.underlineThickness * newFontInfo.scale);
|
newFontInfo.underlineThickness = (newFontInfo.underlineThickness * newFontInfo.scale);
|
||||||
newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
|
newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
|
||||||
|
|
||||||
@ -782,7 +784,7 @@ bool FontManager::preloadGlyph(FontHandle _handle, CodePoint _codePoint)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FontInfo& FontManager::getFontInfo(FontHandle _handle)
|
const FontInfo& FontManager::getFontInfo(FontHandle _handle) const
|
||||||
{
|
{
|
||||||
BX_CHECK(bgfx::invalidHandle != _handle.idx, "Invalid handle used");
|
BX_CHECK(bgfx::invalidHandle != _handle.idx, "Invalid handle used");
|
||||||
return m_cachedFonts[_handle.idx].fontInfo;
|
return m_cachedFonts[_handle.idx].fontInfo;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#define __FONT_MANAGER_H__
|
#define __FONT_MANAGER_H__
|
||||||
|
|
||||||
#include <bx/handlealloc.h>
|
#include <bx/handlealloc.h>
|
||||||
|
#include <bgfx.h>
|
||||||
|
|
||||||
class Atlas;
|
class Atlas;
|
||||||
|
|
||||||
@ -29,6 +30,8 @@ struct FontInfo
|
|||||||
float descender;
|
float descender;
|
||||||
/// The spacing in pixels between one row's descent and the next row's ascent.
|
/// The spacing in pixels between one row's descent and the next row's ascent.
|
||||||
float lineGap;
|
float lineGap;
|
||||||
|
/// This field gives the maximum horizontal cursor advance for all glyphs in the font.
|
||||||
|
float maxAdvanceWidth;
|
||||||
/// The thickness of the under/hover/strike-trough line in pixels.
|
/// The thickness of the under/hover/strike-trough line in pixels.
|
||||||
float underlineThickness;
|
float underlineThickness;
|
||||||
/// The position of the underline relatively to the baseline.
|
/// The position of the underline relatively to the baseline.
|
||||||
@ -169,7 +172,7 @@ public:
|
|||||||
/// Return the font descriptor of a font.
|
/// Return the font descriptor of a font.
|
||||||
///
|
///
|
||||||
/// @remark the handle is required to be valid
|
/// @remark the handle is required to be valid
|
||||||
const FontInfo& getFontInfo(FontHandle _handle);
|
const FontInfo& getFontInfo(FontHandle _handle) const;
|
||||||
|
|
||||||
/// Return the rendering informations about the glyph region. Load the
|
/// Return the rendering informations about the glyph region. Load the
|
||||||
/// glyph from a TrueType font if possible
|
/// glyph from a TrueType font if possible
|
||||||
|
Loading…
Reference in New Issue
Block a user