Enhance LOGFONT to support multiple MBC devfonts (up to 7)

This commit is contained in:
Vincent Wei
2019-02-28 18:47:44 +08:00
parent f73f0786ee
commit 00eb4e363f
24 changed files with 624 additions and 677 deletions
+28 -6
View File
@@ -68,14 +68,36 @@ void font_AddMBDevFont (DEVFONT* dev_font);
void font_DelRelatedDevFont (DEVFONT* dev_font);
void font_ResetDevFont (void);
DEVFONT* font_GetMatchedSBDevFont (LOGFONT* log_font);
DEVFONT* font_GetMatchedMBDevFont (LOGFONT* log_font);
DEVFONT* font_GetMatchedSBDevFont (LOGFONT* lf, const char* family);
DEVFONT* font_GetMatchedMBDevFont (LOGFONT* lf, const char* family);
static inline unsigned short get_devfont_scale(LOGFONT* lf,
const DEVFONT* df)
{
int i;
for (i = 0; i < MAXNR_DEVFONTS; i++) {
if (lf->devfonts[i] == df)
return lf->scales[i];
}
return 1;
}
static inline void set_devfont_scale(LOGFONT* lf, DEVFONT* df,
unsigned short s)
{
int i;
for (i = 0; i < MAXNR_DEVFONTS; i++) {
if (lf->devfonts[i] == df)
lf->scales[i] = s;
}
}
#define GET_DEVFONT_SCALE(logfont, devfont) \
((devfont->charset_ops->bytes_maxlen_char > 1)?logfont->mbc_scale:logfont->sbc_scale)
get_devfont_scale(logfont, devfont)
#define SET_DEVFONT_SCALE(logfont, devfont, scale) \
((devfont->charset_ops->bytes_maxlen_char > 1)?(logfont->mbc_scale = scale):(logfont->sbc_scale = scale))
set_devfont_scale(logfont, devfont, scale)
unsigned short font_GetBestScaleFactor (int height, int expect);
@@ -265,8 +287,8 @@ struct _FONTOPS
};
typedef struct {
char* type;
FONTOPS* fontops;
char* type;
FONTOPS* fontops;
} FONTOPS_INFO;
extern FONTOPS_INFO __mg_fontops_infos[];
+2 -2
View File
@@ -41,12 +41,12 @@
#ifndef GUI_GDI_GLYPH_H
#define GUI_GDI_GLYPH_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
Glyph32 _gdi_set_glyph_dfi(LOGFONT* lf, Glyph32 gv);
#ifdef __cplusplus
}
#endif /* __cplusplus */