mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Fixed a regression where text shaping stopped working
This commit is contained in:
parent
b288bd172c
commit
91d3f3a43a
|
@ -885,7 +885,7 @@ void Font::rebuildTextures()
|
|||
|
||||
// Re-upload the texture data.
|
||||
for (auto it = mGlyphMap.cbegin(); it != mGlyphMap.cend(); ++it) {
|
||||
FT_Face* face {getFaceForChar(it->first, returnedFont)};
|
||||
FT_Face* face {getFaceForChar(it->first, &returnedFont)};
|
||||
FT_GlyphSlot glyphSlot {(*face)->glyph};
|
||||
|
||||
// Load the glyph bitmap through FreeType.
|
||||
|
@ -906,7 +906,7 @@ void Font::rebuildTextures()
|
|||
|
||||
for (auto it = mGlyphMapByIndex.cbegin(); it != mGlyphMapByIndex.cend(); ++it) {
|
||||
FT_Face* face {
|
||||
getFaceForGlyphIndex(std::get<0>(it->first), std::get<1>(it->first), returnedFont)};
|
||||
getFaceForGlyphIndex(std::get<0>(it->first), std::get<1>(it->first), &returnedFont)};
|
||||
FT_GlyphSlot glyphSlot {(*face)->glyph};
|
||||
|
||||
// Load the glyph bitmap through FreeType.
|
||||
|
@ -956,11 +956,11 @@ void Font::getTextureForNewGlyph(const glm::ivec2& glyphSize,
|
|||
}
|
||||
}
|
||||
|
||||
FT_Face* Font::getFaceForChar(unsigned int id, hb_font_t* returnedFont)
|
||||
FT_Face* Font::getFaceForChar(unsigned int id, hb_font_t** returnedFont)
|
||||
{
|
||||
// Look for the glyph in our current font and then in the fallback fonts if needed.
|
||||
if (FT_Get_Char_Index(mFontFace->face, id) != 0) {
|
||||
returnedFont = mFontHB;
|
||||
*returnedFont = mFontHB;
|
||||
return &mFontFace->face;
|
||||
}
|
||||
|
||||
|
@ -969,20 +969,20 @@ FT_Face* Font::getFaceForChar(unsigned int id, hb_font_t* returnedFont)
|
|||
// This is most definitely not thread safe.
|
||||
FT_Set_Char_Size(font.face->face, static_cast<FT_F26Dot6>(0.0f),
|
||||
static_cast<FT_F26Dot6>(mFontSize * 64.0f), 0, 0);
|
||||
returnedFont = font.fontHB;
|
||||
*returnedFont = font.fontHB;
|
||||
return &font.face->face;
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't find a valid glyph, return the current font face so we get a "no glyph" character.
|
||||
returnedFont = nullptr;
|
||||
*returnedFont = nullptr;
|
||||
return &mFontFace->face;
|
||||
}
|
||||
|
||||
FT_Face* Font::getFaceForGlyphIndex(unsigned int id, hb_font_t* fontArg, hb_font_t* returnedFont)
|
||||
FT_Face* Font::getFaceForGlyphIndex(unsigned int id, hb_font_t* fontArg, hb_font_t** returnedFont)
|
||||
{
|
||||
if (mFontFace->fontHB == fontArg && FT_Load_Glyph(mFontFace->face, id, FT_LOAD_RENDER) == 0) {
|
||||
returnedFont = mFontHB;
|
||||
*returnedFont = mFontHB;
|
||||
return &mFontFace->face;
|
||||
}
|
||||
|
||||
|
@ -990,13 +990,13 @@ FT_Face* Font::getFaceForGlyphIndex(unsigned int id, hb_font_t* fontArg, hb_font
|
|||
if (font.fontHB == fontArg && FT_Load_Glyph(font.face->face, id, FT_LOAD_RENDER) == 0) {
|
||||
FT_Set_Char_Size(font.face->face, static_cast<FT_F26Dot6>(0.0f),
|
||||
static_cast<FT_F26Dot6>(mFontSize * 64.0f), 0, 0);
|
||||
returnedFont = font.fontHB;
|
||||
*returnedFont = font.fontHB;
|
||||
return &font.face->face;
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't find a valid glyph, return the current font face so we get a "no glyph" character.
|
||||
returnedFont = nullptr;
|
||||
*returnedFont = nullptr;
|
||||
return &mFontFace->face;
|
||||
}
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ Font::Glyph* Font::getGlyph(const unsigned int id)
|
|||
hb_font_t* returnedFont {nullptr};
|
||||
|
||||
// We need to create a new entry.
|
||||
FT_Face* face {getFaceForChar(id, returnedFont)};
|
||||
FT_Face* face {getFaceForChar(id, &returnedFont)};
|
||||
if (!face) {
|
||||
LOG(LogError) << "Couldn't find appropriate font face for character " << id << " for font "
|
||||
<< mPath;
|
||||
|
@ -1082,7 +1082,7 @@ Font::Glyph* Font::getGlyphByIndex(const unsigned int id, hb_font_t* fontArg, in
|
|||
hb_font_t* returnedFont {nullptr};
|
||||
|
||||
// We need to create a new entry.
|
||||
FT_Face* face {getFaceForGlyphIndex(id, fontArg, returnedFont)};
|
||||
FT_Face* face {getFaceForGlyphIndex(id, fontArg, &returnedFont)};
|
||||
if (!face) {
|
||||
LOG(LogError) << "Couldn't find appropriate font face for character " << id << " for font "
|
||||
<< mPath;
|
||||
|
|
|
@ -221,8 +221,8 @@ private:
|
|||
glm::ivec2& cursorOut);
|
||||
|
||||
std::vector<FallbackFontCache> getFallbackFontPaths();
|
||||
FT_Face* getFaceForChar(unsigned int id, hb_font_t* returnedFont);
|
||||
FT_Face* getFaceForGlyphIndex(unsigned int id, hb_font_t* fontArg, hb_font_t* returnedFont);
|
||||
FT_Face* getFaceForChar(unsigned int id, hb_font_t** returnedFont);
|
||||
FT_Face* getFaceForGlyphIndex(unsigned int id, hb_font_t* fontArg, hb_font_t** returnedFont);
|
||||
Glyph* getGlyph(const unsigned int id);
|
||||
Glyph* getGlyphByIndex(const unsigned int id, hb_font_t* fontArg, int xAdvance);
|
||||
|
||||
|
|
Loading…
Reference in a new issue