MCPcopy Create free account
hub / github.com/ZDoom/Raze / SetupFontSubstitution

Function SetupFontSubstitution

source/core/razefont.cpp:142–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void SetupFontSubstitution()
143{
144 auto tilesmallfont = V_GetFont("tilesmallfont");
145 auto tilebigfont = V_GetFont("tilebigfont");
146
147 // Check if the fonts have been altered by a mod.
148 // If that is the case we need to do a bit of remapping to ensure the proper font gets used at least for English text.
149 if (tilesmallfont)
150 {
151 int hits = 0;
152 hits += compareChar('0', tilesmallfont, SmallFont);
153 hits += compareChar('A', tilesmallfont, SmallFont);
154 hits += compareChar('a', tilesmallfont, SmallFont);
155
156 if (hits < 3)
157 {
158 tilesmallfont->SetName(SmallFont->GetName());
159 SmallFont->SetName("OriginalSmallFont");
160 SmallFont = tilesmallfont;
161 }
162 }
163 if (tilebigfont)
164 {
165 int hits = 0;
166 if (g_gameType & GAMEFLAG_DUKE)
167 {
168 hits += compareChar('0', tilebigfont, BigFont13);
169 hits += compareChar('A', tilebigfont, BigFont13);
170 hits += compareChar('0', tilebigfont, BigFont15);
171 hits += compareChar('A', tilebigfont, BigFont15);
172 }
173 else
174 {
175 hits += compareChar('0', tilebigfont, BigFont);
176 hits += compareChar('A', tilebigfont, BigFont);
177 }
178
179 if (hits < 2)
180 {
181 tilebigfont->SetName(BigFont->GetName());
182 BigFont->SetName("OriginalBigFont");
183 BigFont = tilebigfont;
184 }
185 }
186}
187
188FFont* PickBigFont(const char* txt)
189{

Callers 1

InitTexturesFunction · 0.85

Calls 4

V_GetFontFunction · 0.85
compareCharFunction · 0.85
SetNameMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected