Font family WIP.

This commit is contained in:
Martín Lucas Golini
2023-08-11 01:21:46 -03:00
parent d6a698bacc
commit 0903bd7039
15 changed files with 194 additions and 67 deletions

View File

@@ -71,14 +71,14 @@ minimap_highlight = #FFFF0080
normal = #cfcfcf
symbol = #cfcfcf
comment = #cd8b00
keyword = #8a98ff,shadow
keyword2 = #8abdff,shadow
keyword3 = #cfcfcf,shadow
keyword = #8a98ff,bold
keyword2 = #8abdff,bold
keyword3 = #cfcfcf,bold
number = #f0ad6d
literal = #ffcd8b
string = #ffcd8b
operator = #cfbfad
function = #76c0d0,shadow
function = #76c0d0,bold
link = #5ccfcf
link_hover = transparent,shadow,underline

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -10,6 +10,7 @@
#include <eepp/graphics/drawablesearcher.hpp>
#include <eepp/graphics/font.hpp>
#include <eepp/graphics/fontbmfont.hpp>
#include <eepp/graphics/fontfamily.hpp>
#include <eepp/graphics/fontmanager.hpp>
#include <eepp/graphics/fontsprite.hpp>
#include <eepp/graphics/fontstyleconfig.hpp>

View File

@@ -47,6 +47,8 @@ class EE_API Font {
struct Info {
std::string family; ///< The font family
std::string fontpath; ///< The directory path of the font
std::string filename; ///< The file name
};
static inline Uint32 getHorizontalAlign( const Uint32& flags ) {

View File

@@ -0,0 +1,21 @@
#ifndef EE_GRAPHICS_FONTFAMILY_HPP
#define EE_GRAPHICS_FONTFAMILY_HPP
#include <eepp/graphics/fonttruetype.hpp>
namespace EE { namespace Graphics {
class EE_API FontFamily {
public:
static void loadFromRegular( FontTrueType* font );
private:
static std::string findType( const std::string& fontpath, const std::string& fontname,
const std::string& ext, const std::vector<std::string>& names );
static FontTrueType* setFont( FontTrueType* font, const std::string& fontpath,
const std::string& fontType );
};
}} // namespace EE::Graphics
#endif // FONTFAMILY_HPP

View File

@@ -117,6 +117,12 @@ class EE_API FontTrueType : public Font {
virtual bool hasBoldItalic() { return isBoldItalic() || mFontBoldItalic; }
FontTrueType* getBoldFont() const { return mFontBold; }
FontTrueType* getItalicFont() const { return mFontItalic; }
FontTrueType* getBoldItalicFont() const { return mFontBoldItalic; }
void setBoldFont( FontTrueType* fontBold );
void setItalicFont( FontTrueType* fontItalic );

View File

@@ -58,6 +58,10 @@ class EE_API GlyphDrawable : public DrawableResource {
void setDrawMode( const DrawMode& drawMode );
bool isItalic() const { return mIsItalic; }
void setIsItalic( bool isItalic );
protected:
Texture* mTexture;
Rectf mSrcRect;
@@ -65,6 +69,7 @@ class EE_API GlyphDrawable : public DrawableResource {
Float mPixelDensity;
Vector2f mGlyphOffset;
DrawMode mDrawMode{ DrawMode::Image };
bool mIsItalic{ false };
};
}} // namespace EE::Graphics

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 10.0.2, 2023-07-06T00:10:20. -->
<!-- Written by QtCreator 11.0.0, 2023-08-11T01:21:17. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -86,6 +86,7 @@
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig"></value>
<value type="int" key="ClangTools.ParallelJobs">0</value>
<value type="bool" key="ClangTools.PreferConfigFile">false</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
@@ -935,6 +936,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-test-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-test-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -959,6 +961,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-test</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-test-release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -983,13 +986,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-physics-demo-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-physics-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1007,13 +1010,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-http-request-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-http-request-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1031,13 +1034,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}../../../bin/eeiv-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eeiv-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1055,6 +1058,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-TextureAtlasEditor-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-TextureAtlasEditor-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1079,6 +1083,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-MapEditor-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-MapEditor-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1104,6 +1109,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-UIEditor-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-UIEditor-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1129,13 +1135,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-ui-hello-world-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-ui-hello-world-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1153,6 +1159,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-TexturePacker-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-TexturePacker-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1178,6 +1185,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-ui-perf-test-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-ui-perf-test-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1202,13 +1210,14 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/ecode-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">ecode-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="int" key="RunConfiguration.UseCppDebugger">0</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}/../../bin</value>
@@ -1226,6 +1235,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-empty-window-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-empty-window-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1250,6 +1260,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eterm-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eterm-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1274,6 +1285,7 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-empty-window</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-empty-window-release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
@@ -1298,13 +1310,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-external-shader-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-external-shader-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1322,13 +1334,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-external-shader</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-external-shader-release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1346,13 +1358,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-sound-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-sound-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1370,13 +1382,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-sprites-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-sprites-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
@@ -1394,14 +1406,15 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-fonts-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-fonts-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="int" key="RunConfiguration.UseCppDebugger">0</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
</valuemap>
@@ -1418,13 +1431,13 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-vbo-fbo-batch-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-vbo-fbo-batch-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>

View File

@@ -59,6 +59,7 @@
../../include/eepp/graphics/drawablesearcher.hpp
../../include/eepp/graphics/fontbmfont.hpp
../../include/eepp/graphics/font.hpp
../../include/eepp/graphics/fontfamily.hpp
../../include/eepp/graphics/fontmanager.hpp
../../include/eepp/graphics/fontsprite.hpp
../../include/eepp/graphics/fontstyleconfig.hpp
@@ -543,6 +544,7 @@
../../src/eepp/graphics/drawablesearcher.cpp
../../src/eepp/graphics/fontbmfont.cpp
../../src/eepp/graphics/font.cpp
../../src/eepp/graphics/fontfamily.cpp
../../src/eepp/graphics/fontmanager.cpp
../../src/eepp/graphics/fontsprite.cpp
../../src/eepp/graphics/fonttruetype.cpp

View File

@@ -0,0 +1,60 @@
#include <eepp/graphics/fontfamily.hpp>
#include <eepp/system/filesystem.hpp>
namespace EE { namespace Graphics {
void FontFamily::loadFromRegular( FontTrueType* font ) {
if ( font == nullptr || font->getInfo().fontpath.empty() || font->getInfo().filename.empty() )
return;
std::string ext( FileSystem::fileExtension( font->getInfo().filename ) );
if ( ext.empty() )
return;
std::string fontname( FileSystem::fileRemoveExtension( font->getInfo().filename ) );
if ( String::endsWith( fontname, "-Regular" ) ) {
auto pos( fontname.find_last_of( '-' ) );
fontname.resize( pos );
}
setFont( font, findType( font->getInfo().fontpath, fontname, ext, { "Bold", "bold" } ),
"bold" );
setFont( font,
findType( font->getInfo().fontpath, fontname, ext,
{ "Italic", "Oblique", "italic", "oblique", "It", "it" } ),
"italic" );
setFont( font,
findType( font->getInfo().fontpath, fontname, ext, { "BoldItalic", "BoldOblique" } ),
"bolditalic" );
}
std::string FontFamily::findType( const std::string& fontpath, const std::string& fontname,
const std::string& ext, const std::vector<std::string>& names ) {
std::string path;
for ( const auto& name : names ) {
path = fontpath + fontname + "-" + name + "." + ext;
if ( FileSystem::fileExists( path ) )
return path;
}
return "";
}
FontTrueType* FontFamily::setFont( FontTrueType* font, const std::string& fontpath,
const std::string& fontType ) {
if ( fontpath.empty() )
return nullptr;
FontTrueType* loadedFont = FontTrueType::New( font->getName() + "-" + fontType, fontpath );
if ( fontType == "bold" )
font->setBoldFont( loadedFont );
else if ( fontType == "italic" )
font->setItalicFont( loadedFont );
else if ( fontType == "bolditalic" )
font->setBoldItalicFont( loadedFont );
loadedFont->setBoldAdvanceSameAsRegular( font->getBoldAdvanceSameAsRegular() );
loadedFont->setEnableDynamicMonospace( font->getEnableDynamicMonospace() );
return loadedFont;
}
}} // namespace EE::Graphics

View File

@@ -129,6 +129,9 @@ bool FontTrueType::loadFromFile( const std::string& filename ) {
return false;
}
mInfo.fontpath = FileSystem::fileRemoveFileName( filename );
mInfo.filename = FileSystem::fileNameFromPath( filename );
return setFontFace( face );
}
@@ -214,15 +217,17 @@ bool FontTrueType::loadFromPack( Pack* pack, std::string filePackPath ) {
if ( NULL == pack )
return false;
bool Ret = false;
bool ret = false;
mMemCopy.clear();
if ( pack->isOpen() && pack->extractFileToMemory( filePackPath, mMemCopy ) ) {
Ret = loadFromMemory( mMemCopy.get(), mMemCopy.length(), false );
}
if ( pack->isOpen() && pack->extractFileToMemory( filePackPath, mMemCopy ) )
ret = loadFromMemory( mMemCopy.get(), mMemCopy.length(), false );
return Ret;
mInfo.fontpath = FileSystem::fileRemoveFileName( filePackPath );
mInfo.filename = FileSystem::fileNameFromPath( filePackPath );
return ret;
}
bool FontTrueType::setFontFace( void* _face ) {
@@ -339,18 +344,18 @@ const Glyph& FontTrueType::getGlyph( Uint32 codePoint, unsigned int characterSiz
if ( bold && italic && mFontBoldItalic != nullptr &&
0 != mFontBoldItalic->getGlyphIndex( codePoint ) ) {
return mFontBoldItalic->getGlyph( codePoint, characterSize, false, false, outlineThickness,
return mFontBoldItalic->getGlyph( codePoint, characterSize, true, true, outlineThickness,
getPage( characterSize ), maxWidth );
}
if ( bold && !italic && mFontBold != nullptr && 0 != mFontBold->getGlyphIndex( codePoint ) ) {
return mFontBold->getGlyph( codePoint, characterSize, false, false, outlineThickness,
return mFontBold->getGlyph( codePoint, characterSize, true, false, outlineThickness,
getPage( characterSize ), maxWidth );
}
if ( italic && !bold && mFontItalic != nullptr &&
0 != mFontItalic->getGlyphIndex( codePoint ) ) {
return mFontItalic->getGlyph( codePoint, characterSize, false, false, outlineThickness,
return mFontItalic->getGlyph( codePoint, characterSize, false, true, outlineThickness,
getPage( characterSize ), maxWidth );
}
@@ -417,6 +422,7 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
Uint32 glyphIndex = 0;
Uint32 tGlyphIndex = 0;
Uint32 fontInternalId = mFontInternalId;
bool isItalic = false;
if ( mEnableEmojiFallback && Font::isEmojiCodePoint( codePoint ) && !mIsColorEmojiFont &&
!mIsEmojiFont ) {
@@ -449,6 +455,26 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
glyphIndex = getGlyphIndex( codePoint );
}
if ( bold && italic && mFontBoldItalic != nullptr &&
( tGlyphIndex = mFontBoldItalic->getGlyphIndex( codePoint ) ) ) {
glyphIndex = tGlyphIndex;
fontInternalId = mFontBoldItalic->getFontInternalId();
isItalic = true;
}
if ( bold && !italic && mFontBold != nullptr &&
( tGlyphIndex = mFontBold->getGlyphIndex( codePoint ) ) ) {
glyphIndex = tGlyphIndex;
fontInternalId = mFontBold->getFontInternalId();
}
if ( italic && !bold && mFontItalic != nullptr &&
( tGlyphIndex = mFontItalic->getGlyphIndex( codePoint ) ) ) {
glyphIndex = tGlyphIndex;
fontInternalId = mFontItalic->getFontInternalId();
isItalic = true;
}
if ( 0 == glyphIndex && mEnableFallbackFont &&
FontManager::instance()->getFallbackFont() != nullptr &&
FontManager::instance()->getFallbackFont()->getType() == FontType::TTF ) {
@@ -473,44 +499,19 @@ GlyphDrawable* FontTrueType::getGlyphDrawable( Uint32 codePoint, unsigned int ch
if ( it != drawables.end() ) {
return it->second;
} else {
GlyphDrawable* region = nullptr;
const Glyph* glyph = nullptr;
const Glyph& glyph =
getGlyph( codePoint, characterSize, bold, italic, outlineThickness, maxWidth );
GlyphDrawable* region = GlyphDrawable::New(
page.texture, glyph.textureRect, glyph.size,
String::format( "%s_%d_%u", mFontName.c_str(), characterSize, codePoint ) );
if ( bold && italic && mFontBoldItalic != nullptr &&
0 != mFontBoldItalic->getGlyphIndex( codePoint ) ) {
glyph = &mFontBoldItalic->getGlyph( codePoint, characterSize, false, false,
outlineThickness, maxWidth );
region = GlyphDrawable::New( page.texture, glyph->textureRect, glyph->size,
String::format( "%s_%d_%u_bold_italic", mFontName.c_str(),
characterSize, codePoint ) );
} else if ( bold && !italic && mFontBold != nullptr &&
0 != mFontBold->getGlyphIndex( codePoint ) ) {
glyph = &mFontBold->getGlyph( codePoint, characterSize, false, false, outlineThickness,
maxWidth );
region = GlyphDrawable::New(
page.texture, glyph->textureRect, glyph->size,
String::format( "%s_%d_%u_bold", mFontName.c_str(), characterSize, codePoint ) );
} else if ( italic && !bold && mFontItalic != nullptr &&
0 != mFontItalic->getGlyphIndex( codePoint ) ) {
glyph = &mFontItalic->getGlyph( codePoint, characterSize, false, false,
outlineThickness, maxWidth );
region = GlyphDrawable::New(
page.texture, glyph->textureRect, glyph->size,
String::format( "%s_%d_%u_italic", mFontName.c_str(), characterSize, codePoint ) );
} else {
glyph = &getGlyph( codePoint, characterSize, bold, italic, outlineThickness, maxWidth );
region = GlyphDrawable::New(
page.texture, glyph->textureRect, glyph->size,
String::format( "%s_%d_%u", mFontName.c_str(), characterSize, codePoint ) );
}
region->setGlyphOffset( { glyph.bounds.Left - outlineThickness,
characterSize + glyph.bounds.Top - outlineThickness } );
if ( region != nullptr ) {
region->setGlyphOffset( { glyph->bounds.Left - outlineThickness,
characterSize + glyph->bounds.Top - outlineThickness } );
region->setIsItalic( isItalic );
drawables[key] = region;
return region;
}
drawables[key] = region;
return region;
}
return nullptr;
}
@@ -731,7 +732,7 @@ fontSetRenderOptions( FT_Library library, FontAntialiasing antialiasing, FontHin
return FT_RENDER_MODE_NORMAL;
}
Glyph FontTrueType::loadGlyph( Uint32 index, unsigned int characterSize, bool bold, bool italic,
Glyph FontTrueType::loadGlyph( Uint32 index, unsigned int characterSize, bool bold, bool /*italic*/,
Float outlineThickness, Page& page, const Float& maxWidth ) const {
// The glyph to return
Glyph glyph;
@@ -782,7 +783,7 @@ Glyph FontTrueType::loadGlyph( Uint32 index, unsigned int characterSize, bool bo
FT_Pos weight = 1 << 6;
bool outline = ( glyphDesc->format == FT_GLYPH_FORMAT_OUTLINE );
if ( outline ) {
if ( bold ) {
if ( bold && !mIsBold ) {
FT_OutlineGlyph outlineGlyph = (FT_OutlineGlyph)glyphDesc;
FT_Outline_EmboldenXY( &outlineGlyph->outline, 1 << 5, weight );
}
@@ -803,7 +804,7 @@ Glyph FontTrueType::loadGlyph( Uint32 index, unsigned int characterSize, bool bo
// Apply bold if necessary -- fallback technique using bitmap (lower quality)
if ( !outline ) {
if ( bold )
if ( bold && !mIsBold )
FT_Bitmap_Embolden( static_cast<FT_Library>( mLibrary ), &bitmap, weight, weight );
if ( outlineThickness != 0 && !mIsColorEmojiFont )

View File

@@ -41,7 +41,7 @@ void GlyphDrawable::draw( const Vector2f& position, const Sizef& size ) {
mSrcRect.Top + mSrcRect.Bottom );
if ( mDrawMode == DrawMode::Image ) {
BR->batchQuad( position.x, position.y, size.getWidth(), size.getHeight() );
} else if ( mDrawMode == DrawMode::TextItalic ) {
} else if ( mDrawMode == DrawMode::TextItalic && !mIsItalic ) {
Float x = position.x + mGlyphOffset.x;
Float y = position.y + mGlyphOffset.y;
Float italic = 0.208f * size.getWidth(); // 12 degrees
@@ -63,7 +63,7 @@ void GlyphDrawable::drawIntoVertexBuffer( VertexBuffer* vbo, const Vector2u& gri
Sizef size( mDestSize != Sizef::Zero ? mDestSize : Sizef( mSrcRect.Right, mSrcRect.Bottom ) );
if ( mDrawMode == DrawMode::Image ) {
vbo->setQuad( gridPos, pos, size, mColor );
} else if ( mDrawMode == DrawMode::TextItalic ) {
} else if ( mDrawMode == DrawMode::TextItalic && !mIsItalic ) {
Float x = pos.x + mGlyphOffset.x;
Float y = pos.y + mGlyphOffset.y;
Float italic = 0.208f * size.getWidth(); // 12 degrees
@@ -119,4 +119,8 @@ void GlyphDrawable::setDrawMode( const DrawMode& drawMode ) {
mDrawMode = drawMode;
}
void GlyphDrawable::setIsItalic( bool isItalic ) {
mIsItalic = isItalic;
}
}} // namespace EE::Graphics

View File

@@ -13,6 +13,7 @@
#include "version.hpp"
#include <algorithm>
#include <args/args.hxx>
#include <eepp/graphics/fontfamily.hpp>
#include <filesystem>
#include <nlohmann/json.hpp>
#if EE_PLATFORM == EE_PLATFORM_LINUX
@@ -287,6 +288,7 @@ void App::openFontDialog( std::string& fontPath, bool loadingMonoFont ) {
mFontMono = fontMono;
mFontMono->setEnableDynamicMonospace( true );
mFontMono->setBoldAdvanceSameAsRegular( true );
FontFamily::loadFromRegular( mFontMono );
if ( mSplitter ) {
mSplitter->forEachEditor(
[this]( UICodeEditor* editor ) { editor->setFont( mFontMono ); } );
@@ -3193,6 +3195,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
if ( mFontMono ) {
mFontMono->setEnableDynamicMonospace( true );
mFontMono->setBoldAdvanceSameAsRegular( true );
FontFamily::loadFromRegular( mFontMono );
}
loadFont( "NotoEmoji-Regular", "fonts/NotoEmoji-Regular.ttf" );
@@ -3213,6 +3216,15 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
mTerminalFont = loadFont( "monospace-nerdfont", mConfig.ui.terminalFont,
"fonts/DejaVuSansMonoNerdFontComplete.ttf" );
if ( ( nullptr != mTerminalFont && mTerminalFont->getInfo().family == "DejaVuSansMono NF" &&
mFontMono->getInfo().family == "DejaVu Sans Mono" ) ||
mTerminalFont->getInfo().family == mFontMono->getInfo().family ) {
mTerminalFont->setBoldFont( mFontMono->getBoldFont() );
mTerminalFont->setItalicFont( mFontMono->getItalicFont() );
mTerminalFont->setBoldItalicFont( mFontMono->getBoldItalicFont() );
} else {
FontFamily::loadFromRegular( mTerminalFont );
}
mFallbackFont = loadFont( "fallback-font", "fonts/DroidSansFallbackFull.ttf" );
if ( mFallbackFont )