mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Change the default font from Vera size 12 to Noto Sans size 13.
Resolves issue #1075.
This commit is contained in:
+13
-12
@@ -22,6 +22,7 @@
|
||||
#include "Font.h"
|
||||
#include "BMFontRasterizer.h"
|
||||
#include "ImageRasterizer.h"
|
||||
#include "data/DataModule.h"
|
||||
|
||||
#include "libraries/utf8/utf8.h"
|
||||
|
||||
@@ -30,28 +31,28 @@ namespace love
|
||||
namespace font
|
||||
{
|
||||
|
||||
// Default TrueType font.
|
||||
#include "Vera.ttf.h"
|
||||
// Default TrueType font, gzip-compressed.
|
||||
#include "NotoSans-Regular.ttf.gzip.h"
|
||||
|
||||
class DefaultFontData : public love::Data
|
||||
Font::Font()
|
||||
{
|
||||
public:
|
||||
auto compressedbytes = (const char *) NotoSans_Regular_ttf_gzip;
|
||||
size_t compressedsize = NotoSans_Regular_ttf_gzip_len;
|
||||
|
||||
Data *clone() const override { return new DefaultFontData(); }
|
||||
void *getData() const override { return Vera_ttf; }
|
||||
size_t getSize() const override { return sizeof(Vera_ttf); }
|
||||
};
|
||||
size_t rawsize = 0;
|
||||
char *fontdata = data::decompress(data::Compressor::FORMAT_GZIP, compressedbytes, compressedsize, rawsize);
|
||||
|
||||
defaultFontData.set(new data::ByteData(fontdata, rawsize, true), Acquire::NORETAIN);
|
||||
}
|
||||
|
||||
Rasterizer *Font::newTrueTypeRasterizer(int size, TrueTypeRasterizer::Hinting hinting)
|
||||
{
|
||||
StrongRef<DefaultFontData> data(new DefaultFontData, Acquire::NORETAIN);
|
||||
return newTrueTypeRasterizer(data.get(), size, hinting);
|
||||
return newTrueTypeRasterizer(defaultFontData.get(), size, hinting);
|
||||
}
|
||||
|
||||
Rasterizer *Font::newTrueTypeRasterizer(int size, float dpiscale, TrueTypeRasterizer::Hinting hinting)
|
||||
{
|
||||
StrongRef<DefaultFontData> data(new DefaultFontData, Acquire::NORETAIN);
|
||||
return newTrueTypeRasterizer(data.get(), size, dpiscale, hinting);
|
||||
return newTrueTypeRasterizer(defaultFontData.get(), size, dpiscale, hinting);
|
||||
}
|
||||
|
||||
Rasterizer *Font::newBMFontRasterizer(love::filesystem::FileData *fontdef, const std::vector<image::ImageData *> &images, float dpiscale)
|
||||
|
||||
@@ -43,6 +43,7 @@ class Font : public Module
|
||||
|
||||
public:
|
||||
|
||||
Font();
|
||||
virtual ~Font() {}
|
||||
|
||||
virtual Rasterizer *newRasterizer(love::filesystem::FileData *data) = 0;
|
||||
@@ -64,6 +65,10 @@ public:
|
||||
virtual ModuleType getModuleType() const { return M_FONT; }
|
||||
virtual const char *getName() const = 0;
|
||||
|
||||
private:
|
||||
|
||||
StrongRef<Data> defaultFontData;
|
||||
|
||||
}; // Font
|
||||
|
||||
} // font
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -72,7 +72,7 @@ int w_newTrueTypeRasterizer(lua_State *L)
|
||||
if (lua_type(L, 1) == LUA_TNUMBER || lua_isnone(L, 1))
|
||||
{
|
||||
// First argument is a number: use the default TrueType font.
|
||||
int size = (int) luaL_optinteger(L, 1, 12);
|
||||
int size = (int) luaL_optinteger(L, 1, 13);
|
||||
|
||||
const char *hintstr = lua_isnoneornil(L, 2) ? nullptr : luaL_checkstring(L, 2);
|
||||
if (hintstr && !TrueTypeRasterizer::getConstant(hintstr, hinting))
|
||||
|
||||
@@ -504,7 +504,7 @@ void Graphics::checkSetDefaultFont()
|
||||
|
||||
// Create a new default font if we don't have one yet.
|
||||
if (!defaultFont.get())
|
||||
defaultFont.set(newDefaultFont(12, font::TrueTypeRasterizer::HINTING_NORMAL), Acquire::NORETAIN);
|
||||
defaultFont.set(newDefaultFont(13, font::TrueTypeRasterizer::HINTING_NORMAL), Acquire::NORETAIN);
|
||||
|
||||
states.back().font.set(defaultFont.get());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user