Permalink
Browse files

Enlarge the font by adding 2 pixels above the cap height

  • Loading branch information...
mniip committed Apr 29, 2018
1 parent 67132c9 commit 16acc95621e76fccdfb8ea1493361e58351d2103
Showing with 310 additions and 310 deletions.
  1. +289 −289 data/font.h
  2. +1 −1 font/editor.c
  3. +1 −1 font/packer.c
  4. +1 −1 font/unpacker.c
  5. +15 −15 src/graphics/Graphics.cpp
  6. +3 −3 src/graphics/RasterDrawMethods.inl

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -7,7 +7,7 @@
#include <SDL/SDL.h>
#define CELLW 12
#define CELLH 10
#define CELLH 12
#define XRES 800
#define YRES 600
@@ -6,7 +6,7 @@
#include <math.h>
#define CELLW 12
#define CELLH 10
#define CELLH 12
//#define EXTENDED_FONT 1
char font[256][CELLH][CELLW];
@@ -11,7 +11,7 @@
#include "font.h"
#define CELLW 12
#define CELLH 10
#define CELLH 12
char font[256][CELLH][CELLW];
char width[256];
@@ -91,7 +91,7 @@ int VideoBuffer::SetCharacter(int x, int y, int c, int r, int g, int b, int a)
int i, j, w, bn = 0, ba = 0;
unsigned char *rp = font_data + font_ptrs[c];
w = *(rp++);
for (j=0; j<FONT_H; j++)
for (j=-2; j<FONT_H-2; j++)
for (i=0; i<w; i++)
{
if (!bn)
@@ -111,7 +111,7 @@ int VideoBuffer::BlendCharacter(int x, int y, int c, int r, int g, int b, int a)
int i, j, w, bn = 0, ba = 0;
unsigned char *rp = font_data + font_ptrs[c];
w = *(rp++);
for (j=0; j<FONT_H; j++)
for (j=-2; j<FONT_H-2; j++)
for (i=0; i<w; i++)
{
if (!bn)
@@ -131,7 +131,7 @@ int VideoBuffer::AddCharacter(int x, int y, int c, int r, int g, int b, int a)
int i, j, w, bn = 0, ba = 0;
unsigned char *rp = font_data + font_ptrs[c];
w = *(rp++);
for (j=0; j<FONT_H; j++)
for (j=-2; j<FONT_H-2; j++)
for (i=0; i<w; i++)
{
if (!bn)
@@ -626,7 +626,7 @@ void Graphics::textnpos(char *s, int n, int w, int *cx, int *cy)
if (charspace<wordlen && wordlen && w-x<w/3)
{
x = 0;
y += FONT_H+2;
y += FONT_H;
}
for (; *s && --wordlen>=-1; s++)
{
@@ -637,7 +637,7 @@ void Graphics::textnpos(char *s, int n, int w, int *cx, int *cy)
if (x>=w)
{
x = 0;
y += FONT_H+2;
y += FONT_H;
}
n--;
}
@@ -681,7 +681,7 @@ int Graphics::PositionAtCharIndex(char *s, int charIndex, int & positionX, int &
if(*s == '\n') {
lines++;
x = 0;
y += FONT_H+2;
y += FONT_H;
charIndex--;
continue;
} else if(*s =='\b') {
@@ -705,12 +705,12 @@ int Graphics::PositionAtCharIndex(char *s, int charIndex, int & positionX, int &
int Graphics::CharIndexAtPosition(char *s, int positionX, int positionY)
{
int x=0, y=0,charIndex=0,cw;
int x=0, y=-2,charIndex=0,cw;
for (; *s; s++)
{
if(*s == '\n') {
x = 0;
y += FONT_H+2;
y += FONT_H;
charIndex++;
continue;
} else if(*s == '\b') {
@@ -736,7 +736,7 @@ int Graphics::CharIndexAtPosition(char *s, int positionX, int positionY)
int Graphics::textwrapheight(char *s, int width)
{
int x=0, height=FONT_H+2, cw;
int x=0, height=FONT_H, cw;
int wordlen;
int charspace;
while (*s)
@@ -746,14 +746,14 @@ int Graphics::textwrapheight(char *s, int width)
if (charspace<wordlen && wordlen && width-x<width/3)
{
x = 0;
height += FONT_H+2;
height += FONT_H;
}
for (; *s && --wordlen>=-1; s++)
{
if (*s == '\n')
{
x = 0;
height += FONT_H+2;
height += FONT_H;
}
else if (*s == '\b')
{
@@ -771,7 +771,7 @@ int Graphics::textwrapheight(char *s, int width)
if (x+cw>=width)
{
x = 0;
height += FONT_H+2;
height += FONT_H;
}
x += cw;
}
@@ -785,17 +785,17 @@ void Graphics::textsize(const char * s, int & width, int & height)
if(!strlen(s))
{
width = 0;
height = FONT_H;
height = FONT_H-2;
return;
}
int cHeight = FONT_H, cWidth = 0, lWidth = 0;
int cHeight = FONT_H-2, cWidth = 0, lWidth = 0;
for (; *s; s++)
{
if (*s == '\n')
{
cWidth = 0;
cHeight += FONT_H+2;
cHeight += FONT_H;
}
else if (*s == '\x0F')
{
@@ -26,7 +26,7 @@ int PIXELMETHODS_CLASS::drawtext(int x, int y, const char *s, int r, int g, int
if (*s == '\n')
{
characterX = startX;
characterY += FONT_H+2;
characterY += FONT_H;
}
else if (*s == '\x0F')
{
@@ -112,7 +112,7 @@ int PIXELMETHODS_CLASS::drawchar(int x, int y, int c, int r, int g, int b, int a
int i, j, w, bn = 0, ba = 0;
unsigned char *rp = font_data + font_ptrs[c];
w = *(rp++);
for (j=0; j<FONT_H; j++)
for (j=-2; j<FONT_H-2; j++)
for (i=0; i<w; i++)
{
if (!bn)
@@ -132,7 +132,7 @@ int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
int i, j, w, bn = 0, ba = 0;
unsigned char *rp = font_data + font_ptrs[c];
w = *(rp++);
for (j=0; j<FONT_H; j++)
for (j=-2; j<FONT_H-2; j++)
for (i=0; i<w; i++)
{
if (!bn)

0 comments on commit 16acc95

Please sign in to comment.