mirror of
https://gitlab.com/c3d/db48x.git
synced 2024-09-29 05:36:58 +02:00
Add some basic code for font objects
This parses the font object to return the address of the bitmap data. Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
431c633512
commit
6e3557ace4
4 changed files with 37 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -87,7 +87,8 @@ CXX_SOURCES += \
|
|||
src/rplstring.cc \
|
||||
src/symbol.cc \
|
||||
src/algebraic.cc \
|
||||
src/arithmetic.cc
|
||||
src/arithmetic.cc \
|
||||
src/font.cc
|
||||
|
||||
# Generate the sized variants of decimal128
|
||||
src/decimal-%.cc: src/decimal128.cc src/decimal-%.h
|
||||
|
|
|
@ -51,6 +51,7 @@ SOURCES += \
|
|||
../src/symbol.cc \
|
||||
../src/algebraic.cc \
|
||||
../src/arithmetic.cc \
|
||||
../src/font.cc \
|
||||
../src/tests.cc
|
||||
|
||||
HEADERS += \
|
||||
|
|
32
src/font.h
32
src/font.h
|
@ -32,15 +32,47 @@
|
|||
#include "object.h"
|
||||
|
||||
struct font : object
|
||||
// ----------------------------------------------------------------------------
|
||||
// Shared by all font objects
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
font(id type): object(type) { }
|
||||
|
||||
byte *bitmap(uint codepoint, uint *x, uint *y, uint *w, uint *h, uint *adv);
|
||||
|
||||
OBJECT_HANDLER(font);
|
||||
OBJECT_PARSER(font);
|
||||
OBJECT_RENDERER(font);
|
||||
};
|
||||
|
||||
|
||||
struct sparse_font : font
|
||||
// ----------------------------------------------------------------------------
|
||||
// An object representing a sparse font (one bitmap per character)
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
sparse_font(id type = ID_sparse_font): font(type) {}
|
||||
byte *bitmap(uint codepoint, uint *x, uint *y, uint *w, uint *h, uint *adv);
|
||||
};
|
||||
|
||||
|
||||
struct dense_font : font
|
||||
// ----------------------------------------------------------------------------
|
||||
// An object representing a dense font (a single bitmap for all characters)
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
dense_font(id type = ID_dense_font): font(type) {}
|
||||
byte *bitmap(uint codepoint, uint *x, uint *y, uint *w, uint *h, uint *adv);
|
||||
};
|
||||
|
||||
|
||||
struct dmcp_font : font
|
||||
// ----------------------------------------------------------------------------
|
||||
// An object accessing the DMCP built-in fonts (and remapping to Unicode)
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
dmcp_font(id type = ID_dense_font): font(type) {}
|
||||
byte *bitmap(uint codepoint, uint *x, uint *y, uint *w, uint *h, uint *adv);
|
||||
};
|
||||
|
||||
#endif // FONT_H
|
||||
|
|
|
@ -80,8 +80,10 @@ NAMED(inv, "Invert")
|
|||
|
||||
|
||||
// Special objects
|
||||
ID(font)
|
||||
ID(dense_font)
|
||||
ID(sparse_font)
|
||||
ID(dmcp_font)
|
||||
|
||||
#undef ID
|
||||
#undef OP
|
||||
|
|
Loading…
Reference in a new issue