change fonts to woff2
This commit is contained in:
parent
9aaaf874e9
commit
84a2d8f7f8
Binary file not shown.
BIN
assets/opensb/font/barcode/barcode.woff2
Normal file
BIN
assets/opensb/font/barcode/barcode.woff2
Normal file
Binary file not shown.
BIN
assets/opensb/font/barcode/barcodetext.woff2
Normal file
BIN
assets/opensb/font/barcode/barcodetext.woff2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/beech.woff2
Normal file
BIN
assets/opensb/font/beech.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extended.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extended.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extendedextrabold.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extendedextrabold.woff2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extendedextralight.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extendedextralight.woff2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extendedoblique.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extendedoblique.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extendedsemibold.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extendedsemibold.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extendedsemiboldoblique.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extendedsemiboldoblique.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extrabold.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extrabold.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extraboldoblique.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extraboldoblique.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extralight.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extralight.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-extralightoblique.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-extralightoblique.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-oblique.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-oblique.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-semibold.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-semibold.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka-semiboldoblique.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka-semiboldoblique.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/iosevka/iosevka.woff2
Normal file
BIN
assets/opensb/font/iosevka/iosevka.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/newspaper.woff2
Normal file
BIN
assets/opensb/font/newspaper.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/pixelhobo.woff2
Normal file
BIN
assets/opensb/font/pixelhobo.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/spacemono/spacemono-bold.woff2
Normal file
BIN
assets/opensb/font/spacemono/spacemono-bold.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/spacemono/spacemono-bolditalic.woff2
Normal file
BIN
assets/opensb/font/spacemono/spacemono-bolditalic.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/spacemono/spacemono-italic.woff2
Normal file
BIN
assets/opensb/font/spacemono/spacemono-italic.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/opensb/font/spacemono/spacemono.woff2
Normal file
BIN
assets/opensb/font/spacemono/spacemono.woff2
Normal file
Binary file not shown.
@ -1181,7 +1181,7 @@ shared_ptr<Assets::AssetData> Assets::loadAudio(AssetPath const& path) const {
|
|||||||
shared_ptr<Assets::AssetData> Assets::loadFont(AssetPath const& path) const {
|
shared_ptr<Assets::AssetData> Assets::loadFont(AssetPath const& path) const {
|
||||||
return unlockDuring([&]() {
|
return unlockDuring([&]() {
|
||||||
auto newData = make_shared<FontData>();
|
auto newData = make_shared<FontData>();
|
||||||
newData->font = Font::loadTrueTypeFont(make_shared<ByteArray>(read(path.basePath)));
|
newData->font = Font::loadFont(make_shared<ByteArray>(read(path.basePath)));
|
||||||
return newData;
|
return newData;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,11 @@ struct FontImpl {
|
|||||||
FT_Face face;
|
FT_Face face;
|
||||||
};
|
};
|
||||||
|
|
||||||
FontPtr Font::loadTrueTypeFont(String const& fileName, unsigned pixelSize) {
|
FontPtr Font::loadFont(String const& fileName, unsigned pixelSize) {
|
||||||
return loadTrueTypeFont(make_shared<ByteArray>(File::readFile(fileName)), pixelSize);
|
return loadFont(make_shared<ByteArray>(File::readFile(fileName)), pixelSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
FontPtr Font::loadTrueTypeFont(ByteArrayConstPtr const& bytes, unsigned pixelSize) {
|
FontPtr Font::loadFont(ByteArrayConstPtr const& bytes, unsigned pixelSize) {
|
||||||
FontPtr font = make_shared<Font>();
|
FontPtr font = make_shared<Font>();
|
||||||
font->m_fontBuffer = bytes;
|
font->m_fontBuffer = bytes;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ FontPtr Font::loadTrueTypeFont(ByteArrayConstPtr const& bytes, unsigned pixelSiz
|
|||||||
Font::Font() : m_pixelSize(0), m_alphaThreshold(0) {}
|
Font::Font() : m_pixelSize(0), m_alphaThreshold(0) {}
|
||||||
|
|
||||||
FontPtr Font::clone() const {
|
FontPtr Font::clone() const {
|
||||||
return Font::loadTrueTypeFont(m_fontBuffer, m_pixelSize);
|
return Font::loadFont(m_fontBuffer, m_pixelSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::setPixelSize(unsigned pixelSize) {
|
void Font::setPixelSize(unsigned pixelSize) {
|
||||||
|
@ -14,8 +14,8 @@ STAR_CLASS(Font);
|
|||||||
|
|
||||||
class Font {
|
class Font {
|
||||||
public:
|
public:
|
||||||
static FontPtr loadTrueTypeFont(String const& fileName, unsigned pixelSize = 12);
|
static FontPtr loadFont(String const& fileName, unsigned pixelSize = 12);
|
||||||
static FontPtr loadTrueTypeFont(ByteArrayConstPtr const& bytes, unsigned pixelSize = 12);
|
static FontPtr loadFont(ByteArrayConstPtr const& bytes, unsigned pixelSize = 12);
|
||||||
|
|
||||||
Font();
|
Font();
|
||||||
|
|
||||||
|
@ -337,7 +337,8 @@ void TextPainter::reloadFonts() {
|
|||||||
auto assets = Root::singleton().assets();
|
auto assets = Root::singleton().assets();
|
||||||
String defaultName = "hobo";
|
String defaultName = "hobo";
|
||||||
auto defaultFont = loadFont("/hobo.ttf", defaultName);
|
auto defaultFont = loadFont("/hobo.ttf", defaultName);
|
||||||
for (auto& fontPath : assets->scanExtension("ttf")) {
|
auto loadFontsByExtension = [&](String const& ext) {
|
||||||
|
for (auto& fontPath : assets->scanExtension(ext)) {
|
||||||
auto font = assets->font(fontPath);
|
auto font = assets->font(fontPath);
|
||||||
if (font == defaultFont)
|
if (font == defaultFont)
|
||||||
continue;
|
continue;
|
||||||
@ -346,6 +347,9 @@ void TextPainter::reloadFonts() {
|
|||||||
name = name.substr(0, name.findLast("."));
|
name = name.substr(0, name.findLast("."));
|
||||||
addFont(loadFont(fontPath, name), name);
|
addFont(loadFont(fontPath, name), name);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
loadFontsByExtension("ttf");
|
||||||
|
loadFontsByExtension("woff2");
|
||||||
m_fontTextureGroup.addFont(defaultFont, defaultName, true);
|
m_fontTextureGroup.addFont(defaultFont, defaultName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user