228 typedef struct _LOGFONT {
- 229 char type [LEN_FONT_NAME + 1];
- 230 char family [LEN_FONT_NAME + 1];
- 231 char charset [LEN_FONT_NAME + 1];
+ 229 char type [LEN_LOGFONT_NAME_FIELD + 1];
+ 230 char family [LEN_LOGFONT_NAME_FIELD + 1];
+ 231 char charset [LEN_LOGFONT_NAME_FIELD + 1];
232 DWORD style;
233 int size;
234 int rotation;
diff --git a/include/gdi.h b/include/gdi.h
index 2199c924..324f583b 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -5456,9 +5456,9 @@ MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc
*/
/* Font-related structures */
-#define LEN_FONT_NAME 31
-#define LEN_DEVFONT_NAME 79
-#define LEN_UNIDEVFONT_NAME 127
+#define LEN_LOGFONT_NAME_FIELD 31
+#define LEN_UNIDEVFONT_NAME 255
+#define LEN_DEVFONT_NAME LEN_UNIDEVFONT_NAME
#define FONT_WEIGHT_NIL '\0'
#define FONT_WEIGHT_ALL '*'
@@ -5728,11 +5728,11 @@ typedef struct _DEVFONT DEVFONT;
/** The logical font structure. */
typedef struct _LOGFONT {
/** The type of the logical font. */
- char type [LEN_FONT_NAME + 1];
+ char type [LEN_LOGFONT_NAME_FIELD + 1];
/** The family name of the logical font. */
- char family [LEN_FONT_NAME + 1];
+ char family [LEN_LOGFONT_NAME_FIELD + 1];
/** The charset of the logical font. */
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
/** The styles of the logical font. */
DWORD style;
/** The size of the logical font. */
@@ -5888,11 +5888,20 @@ struct _CHARSETOPS;
typedef struct _FONTOPS FONTOPS;
typedef struct _CHARSETOPS CHARSETOPS;
-/* charops fontops devont structure is here. */
+/* charops fontops devont structure is here. */
/** The device font structure. */
struct _DEVFONT
{
- /** The device font name. */
+ /**
+ * The device font name.
+ * The family name supports aliases since 3.4.0:
+ *
+ * -----
+ *
+ * for example:
+ *
+ * ttf-courier,monospace-rrncnn-8-16-ISO8859-1,UTF-8
+ */
char name [LEN_UNIDEVFONT_NAME + 1];
/** The styles of the device font. */
diff --git a/src/font/bitmapfont.c b/src/font/bitmapfont.c
index 86165474..f602c1fd 100644
--- a/src/font/bitmapfont.c
+++ b/src/font/bitmapfont.c
@@ -469,7 +469,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
{
DEVFONT* bitmapfont_dev_font = NULL;
CHARSETOPS* charset_ops;
- char charset[LEN_FONT_NAME + 1];
+ char charset[LEN_LOGFONT_NAME_FIELD + 1];
BMPFONTINFO *bmpfont_info;
int offset;
diff --git a/src/font/charset-arabic.c b/src/font/charset-arabic.c
index 71baba39..d608836b 100644
--- a/src/font/charset-arabic.c
+++ b/src/font/charset-arabic.c
@@ -94,9 +94,9 @@ static const SHAPEINFO shape_info[SHAPENUMBER] = {
static int iso8859_6_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
diff --git a/src/font/charset.c b/src/font/charset.c
index 3431ba3f..67e9a47b 100644
--- a/src/font/charset.c
+++ b/src/font/charset.c
@@ -180,9 +180,9 @@ static const unsigned char* sb_get_next_word (const unsigned char* mstr,
static int ascii_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -242,10 +242,10 @@ static CHARSETOPS CharsetOps_ascii = {
static int iso8859_1_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
char* sub_enc;
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -308,9 +308,9 @@ static CHARSETOPS CharsetOps_iso8859_1 = {
static int iso8859_2_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -422,9 +422,9 @@ static CHARSETOPS CharsetOps_iso8859_2 = {
static int iso8859_3_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -535,9 +535,9 @@ static CHARSETOPS CharsetOps_iso8859_3 = {
static int iso8859_4_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -650,9 +650,9 @@ static CHARSETOPS CharsetOps_iso8859_4 = {
static int iso8859_5_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -799,9 +799,9 @@ static BOOL get_mirror_glyph (const BIDICHAR_MIRROR_MAP* map, int n, Glyph32 gly
static int iso8859_7_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -901,9 +901,9 @@ static CHARSETOPS CharsetOps_iso8859_7 = {
static int iso8859_8_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1170,9 +1170,9 @@ static CHARSETOPS CharsetOps_iso8859_8 = {
static int iso8859_9_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1272,9 +1272,9 @@ static CHARSETOPS CharsetOps_iso8859_9 = {
static int iso8859_10_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1386,9 +1386,9 @@ static CHARSETOPS CharsetOps_iso8859_10 = {
static int iso8859_11_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1499,9 +1499,9 @@ static CHARSETOPS CharsetOps_iso8859_11 = {
static int iso8859_13_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1612,9 +1612,9 @@ static CHARSETOPS CharsetOps_iso8859_13 = {
static int iso8859_14_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1725,9 +1725,9 @@ static CHARSETOPS CharsetOps_iso8859_14 = {
static int iso8859_15_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -1836,9 +1836,9 @@ static CHARSETOPS CharsetOps_iso8859_15 = {
static int iso8859_16_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -2059,9 +2059,9 @@ static Glyph32 gb2312_0_char_glyph_value (const unsigned char* pre_mchar,
static int gb2312_0_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -2214,9 +2214,9 @@ static Glyph32 gbk_char_glyph_value (const unsigned char* pre_mchar, int pre_le
static int gbk_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -2390,9 +2390,9 @@ static Glyph32 gb18030_0_char_glyph_value (const unsigned char* pre_mchar,
static int gb18030_0_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -2638,9 +2638,9 @@ static Glyph32 big5_char_glyph_value (const unsigned char* pre_mchar, int pre_l
static int big5_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -2798,9 +2798,9 @@ static Glyph32 ksc5601_0_char_glyph_value (const unsigned char* pre_mchar,
static int ksc5601_0_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -2970,9 +2970,9 @@ static int jisx0201_0_nr_chars_in_str (const unsigned char* mstr, int mstrlen)
static int jisx0201_0_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -3065,9 +3065,9 @@ static Glyph32 jisx0208_0_char_glyph_value (const unsigned char* pre_mchar,
static int jisx0208_0_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -3183,9 +3183,9 @@ static CHARSETOPS CharsetOps_jisx0208_0 = {
static int jisx0201_1_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -3320,9 +3320,9 @@ static Glyph32 jisx0208_1_char_glyph_value (const unsigned char* pre_mchar,
static int jisx0208_1_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -3642,9 +3642,9 @@ static int utf8_nr_chars_in_str (const unsigned char* mstr, int mstrlen)
static int utf8_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -3892,9 +3892,9 @@ static int utf16le_nr_chars_in_str (const unsigned char* mstr, int mstrlen)
static int utf16le_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -4118,9 +4118,9 @@ static int utf16be_nr_chars_in_str (const unsigned char* mstr, int mstrlen)
static int utf16be_is_this_charset (const unsigned char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -4375,9 +4375,9 @@ CHARSETOPS* GetCharsetOps (const char* charset)
CHARSETOPS* GetCharsetOpsEx (const char* charset)
{
int i;
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
- for (i = 0; i < LEN_FONT_NAME + 1; i++) {
+ for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
diff --git a/src/font/devfont.c b/src/font/devfont.c
index bd072117..96ac66cd 100644
--- a/src/font/devfont.c
+++ b/src/font/devfont.c
@@ -124,7 +124,6 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
dev_font = list_head;
while (dev_font) {
int type_req;
- char family [LEN_FONT_NAME + 1];
int weight_req = log_font->style & FS_WEIGHT_MASK;
int weight_cur = dev_font->style & FS_WEIGHT_MASK;
@@ -139,10 +138,17 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
match_bits [i] |= MATCHED_TYPE;
/* does match this family? */
+#if 0 // since 3.4.0
+ char family [LEN_LOGFONT_NAME_FIELD + 1];
fontGetFamilyFromName (dev_font->name, family);
if (strcasecmp (family, log_font->family) == 0) {
match_bits [i] |= MATCHED_FAMILY;
}
+#else
+ if (fontDoesMatchFamily(dev_font->name, log_font->family)) {
+ match_bits [i] |= MATCHED_FAMILY;
+ }
+#endif
/* does match this charset */
if (IsCompatibleCharset (req_charset, dev_font->charset_ops)) {
@@ -238,7 +244,7 @@ DEVFONT* font_GetMatchedSBDevFont (LOGFONT* log_font)
if (GetCharsetOps (log_font->charset)->bytes_maxlen_char > 1) {
/*mbc logfont --- sbc devfont*/
- char sysfont_charset [LEN_FONT_NAME + 1];
+ char sysfont_charset [LEN_LOGFONT_NAME_FIELD + 1];
fontGetCharsetFromName (g_SysLogFont[0]->sbc_devfont->name, sysfont_charset);
matched_devfont = get_matched_devfont (log_font, sb_dev_font_head,
nr_sb_dev_fonts, sysfont_charset);
@@ -351,26 +357,26 @@ void dbg_dumpDevFonts (void)
*/
void font_DelSBDevFont (DEVFONT* dev_font)
{
- DEVFONT *tmp, *prev = NULL;
+ DEVFONT *tmp, *prev = NULL;
- tmp = sb_dev_font_head;
- while (tmp != NULL) {
- if (tmp == dev_font) {
- if (prev != NULL)
- prev->next = tmp->next;
- else
- sb_dev_font_head = tmp->next;
+ tmp = sb_dev_font_head;
+ while (tmp != NULL) {
+ if (tmp == dev_font) {
+ if (prev != NULL)
+ prev->next = tmp->next;
+ else
+ sb_dev_font_head = tmp->next;
- nr_sb_dev_fonts --;
+ nr_sb_dev_fonts --;
- break;
- }
+ break;
+ }
- prev = tmp;
- tmp = prev->next;
- }
+ prev = tmp;
+ tmp = prev->next;
+ }
- return;
+ return;
}
/*
@@ -392,7 +398,7 @@ void font_DelMBDevFont (DEVFONT* dev_font)
nr_mb_dev_fonts --;
- break;
+ break;
}
prev = tmp;
tmp = prev->next;
@@ -407,7 +413,7 @@ static DEVFONT* make_devfont (const char* font_name, void* data, BOOL is_filenam
FONTOPS_INFO* fontops_info = __mg_fontops_infos;
DEVFONT* devfont;
CHARSETOPS* charset_ops;
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
/*find the FONTOPS and LOADER*/
while (fontops_info->type) {
@@ -473,7 +479,7 @@ static void add_relating_devfonts_to_list (DEVFONT* related_devfont)
{
DEVFONT* sub_devfont;
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
char charsets [LEN_UNIDEVFONT_NAME + 1];
int nr_charsets;
diff --git a/src/font/fontcache.c b/src/font/fontcache.c
index 631bf6d8..3ad306ca 100644
--- a/src/font/fontcache.c
+++ b/src/font/fontcache.c
@@ -87,9 +87,9 @@ typedef struct _HashDirectory {
makeHashKeyFunc : the function which make hash key */
typedef struct cache {
/* Information about font */
- char family[LEN_FONT_NAME + 1];
+ char family[LEN_LOGFONT_NAME_FIELD + 1];
// VincentWei: no need to check charset for TrueType
- //char charset[LEN_FONT_NAME + 1];
+ //char charset[LEN_LOGFONT_NAME_FIELD + 1];
int render_style; // render style
int fontsize;
int rotation;
@@ -480,8 +480,8 @@ __mg_ttc_create(char *family, char *charset,
return (HCACHE)(0);
}
- strncpy(temp->cache.family, family, LEN_FONT_NAME);
- //strncpy(temp->cache.charset, charset, LEN_FONT_NAME);
+ strncpy(temp->cache.family, family, LEN_LOGFONT_NAME_FIELD);
+ //strncpy(temp->cache.charset, charset, LEN_LOGFONT_NAME_FIELD);
temp->cache.render_style = (style & FS_RENDER_MASK);
temp->cache.fontsize = size;
temp->cache.rotation = rotation;
@@ -588,8 +588,8 @@ __mg_ttc_is_exist(char *family, char *charset,
/* If can not match font name*/
p = __mg_globalCache.queueDummyHead.nextCache;
while (p != &__mg_globalCache.queueDummyHead) {
- if (strncmp(p->cache.family, family, LEN_FONT_NAME) == 0) {
- if (strncmp(p->cache.charset, charset, LEN_FONT_NAME) == 0) {
+ if (strncmp(p->cache.family, family, LEN_LOGFONT_NAME_FIELD) == 0) {
+ if (strncmp(p->cache.charset, charset, LEN_LOGFONT_NAME_FIELD) == 0) {
if (p->cache.fontsize == size) {
int s = style & 0x000000FF;
if ((s == FS_WEIGHT_BOOK || s == FS_WEIGHT_DEMIBOLD || s == FS_WEIGHT_SUBPIXEL) &&
@@ -609,9 +609,9 @@ __mg_ttc_is_exist(char *family, char *charset,
#else
p = __mg_globalCache.queueDummyHead.nextCache;
while (p != &__mg_globalCache.queueDummyHead) {
- if (strncmp(p->cache.family, family, LEN_FONT_NAME) == 0
+ if (strncmp(p->cache.family, family, LEN_LOGFONT_NAME_FIELD) == 0
#if 0 // VincentWei: do not need to check charset.
- && strncmp(p->cache.charset, charset, LEN_FONT_NAME) == 0
+ && strncmp(p->cache.charset, charset, LEN_LOGFONT_NAME_FIELD) == 0
#endif
&& p->cache.fontsize == size
&& p->cache.rotation == rotation
diff --git a/src/font/fontname.c b/src/font/fontname.c
index 77da8dac..aba05377 100644
--- a/src/font/fontname.c
+++ b/src/font/fontname.c
@@ -42,6 +42,7 @@
#include
#include
#include
+#include
#include "common.h"
#include "minigui.h"
@@ -96,7 +97,7 @@ BOOL fontGetTypeNameFromName (const char* name, char* type)
int fontGetFontTypeFromName (const char* name)
{
- char type [LEN_FONT_NAME + 1];
+ char type [LEN_LOGFONT_NAME_FIELD + 1];
if (!fontGetTypeNameFromName (name, type))
return -1;
@@ -114,8 +115,8 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
if (*(++family_part) == '\0')
return FALSE;
- while (family_part [i] && i <= LEN_FONT_NAME) {
- if (family_part [i] == '-') {
+ while (family_part [i] && i <= LEN_LOGFONT_NAME_FIELD) {
+ if (family_part [i] == '-' || family_part [i] == ',') {
family [i] = '\0';
break;
}
@@ -127,6 +128,59 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
return TRUE;
}
+static BOOL get_family_part_lower (const char* name, char* family)
+{
+ int i = 0;
+ const char* family_part;
+
+ if ((family_part = strchr (name, '-')) == NULL)
+ return FALSE;
+ if (*(++family_part) == '\0')
+ return FALSE;
+
+ while (family_part [i] && i <= LEN_UNIDEVFONT_NAME) {
+ if (family_part [i] == '-') {
+ family [i] = '\0';
+ break;
+ }
+
+ family [i] = tolower(family_part [i]);
+ i++;
+ }
+
+ return TRUE;
+}
+
+/* devfont family specification:
+ * family[,alias]...
+ */
+BOOL fontDoesMatchFamily (const char* name, const char* family)
+{
+ char family_part[LEN_UNIDEVFONT_NAME + 2];
+ char family_request[LEN_LOGFONT_NAME_FIELD + 2];
+ int i = 0;
+
+ if (!get_family_part_lower(name, family_part)) {
+ return FALSE;
+ }
+
+ // add ',' to the tail
+ family_part[strlen(family_part)] = ',';
+
+ // lowercase for family_request
+ strncpy(family_request, family, LEN_LOGFONT_NAME_FIELD);
+ while (family_request[i]) {
+ family_request[i] = tolower(family_request[i]);
+ i++;
+ }
+
+ // add ',' to the tail
+ family_request[strlen(family_request)] = ',';
+
+ // try ","
+ return strstr(family_part, family_request) != NULL;
+}
+
DWORD fontConvertStyle (const char* style_part)
{
DWORD style = 0;
@@ -345,7 +399,7 @@ int fontGetWidthFromName (const char* name)
{
int i;
const char* width_part = name;
- char width [LEN_FONT_NAME + 1];
+ char width [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_WIDTH; i++) {
if ((width_part = strchr (width_part, '-')) == NULL)
@@ -376,7 +430,7 @@ int fontGetHeightFromName (const char* name)
{
int i;
const char* height_part = name;
- char height [LEN_FONT_NAME + 1];
+ char height [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_HEIGHT; i++) {
if ((height_part = strchr (height_part, '-')) == NULL)
@@ -423,8 +477,8 @@ BOOL fontGetCharsetFromName (const char* name, char* charset)
return TRUE;
}
- strncpy (charset, charset_part, LEN_FONT_NAME);
- charset [LEN_FONT_NAME] = '\0';
+ strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
+ charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
@@ -446,8 +500,8 @@ BOOL fontGetCompatibleCharsetFromName (const char* name, char* charset)
if (*(++charset_part) == '\0')
return FALSE;
- strncpy (charset, charset_part, LEN_FONT_NAME);
- charset [LEN_FONT_NAME] = '\0';
+ strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
+ charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
@@ -505,8 +559,8 @@ BOOL charsetGetSpecificCharset (const char* charsets, int _index, char* charset)
return TRUE;
}
- strncpy (charset, charsets, LEN_FONT_NAME);
- charset [LEN_FONT_NAME] = '\0';
+ strncpy (charset, charsets, LEN_LOGFONT_NAME_FIELD);
+ charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
diff --git a/src/font/freetype1.c b/src/font/freetype1.c
index 7526d551..de1b1e7a 100644
--- a/src/font/freetype1.c
+++ b/src/font/freetype1.c
@@ -626,7 +626,7 @@ static DEVFONT* new_instance (LOGFONT* logfont, DEVFONT* devfont,
memcpy (new_devfont, devfont, sizeof (DEVFONT));
if (need_sbc_font && devfont->charset_ops->bytes_maxlen_char > 1) {
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
fontGetCompatibleCharsetFromName (devfont->name, charset);
new_devfont->charset_ops = GetCharsetOpsEx (charset);
diff --git a/src/font/freetype2.c b/src/font/freetype2.c
index 6726a8f3..897a263e 100644
--- a/src/font/freetype2.c
+++ b/src/font/freetype2.c
@@ -706,7 +706,7 @@ new_instance (LOGFONT* logfont, DEVFONT* devfont, BOOL need_sbc_font)
/* copy CharsetOps */
if (need_sbc_font && devfont->charset_ops->bytes_maxlen_char > 1) {
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
fontGetCompatibleCharsetFromName (devfont->name, charset);
new_devfont->charset_ops = GetCharsetOps (charset);
diff --git a/src/font/logfont.c b/src/font/logfont.c
index b200d20c..f48ee1ee 100644
--- a/src/font/logfont.c
+++ b/src/font/logfont.c
@@ -72,7 +72,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
{
PLOGFONT log_font;
int sbc_value, mbc_value = 0;
- char dev_family [LEN_FONT_NAME + 1];
+ char dev_family [LEN_LOGFONT_NAME_FIELD + 1];
DEVFONT* sbc_devfont, *mbc_devfont;
// is valid style?
@@ -100,17 +100,17 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
log_font->style = style;
if (type) {
- strncpy (log_font->type, type, LEN_FONT_NAME);
- log_font->type [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->type, type, LEN_LOGFONT_NAME_FIELD);
+ log_font->type [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else
strcpy (log_font->type, FONT_TYPE_NAME_ALL);
- strncpy (log_font->family, family, LEN_FONT_NAME);
- log_font->family [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->family, family, LEN_LOGFONT_NAME_FIELD);
+ log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
- strncpy (log_font->charset, charset, LEN_FONT_NAME);
- log_font->charset [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->charset, charset, LEN_LOGFONT_NAME_FIELD);
+ log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
if (size > FONT_MAX_SIZE)
log_font->size = FONT_MAX_SIZE;
@@ -164,37 +164,37 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
/*reset type name of logfont*/
if (log_font->mbc_devfont) {
fontGetTypeNameFromName (log_font->mbc_devfont->name, dev_family);
- strncpy (log_font->type, dev_family, LEN_FONT_NAME);
- log_font->type[LEN_FONT_NAME] = '\0';
+ strncpy (log_font->type, dev_family, LEN_LOGFONT_NAME_FIELD);
+ log_font->type[LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
fontGetTypeNameFromName (log_font->sbc_devfont->name, dev_family);
- strncpy (log_font->type, dev_family, LEN_FONT_NAME);
- log_font->type[LEN_FONT_NAME] = '\0';
+ strncpy (log_font->type, dev_family, LEN_LOGFONT_NAME_FIELD);
+ log_font->type[LEN_LOGFONT_NAME_FIELD] = '\0';
}
/*reset family name of logfont*/
if (log_font->mbc_devfont) {
fontGetFamilyFromName (log_font->mbc_devfont->name, dev_family);
- strncpy (log_font->family, dev_family, LEN_FONT_NAME);
- log_font->family [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->family, dev_family, LEN_LOGFONT_NAME_FIELD);
+ log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
fontGetFamilyFromName (log_font->sbc_devfont->name, dev_family);
- strncpy (log_font->family, dev_family, LEN_FONT_NAME);
- log_font->family [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->family, dev_family, LEN_LOGFONT_NAME_FIELD);
+ log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
}
/*reset charset name of logfont*/
if (log_font->mbc_devfont) {
strncpy (log_font->charset,
- log_font->mbc_devfont->charset_ops->name, LEN_FONT_NAME);
- log_font->charset [LEN_FONT_NAME] = '\0';
+ log_font->mbc_devfont->charset_ops->name, LEN_LOGFONT_NAME_FIELD);
+ log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
strncpy (log_font->charset,
- log_font->sbc_devfont->charset_ops->name, LEN_FONT_NAME);
- log_font->charset [LEN_FONT_NAME] = '\0';
+ log_font->sbc_devfont->charset_ops->name, LEN_LOGFONT_NAME_FIELD);
+ log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
}
/*reset ascent of logfont*/
@@ -345,9 +345,9 @@ PLOGFONT GUIAPI CreateLogFontEx (const char* type, const char* family,
PLOGFONT GUIAPI CreateLogFontByName (const char* font_name)
{
- char type[LEN_FONT_NAME + 1];
- char family[LEN_FONT_NAME + 1];
- char charset[LEN_FONT_NAME + 1];
+ char type[LEN_LOGFONT_NAME_FIELD + 1];
+ char family[LEN_LOGFONT_NAME_FIELD + 1];
+ char charset[LEN_LOGFONT_NAME_FIELD + 1];
DWORD style;
int height;
diff --git a/src/font/scripteasy.c b/src/font/scripteasy.c
index 1f22bdcb..a2ef1ebb 100644
--- a/src/font/scripteasy.c
+++ b/src/font/scripteasy.c
@@ -113,7 +113,7 @@ static BOOL load_fonts(void)
se_dev_fonts = calloc (font_table_size, sizeof (DEVFONT));
for (i = 0; i < font_table_size; i++) {
- char charset[LEN_FONT_NAME + 1];
+ char charset[LEN_LOGFONT_NAME_FIELD + 1];
CHARSETOPS *charset_ops;
const char *font_name;
int font_id;
@@ -158,7 +158,7 @@ static BOOL load_fonts(void)
if ((nr_charsets = charsetGetCharsetsNumber (charsets)) > 1) {
int j;
for (j = 1; j < nr_charsets; j++) {
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
CHARSETOPS* charset_ops;
DEVFONT* new_devfont;
diff --git a/src/font/sysfont.c b/src/font/sysfont.c
index c3ab46ce..b730be13 100644
--- a/src/font/sysfont.c
+++ b/src/font/sysfont.c
@@ -102,10 +102,10 @@ BOOL mg_InitSysFont (void)
for (i = 0; i < nr_fonts; i++) {
char key [11];
- char type [LEN_FONT_NAME + 1];
- char family [LEN_FONT_NAME + 1];
- char style [LEN_FONT_NAME + 1];
- char charset [LEN_FONT_NAME + 1];
+ char type [LEN_LOGFONT_NAME_FIELD + 1];
+ char family [LEN_LOGFONT_NAME_FIELD + 1];
+ char style [LEN_LOGFONT_NAME_FIELD + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
char font_name [LEN_DEVFONT_NAME + 1];
int height;
int j = 0, need = 0;
diff --git a/src/font/sysfont.old.c b/src/font/sysfont.old.c
index 1609c8bf..397e2a36 100644
--- a/src/font/sysfont.old.c
+++ b/src/font/sysfont.old.c
@@ -86,7 +86,7 @@ BOOL mg_InitSysFont (void)
for (i = 0; i < nr_fonts; i++) {
char key [11];
- char charset [LEN_FONT_NAME + 1];
+ char charset [LEN_LOGFONT_NAME_FIELD + 1];
char file [MAX_PATH + 1];
sprintf (key, "name%d", i);
diff --git a/src/font/utils/bdf2vbf.c b/src/font/utils/bdf2vbf.c
index eadce7e3..42199e7b 100644
--- a/src/font/utils/bdf2vbf.c
+++ b/src/font/utils/bdf2vbf.c
@@ -197,13 +197,13 @@ static BOOL get_font_propt(FILE* fp, char* family, char* font_rrncnn, char* cha
/*FAMILY_NAME*/
if (strcmp (line_buf, "FAMILY_NAME") == 0)
{
- if (strlen(body) > LEN_FONT_NAME)
+ if (strlen(body) > LEN_LOGFONT_NAME_FIELD)
{
fprintf(stderr, "the FAMILY_NAME is too long, "
- "please truncation it to less than %d\n", LEN_FONT_NAME-2);
+ "please truncation it to less than %d\n", LEN_LOGFONT_NAME_FIELD-2);
return FALSE;
}
- strncpy (family, body, LEN_FONT_NAME);
+ strncpy (family, body, LEN_LOGFONT_NAME_FIELD);
}
else if (strcmp (line_buf, "WEIGHT_NAME") == 0)
set_rrncnn (font_rrncnn, SET_WEIGHT_POS, body);
@@ -216,7 +216,7 @@ static BOOL get_font_propt(FILE* fp, char* family, char* font_rrncnn, char* cha
/*FIXME must inorder*/
else if (strcmp (line_buf, "CHARSET_REGISTRY") == 0)
- strncpy (charset, body, LEN_FONT_NAME);
+ strncpy (charset, body, LEN_LOGFONT_NAME_FIELD);
else if (strcmp (line_buf, "CHARSET_ENCODING") == 0)
{
if (body[0] != '-')
@@ -494,8 +494,8 @@ typedef struct _FONT_PROPT {
} FONT_PROPT;
char font_name [LEN_UNIDEVFONT_NAME];
-char family [LEN_FONT_NAME];
-char charset [LEN_FONT_NAME];
+char family [LEN_LOGFONT_NAME_FIELD];
+char charset [LEN_LOGFONT_NAME_FIELD];
char new_file_name [LEN_UNIDEVFONT_NAME+5];
#define MAKE_HEADER(header, glyph_num)\
diff --git a/src/font/utils/dumpvbf.c b/src/font/utils/dumpvbf.c
index 73d4ea5f..b35cd6c2 100644
--- a/src/font/utils/dumpvbf.c
+++ b/src/font/utils/dumpvbf.c
@@ -54,7 +54,7 @@ typedef int BOOL;
#define TRUE 1
#define FALSE 0
-#define LEN_FONT_NAME 23
+#define LEN_LOGFONT_NAME_FIELD 23
#define LEN_DEVFONT_NAME 79
extern VBFINFO extern_vbfinfo;
@@ -64,8 +64,8 @@ extern VBFINFO extern_vbfinfo;
BOOL dumpVBF (VBFINFO* vbf, char* file)
{
FILE* fp;
- char family [LEN_FONT_NAME + 1];
- char style [LEN_FONT_NAME + 1];
+ char family [LEN_LOGFONT_NAME_FIELD + 1];
+ char style [LEN_LOGFONT_NAME_FIELD + 1];
int len_offsets;
int len_widths;
int len_header;
diff --git a/src/gui/lf_test/src/font_dialog.c b/src/gui/lf_test/src/font_dialog.c
index f3443ade..be376b51 100644
--- a/src/gui/lf_test/src/font_dialog.c
+++ b/src/gui/lf_test/src/font_dialog.c
@@ -70,13 +70,13 @@
typedef struct _CHARSET
{
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
struct _CHARSET* next;
}CHARSET;
typedef struct _FAMILY
{
- char name [LEN_FONT_NAME + 1];
+ char name [LEN_LOGFONT_NAME_FIELD + 1];
CHARSET chset_head;
struct _FAMILY* next;
}FAMILY;
@@ -98,8 +98,8 @@ static FAMILY* find_insert_family (FAMILY* head, const char* fami_name)
}
cur = (FAMILY*)malloc(sizeof(*cur));
- strncpy (cur->name, fami_name, LEN_FONT_NAME);
- cur->name [LEN_FONT_NAME] = '\0';
+ strncpy (cur->name, fami_name, LEN_LOGFONT_NAME_FIELD);
+ cur->name [LEN_LOGFONT_NAME_FIELD] = '\0';
cur->chset_head.next = NULL;
cur->next = NULL;
@@ -133,8 +133,8 @@ static void insert_chset (FAMILY* fami, const char* chset_name)
}
cur = (CHARSET*)malloc(sizeof(*cur));
- strncpy (cur->name, chset_name, LEN_FONT_NAME);
- cur->name [LEN_FONT_NAME] = '\0';
+ strncpy (cur->name, chset_name, LEN_LOGFONT_NAME_FIELD);
+ cur->name [LEN_LOGFONT_NAME_FIELD] = '\0';
cur->next = NULL;
pre->next = cur;
@@ -416,7 +416,7 @@ static void insert_strings (HWND hWnd, char** strs, int str_num)
static int fresh_chset_list (HWND hWnd)
{
- char str_buffer [LEN_FONT_NAME + 1];
+ char str_buffer [LEN_LOGFONT_NAME_FIELD + 1];
HWND fami_lb;
HWND chset_lb;
int cur_sel;
@@ -455,7 +455,7 @@ static int fresh_chset_list (HWND hWnd)
static int insert_listboxs (HWND hWnd)
{
FAMILY* fami_cur = ((FAMILY*)GetWindowAdditionalData(hWnd))->next;
- char str_buffer [LEN_FONT_NAME + 1];
+ char str_buffer [LEN_LOGFONT_NAME_FIELD + 1];
int i;
HWND hctrl;
@@ -496,8 +496,8 @@ static int insert_listboxs (HWND hWnd)
static LOGFONT* create_sel_font(HWND hWnd)
{
- char family [LEN_FONT_NAME +1];
- char chset [LEN_FONT_NAME +1];
+ char family [LEN_LOGFONT_NAME_FIELD +1];
+ char chset [LEN_LOGFONT_NAME_FIELD +1];
char weight;
char slant;
char flip;
diff --git a/src/include/fontname.h b/src/include/fontname.h
index 3ce94003..75c73df0 100644
--- a/src/include/fontname.h
+++ b/src/include/fontname.h
@@ -53,6 +53,7 @@ BOOL fontGetTypeNameFromName (const char* name, char* type);
int fontConvertFontType (const char* type);
BOOL fontGetFamilyFromName (const char* name, char* family);
+BOOL fontDoesMatchFamily (const char* name, const char* family);
BOOL fontCopyStyleFromName (const char* name, char* style);
DWORD fontGetStyleFromName (const char* name);
diff --git a/src/newgdi/logfont.c b/src/newgdi/logfont.c
index e7fc26c1..139c48e0 100644
--- a/src/newgdi/logfont.c
+++ b/src/newgdi/logfont.c
@@ -67,7 +67,7 @@ static PLOGFONT gdiCreateLogFont ( const char* type, const char* family,
{
PLOGFONT log_font;
int sbc_descent, mbc_descent = 0;
- char dev_family [LEN_FONT_NAME + 1];
+ char dev_family [LEN_LOGFONT_NAME_FIELD + 1];
DEVFONT* sbc_devfont, *mbc_devfont;
// is valid style?
@@ -89,17 +89,17 @@ static PLOGFONT gdiCreateLogFont ( const char* type, const char* family,
#endif
if (type) {
- strncpy (log_font->type, type, LEN_FONT_NAME);
- log_font->type [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->type, type, LEN_LOGFONT_NAME_FIELD);
+ log_font->type [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else
strcpy (log_font->type, FONT_TYPE_NAME_ALL);
- strncpy (log_font->family, family, LEN_FONT_NAME);
- log_font->family [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->family, family, LEN_LOGFONT_NAME_FIELD);
+ log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
- strncpy (log_font->charset, charset, LEN_FONT_NAME);
- log_font->charset [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->charset, charset, LEN_LOGFONT_NAME_FIELD);
+ log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
if (size > FONT_MAX_SIZE)
log_font->size = FONT_MAX_SIZE;
@@ -138,25 +138,25 @@ static PLOGFONT gdiCreateLogFont ( const char* type, const char* family,
// family name
if (log_font->mbc_devfont) {
fontGetFamilyFromName (log_font->mbc_devfont->name, dev_family);
- strncpy (log_font->family, dev_family, LEN_FONT_NAME);
- log_font->family [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->family, dev_family, LEN_LOGFONT_NAME_FIELD);
+ log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
fontGetFamilyFromName (log_font->sbc_devfont->name, dev_family);
- strncpy (log_font->family, dev_family, LEN_FONT_NAME);
- log_font->family [LEN_FONT_NAME] = '\0';
+ strncpy (log_font->family, dev_family, LEN_LOGFONT_NAME_FIELD);
+ log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
}
// charset name
if (log_font->mbc_devfont) {
strncpy (log_font->charset,
- log_font->mbc_devfont->charset_ops->name, LEN_FONT_NAME);
- log_font->charset [LEN_FONT_NAME] = '\0';
+ log_font->mbc_devfont->charset_ops->name, LEN_LOGFONT_NAME_FIELD);
+ log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
strncpy (log_font->charset,
- log_font->sbc_devfont->charset_ops->name, LEN_FONT_NAME);
- log_font->charset [LEN_FONT_NAME] = '\0';
+ log_font->sbc_devfont->charset_ops->name, LEN_LOGFONT_NAME_FIELD);
+ log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
}
// size
@@ -215,9 +215,9 @@ PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family,
PLOGFONT GUIAPI CreateLogFontByName (const char* font_name)
{
- char type[LEN_FONT_NAME + 1];
- char family[LEN_FONT_NAME + 1];
- char charset[LEN_FONT_NAME + 1];
+ char type[LEN_LOGFONT_NAME_FIELD + 1];
+ char family[LEN_LOGFONT_NAME_FIELD + 1];
+ char charset[LEN_LOGFONT_NAME_FIELD + 1];
DWORD style;
int height;
|