tune document

This commit is contained in:
Vincent Wei
2019-03-01 14:38:48 +08:00
parent d886268eee
commit dd93e67a3d
2 changed files with 48 additions and 44 deletions
+11 -6
View File
@@ -6548,7 +6548,9 @@ MG_EXPORT void GUIAPI TermVectorialFonts (void);
* \param family The family of the logical font, such as "Courier",
* "Helvetica", and so on. Since version 3.4.0, you can specify
* up to 7 family names separated by comma, e.g.,
* "Helvetica,Naskh".
* "Helvetica,黑体,Naskh,Sans Serif". Note that a family name should
* be encoded in UTF-8 and without special characters (middle spaces
* are allowed).
* \param charset The charset of the logical font. You can specify a
* sigle-byte charset like "ISO8859-1", or a multi-byte charset
* like "UTF-8", or "GB2312-0".
@@ -6673,10 +6675,12 @@ MG_EXPORT PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family,
* \param family The family of the logical font, such as "Courier",
* "Helvetica", and so on. Since version 3.4.0, you can specify
* up to 7 family names separated by comma, e.g.,
* "Helvetica,Naskh".
* "Helvetica,黑体,Naskh,Sans Serif". Note that a family name should
* be encoded in UTF-8 and without special characters (middle spaces
* are allowed).
* \param charset The charset of the logical font. You can specify a
* sigle-byte charset like "ISO8859-1", or a multi-byte charset
* like "GB2312-0".
* like "GB2312-0" and "UTF-8".
* \param weight The weight of the logical font, can be one of the values:
* - FONT_WEIGHT_ANY\n
* Any one.
@@ -6781,12 +6785,13 @@ MG_EXPORT PLOGFONT GUIAPI CreateLogFontEx (const char* type, const char* family,
* \a font_name. Note that since version 3.4.0, you can specify up
* to 4 family names in the LOGFONT name, such as:
*
* ttf-Courier,Naskh-rrncns-*-16-UTF-8
* ttf-Courier,宋体,Naskh,Sans Serif-rrncns-*-16-UTF-8
*
* In this way, you can specify a logfont to use multiple devfonts
* to render a complex text. This is useful when different glyphs are
* contained in different font files. Whereas, a font is often designed
* for a particular language/script or a few similar languages/scripts.
* contained in different font files. It is well known that, a font is
* often designed for a particular language/script or a few similar
* languages/scripts.
*
* \param font_name The name of the logfont.
*
+37 -38
View File
@@ -109,7 +109,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
char name_field[LEN_LOGFONT_NAME_FIELD + 1];
DEVFONT* devfonts[MAXNR_DEVFONTS] = {};
const char* iter;
int i;
int i, n;
// is valid style?
if (style == 0xFFFFFFFF)
@@ -150,51 +150,50 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
newlf->style, newlf->charset, newlf->size);
iter = family;
for (i = 0; i < MAXNR_DEVFONTS; i++) {
if ((n = get_family_name_len(iter)) <= 0)
goto error;
int n = get_family_name_len(iter);
strncpy (name_field, iter, n);
name_field[LEN_LOGFONT_NAME_FIELD] = '\0';
if (n <= 0)
break;
_DBG_PRINTF ("FONT>LogFont: try to create SBC Devfont for family (%s)\n",
name_field);
strncpy (name_field, iter, n);
name_field[LEN_LOGFONT_NAME_FIELD] = '\0';
newlf->scales[0] = 1;
if ((devfonts[0] = font_GetMatchedSBDevFont (newlf, name_field)) == NULL)
goto error;
iter += n;
if (*iter == ',' || *iter == ' ')
iter++;
for (i = 1; i < MAXNR_DEVFONTS; i++) {
DEVFONT* df;
_DBG_PRINTF ("FONT>LogFont: try to create MBC Devfont for family (%s)\n",
name_field);
newlf->scales[i] = 1;
if (i == 0) {
_DBG_PRINTF ("FONT>LogFont: try to match SBC Devfont for family (%s)\n",
name_field);
if ((devfonts[0] = font_GetMatchedSBDevFont (newlf, name_field)) == NULL)
goto error;
// do not forward iter
}
else {
DEVFONT* df;
_DBG_PRINTF ("FONT>LogFont: try to match MBC Devfont for family (%s)\n",
name_field);
if ((df = font_GetMatchedMBDevFont (newlf, name_field))) {
int j;
// check duplicated.
for (j = 0; j <= i; j++) {
if (df == devfonts[j]) {
// duplicated
_DBG_PRINTF ("FONT>LogFont: ignore the duplicated devfont (%s)\n",
name_field);
break;
}
else if (devfonts[j] == NULL) {
devfonts[j] = df;
break;
}
if ((df = font_GetMatchedMBDevFont (newlf, name_field))) {
int j;
// check duplicated.
for (j = 1; j < i; j++) {
if (df == devfonts[j]) {
// duplicated
_DBG_PRINTF ("FONT>LogFont: ignore the duplicated devfont (%s)\n",
name_field);
break;
}
else if (devfonts[j] == NULL) {
devfonts[j] = df;
break;
}
}
iter += n;
if (*iter == ',' || *iter == ' ')
iter++;
}
iter += n;
if (*iter == ',' || *iter == ' ')
iter++;
}
// check if all devfonts support rotation