Implement font upscaling hack for similar looking web/PC font rendering.

This commit is contained in:
2023-11-29 06:16:56 -06:00
parent f9b00a8931
commit 5331a3d443
7 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -73,7 +73,7 @@ namespace olc {
Font(std::string path, int fontSize) : fontSize(fontSize) {
FT_Error error = FT_New_Face(library, path.c_str(), 0, &fontFace);
error = FT_Set_Pixel_Sizes(fontFace, 0, fontSize);
error = FT_Set_Pixel_Sizes(fontFace, 0, fontSize*4);
}
Font(const Font &other) = delete;
@@ -114,7 +114,7 @@ namespace olc {
for (size_t i = 0; i < string.size(); i++) {
char32_t chr = string[i];
if(chr=='\r')continue;
Font *toUse = this;
FT_UInt chrIndex = GetCharIndex(chr);
@@ -261,7 +261,7 @@ namespace olc {
public:
FontRect GetStringBounds(std::u32string string, float angle = 0.0f) {
FontRect temp=_GetStringBounds(string,angle);
return {temp.offset/2,{temp.size/2}};
return {temp.offset/4,{temp.size/4}};
}
olc::Sprite *RenderStringToSprite(std::u32string string,