mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Disable the padding at end of bitmapped drawn text by default
This commit is contained in:
parent
f6c3b6e582
commit
23f9194b27
@ -543,9 +543,8 @@ static int MeasureBitmappedWidth(const struct DrawTextArgs* args) {
|
|||||||
width += Drawer2D_Width(point, c) + xPadding;
|
width += Drawer2D_Width(point, c) + xPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: this should be always done? */
|
|
||||||
/* Remove padding at end */
|
/* Remove padding at end */
|
||||||
if (width && (args->font->flags & FONT_FLAGS_NOPADDING)) width -= xPadding;
|
if (width && !(args->font->flags & FONT_FLAGS_PADDING)) width -= xPadding;
|
||||||
|
|
||||||
if (args->useShadow) { width += Drawer2D_ShadowOffset(point); }
|
if (args->useShadow) { width += Drawer2D_ShadowOffset(point); }
|
||||||
return width;
|
return width;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Copyright 2014-2020 ClassiCube | Licensed under BSD-3
|
Copyright 2014-2020 ClassiCube | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum FONT_FLAGS { FONT_FLAGS_NONE = 0x00, FONT_FLAGS_BOLD = 0x01, FONT_FLAGS_UNDERLINE = 0x02, FONT_FLAGS_NOPADDING = 0x04 };
|
enum FONT_FLAGS { FONT_FLAGS_NONE = 0x00, FONT_FLAGS_BOLD = 0x01, FONT_FLAGS_UNDERLINE = 0x02, FONT_FLAGS_PADDING = 0x04 };
|
||||||
struct FontDesc { void* handle; cc_uint16 size, flags; int height; };
|
struct FontDesc { void* handle; cc_uint16 size, flags; int height; };
|
||||||
struct DrawTextArgs { cc_string text; struct FontDesc* font; cc_bool useShadow; };
|
struct DrawTextArgs { cc_string text; struct FontDesc* font; cc_bool useShadow; };
|
||||||
struct Texture;
|
struct Texture;
|
||||||
|
@ -3181,7 +3181,7 @@ static void TexIdsOverlay_ContextRecreated(void* screen) {
|
|||||||
struct FontDesc textFont, titleFont;
|
struct FontDesc textFont, titleFont;
|
||||||
|
|
||||||
Screen_CreateVb(screen);
|
Screen_CreateVb(screen);
|
||||||
Drawer2D_MakeFont(&textFont, 8, FONT_FLAGS_NONE);
|
Drawer2D_MakeFont(&textFont, 8, FONT_FLAGS_PADDING);
|
||||||
Font_SetPadding(&textFont, 1);
|
Font_SetPadding(&textFont, 1);
|
||||||
TextAtlas_Make(&s->idAtlas, &chars, &textFont, &prefix);
|
TextAtlas_Make(&s->idAtlas, &chars, &textFont, &prefix);
|
||||||
Font_Free(&textFont);
|
Font_Free(&textFont);
|
||||||
|
@ -192,7 +192,7 @@ static void HUDScreen_ContextRecreated(void* screen) {
|
|||||||
struct TextWidget* line1 = &s->line1;
|
struct TextWidget* line1 = &s->line1;
|
||||||
struct TextWidget* line2 = &s->line2;
|
struct TextWidget* line2 = &s->line2;
|
||||||
|
|
||||||
Drawer2D_MakeFont(&s->font, 16, FONT_FLAGS_NONE);
|
Drawer2D_MakeFont(&s->font, 16, FONT_FLAGS_PADDING);
|
||||||
Font_SetPadding(&s->font, 2);
|
Font_SetPadding(&s->font, 2);
|
||||||
HotbarWidget_SetFont(&s->hotbar, &s->font);
|
HotbarWidget_SetFont(&s->hotbar, &s->font);
|
||||||
|
|
||||||
@ -643,7 +643,7 @@ static void TabListOverlay_ContextRecreated(void* screen) {
|
|||||||
int size, id;
|
int size, id;
|
||||||
|
|
||||||
size = Drawer2D_BitmappedText ? 16 : 11;
|
size = Drawer2D_BitmappedText ? 16 : 11;
|
||||||
Drawer2D_MakeFont(&s->font, size, FONT_FLAGS_NONE);
|
Drawer2D_MakeFont(&s->font, size, FONT_FLAGS_PADDING);
|
||||||
s->namesCount = 0;
|
s->namesCount = 0;
|
||||||
|
|
||||||
TextWidget_SetConst(&s->title, "Connected players:", &s->font);
|
TextWidget_SetConst(&s->title, "Connected players:", &s->font);
|
||||||
@ -802,7 +802,7 @@ static cc_bool ChatScreen_ChatUpdateFont(struct ChatScreen* s) {
|
|||||||
/* TODO: Add function for this, don't use Display_ScaleY (Drawer2D_SameFontSize ??) */
|
/* TODO: Add function for this, don't use Display_ScaleY (Drawer2D_SameFontSize ??) */
|
||||||
if (Display_ScaleY(size) == s->chatFont.size) return false;
|
if (Display_ScaleY(size) == s->chatFont.size) return false;
|
||||||
ChatScreen_FreeChatFonts(s);
|
ChatScreen_FreeChatFonts(s);
|
||||||
Drawer2D_MakeFont(&s->chatFont, size, FONT_FLAGS_NONE);
|
Drawer2D_MakeFont(&s->chatFont, size, FONT_FLAGS_PADDING);
|
||||||
|
|
||||||
size = (int)(16 * Gui_GetChatScale());
|
size = (int)(16 * Gui_GetChatScale());
|
||||||
Math_Clamp(size, 8, 60);
|
Math_Clamp(size, 8, 60);
|
||||||
@ -2040,7 +2040,7 @@ static void TouchScreen_ContextRecreated(void* screen) {
|
|||||||
const struct TouchButtonDesc* desc;
|
const struct TouchButtonDesc* desc;
|
||||||
int i;
|
int i;
|
||||||
Screen_CreateVb(screen);
|
Screen_CreateVb(screen);
|
||||||
Drawer2D_MakeFont(&s->font, 16, FONT_FLAGS_BOLD | FONT_FLAGS_NOPADDING);
|
Drawer2D_MakeFont(&s->font, 16, FONT_FLAGS_BOLD);
|
||||||
|
|
||||||
for (i = 0; i < s->numOnscreen; i++) {
|
for (i = 0; i < s->numOnscreen; i++) {
|
||||||
desc = s->onscreenDescs[i];
|
desc = s->onscreenDescs[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user