Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Miguel Gustavo Rodrigues Teixeira
SRB2
Commits
02f31a49
Commit
02f31a49
authored
1 year ago
by
sphere
Browse files
Options
Downloads
Patches
Plain Diff
Add character width to font definitions
Used for V_MONOSPACE and V_OLDSPACING instead of spacewidth*2
parent
94db9ddf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/hu_stuff.c
+9
-8
9 additions, 8 deletions
src/hu_stuff.c
src/hu_stuff.h
+2
-1
2 additions, 1 deletion
src/hu_stuff.h
src/v_video.c
+6
-6
6 additions, 6 deletions
src/v_video.c
with
17 additions
and
15 deletions
src/hu_stuff.c
+
9
−
8
View file @
02f31a49
...
@@ -200,13 +200,13 @@ void HU_LoadGraphics(void)
...
@@ -200,13 +200,13 @@ void HU_LoadGraphics(void)
HU_LoadFontCharacters
(
&
ntb_font
,
"NTFNT"
);
HU_LoadFontCharacters
(
&
ntb_font
,
"NTFNT"
);
HU_LoadFontCharacters
(
&
nto_font
,
"NTFNO"
);
HU_LoadFontCharacters
(
&
nto_font
,
"NTFNO"
);
//
S
et kerning, space width
& line spacing for each font
//
For each font, s
et kerning, space width
, character width and line spacing
HU_SetFontProperties
(
&
hu_font
,
0
,
4
,
12
);
HU_SetFontProperties
(
&
hu_font
,
0
,
4
,
8
,
12
);
HU_SetFontProperties
(
&
tny_font
,
0
,
2
,
12
);
HU_SetFontProperties
(
&
tny_font
,
0
,
2
,
4
,
12
);
HU_SetFontProperties
(
&
cred_font
,
0
,
16
,
16
);
HU_SetFontProperties
(
&
cred_font
,
0
,
16
,
16
,
16
);
HU_SetFontProperties
(
&
lt_font
,
0
,
16
,
20
);
HU_SetFontProperties
(
&
lt_font
,
0
,
16
,
20
,
20
);
HU_SetFontProperties
(
&
ntb_font
,
2
,
4
,
21
);
HU_SetFontProperties
(
&
ntb_font
,
2
,
4
,
20
,
21
);
HU_SetFontProperties
(
&
nto_font
,
0
,
4
,
21
);
HU_SetFontProperties
(
&
nto_font
,
0
,
4
,
20
,
21
);
//cache numbers too!
//cache numbers too!
for
(
i
=
0
;
i
<
10
;
i
++
)
for
(
i
=
0
;
i
<
10
;
i
++
)
...
@@ -279,10 +279,11 @@ void HU_LoadFontCharacters(fontdef_t *font, const char *prefix)
...
@@ -279,10 +279,11 @@ void HU_LoadFontCharacters(fontdef_t *font, const char *prefix)
}
}
}
}
void
HU_SetFontProperties
(
fontdef_t
*
font
,
INT32
kerning
,
UINT32
spacewidth
,
UINT32
linespacing
)
void
HU_SetFontProperties
(
fontdef_t
*
font
,
INT32
kerning
,
UINT32
spacewidth
,
UINT32
charwidth
,
UINT32
linespacing
)
{
{
font
->
kerning
=
kerning
;
font
->
kerning
=
kerning
;
font
->
spacewidth
=
spacewidth
;
font
->
spacewidth
=
spacewidth
;
font
->
charwidth
=
charwidth
;
font
->
linespacing
=
linespacing
;
font
->
linespacing
=
linespacing
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/hu_stuff.h
+
2
−
1
View file @
02f31a49
...
@@ -35,6 +35,7 @@ typedef struct
...
@@ -35,6 +35,7 @@ typedef struct
patch_t
*
chars
[
FONTSIZE
];
patch_t
*
chars
[
FONTSIZE
];
INT32
kerning
;
INT32
kerning
;
UINT32
spacewidth
;
UINT32
spacewidth
;
UINT32
charwidth
;
UINT32
linespacing
;
UINT32
linespacing
;
}
fontdef_t
;
}
fontdef_t
;
...
@@ -94,7 +95,7 @@ void HU_Init(void);
...
@@ -94,7 +95,7 @@ void HU_Init(void);
void
HU_LoadGraphics
(
void
);
void
HU_LoadGraphics
(
void
);
void
HU_LoadFontCharacters
(
fontdef_t
*
font
,
const
char
*
prefix
);
void
HU_LoadFontCharacters
(
fontdef_t
*
font
,
const
char
*
prefix
);
void
HU_SetFontProperties
(
fontdef_t
*
font
,
INT32
kerning
,
UINT32
spacewidth
,
UINT32
linespacing
);
void
HU_SetFontProperties
(
fontdef_t
*
font
,
INT32
kerning
,
UINT32
spacewidth
,
UINT32
charwidth
,
UINT32
linespacing
);
// reset heads up when consoleplayer respawns.
// reset heads up when consoleplayer respawns.
void
HU_Start
(
void
);
void
HU_Start
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/v_video.c
+
6
−
6
View file @
02f31a49
...
@@ -1961,10 +1961,10 @@ char *V_FontWordWrap(INT32 x, INT32 w, INT32 option, fixed_t scale, const char *
...
@@ -1961,10 +1961,10 @@ char *V_FontWordWrap(INT32 x, INT32 w, INT32 option, fixed_t scale, const char *
switch
(
option
&
V_SPACINGMASK
)
switch
(
option
&
V_SPACINGMASK
)
{
{
case
V_MONOSPACE
:
case
V_MONOSPACE
:
spacewidth
=
font
.
space
width
*
2
;
spacewidth
=
font
.
char
width
;
/* FALLTHRU */
/* FALLTHRU */
case
V_OLDSPACING
:
case
V_OLDSPACING
:
charwidth
=
font
.
space
width
*
2
;
charwidth
=
font
.
char
width
;
break
;
break
;
case
V_6WIDTHSPACE
:
case
V_6WIDTHSPACE
:
spacewidth
=
6
;
spacewidth
=
6
;
...
@@ -2057,10 +2057,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale,
...
@@ -2057,10 +2057,10 @@ void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale,
switch
(
option
&
V_SPACINGMASK
)
// TODO: 2.3: drop support for these crusty flags
switch
(
option
&
V_SPACINGMASK
)
// TODO: 2.3: drop support for these crusty flags
{
{
case
V_MONOSPACE
:
case
V_MONOSPACE
:
spacewidth
=
font
.
space
width
*
2
;
spacewidth
=
font
.
char
width
;
/* FALLTHRU */
/* FALLTHRU */
case
V_OLDSPACING
:
case
V_OLDSPACING
:
charwidth
=
font
.
space
width
*
2
;
charwidth
=
font
.
char
width
;
break
;
break
;
case
V_6WIDTHSPACE
:
case
V_6WIDTHSPACE
:
spacewidth
=
6
;
spacewidth
=
6
;
...
@@ -2432,10 +2432,10 @@ INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
...
@@ -2432,10 +2432,10 @@ INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
switch
(
option
&
V_SPACINGMASK
)
switch
(
option
&
V_SPACINGMASK
)
{
{
case
V_MONOSPACE
:
case
V_MONOSPACE
:
spacewidth
=
font
.
space
width
*
2
;
spacewidth
=
font
.
char
width
;
/* FALLTHRU */
/* FALLTHRU */
case
V_OLDSPACING
:
case
V_OLDSPACING
:
charwidth
=
font
.
space
width
*
2
;
charwidth
=
font
.
char
width
;
break
;
break
;
case
V_6WIDTHSPACE
:
case
V_6WIDTHSPACE
:
spacewidth
=
6
;
spacewidth
=
6
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment