From ed35a4576d1d5e8d7b86ae3fa8e2afea0c1ff67b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 23 Mar 2018 01:52:20 +0000 Subject: Add wide character capability to Pbmtext git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3177 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/pbmfont.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'lib/pbmfont.h') diff --git a/lib/pbmfont.h b/lib/pbmfont.h index 5111a075..ad5d3acf 100644 --- a/lib/pbmfont.h +++ b/lib/pbmfont.h @@ -20,6 +20,23 @@ extern "C" { a 65536 x 65536 glyph occupies 4G pixels. */ +typedef wchar_t PM_WCHAR; + /* Precaution to make adjustments, if necessary, for systems with + unique wchar_t. + */ + +#define PM_FONT_MAXGLYPH 255 + +#define PM_FONT2_MAXGLYPH 65535 + /* Upper limit of codepoint value. + + This is large enough to handle Unicode Plane 0 (Basic Multilingual + Plane: BMP) which defines the great majority of characters used in + modern languages. + + This can be set to a higher value at some cost to efficiency. + As of Unicode v. 11.0.0 planes up to 16 are defined. + */ struct glyph { /* A glyph consists of white borders and the "central glyph" which @@ -60,7 +77,7 @@ struct font { an code point in the range 0..255, this structure describes the glyph for that character. */ - int maxwidth, maxheight; + unsigned int maxwidth, maxheight; int x; /* The minimum value of glyph.font. The left edge of the glyph in the glyph set which advances furthest to the left. */ @@ -76,6 +93,33 @@ struct font { int fcols, frows; }; + +struct font2 { + /* Font structure for expanded character set. Code point is in the + range 0..maxglyph . + */ + int maxwidth, maxheight; + + int x; + /* The minimum value of glyph.font. The left edge of the glyph + in the glyph set which advances furthest to the left. */ + int y; + /* Amount of white space that should be added between lines of + this font. Can be negative. + */ + struct glyph ** glyph; + /* glyph[i] is the glyph for code point i */ + + PM_WCHAR maxglyph; + /* max code point for glyphs, including vacant slots */ + + const bit ** oldfont; + /* for compatibility with old pbmtext routines */ + /* oldfont is NULL if the font is BDF derived */ + + unsigned int fcols, frows; +}; + struct font * pbm_defaultfont(const char* const which); @@ -93,6 +137,13 @@ pbm_loadpbmfont(const char * const filename); struct font * pbm_loadbdffont(const char * const filename); +struct font2 * +pbm_loadbdffont2(const char * const filename, + PM_WCHAR const maxglyph); + +struct font2 * +pbm_expandbdffont(const struct font * const font); + void pbm_dumpfont(struct font * const fontP, FILE * const ofP); -- cgit 1.4.1