1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Conditionalise FontSpec structure definition.

FontSpec is completely different per platform; not only is the
structure type different, not only are the behind-the-scenes
implementations of copy and free functions different, but even the API
of the constructor function is different. Cross-platform code can't
construct a FontSpec at all. This makes it hard to write a
cross-platform test program that works with them.

So, as a nasty bodge, I'll allow test programs to #define
SUPERSEDE_FONTSPEC_FOR_TESTING before including putty.h. Then they can
provide their own definition of FontSpec, and they also take
responsibility for superseding all the other functions that work with
one.
This commit is contained in:
Simon Tatham 2023-09-22 13:55:33 +01:00
parent 6371702145
commit 954db6f7fe
2 changed files with 4 additions and 0 deletions

View File

@ -60,10 +60,12 @@ struct Filename {
};
FILE *f_open(const struct Filename *, char const *, bool);
#ifndef SUPERSEDE_FONTSPEC_FOR_TESTING
struct FontSpec {
char *name; /* may be "" to indicate no selected font at all */
};
struct FontSpec *fontspec_new(const char *name);
#endif
extern const struct BackendVtable pty_backend;

View File

@ -68,6 +68,7 @@ struct Filename {
Filename *filename_from_wstr(const wchar_t *str);
FILE *f_open(const Filename *filename, const char *mode, bool isprivate);
#ifndef SUPERSEDE_FONTSPEC_FOR_TESTING
struct FontSpec {
char *name;
bool isbold;
@ -76,6 +77,7 @@ struct FontSpec {
};
struct FontSpec *fontspec_new(
const char *name, bool bold, int height, int charset);
#endif
#ifndef CLEARTYPE_QUALITY
#define CLEARTYPE_QUALITY 5