Fixed FontTrueType::getGlyphDrawable.

ecode: Added -V/--version command parameter.
This commit is contained in:
Martín Lucas Golini
2023-01-04 02:58:09 -03:00
parent 9a85864443
commit 6146d798fb
2 changed files with 28 additions and 6 deletions
+22 -6
View File
@@ -466,6 +466,7 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
GlyphDrawableTable& drawables = page.drawables;
Uint32 glyphIndex = 0;
Uint32 tGlyphIndex = 0;
Uint32 fontInternalId = mFontInternalId;
if ( mEnableEmojiFallback && Font::isEmojiCodePoint( codePoint ) && !mIsColorEmojiFont &&
@@ -474,14 +475,24 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
FontManager::instance()->getColorEmojiFont()->getType() == FontType::TTF ) {
FontTrueType* fontEmoji =
static_cast<FontTrueType*>( FontManager::instance()->getColorEmojiFont() );
glyphIndex = fontEmoji->getGlyphIndex( codePoint );
fontInternalId = fontEmoji->getFontInternalId();
tGlyphIndex = fontEmoji->getGlyphIndex( codePoint );
if ( 0 != tGlyphIndex ) {
glyphIndex = tGlyphIndex;
fontInternalId = fontEmoji->getFontInternalId();
} else {
glyphIndex = getGlyphIndex( codePoint );
}
} else if ( !mIsEmojiFont && FontManager::instance()->getEmojiFont() != nullptr &&
FontManager::instance()->getEmojiFont()->getType() == FontType::TTF ) {
FontTrueType* fontEmoji =
static_cast<FontTrueType*>( FontManager::instance()->getEmojiFont() );
glyphIndex = fontEmoji->getGlyphIndex( codePoint );
fontInternalId = fontEmoji->getFontInternalId();
tGlyphIndex = fontEmoji->getGlyphIndex( codePoint );
if ( 0 != tGlyphIndex ) {
glyphIndex = tGlyphIndex;
fontInternalId = fontEmoji->getFontInternalId();
} else {
glyphIndex = getGlyphIndex( codePoint );
}
} else {
glyphIndex = getGlyphIndex( codePoint );
}
@@ -494,8 +505,13 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
FontManager::instance()->getFallbackFont()->getType() == FontType::TTF ) {
FontTrueType* fontFallback =
static_cast<FontTrueType*>( FontManager::instance()->getFallbackFont() );
glyphIndex = fontFallback->getGlyphIndex( codePoint );
fontInternalId = fontFallback->getFontInternalId();
tGlyphIndex = fontFallback->getGlyphIndex( codePoint );
if ( 0 != tGlyphIndex ) {
glyphIndex = tGlyphIndex;
fontInternalId = fontFallback->getFontInternalId();
} else {
glyphIndex = getGlyphIndex( codePoint );
}
}
Uint64 key = getIndexKey( fontInternalId, glyphIndex, bold, outlineThickness );
+6
View File
@@ -4106,6 +4106,7 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
{ "benchmark-mode" } );
args::Flag verbose( parser, "verbose", "Print all logs to the standard output.",
{ 'v', "verbose" } );
args::Flag version( parser, "version", "Prints version information", { 'V', "version" } );
try {
parser.ParseCLI( Sys::parseArguments( argc, argv ) );
} catch ( const args::Help& ) {
@@ -4121,6 +4122,11 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
return EXIT_FAILURE;
}
if ( version.Get() ) {
std::cout << ecode::Version::getVersionName() << '\n';
return EXIT_SUCCESS;
}
if ( verbose.Get() )
Log::instance()->setConsoleOutput( true );