mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Clean up some unused Font functionality.
This commit is contained in:
@@ -294,6 +294,12 @@
|
||||
"command": "${project_root}/bin/eeiv-debug",
|
||||
"name": "eeiv-debug",
|
||||
"working_dir": "${project_root}/bin"
|
||||
},
|
||||
{
|
||||
"args": "",
|
||||
"command": "${project_root}/bin/eepp-fonts-debug",
|
||||
"name": "eepp-fonts-debug",
|
||||
"working_dir": "${project_root}/bin"
|
||||
}
|
||||
],
|
||||
"var": {
|
||||
|
||||
@@ -91,15 +91,13 @@ class EE_API Font {
|
||||
virtual const Info& getInfo() const = 0;
|
||||
|
||||
virtual const Glyph& getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness = 0,
|
||||
Float maxWidth = 0 ) const = 0;
|
||||
bool italic, Float outlineThickness = 0 ) const = 0;
|
||||
|
||||
/** @return The glyph drawable that represents the glyph in a texture. The glyph drawable
|
||||
* allocation is managed by the font. */
|
||||
virtual GlyphDrawable* getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold = false, bool italic = false,
|
||||
Float outlineThickness = 0,
|
||||
const Float& forzeSize = 0 ) const = 0;
|
||||
Float outlineThickness = 0 ) const = 0;
|
||||
|
||||
virtual Float getKerning( Uint32 first, Uint32 second, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness = 0 ) const = 0;
|
||||
|
||||
@@ -37,11 +37,11 @@ class EE_API FontBMFont : public Font {
|
||||
const Font::Info& getInfo() const;
|
||||
|
||||
const Glyph& getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness = 0, Float maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
GlyphDrawable* getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold = false, bool italic = false,
|
||||
Float outlineThickness = 0, const Float& maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
Float getKerning( Uint32 first, Uint32 second, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness = 0 ) const;
|
||||
|
||||
@@ -41,11 +41,11 @@ class EE_API FontSprite : public Font {
|
||||
const Font::Info& getInfo() const;
|
||||
|
||||
const Glyph& getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness = 0, Float maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
GlyphDrawable* getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold = false, bool italic = false,
|
||||
Float outlineThickness = 0, const Float& maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
Float getKerning( Uint32 first, Uint32 second, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness = 0 ) const;
|
||||
|
||||
@@ -32,19 +32,18 @@ class EE_API FontTrueType : public Font {
|
||||
const Font::Info& getInfo() const;
|
||||
|
||||
const Glyph& getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness = 0, Float maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
const Glyph& getGlyphByIndex( Uint32 index, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
GlyphDrawable* getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold = false, bool italic = false,
|
||||
Float outlineThickness = 0, const Float& maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
GlyphDrawable* getGlyphDrawableFromGlyphIndex( Uint32 glyphIndex, unsigned int characterSize,
|
||||
bool bold = false, bool italic = false,
|
||||
Float outlineThickness = 0,
|
||||
const Float& maxWidth = 0 ) const;
|
||||
Float outlineThickness = 0 ) const;
|
||||
|
||||
Float getKerning( Uint32 first, Uint32 second, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness = 0 ) const;
|
||||
@@ -185,19 +184,19 @@ class EE_API FontTrueType : public Font {
|
||||
void cleanup();
|
||||
|
||||
const Glyph& getGlyphByIndex( Uint32 index, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness, Page& page, const Float& maxWidth ) const;
|
||||
Float outlineThickness, Page& page ) const;
|
||||
|
||||
const Glyph& getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness, Page& page, const Float& maxWidth ) const;
|
||||
Float outlineThickness, Page& page ) const;
|
||||
|
||||
GlyphDrawable* getGlyphDrawableFromGlyphIndex( Uint32 glyphIndex, unsigned int characterSize,
|
||||
bool bold, bool italic, Float outlineThickness,
|
||||
Page& page, const Float& maxWidth = 0 ) const;
|
||||
Page& page ) const;
|
||||
|
||||
Uint32 getGlyphIndex( const Uint32& codePoint ) const;
|
||||
|
||||
Glyph loadGlyphByIndex( Uint32 codePoint, unsigned int characterSize, bool bold, bool italic,
|
||||
Float outlineThickness, Page& page, const Float& maxWidth = 0.f ) const;
|
||||
Float outlineThickness, Page& page ) const;
|
||||
|
||||
Rect findGlyphRect( Page& page, unsigned int width, unsigned int height ) const;
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ const FontBMFont::Info& FontBMFont::getInfo() const {
|
||||
}
|
||||
|
||||
const Glyph& FontBMFont::getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold,
|
||||
bool /*italic*/, Float outlineThickness, Float ) const {
|
||||
bool /*italic*/, Float outlineThickness ) const {
|
||||
GlyphTable& glyphs = mPages[characterSize].glyphs;
|
||||
|
||||
GlyphTable::const_iterator it = glyphs.find( codePoint );
|
||||
@@ -200,8 +200,8 @@ const Glyph& FontBMFont::getGlyph( Uint32 codePoint, unsigned int characterSize,
|
||||
}
|
||||
|
||||
GlyphDrawable* FontBMFont::getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold, bool italic, Float outlineThickness,
|
||||
const Float& ) const {
|
||||
bool bold, bool italic,
|
||||
Float outlineThickness ) const {
|
||||
GlyphDrawableTable& drawables = mPages[characterSize].drawables;
|
||||
auto it = drawables.find( codePoint );
|
||||
if ( it != drawables.end() ) {
|
||||
|
||||
@@ -164,7 +164,7 @@ const FontSprite::Info& FontSprite::getInfo() const {
|
||||
return mInfo;
|
||||
}
|
||||
|
||||
const Glyph& FontSprite::getGlyph( Uint32 codePoint, unsigned int characterSize, bool, bool, Float,
|
||||
const Glyph& FontSprite::getGlyph( Uint32 codePoint, unsigned int characterSize, bool, bool,
|
||||
Float ) const {
|
||||
GlyphTable& glyphs = mPages[characterSize].glyphs;
|
||||
|
||||
@@ -179,8 +179,8 @@ const Glyph& FontSprite::getGlyph( Uint32 codePoint, unsigned int characterSize,
|
||||
}
|
||||
|
||||
GlyphDrawable* FontSprite::getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold, bool italic, Float outlineThickness,
|
||||
const Float& ) const {
|
||||
bool bold, bool italic,
|
||||
Float outlineThickness ) const {
|
||||
GlyphDrawableTable& drawables = mPages[characterSize].drawables;
|
||||
auto it = drawables.find( codePoint );
|
||||
if ( it != drawables.end() ) {
|
||||
|
||||
@@ -329,49 +329,35 @@ Uint32 FontTrueType::getGlyphIndex( const Uint32& codePoint ) const {
|
||||
}
|
||||
|
||||
const Glyph& FontTrueType::getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness, Float maxWidth ) const {
|
||||
bool italic, Float outlineThickness ) const {
|
||||
Uint32 idx = 0;
|
||||
if ( mEnableEmojiFallback && !mIsColorEmojiFont && !mIsEmojiFont &&
|
||||
Font::isEmojiCodePoint( codePoint ) ) {
|
||||
if ( !mIsColorEmojiFont && FontManager::instance()->getColorEmojiFont() != nullptr &&
|
||||
FontManager::instance()->getColorEmojiFont()->getType() == FontType::TTF ) {
|
||||
|
||||
// if ( isMonospace() && maxWidth == 0.f && !Text::TextShaperEnabled ) {
|
||||
// const Glyph& monospaceGlyph =
|
||||
// getGlyph( ' ', characterSize, bold, italic, outlineThickness );
|
||||
// maxWidth = monospaceGlyph.advance;
|
||||
// }
|
||||
|
||||
FontTrueType* fontEmoji =
|
||||
static_cast<FontTrueType*>( FontManager::instance()->getColorEmojiFont() );
|
||||
if ( ( idx = fontEmoji->getGlyphIndex( codePoint ) ) ) {
|
||||
if ( mIsMonospace && mEnableDynamicMonospace && 0.f == maxWidth ) {
|
||||
if ( mIsMonospace && mEnableDynamicMonospace ) {
|
||||
mIsMonospaceComplete = false;
|
||||
mUsingFallback = true;
|
||||
}
|
||||
return fontEmoji->getGlyphByIndex( idx, characterSize, bold, italic,
|
||||
outlineThickness, getPage( characterSize ),
|
||||
maxWidth );
|
||||
outlineThickness, getPage( characterSize ) );
|
||||
}
|
||||
} else if ( !mIsEmojiFont && FontManager::instance()->getEmojiFont() != nullptr &&
|
||||
FontManager::instance()->getEmojiFont()->getType() == FontType::TTF ) {
|
||||
|
||||
// if ( isMonospace() && maxWidth == 0.f && !Text::TextShaperEnabled ) {
|
||||
// const Glyph& monospaceGlyph =
|
||||
// getGlyph( ' ', characterSize, bold, italic, outlineThickness );
|
||||
// maxWidth = monospaceGlyph.advance;
|
||||
// }
|
||||
|
||||
FontTrueType* fontEmoji =
|
||||
static_cast<FontTrueType*>( FontManager::instance()->getEmojiFont() );
|
||||
if ( ( idx = fontEmoji->getGlyphIndex( codePoint ) ) ) {
|
||||
if ( mIsMonospace && mEnableDynamicMonospace && 0.f == maxWidth ) {
|
||||
if ( mIsMonospace && mEnableDynamicMonospace ) {
|
||||
mIsMonospaceComplete = false;
|
||||
mUsingFallback = true;
|
||||
}
|
||||
return fontEmoji->getGlyphByIndex( idx, characterSize, bold, italic,
|
||||
outlineThickness, getPage( characterSize ),
|
||||
maxWidth );
|
||||
outlineThickness, getPage( characterSize ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,19 +365,19 @@ const Glyph& FontTrueType::getGlyph( Uint32 codePoint, unsigned int characterSiz
|
||||
if ( bold && italic && mFontBoldItalic != nullptr &&
|
||||
( idx = mFontBoldItalic->getGlyphIndex( codePoint ) ) ) {
|
||||
return mFontBoldItalic->getGlyphByIndex( idx, characterSize, true, true, outlineThickness,
|
||||
getPage( characterSize ), maxWidth );
|
||||
getPage( characterSize ) );
|
||||
}
|
||||
|
||||
if ( bold && !italic && mFontBold != nullptr &&
|
||||
( idx = mFontBold->getGlyphIndex( codePoint ) ) ) {
|
||||
return mFontBold->getGlyphByIndex( idx, characterSize, true, false, outlineThickness,
|
||||
getPage( characterSize ), maxWidth );
|
||||
getPage( characterSize ) );
|
||||
}
|
||||
|
||||
if ( italic && !bold && mFontItalic != nullptr &&
|
||||
( idx = mFontItalic->getGlyphIndex( codePoint ) ) ) {
|
||||
return mFontItalic->getGlyphByIndex( idx, characterSize, false, true, outlineThickness,
|
||||
getPage( characterSize ), maxWidth );
|
||||
getPage( characterSize ) );
|
||||
}
|
||||
|
||||
idx = getGlyphIndex( codePoint );
|
||||
@@ -406,8 +392,7 @@ const Glyph& FontTrueType::getGlyph( Uint32 codePoint, unsigned int characterSiz
|
||||
mUsingFallback = true;
|
||||
}
|
||||
return fallbackFont->getGlyphByIndex( idx, characterSize, bold, italic,
|
||||
outlineThickness, getPage( characterSize ),
|
||||
maxWidth );
|
||||
outlineThickness, getPage( characterSize ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,15 +401,14 @@ const Glyph& FontTrueType::getGlyph( Uint32 codePoint, unsigned int characterSiz
|
||||
}
|
||||
|
||||
const Glyph& FontTrueType::getGlyph( Uint32 codePoint, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness, Page& page,
|
||||
const Float& maxWidth ) const {
|
||||
bool italic, Float outlineThickness, Page& page ) const {
|
||||
Uint32 index = getGlyphIndex( codePoint );
|
||||
return getGlyphByIndex( index, characterSize, bold, italic, outlineThickness, page, maxWidth );
|
||||
return getGlyphByIndex( index, characterSize, bold, italic, outlineThickness, page );
|
||||
}
|
||||
|
||||
const Glyph& FontTrueType::getGlyphByIndex( Uint32 index, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness, Page& page,
|
||||
const Float& maxWidth ) const {
|
||||
bool italic, Float outlineThickness,
|
||||
Page& page ) const {
|
||||
eeASSERT( Engine::isRunninMainThread() );
|
||||
|
||||
// Get the page corresponding to the character size
|
||||
@@ -440,8 +424,8 @@ const Glyph& FontTrueType::getGlyphByIndex( Uint32 index, unsigned int character
|
||||
return it->second;
|
||||
} else {
|
||||
// Not found: we have to load it
|
||||
Glyph glyph = loadGlyphByIndex( index, characterSize, bold, italic, outlineThickness, page,
|
||||
maxWidth );
|
||||
Glyph glyph =
|
||||
loadGlyphByIndex( index, characterSize, bold, italic, outlineThickness, page );
|
||||
|
||||
return glyphs.emplace( key, glyph ).first->second;
|
||||
}
|
||||
@@ -450,12 +434,12 @@ const Glyph& FontTrueType::getGlyphByIndex( Uint32 index, unsigned int character
|
||||
const Glyph& FontTrueType::getGlyphByIndex( Uint32 index, unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness ) const {
|
||||
return getGlyphByIndex( index, characterSize, bold, italic, outlineThickness,
|
||||
getPage( characterSize ), 0.f );
|
||||
getPage( characterSize ) );
|
||||
}
|
||||
|
||||
GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int characterSize,
|
||||
bool bold, bool italic, Float outlineThickness,
|
||||
const Float& maxWidth ) const {
|
||||
bool bold, bool italic,
|
||||
Float outlineThickness ) const {
|
||||
// mKeyCache
|
||||
Page& page = getPage( characterSize );
|
||||
GlyphDrawableTable& drawables = page.drawables;
|
||||
@@ -555,8 +539,7 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
|
||||
if ( it != drawables.end() ) {
|
||||
return it->second;
|
||||
} else {
|
||||
const Glyph& glyph =
|
||||
getGlyph( codePoint, characterSize, bold, italic, outlineThickness, maxWidth );
|
||||
const Glyph& glyph = getGlyph( codePoint, characterSize, bold, italic, outlineThickness );
|
||||
GlyphDrawable* region = GlyphDrawable::New(
|
||||
page.texture, glyph.textureRect, glyph.size,
|
||||
String::format( "%s_%d_%u", mFontName.c_str(), characterSize, glyphIndex ) );
|
||||
@@ -575,8 +558,7 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
|
||||
GlyphDrawable* FontTrueType::getGlyphDrawableFromGlyphIndex( Uint32 glyphIndex,
|
||||
unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness,
|
||||
Page& page,
|
||||
const Float& maxWidth ) const {
|
||||
Page& page ) const {
|
||||
GlyphDrawableTable& drawables = page.drawables;
|
||||
Uint64 key = getIndexKey( mFontInternalId, glyphIndex, bold, italic, outlineThickness );
|
||||
|
||||
@@ -584,8 +566,8 @@ GlyphDrawable* FontTrueType::getGlyphDrawableFromGlyphIndex( Uint32 glyphIndex,
|
||||
if ( it != drawables.end() ) {
|
||||
return it->second;
|
||||
} else {
|
||||
const Glyph& glyph = getGlyphByIndex( glyphIndex, characterSize, bold, italic,
|
||||
outlineThickness, page, maxWidth );
|
||||
const Glyph& glyph =
|
||||
getGlyphByIndex( glyphIndex, characterSize, bold, italic, outlineThickness, page );
|
||||
GlyphDrawable* region = GlyphDrawable::New(
|
||||
page.texture, glyph.textureRect, glyph.size,
|
||||
String::format( "%s_%d_%u", mFontName.c_str(), characterSize, glyphIndex ) );
|
||||
@@ -603,10 +585,10 @@ GlyphDrawable* FontTrueType::getGlyphDrawableFromGlyphIndex( Uint32 glyphIndex,
|
||||
|
||||
GlyphDrawable* FontTrueType::getGlyphDrawableFromGlyphIndex( Uint32 glyphIndex,
|
||||
unsigned int characterSize, bool bold,
|
||||
bool italic, Float outlineThickness,
|
||||
const Float& maxWidth ) const {
|
||||
bool italic,
|
||||
Float outlineThickness ) const {
|
||||
return getGlyphDrawableFromGlyphIndex( glyphIndex, characterSize, bold, italic,
|
||||
outlineThickness, getPage( characterSize ), maxWidth );
|
||||
outlineThickness, getPage( characterSize ) );
|
||||
}
|
||||
|
||||
Float FontTrueType::getKerning( Uint32 first, Uint32 second, unsigned int characterSize, bool bold,
|
||||
@@ -906,8 +888,7 @@ fontSetRenderOptions( FT_Library library, FontAntialiasing antialiasing, FontHin
|
||||
}
|
||||
|
||||
Glyph FontTrueType::loadGlyphByIndex( Uint32 index, unsigned int characterSize, bool bold,
|
||||
bool /*italic*/, Float outlineThickness, Page& page,
|
||||
const Float& maxWidth ) const {
|
||||
bool /*italic*/, Float outlineThickness, Page& page ) const {
|
||||
// The glyph to return
|
||||
Glyph glyph;
|
||||
|
||||
@@ -988,9 +969,6 @@ Glyph FontTrueType::loadGlyphByIndex( Uint32 index, unsigned int characterSize,
|
||||
// Compute the glyph's advance offset
|
||||
glyph.advance = static_cast<Float>( slot->metrics.horiAdvance ) / static_cast<Float>( 1 << 6 );
|
||||
|
||||
if ( maxWidth > 0.f )
|
||||
glyph.advance = maxWidth;
|
||||
|
||||
if ( bold && !mBoldAdvanceSameAsRegular )
|
||||
glyph.advance += static_cast<Float>( weight ) / static_cast<Float>( 1 << 6 );
|
||||
|
||||
@@ -1012,15 +990,13 @@ Glyph FontTrueType::loadGlyphByIndex( Uint32 index, unsigned int characterSize,
|
||||
Float scale = 1.f;
|
||||
|
||||
if ( mIsColorEmojiFont || mIsEmojiFont ) {
|
||||
scale = eemin( 1.f, (Float)( maxWidth > 0.f ? maxWidth : characterSize ) /
|
||||
(Float)( maxWidth > 0.f ? width : height ) );
|
||||
scale = eemin( 1.f, (Float)characterSize / height );
|
||||
}
|
||||
|
||||
int destWidth = width;
|
||||
int destHeight = height;
|
||||
|
||||
if ( maxWidth <= 0.f )
|
||||
glyph.advance = eeceil( glyph.advance * scale );
|
||||
glyph.advance = eeceil( glyph.advance * scale );
|
||||
|
||||
if ( scale >= 1.f ) {
|
||||
destWidth *= scale;
|
||||
|
||||
@@ -1099,42 +1099,37 @@ Float Text::getTextWidth( Font* font, const Uint32& fontSize, const StringType&
|
||||
#ifdef EE_TEXT_SHAPER_ENABLED
|
||||
if ( TextShaperEnabled && font->getType() == FontType::TTF ) {
|
||||
FontTrueType* rFont = static_cast<FontTrueType*>( font );
|
||||
shapeAndRun( string, rFont, fontSize, style, outlineThickness,
|
||||
[&]( hb_glyph_info_t* glyphInfo, hb_glyph_position_t*, Uint32 glyphCount,
|
||||
const hb_segment_properties_t&, TextShapeRun& run ) {
|
||||
FontTrueType* font = run.font();
|
||||
Uint32 prevGlyphIndex = 0;
|
||||
for ( std::size_t i = 0; i < glyphCount; ++i ) {
|
||||
hb_glyph_info_t curGlyph = glyphInfo[i];
|
||||
auto curChar = string[curGlyph.cluster];
|
||||
if ( curChar == '\t' ) {
|
||||
width += tabAdvance( hspace, tabWidth,
|
||||
tabOffset ? *tabOffset + width : tabOffset );
|
||||
} else {
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, fontSize, bold, italic, outlineThickness,
|
||||
rFont->getPage( fontSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
shapeAndRun(
|
||||
string, rFont, fontSize, style, outlineThickness,
|
||||
[&]( hb_glyph_info_t* glyphInfo, hb_glyph_position_t*, Uint32 glyphCount,
|
||||
const hb_segment_properties_t&, TextShapeRun& run ) {
|
||||
FontTrueType* font = run.font();
|
||||
Uint32 prevGlyphIndex = 0;
|
||||
for ( std::size_t i = 0; i < glyphCount; ++i ) {
|
||||
hb_glyph_info_t curGlyph = glyphInfo[i];
|
||||
auto curChar = string[curGlyph.cluster];
|
||||
if ( curChar == '\t' ) {
|
||||
width += tabAdvance( hspace, tabWidth,
|
||||
tabOffset ? *tabOffset + width : tabOffset );
|
||||
} else {
|
||||
const Glyph& glyph =
|
||||
font->getGlyphByIndex( curGlyph.codepoint, fontSize, bold, italic,
|
||||
outlineThickness, rFont->getPage( fontSize ) );
|
||||
|
||||
width += rFont->getKerningFromGlyphIndex(
|
||||
prevGlyphIndex, curGlyph.codepoint, fontSize, bold, italic,
|
||||
outlineThickness );
|
||||
width += rFont->getKerningFromGlyphIndex( prevGlyphIndex,
|
||||
curGlyph.codepoint, fontSize,
|
||||
bold, italic, outlineThickness );
|
||||
|
||||
width += font->isColorEmojiFont() && ' ' != curChar
|
||||
? glyph.size.getWidth()
|
||||
: glyph.advance;
|
||||
}
|
||||
maxWidth = eemax( maxWidth, width );
|
||||
prevGlyphIndex = curGlyph.codepoint;
|
||||
}
|
||||
if ( run.runIsNewLine() )
|
||||
width = 0;
|
||||
return true;
|
||||
} );
|
||||
width += font->isColorEmojiFont() && ' ' != curChar ? glyph.size.getWidth()
|
||||
: glyph.advance;
|
||||
}
|
||||
maxWidth = eemax( maxWidth, width );
|
||||
prevGlyphIndex = curGlyph.codepoint;
|
||||
}
|
||||
if ( run.runIsNewLine() )
|
||||
width = 0;
|
||||
return true;
|
||||
} );
|
||||
return maxWidth;
|
||||
}
|
||||
#endif
|
||||
@@ -1192,14 +1187,9 @@ Text::findLastCharPosWithinLength( Font* font, const Uint32& fontSize, const Str
|
||||
width += tabAdvance( hspace, tabWidth,
|
||||
tabOffset ? *tabOffset + width : tabOffset );
|
||||
} else {
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, fontSize, bold, italic, outlineThickness,
|
||||
rFont->getPage( fontSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
const Glyph& glyph =
|
||||
font->getGlyphByIndex( curGlyph.codepoint, fontSize, bold, italic,
|
||||
outlineThickness, rFont->getPage( fontSize ) );
|
||||
|
||||
width += rFont->getKerningFromGlyphIndex( prevGlyphIndex,
|
||||
curGlyph.codepoint, fontSize,
|
||||
@@ -1297,12 +1287,7 @@ Vector2f Text::findCharacterPos( std::size_t index, Font* font, const Uint32& fo
|
||||
} else {
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, fontSize, bold, italic, outlineThickness,
|
||||
rFont->getPage( fontSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
rFont->getPage( fontSize ) );
|
||||
|
||||
position.x += rFont->getKerningFromGlyphIndex(
|
||||
prevGlyphIndex, curGlyph.codepoint, fontSize, bold, italic,
|
||||
@@ -1412,14 +1397,9 @@ Int32 Text::findCharacterFromPos( const Vector2i& pos, bool returnNearest, Font*
|
||||
width += tabAdvance( hspace, tabWidth,
|
||||
tabOffset ? *tabOffset + width : tabOffset );
|
||||
} else {
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, fontSize, bold, italic, outlineThickness,
|
||||
rFont->getPage( fontSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
const Glyph& glyph =
|
||||
font->getGlyphByIndex( curGlyph.codepoint, fontSize, bold, italic,
|
||||
outlineThickness, rFont->getPage( fontSize ) );
|
||||
|
||||
width += rFont->getKerningFromGlyphIndex( prevGlyphIndex,
|
||||
curGlyph.codepoint, fontSize,
|
||||
@@ -1599,12 +1579,7 @@ void Text::updateWidthCache() {
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, mFontStyleConfig.CharacterSize, bold,
|
||||
italic, mFontStyleConfig.OutlineThickness,
|
||||
rFont->getPage( mFontStyleConfig.CharacterSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
rFont->getPage( mFontStyleConfig.CharacterSize ) );
|
||||
|
||||
width += rFont->getKerningFromGlyphIndex(
|
||||
prevGlyphIndex, curGlyph.codepoint,
|
||||
@@ -1985,12 +1960,7 @@ void Text::ensureGeometryUpdate() {
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, mFontStyleConfig.CharacterSize, bold, reqItalic,
|
||||
mFontStyleConfig.OutlineThickness,
|
||||
rFont->getPage( mFontStyleConfig.CharacterSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
rFont->getPage( mFontStyleConfig.CharacterSize ) );
|
||||
|
||||
Float left = glyph.bounds.Left;
|
||||
Float top = glyph.bounds.Top;
|
||||
@@ -2019,12 +1989,7 @@ void Text::ensureGeometryUpdate() {
|
||||
// Extract the current glyph's description
|
||||
const Glyph& glyph = font->getGlyphByIndex(
|
||||
curGlyph.codepoint, mFontStyleConfig.CharacterSize, bold, reqItalic, 0,
|
||||
rFont->getPage( mFontStyleConfig.CharacterSize ),
|
||||
rFont->isMonospace() && !rFont->isColorEmojiFont() &&
|
||||
!rFont->isEmojiFont() &&
|
||||
( font->isColorEmojiFont() || font->isEmojiFont() )
|
||||
? hspace
|
||||
: 0 );
|
||||
rFont->getPage( mFontStyleConfig.CharacterSize ) );
|
||||
|
||||
Float left = glyph.bounds.Left;
|
||||
Float top = glyph.bounds.Top;
|
||||
|
||||
@@ -1246,7 +1246,7 @@ void TerminalDisplay::drawGrid( const Vector2f& pos ) {
|
||||
mVBForeground->setQuadColor( mCurGridPos, Color::Transparent );
|
||||
} else {
|
||||
auto* gd = mFont->getGlyphDrawable( glyph.u, mFontSize, glyph.mode & ATTR_BOLD,
|
||||
glyph.mode & ATTR_ITALIC, 0, advanceX );
|
||||
glyph.mode & ATTR_ITALIC, 0 );
|
||||
|
||||
if ( ( glyph.mode & ATTR_EMOJI ) && FontManager::instance()->getColorEmojiFont() ) {
|
||||
gd->setColor( Color::White );
|
||||
|
||||
@@ -26,6 +26,10 @@ SyntaxDefinition& addCMake() {
|
||||
{ { "[%a_][%w_]*" }, "symbol" },
|
||||
},
|
||||
{
|
||||
{ "PRIVATE", "keyword" },
|
||||
{ "PUBLIC", "keyword" },
|
||||
{ "TREE", "literal" },
|
||||
{ "FILES", "literal" },
|
||||
{ "REPLACE", "literal" },
|
||||
{ "SOURCES", "type" },
|
||||
{ "REGEX", "literal" },
|
||||
|
||||
Reference in New Issue
Block a user