From 2eb312e0418eeae8791fa5d3e8ccb6badcaecfa4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Feb 2019 01:02:42 +0100 Subject: [PATCH] - added a kerning option to FONTDEFS --- src/gamedata/fonts/v_font.cpp | 9 +++++++++ src/gamedata/fonts/v_font.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/gamedata/fonts/v_font.cpp b/src/gamedata/fonts/v_font.cpp index 4e4a5382f..4c84513bb 100644 --- a/src/gamedata/fonts/v_font.cpp +++ b/src/gamedata/fonts/v_font.cpp @@ -929,6 +929,7 @@ void V_InitCustomFonts() int first; int count; int spacewidth; + int kerning; char cursor = '_'; while ((llump = Wads.FindLump ("FONTDEFS", &lastlump)) != -1) @@ -945,6 +946,7 @@ void V_InitCustomFonts() first = 33; count = 223; spacewidth = -1; + kerning = 0; sc.MustGetStringName ("{"); while (!sc.CheckString ("}")) @@ -1004,6 +1006,11 @@ void V_InitCustomFonts() } format = 2; } + else if (sc.Compare("KERNING")) + { + sc.MustGetNumber(); + kerning = sc.Number; + } else { if (format == 1) goto wrong; @@ -1026,6 +1033,7 @@ void V_InitCustomFonts() { FFont *fnt = new FFont (namebuffer, templatebuf, nullptr, first, count, start, llump, spacewidth, donttranslate); fnt->SetCursor(cursor); + fnt->SetKerning(kerning); } else if (format == 2) { @@ -1050,6 +1058,7 @@ void V_InitCustomFonts() FFont *CreateSpecialFont (const char *name, int first, int count, FTexture **lumplist, const bool *notranslate, int lump, bool donttranslate); FFont *fnt = CreateSpecialFont (namebuffer, first, count, &lumplist[first], notranslate, llump, donttranslate); fnt->SetCursor(cursor); + fnt->SetKerning(kerning); } } else goto wrong; diff --git a/src/gamedata/fonts/v_font.h b/src/gamedata/fonts/v_font.h index 18ca18978..b8043f089 100644 --- a/src/gamedata/fonts/v_font.h +++ b/src/gamedata/fonts/v_font.h @@ -104,6 +104,7 @@ public: int GetCharCode(int code, bool needpic) const; char GetCursor() const { return Cursor; } void SetCursor(char c) { Cursor = c; } + void SetKerning(int c) { GlobalKerning = c; } bool NoTranslate() const { return noTranslate; } protected: