mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 00:54:18 +08:00
Enhance LOGFONT to support multiple MBC devfonts (up to 7)
This commit is contained in:
+54
-54
@@ -5457,6 +5457,7 @@ MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc
|
||||
|
||||
/* Font-related structures */
|
||||
#define LEN_LOGFONT_NAME_FIELD 31
|
||||
#define LEN_LOGFONT_FAMILY_FILED (LEN_LOGFONT_NAME_FIELD*7+6)
|
||||
#define LEN_UNIDEVFONT_NAME 255
|
||||
|
||||
#define LEN_FONT_NAME LEN_LOGFONT_NAME_FIELD
|
||||
@@ -5723,9 +5724,10 @@ MG_EXPORT int GUIAPI SubtractRect (RECT* rc, const RECT* psrc1, const RECT* psrc
|
||||
|
||||
#define FONT_MAX_SIZE 256
|
||||
#define FONT_MIN_SIZE 4
|
||||
#define MAXNR_DEVFONTS 8
|
||||
|
||||
struct _DEVFONT;
|
||||
typedef struct _DEVFONT DEVFONT;
|
||||
typedef struct _DEVFONT DEVFONT;
|
||||
|
||||
/**
|
||||
* The logical font structure.
|
||||
@@ -5733,48 +5735,45 @@ typedef struct _DEVFONT DEVFONT;
|
||||
*/
|
||||
typedef struct _LOGFONT {
|
||||
/** The type of the logical font. */
|
||||
char type [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char* type;
|
||||
/** The family name of the logical font. */
|
||||
char family [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char* family;
|
||||
/** The charset of the logical font. */
|
||||
char charset [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char* charset;
|
||||
/** The styles of the logical font. */
|
||||
DWORD32 style;
|
||||
/** The size of the logical font. */
|
||||
int size;
|
||||
int size;
|
||||
/** The rotation angle of the logical font. */
|
||||
int rotation;
|
||||
int rotation;
|
||||
/** The ascent of the logical font. */
|
||||
int ascent;
|
||||
int ascent;
|
||||
/** The descent of the logical font. */
|
||||
int descent;
|
||||
int descent;
|
||||
/** The size requested initially. */
|
||||
int size_request;
|
||||
int size_request;
|
||||
|
||||
/* The devfonts for the logfont */
|
||||
DEVFONT* devfonts[4];
|
||||
/* The scale factors of devfonts */
|
||||
Uint8 df_scales[4];
|
||||
/*
|
||||
* The following fields are internally used.
|
||||
* They may be changed in the future.
|
||||
*/
|
||||
|
||||
/* To be deprecated. The scale factor of sbc device font. */
|
||||
unsigned short sbc_scale;
|
||||
/* To be deprecated. The scale factor of mbc device font. */
|
||||
unsigned short mbc_scale;
|
||||
/* To be deprecated. Device font in single charset set */
|
||||
DEVFONT* sbc_devfont;
|
||||
/* To be deprecated. Device font in multiply charset set */
|
||||
DEVFONT* mbc_devfont;
|
||||
// The scale factors of devfonts
|
||||
unsigned short scales[MAXNR_DEVFONTS];
|
||||
// The devfonts for the logfont
|
||||
DEVFONT* devfonts[MAXNR_DEVFONTS];
|
||||
} LOGFONT;
|
||||
|
||||
/**
|
||||
* \var typedef LOGFONT* PLOGFONT
|
||||
* \brief Data type of pointer to a LOGFONT.
|
||||
*/
|
||||
typedef LOGFONT* PLOGFONT;
|
||||
/**
|
||||
* \var typedef const LOGFONT* CPLOGFONT
|
||||
* \brief Data type of pointer to a const LOGFONT.
|
||||
* \var typedef LOGFONT* CPLOGFONT
|
||||
* \brief Data type of pointer to a LOGFONT.
|
||||
*/
|
||||
typedef const LOGFONT* CPLOGFONT;
|
||||
typedef LOGFONT* CPLOGFONT;
|
||||
|
||||
struct _WORDINFO;
|
||||
/**
|
||||
@@ -6436,12 +6435,6 @@ struct _DEVFONT {
|
||||
BOOL need_unload;
|
||||
};
|
||||
|
||||
#define SBC_DEVFONT_INFO(logfont) (logfont.sbc_devfont)
|
||||
#define MBC_DEVFONT_INFO(logfont) (logfont.mbc_devfont)
|
||||
|
||||
#define SBC_DEVFONT_INFO_P(logfont) (logfont->sbc_devfont)
|
||||
#define MBC_DEVFONT_INFO_P(logfont) (logfont->mbc_devfont)
|
||||
|
||||
/**
|
||||
* \def INV_LOGFONT
|
||||
* \brief Invalid logfont.
|
||||
@@ -6545,10 +6538,12 @@ MG_EXPORT void GUIAPI TermVectorialFonts (void);
|
||||
* - FONT_TYPE_NAME_ALL\n
|
||||
* Creates a logical font by using any type device font.
|
||||
* \param family The family of the logical font, such as "Courier",
|
||||
* "Helvetica", and so on.
|
||||
* "Helvetica", and so on. Since version 3.4.0, you can specify
|
||||
* up to 7 family names separated by comma, e.g.,
|
||||
* "Helvetica,Naskh".
|
||||
* \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 "UTF-8", or "GB2312-0".
|
||||
* \param weight The weight of the logical font, can be one of the values:
|
||||
* - FONT_WEIGHT_ALL\n
|
||||
* Any one.
|
||||
@@ -6668,7 +6663,9 @@ MG_EXPORT PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family,
|
||||
* - FONT_TYPE_NAME_ALL\n
|
||||
* Creates a logical font by using any type device font.
|
||||
* \param family The family of the logical font, such as "Courier",
|
||||
* "Helvetica", and so on.
|
||||
* "Helvetica", and so on. Since version 3.4.0, you can specify
|
||||
* up to 7 family names separated by comma, e.g.,
|
||||
* "Helvetica,Naskh".
|
||||
* \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".
|
||||
@@ -6773,9 +6770,17 @@ MG_EXPORT PLOGFONT GUIAPI CreateLogFontEx (const char* type, const char* family,
|
||||
* \brief Creates a logical font by a font name.
|
||||
*
|
||||
* This function creates a logical font by a font name specified by
|
||||
* \a font_name.
|
||||
* \a font_name. Note that since version 3.4.0, you can specify up
|
||||
* to 4 family names in the LOGFONT name, such as:
|
||||
*
|
||||
* \param font_name The name of the font.
|
||||
* ttf-Courier,Naskh-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.
|
||||
*
|
||||
* \param font_name The name of the logfont.
|
||||
*
|
||||
* \return The pointer to the logical font created, NULL on error.
|
||||
*
|
||||
@@ -6817,7 +6822,8 @@ MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirect (LOGFONT* logfont);
|
||||
*
|
||||
* \sa CreateLogFont, CreateLogFontIndirect, SelectFont
|
||||
*/
|
||||
MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirectEx (LOGFONT* logfont, int rotation);
|
||||
MG_EXPORT PLOGFONT GUIAPI CreateLogFontIndirectEx (LOGFONT* logfont,
|
||||
int rotation);
|
||||
|
||||
/**
|
||||
* \fn void GUIAPI DestroyLogFont (PLOGFONT log_font)
|
||||
@@ -9535,8 +9541,8 @@ typedef Uint32 Glyph32;
|
||||
*/
|
||||
#define INV_GLYPH_VALUE 0xFFFFFFFF
|
||||
|
||||
#define GLYPH_DEVFONT_INDEX_MASK 0xC0000000
|
||||
#define GLYPH_DEVFONT_INDEX_SHIFT 30
|
||||
#define GLYPH_DEVFONT_INDEX_MASK 0xF0000000
|
||||
#define GLYPH_DEVFONT_INDEX_SHIFT 28
|
||||
|
||||
/**
|
||||
* \def REAL_GLYPH(glyph)
|
||||
@@ -9547,20 +9553,18 @@ typedef Uint32 Glyph32;
|
||||
#define REAL_GLYPH(glyph) ((glyph) & ~GLYPH_DEVFONT_INDEX_MASK)
|
||||
|
||||
/**
|
||||
* \def SELECT_DEVFONT_EX(plogfont, glyph)
|
||||
* \def SELECT_DEVFONT(logfont, glyph)
|
||||
* \brief Select a DEVFONT according to the LOGFONT glyph value.
|
||||
*
|
||||
* \param plogfont The pointer to a logical font.
|
||||
* \param glyph The logical glyph value.
|
||||
* \param logfont The pointer to a logical font.
|
||||
* \param glyph The logical glyph value.
|
||||
*
|
||||
*/
|
||||
#define SELECT_DEVFONT_EX(plogfont, glyph) \
|
||||
(plogfont)->devfonts[((glyph) >> GLYPH_DEVFONT_INDEX_SHIFT) & 0x03]
|
||||
#define SELECT_DEVFONT(logfont, glyph) \
|
||||
(logfont)->devfonts[((glyph) >> GLYPH_DEVFONT_INDEX_SHIFT) & 0x07]
|
||||
|
||||
/* to be deprecated */
|
||||
#define SELECT_DEVFONT(plogfont, glyph) \
|
||||
((glyph) & GLYPH_DEVFONT_INDEX_MASK ? \
|
||||
(plogfont)->mbc_devfont : (plogfont)->sbc_devfont)
|
||||
#define DFI_IN_GLYPH(glyph) \
|
||||
(((glyph) >> GLYPH_DEVFONT_INDEX_SHIFT) & 0x07)
|
||||
|
||||
/**
|
||||
* \def IS_MBC_GLYPH(glyph)
|
||||
@@ -9570,13 +9574,9 @@ typedef Uint32 Glyph32;
|
||||
*/
|
||||
#define IS_MBC_GLYPH(glyph) ((glyph) & GLYPH_DEVFONT_INDEX_MASK)
|
||||
|
||||
/**
|
||||
* \def SET_MBC_GLYPH(glyph)
|
||||
* \brief set the glyph with multibyte mask
|
||||
*
|
||||
* \param glyph glyph value
|
||||
*/
|
||||
#define SET_MBC_GLYPH(glyph) ((glyph) | 0x80000000)
|
||||
#define SET_GLYPH_DFI(glyph, dfi) \
|
||||
(((glyph) & ~GLYPH_DEVFONT_INDEX_MASK) | \
|
||||
(((Glyph32)((dfi) & 0x07)) << GLYPH_DEVFONT_INDEX_SHIFT))
|
||||
|
||||
/**
|
||||
* \var typedef struct _GLYPHMAPINFO GLYPHMAPINFO
|
||||
|
||||
@@ -1071,14 +1071,12 @@ static int inline get_glyph_bidi_type (LOGFONT* logfont, Glyph32 glyph)
|
||||
DEVFONT* devfont;
|
||||
|
||||
if (IS_MBC_GLYPH(glyph)) {
|
||||
devfont = logfont->mbc_devfont;
|
||||
devfont = logfont->devfonts[1];
|
||||
|
||||
if (devfont->charset_ops->bidi_glyph_type)
|
||||
{
|
||||
if (devfont->charset_ops->bidi_glyph_type) {
|
||||
return devfont->charset_ops->bidi_glyph_type (glyph);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
return BIDI_TYPE_LTR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,13 +754,13 @@ Uint32 __mg_charset_bidi_str_base_dir (const CHARSETOPS* charset_ops,
|
||||
BOOL GetGlyphBIDIType (LOGFONT* log_font, Glyph32 glyph_value,
|
||||
Uint32 *bidi_type)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* devfont = SELECT_DEVFONT(log_font, glyph_value);
|
||||
|
||||
if (mbc_devfont == NULL ||
|
||||
mbc_devfont->charset_ops->bidi_glyph_type == NULL)
|
||||
if (devfont == NULL ||
|
||||
devfont->charset_ops->bidi_glyph_type == NULL)
|
||||
return FALSE;
|
||||
|
||||
*bidi_type = mbc_devfont->charset_ops->bidi_glyph_type (glyph_value);
|
||||
*bidi_type = devfont->charset_ops->bidi_glyph_type (glyph_value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -750,8 +750,8 @@ static BOOL get_mirror_glyph (const BIDICHAR_MIRROR_MAP* map, int n, Glyph32 gly
|
||||
|
||||
pos = step = (n / 2) + 1;
|
||||
|
||||
BOOL is_mbc;
|
||||
is_mbc = IS_MBC_GLYPH(glyph);
|
||||
int dfi;
|
||||
dfi = DFI_IN_GLYPH(glyph);
|
||||
glyph = REAL_GLYPH(glyph);
|
||||
|
||||
while (step > 1) {
|
||||
@@ -777,9 +777,9 @@ static BOOL get_mirror_glyph (const BIDICHAR_MIRROR_MAP* map, int n, Glyph32 gly
|
||||
if (mirrored){
|
||||
*mirrored = found ? map[pos].mirrored : glyph;
|
||||
|
||||
/* use the same mbc font for mirror char. */
|
||||
if(is_mbc)
|
||||
*mirrored = SET_MBC_GLYPH(*mirrored);
|
||||
/* use the same devfont index for mirror char. */
|
||||
if (dfi)
|
||||
*mirrored = SET_GLYPH_DFI(*mirrored, dfi);
|
||||
}
|
||||
|
||||
return found;
|
||||
|
||||
+27
-26
@@ -105,8 +105,8 @@ void font_ResetDevFont (void)
|
||||
#define MATCHED_WEIGHT 0x08
|
||||
#define MATCHED_SLANT 0x10
|
||||
|
||||
static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
|
||||
int list_len, char* req_charset)
|
||||
static DEVFONT* get_matched_devfont (LOGFONT* lf, const char* family,
|
||||
DEVFONT* list_head, int list_len, char* req_charset)
|
||||
{
|
||||
int i = 0;
|
||||
BYTE* match_bits;
|
||||
@@ -124,28 +124,28 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
|
||||
dev_font = list_head;
|
||||
while (dev_font) {
|
||||
int type_req;
|
||||
int weight_req = log_font->style & FS_WEIGHT_MASK;
|
||||
int weight_req = lf->style & FS_WEIGHT_MASK;
|
||||
int weight_cur = dev_font->style & FS_WEIGHT_MASK;
|
||||
|
||||
/* clear match_bits first. */
|
||||
match_bits [i] = 0;
|
||||
|
||||
/* does match this font type? */
|
||||
type_req = fontConvertFontType (log_font->type);
|
||||
type_req = fontConvertFontType (lf->type);
|
||||
if (type_req == FONT_TYPE_ALL)
|
||||
match_bits [i] |= MATCHED_TYPE;
|
||||
else if (type_req == fontGetFontTypeFromName (dev_font->name))
|
||||
match_bits [i] |= MATCHED_TYPE;
|
||||
|
||||
/* does match this family? */
|
||||
/* does match this family requested? */
|
||||
#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) {
|
||||
if (strcasecmp (family, lf->family) == 0) {
|
||||
match_bits [i] |= MATCHED_FAMILY;
|
||||
}
|
||||
#else
|
||||
if (fontDoesMatchFamily(dev_font->name, log_font->family)) {
|
||||
if (fontDoesMatchFamily(dev_font->name, family?family:lf->family)) {
|
||||
match_bits [i] |= MATCHED_FAMILY;
|
||||
}
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
|
||||
if (weight_req == FS_WEIGHT_ANY || weight_req == weight_cur) {
|
||||
match_bits [i] |= MATCHED_WEIGHT;
|
||||
}
|
||||
else if (dev_font->font_ops->get_glyph_bmptype(log_font, dev_font)
|
||||
else if (dev_font->font_ops->get_glyph_bmptype(lf, dev_font)
|
||||
== DEVFONTGLYPHTYPE_MONOBMP
|
||||
&& weight_req > FS_WEIGHT_DEMIBOLD
|
||||
&& weight_cur < FS_WEIGHT_MEDIUM) {
|
||||
@@ -184,16 +184,16 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
|
||||
|
||||
int error, size_error, weight_error, slant_error;
|
||||
|
||||
size_error = log_font->size -
|
||||
(*dev_font->font_ops->get_font_size) (log_font, dev_font,
|
||||
log_font->size);
|
||||
size_error = lf->size -
|
||||
(*dev_font->font_ops->get_font_size) (lf, dev_font,
|
||||
lf->size);
|
||||
size_error = ABS (size_error);
|
||||
|
||||
weight_error = (log_font->style & FS_WEIGHT_MASK) -
|
||||
weight_error = (lf->style & FS_WEIGHT_MASK) -
|
||||
(dev_font->style & FS_WEIGHT_MASK);
|
||||
weight_error = ABS (weight_error);
|
||||
|
||||
slant_error = (log_font->style & FS_SLANT_MASK) -
|
||||
slant_error = (lf->style & FS_SLANT_MASK) -
|
||||
(dev_font->style & FS_SLANT_MASK);
|
||||
slant_error = ABS (slant_error);
|
||||
|
||||
@@ -215,8 +215,8 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
|
||||
for (i = 0; i < list_len; i++) {
|
||||
int error;
|
||||
if (match_bits [i] & MATCHED_CHARSET) {
|
||||
error = log_font->size -
|
||||
(*dev_font->font_ops->get_font_size) (log_font, dev_font, log_font->size);
|
||||
error = lf->size -
|
||||
(*dev_font->font_ops->get_font_size) (lf, dev_font, lf->size);
|
||||
error = ABS (error);
|
||||
if (min_error >= error) { /* use >=, make the later has a higher priority */
|
||||
min_error = error;
|
||||
@@ -233,40 +233,41 @@ matched:
|
||||
#endif
|
||||
|
||||
if (matched_font)
|
||||
matched_font->font_ops->get_font_size (log_font, matched_font, log_font->size);
|
||||
matched_font->font_ops->get_font_size (lf, matched_font, lf->size);
|
||||
|
||||
return matched_font;
|
||||
}
|
||||
|
||||
DEVFONT* font_GetMatchedSBDevFont (LOGFONT* log_font)
|
||||
DEVFONT* font_GetMatchedSBDevFont (LOGFONT* lf, const char* family)
|
||||
{
|
||||
DEVFONT* matched_devfont;
|
||||
|
||||
if (GetCharsetOps (log_font->charset)->bytes_maxlen_char > 1) {
|
||||
if (GetCharsetOps (lf->charset)->bytes_maxlen_char > 1) {
|
||||
/*mbc logfont --- sbc devfont*/
|
||||
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,
|
||||
fontGetCharsetFromName (g_SysLogFont[0]->devfonts[0]->name,
|
||||
sysfont_charset);
|
||||
matched_devfont = get_matched_devfont (lf, family, sb_dev_font_head,
|
||||
nr_sb_dev_fonts, sysfont_charset);
|
||||
}
|
||||
else {
|
||||
/*sbc logfont --- sbc devfont*/
|
||||
matched_devfont = get_matched_devfont (log_font, sb_dev_font_head,
|
||||
nr_sb_dev_fonts, log_font->charset);
|
||||
matched_devfont = get_matched_devfont (lf, family, sb_dev_font_head,
|
||||
nr_sb_dev_fonts, lf->charset);
|
||||
}
|
||||
|
||||
return matched_devfont;
|
||||
}
|
||||
|
||||
DEVFONT* font_GetMatchedMBDevFont (LOGFONT* log_font)
|
||||
DEVFONT* font_GetMatchedMBDevFont (LOGFONT* lf, const char* family)
|
||||
{
|
||||
/*sbc logfont doesn't need mbc font*/
|
||||
if (GetCharsetOps (log_font->charset)->bytes_maxlen_char == 1)
|
||||
if (GetCharsetOps (lf->charset)->bytes_maxlen_char == 1)
|
||||
return NULL;
|
||||
/*mbc logfont --- mbc devfont*/
|
||||
else
|
||||
return get_matched_devfont (log_font, mb_dev_font_head,
|
||||
nr_mb_dev_fonts, log_font->charset);
|
||||
return get_matched_devfont (lf, family, mb_dev_font_head,
|
||||
nr_mb_dev_fonts, lf->charset);
|
||||
}
|
||||
|
||||
const DEVFONT* GUIAPI GetNextDevFont (const DEVFONT* dev_font)
|
||||
|
||||
+9
-11
@@ -1163,24 +1163,22 @@ FONTOPS __mg_ttf_ops = {
|
||||
BOOL
|
||||
ft2SetLcdFilter (LOGFONT* logfont, FT2LCDFilter filter)
|
||||
{
|
||||
int i;
|
||||
BOOL rv = FALSE;
|
||||
DEVFONT* devfont;
|
||||
|
||||
if (IS_SUBPIXEL(logfont)) {
|
||||
if (filter >= MG_SMOOTH_MAX)
|
||||
filter = MG_SMOOTH_DEFAULT;
|
||||
devfont = logfont->sbc_devfont;
|
||||
if (devfont && devfont->font_ops == &__mg_ttf_ops) {
|
||||
FTINSTANCEINFO* ft_inst_info = FT_INST_INFO_P (devfont);
|
||||
ft_inst_info->ft_lcdfilter = filter;
|
||||
rv = TRUE;
|
||||
}
|
||||
for (i = 0; i < MAXNR_DEVFONTS; i++) {
|
||||
if ((devfont = logfont->devfonts[i]) == NULL)
|
||||
break;
|
||||
|
||||
devfont = logfont->mbc_devfont;
|
||||
if (devfont && devfont->font_ops == &__mg_ttf_ops) {
|
||||
FTINSTANCEINFO* ft_inst_info = FT_INST_INFO_P (devfont);
|
||||
ft_inst_info->ft_lcdfilter = filter;
|
||||
rv = TRUE;
|
||||
if (devfont->font_ops == &__mg_ttf_ops) {
|
||||
FTINSTANCEINFO* ft_inst_info = FT_INST_INFO_P (devfont);
|
||||
ft_inst_info->ft_lcdfilter = filter;
|
||||
rv = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove subpixel style if filter is none */
|
||||
|
||||
+271
-396
File diff suppressed because it is too large
Load Diff
+21
-21
@@ -343,10 +343,10 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
|
||||
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||
unsigned char ascii_ch = uc16;
|
||||
return logfont->sbc_devfont->font_ops->get_glyph_monobitmap (logfont,
|
||||
logfont->sbc_devfont, ascii_ch, pitch, scale);
|
||||
return logfont->devfonts[0]->font_ops->get_glyph_monobitmap (logfont,
|
||||
logfont->devfonts[0], ascii_ch, pitch, scale);
|
||||
}
|
||||
else
|
||||
glyph = &def_glyph;
|
||||
@@ -411,21 +411,21 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
||||
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||
unsigned char ascii_ch = uc16;
|
||||
if (logfont->sbc_devfont->font_ops->get_glyph_bbox) {
|
||||
return logfont->sbc_devfont->font_ops->get_glyph_bbox (logfont,
|
||||
logfont->sbc_devfont, ascii_ch,
|
||||
if (logfont->devfonts[0]->font_ops->get_glyph_bbox) {
|
||||
return logfont->devfonts[0]->font_ops->get_glyph_bbox (logfont,
|
||||
logfont->devfonts[0], ascii_ch,
|
||||
px, py, pwidth, pheight);
|
||||
}
|
||||
else {
|
||||
int width, height, ascent;
|
||||
logfont->sbc_devfont->font_ops->get_glyph_advance
|
||||
(logfont, logfont->sbc_devfont, glyph_value, &width, 0);
|
||||
height = logfont->sbc_devfont->font_ops->get_font_height
|
||||
(logfont, logfont->sbc_devfont);
|
||||
ascent = logfont->sbc_devfont->font_ops->get_font_ascent
|
||||
(logfont, logfont->sbc_devfont);
|
||||
logfont->devfonts[0]->font_ops->get_glyph_advance
|
||||
(logfont, logfont->devfonts[0], glyph_value, &width, 0);
|
||||
height = logfont->devfonts[0]->font_ops->get_font_height
|
||||
(logfont, logfont->devfonts[0]);
|
||||
ascent = logfont->devfonts[0]->font_ops->get_font_ascent
|
||||
(logfont, logfont->devfonts[0]);
|
||||
|
||||
if (pwidth) *pwidth = width;
|
||||
if (pheight) *pheight = height;
|
||||
@@ -464,11 +464,11 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||
unsigned char ascii_ch = uc16;
|
||||
if (logfont->sbc_devfont->font_ops->get_glyph_advance) {
|
||||
return logfont->sbc_devfont->font_ops->
|
||||
get_glyph_advance (logfont, logfont->sbc_devfont,
|
||||
if (logfont->devfonts[0]->font_ops->get_glyph_advance) {
|
||||
return logfont->devfonts[0]->font_ops->
|
||||
get_glyph_advance (logfont, logfont->devfonts[0],
|
||||
ascii_ch, px, py);
|
||||
}
|
||||
}
|
||||
@@ -507,13 +507,13 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
|
||||
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||
else
|
||||
uc16 = glyph_value;
|
||||
|
||||
|
||||
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) /* ASCII */
|
||||
return logfont->sbc_devfont->font_ops->is_glyph_existed (logfont,
|
||||
logfont->sbc_devfont, glyph_value);
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) /* ASCII */
|
||||
return logfont->devfonts[0]->font_ops->is_glyph_existed (logfont,
|
||||
logfont->devfonts[0], glyph_value);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ static int get_font_ascent (LOGFONT* logfont, DEVFONT* devfont)
|
||||
static int get_font_descent (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
int height = RBFONT_INFO_P (devfont)->height;
|
||||
|
||||
|
||||
height *= GET_DEVFONT_SCALE (logfont, devfont);
|
||||
|
||||
if (height >= 40)
|
||||
|
||||
+9
-9
@@ -205,28 +205,28 @@ void mg_TermSysFont (void)
|
||||
const char* GUIAPI GetSysCharset (BOOL wchar)
|
||||
{
|
||||
if (wchar) {
|
||||
if (g_SysLogFont[1]->mbc_devfont)
|
||||
return MBC_DEVFONT_INFO_P (g_SysLogFont[1])->charset_ops->name;
|
||||
if (g_SysLogFont[1]->devfonts[1])
|
||||
return g_SysLogFont[1]->devfonts[1]->charset_ops->name;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return SBC_DEVFONT_INFO_P (g_SysLogFont[0])->charset_ops->name;
|
||||
else
|
||||
return g_SysLogFont[0]->devfonts[0]->charset_ops->name;
|
||||
}
|
||||
|
||||
int GUIAPI GetSysCharWidth (void)
|
||||
{
|
||||
DEVFONT* sbc_devfont = g_SysLogFont[0]->sbc_devfont;
|
||||
DEVFONT* sbc_devfont = g_SysLogFont[0]->devfonts[0];
|
||||
|
||||
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[0], sbc_devfont);
|
||||
}
|
||||
|
||||
int GUIAPI GetSysCCharWidth (void)
|
||||
{
|
||||
DEVFONT* mbc_devfont = g_SysLogFont[1]->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = g_SysLogFont[1]->devfonts[1];
|
||||
|
||||
if (mbc_devfont)
|
||||
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
|
||||
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
|
||||
else
|
||||
return GetSysCharWidth () * 2;
|
||||
}
|
||||
@@ -238,14 +238,14 @@ int GUIAPI GetSysCharHeight (void)
|
||||
|
||||
int GUIAPI GetSysFontMaxWidth (int font_id)
|
||||
{
|
||||
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->sbc_devfont;
|
||||
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->devfonts[0];
|
||||
|
||||
return sbc_devfont->font_ops->get_max_width (g_SysLogFont[font_id], sbc_devfont);
|
||||
}
|
||||
|
||||
int GUIAPI GetSysFontAveWidth (int font_id)
|
||||
{
|
||||
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->sbc_devfont;
|
||||
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->devfonts[0];
|
||||
|
||||
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[font_id], sbc_devfont);
|
||||
}
|
||||
|
||||
+21
-21
@@ -50,8 +50,8 @@
|
||||
int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
|
||||
int* pos_chars)
|
||||
{
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
int count = 0;
|
||||
int left_bytes = len;
|
||||
int len_cur_char;
|
||||
@@ -86,8 +86,8 @@ int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
|
||||
int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len,
|
||||
int* pos_words, WORDINFO* info_words)
|
||||
{
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
WORDINFO word_info;
|
||||
int count = 0;
|
||||
int left_bytes = len;
|
||||
@@ -150,8 +150,8 @@ int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len,
|
||||
|
||||
int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len)
|
||||
{
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
int len_cur_char = 0;
|
||||
|
||||
if (mbc_devfont) {
|
||||
@@ -171,8 +171,8 @@ int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len)
|
||||
|
||||
int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len)
|
||||
{
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
int left_bytes = len;
|
||||
int len_cur_char;
|
||||
int lastlen = 0;
|
||||
@@ -204,8 +204,8 @@ int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len)
|
||||
int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
|
||||
WORDINFO* word_info)
|
||||
{
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (mbc_devfont) {
|
||||
int mbc_pos;
|
||||
@@ -234,8 +234,8 @@ int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
|
||||
int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
||||
const unsigned char* mchar, int n)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* devfont;
|
||||
int len_cur_char = 0;
|
||||
Glyph32 glyph_value;
|
||||
@@ -282,8 +282,8 @@ int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
||||
|
||||
int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, Uchar32 wc)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
unsigned char mchar [16];
|
||||
int len_cur_char = 0;
|
||||
|
||||
@@ -311,8 +311,8 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
||||
const unsigned char* mstr, int mstr_len, int n,
|
||||
int* conved_mstr_len)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* devfont;
|
||||
int left, count = 0;
|
||||
Uchar32* uchar32;
|
||||
@@ -406,8 +406,8 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
|
||||
const void *wcs, int wcs_len, BOOL wc32, int n,
|
||||
int* conved_wcs_len)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
int wc_count = 0, count = 0;
|
||||
unsigned char mchar [16] = {0};
|
||||
const Uchar32* uchar32;
|
||||
@@ -493,7 +493,7 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
|
||||
|
||||
size_t __mg_strlen (PLOGFONT log_font, const char* mstr)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
|
||||
size_t len = 0;
|
||||
@@ -514,7 +514,7 @@ char* __mg_strnchr (PLOGFONT log_font, const char* s, size_t n, int c,
|
||||
{
|
||||
size_t i;
|
||||
unsigned char c1, c2;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (mbc_devfont) {
|
||||
*chlen = 2;
|
||||
@@ -566,7 +566,7 @@ int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
|
||||
|
||||
len = substr - text;
|
||||
if (*nr_delim == 2) {
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (strstr (mbc_devfont->charset_ops->name, "UTF-16LE")) {
|
||||
|
||||
+20
-20
@@ -287,10 +287,10 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
|
||||
glyph = get_glyph (p_upf, (UPFNODE *)(((UPFV1_FILE_HEADER *)p_upf)->off_nodes + p_upf), uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||
unsigned char ascii_ch = uc16;
|
||||
return logfont->sbc_devfont->font_ops->get_glyph_monobitmap (logfont,
|
||||
logfont->sbc_devfont, ascii_ch, pitch, scale);
|
||||
return logfont->devfonts[0]->font_ops->get_glyph_monobitmap (logfont,
|
||||
logfont->devfonts[0], ascii_ch, pitch, scale);
|
||||
}
|
||||
else
|
||||
glyph = &def_glyph;
|
||||
@@ -377,21 +377,21 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
||||
glyph = get_glyph (p_upf, (UPFNODE *)(((UPFV1_FILE_HEADER *)p_upf)->off_nodes + p_upf), uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||
unsigned char ascii_ch = uc16;
|
||||
if (logfont->sbc_devfont->font_ops->get_glyph_bbox) {
|
||||
return logfont->sbc_devfont->font_ops->get_glyph_bbox (logfont,
|
||||
logfont->sbc_devfont, ascii_ch,
|
||||
if (logfont->devfonts[0]->font_ops->get_glyph_bbox) {
|
||||
return logfont->devfonts[0]->font_ops->get_glyph_bbox (logfont,
|
||||
logfont->devfonts[0], ascii_ch,
|
||||
px, py, pwidth, pheight);
|
||||
}
|
||||
else {
|
||||
int width, height, ascent;
|
||||
logfont->sbc_devfont->font_ops->get_glyph_advance
|
||||
(logfont, logfont->sbc_devfont, glyph_value, &width, 0);
|
||||
height = logfont->sbc_devfont->font_ops->get_font_height
|
||||
(logfont, logfont->sbc_devfont);
|
||||
ascent = logfont->sbc_devfont->font_ops->get_font_ascent
|
||||
(logfont, logfont->sbc_devfont);
|
||||
logfont->devfonts[0]->font_ops->get_glyph_advance
|
||||
(logfont, logfont->devfonts[0], glyph_value, &width, 0);
|
||||
height = logfont->devfonts[0]->font_ops->get_font_height
|
||||
(logfont, logfont->devfonts[0]);
|
||||
ascent = logfont->devfonts[0]->font_ops->get_font_ascent
|
||||
(logfont, logfont->devfonts[0]);
|
||||
|
||||
if (pwidth) *pwidth = width;
|
||||
if (pheight) *pheight = height;
|
||||
@@ -435,11 +435,11 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
glyph = get_glyph (p_upf, (UPFNODE *)(((UPFV1_FILE_HEADER *)p_upf)->off_nodes + p_upf), uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||
unsigned char ascii_ch = uc16;
|
||||
if (logfont->sbc_devfont->font_ops->get_glyph_advance) {
|
||||
return logfont->sbc_devfont->font_ops->get_glyph_advance (
|
||||
logfont, logfont->sbc_devfont, ascii_ch, px, py);
|
||||
if (logfont->devfonts[0]->font_ops->get_glyph_advance) {
|
||||
return logfont->devfonts[0]->font_ops->get_glyph_advance (
|
||||
logfont, logfont->devfonts[0], ascii_ch, px, py);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -495,9 +495,9 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
|
||||
glyph = get_glyph (p_upf, (UPFNODE *)(((UPFV1_FILE_HEADER *)p_upf)->off_nodes + p_upf), uc16);
|
||||
|
||||
if (glyph == NULL) {
|
||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) /* ASCII */
|
||||
return logfont->sbc_devfont->font_ops->is_glyph_existed (logfont,
|
||||
logfont->sbc_devfont, glyph_value);
|
||||
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) /* ASCII */
|
||||
return logfont->devfonts[0]->font_ops->is_glyph_existed (logfont,
|
||||
logfont->devfonts[0], glyph_value);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+28
-6
@@ -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
@@ -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 */
|
||||
|
||||
@@ -1038,7 +1038,7 @@ static int srvChangeCaption (int cli, int idx_znode, const char *caption)
|
||||
if (caplen < 32) {
|
||||
strcpy (nodes[idx_znode].caption, caption);
|
||||
} else {
|
||||
GetTextCharPos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
|
||||
get_text_char_pos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
|
||||
&fit_chars, pos_chars);
|
||||
memcpy(nodes[idx_znode].caption,
|
||||
caption, pos_chars[fit_chars-1]);
|
||||
|
||||
@@ -1340,11 +1340,11 @@ static HWND dskSetActiveZOrderNode (int cli, int idx_znode)
|
||||
return old_hwnd;
|
||||
}
|
||||
|
||||
static void GetTextCharPos (PLOGFONT log_font, const char *text,
|
||||
static void get_text_char_pos (PLOGFONT log_font, const char *text,
|
||||
int len, int fit_bytes, int *fit_chars, int *pos_chars)
|
||||
{
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
int len_cur_char;
|
||||
int left_bytes = len;
|
||||
int char_count = 0, bytes = 0;
|
||||
@@ -1624,11 +1624,11 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
||||
strcpy (nodes[free_slot].caption, caption);
|
||||
} else {
|
||||
int tail_pos;
|
||||
GetTextCharPos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
|
||||
get_text_char_pos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
|
||||
&fit_chars, pos_chars);
|
||||
|
||||
tail_pos = pos_chars[fit_chars-1];
|
||||
|
||||
|
||||
if ((tail_pos + 3) >= 32 && fit_chars > 4) {
|
||||
tail_pos = pos_chars[fit_chars-2];
|
||||
if (tail_pos + 3 >= 32) {
|
||||
@@ -1640,7 +1640,7 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
||||
}
|
||||
memcpy(nodes[free_slot].caption, caption, tail_pos);
|
||||
strcpy ((nodes[free_slot].caption + tail_pos), "...");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-31
@@ -65,29 +65,30 @@ static Glyph32* _gdi_get_glyphs_string(PDC pdc, const unsigned char* text,
|
||||
int left_bytes = text_len;
|
||||
unsigned int glyph_type;
|
||||
Glyph32 glyph_value;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
Glyph32 *logical_glyphs = NULL;
|
||||
|
||||
if (mbc_devfont) {
|
||||
int prev_len = 0;
|
||||
const unsigned char* prev_mchar = NULL;
|
||||
logical_glyphs = malloc(text_len * sizeof (Glyph32));
|
||||
while (left_bytes > 0){
|
||||
while (left_bytes > 0) {
|
||||
len_cur_char = mbc_devfont->charset_ops->len_first_char
|
||||
((const unsigned char*)text, left_bytes);
|
||||
if (len_cur_char > 0) {
|
||||
glyph_value = mbc_devfont->charset_ops->char_glyph_value
|
||||
(prev_mchar, prev_len, text, left_bytes);
|
||||
|
||||
logical_glyphs[i++] = SET_MBC_GLYPH(glyph_value);
|
||||
logical_glyphs[i++]
|
||||
= _gdi_set_glyph_dfi(pdc->pLogFont, glyph_value);
|
||||
glyph_type = (*mbc_devfont->charset_ops->glyph_type)
|
||||
(glyph_value);
|
||||
if(!(glyph_type & MCHAR_TYPE_NOSPACING_MARK)){
|
||||
if (!(glyph_type & MCHAR_TYPE_NOSPACING_MARK)){
|
||||
prev_mchar = text;
|
||||
prev_len = len_cur_char;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
prev_len += len_cur_char;
|
||||
}
|
||||
|
||||
@@ -109,17 +110,20 @@ static Glyph32* _gdi_get_glyphs_string(PDC pdc, const unsigned char* text,
|
||||
else
|
||||
break;
|
||||
}
|
||||
if(nr_glyphs) *nr_glyphs = i;
|
||||
|
||||
if (nr_glyphs)
|
||||
*nr_glyphs = i;
|
||||
}
|
||||
|
||||
return logical_glyphs;
|
||||
}
|
||||
|
||||
static unsigned int inline get_glyph_type(LOGFONT* logfont, Glyph32 glyph_value)
|
||||
{
|
||||
if (IS_MBC_GLYPH (glyph_value))
|
||||
return logfont->mbc_devfont->charset_ops->glyph_type(glyph_value);
|
||||
return logfont->devfonts[1]->charset_ops->glyph_type(glyph_value);
|
||||
else
|
||||
return logfont->sbc_devfont->charset_ops->glyph_type(glyph_value);
|
||||
return logfont->devfonts[0]->charset_ops->glyph_type(glyph_value);
|
||||
}
|
||||
|
||||
static int inline get_glyph_advance_in_dc (PDC pdc, Glyph32 glyph_value)
|
||||
@@ -378,8 +382,8 @@ static int _gdi_output_glyphs_direct(PDC pdc, const unsigned char* text,
|
||||
{
|
||||
unsigned int glyph_type;
|
||||
Glyph32 glyph_value;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
int len_cur_char = 0;
|
||||
int left_bytes = text_len;
|
||||
int prev_len = 0;
|
||||
@@ -403,7 +407,7 @@ static int _gdi_output_glyphs_direct(PDC pdc, const unsigned char* text,
|
||||
glyph_value = mbc_devfont->charset_ops->char_glyph_value
|
||||
(prev_mchar, prev_len, text, left_bytes);
|
||||
|
||||
glyph_value = SET_MBC_GLYPH(glyph_value);
|
||||
glyph_value = _gdi_set_glyph_dfi(pdc->pLogFont, glyph_value);
|
||||
goto do_glyph;
|
||||
}
|
||||
}
|
||||
@@ -461,7 +465,7 @@ do_glyph:
|
||||
Glyph32* _gdi_bidi_reorder (PDC pdc, const unsigned char* text, int text_len,
|
||||
int* nr_glyphs)
|
||||
{
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
Glyph32 *logical_glyphs = NULL;
|
||||
|
||||
if (mbc_devfont && mbc_devfont->charset_ops->bidi_glyph_type) {
|
||||
@@ -480,8 +484,8 @@ int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len,
|
||||
int i = 0;
|
||||
unsigned int glyph_type;
|
||||
Glyph32 glyph_value;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
|
||||
if (mbc_devfont) {
|
||||
int nr_glyphs = 0;
|
||||
@@ -490,7 +494,7 @@ int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len,
|
||||
if (mbc_devfont->charset_ops->bidi_glyph_type) {
|
||||
|
||||
logical_glyphs = _gdi_bidi_reorder (pdc, text, text_len, &nr_glyphs);
|
||||
if(!logical_glyphs || nr_glyphs <= 0)
|
||||
if (!logical_glyphs || nr_glyphs <= 0)
|
||||
return 0;
|
||||
|
||||
i = _gdi_output_visual_glyphs (pdc, logical_glyphs, nr_glyphs,
|
||||
@@ -556,8 +560,8 @@ _gdi_get_glyphs_string_charbreak(PDC pdc, const unsigned char* text,
|
||||
int left_bytes = text_len;
|
||||
unsigned int glyph_type;
|
||||
Glyph32 glyph_value;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
Glyph32 *logical_glyphs = NULL;
|
||||
|
||||
DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context;
|
||||
@@ -582,7 +586,7 @@ _gdi_get_glyphs_string_charbreak(PDC pdc, const unsigned char* text,
|
||||
|
||||
prev_mchar = text;
|
||||
prev_len = len_cur_char;
|
||||
logical_glyphs[i++] = SET_MBC_GLYPH(glyph_value);
|
||||
logical_glyphs[i++] = _gdi_set_glyph_dfi(pdc->pLogFont, glyph_value);
|
||||
|
||||
glyph_type = (*mbc_devfont->charset_ops->glyph_type)
|
||||
(glyph_value);
|
||||
@@ -630,8 +634,8 @@ static int _gdi_get_nextword_width (PDC pdc, const unsigned char* pText,
|
||||
int nCount, int* nChars, void* context)
|
||||
{
|
||||
SIZE size;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
WORDINFO word_info = {0};
|
||||
|
||||
*nChars = 0;
|
||||
@@ -725,7 +729,7 @@ static Glyph32*
|
||||
_gdi_get_glyphs_string_wordbreak(PDC pdc, const unsigned char* text,
|
||||
int text_len, int* nr_glyphs, void* context)
|
||||
{
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context;
|
||||
Glyph32 *logical_glyphs = NULL;
|
||||
|
||||
@@ -823,7 +827,7 @@ _gdi_output_glyphs_direct_sbc_rtol_break(PDC pdc, const unsigned char* text,
|
||||
int i = 0;
|
||||
unsigned int glyph_type;
|
||||
Glyph32 glyph_value;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
|
||||
if(ctxt->nFormat & DT_WORDBREAK){
|
||||
_gdi_get_glyphs_string_sbc_rtol_wordbreak(pdc,
|
||||
@@ -858,7 +862,7 @@ int _gdi_reorder_text_break (PDC pdc, const unsigned char* text,
|
||||
int text_len, BOOL direction, CB_ONE_GLYPH cb_one_glyph, void* context)
|
||||
{
|
||||
int i = 0;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
|
||||
if (mbc_devfont) {
|
||||
int nr_glyphs = text_len;
|
||||
@@ -1356,8 +1360,8 @@ void GUIAPI BIDIGetTextRangesLog2Vis(LOGFONT* log_font,
|
||||
|
||||
*nr_ranges = 0;
|
||||
/* it is not bidi string. */
|
||||
if (!log_font->mbc_devfont || (log_font->mbc_devfont &&
|
||||
!log_font->mbc_devfont->charset_ops->bidi_glyph_type)) {
|
||||
if (!log_font->devfonts[1] || (log_font->devfonts[1] &&
|
||||
!log_font->devfonts[1]->charset_ops->bidi_glyph_type)) {
|
||||
*ranges = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -1444,7 +1448,7 @@ int GUIAPI BIDIGetTextVisualGlyphs(LOGFONT* log_font,
|
||||
GLYPHMAPINFO** glyphs_map)
|
||||
{
|
||||
int nr_glyphs = 0;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (glyphs == NULL || glyphs_map == NULL)
|
||||
return nr_glyphs;
|
||||
@@ -1465,7 +1469,7 @@ int GUIAPI BIDIGetTextVisualGlyphs(LOGFONT* log_font,
|
||||
Glyph32* GUIAPI BIDILogGlyphs2VisGlyphs(LOGFONT* log_font,
|
||||
Glyph32* glyphs, int nr_glyphs, GLYPHMAPINFO* glyphs_map)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (nr_glyphs > 0 && mbc_devfont
|
||||
&& mbc_devfont->charset_ops->bidi_glyph_type) {
|
||||
@@ -1483,7 +1487,7 @@ BOOL GUIAPI BIDILogGlyphs2VisGlyphsEx(LOGFONT* log_font,
|
||||
Glyph32* glyphs, int nr_glyphs, int pel,
|
||||
void* extra, CB_REVERSE_EXTRA cb_reorder_extra)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (nr_glyphs > 0 && mbc_devfont
|
||||
&& mbc_devfont->charset_ops->bidi_glyph_type) {
|
||||
@@ -1501,7 +1505,7 @@ void GUIAPI BIDIGetLogicalEmbedLevelsEx(LOGFONT* log_font,
|
||||
Glyph32* glyphs, int nr_glyphs, int pel,
|
||||
Uint8** embedding_levels)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (*embedding_levels == NULL)
|
||||
*embedding_levels = malloc(nr_glyphs * sizeof (Uint8));
|
||||
@@ -1519,7 +1523,7 @@ void GUIAPI BIDIGetVisualEmbedLevelsEx(LOGFONT* log_font,
|
||||
Glyph32* glyphs, int nr_glyphs, int pel,
|
||||
Uint8** embedding_levels)
|
||||
{
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
|
||||
if (*embedding_levels == NULL)
|
||||
*embedding_levels = malloc(nr_glyphs * sizeof (Uint8));
|
||||
|
||||
@@ -64,7 +64,7 @@ extern int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
|
||||
static inline BOOL is_utf16_logfont (PDC pdc)
|
||||
{
|
||||
DEVFONT* mbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
|
||||
return TRUE;
|
||||
}
|
||||
@@ -135,8 +135,8 @@ static int txtGetWidthOfNextWord (PDC pdc, const unsigned char* pText,
|
||||
int nCount, int* nChars)
|
||||
{
|
||||
SIZE size;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
WORDINFO word_info = {0};
|
||||
|
||||
*nChars = 0;
|
||||
@@ -433,12 +433,12 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
|
||||
line_height = pdc->pLogFont->size + pdc->alExtra + pdc->blExtra;
|
||||
if (nFormat & DT_TABSTOP)
|
||||
nTabWidth = HIWORD (nFormat) *
|
||||
(*pdc->pLogFont->sbc_devfont->font_ops->get_ave_width)
|
||||
(pdc->pLogFont, pdc->pLogFont->sbc_devfont);
|
||||
(*pdc->pLogFont->devfonts[0]->font_ops->get_ave_width)
|
||||
(pdc->pLogFont, pdc->pLogFont->devfonts[0]);
|
||||
else {
|
||||
nTabWidth = pdc->tabstop *
|
||||
(*pdc->pLogFont->sbc_devfont->font_ops->get_ave_width)
|
||||
(pdc->pLogFont, pdc->pLogFont->sbc_devfont);
|
||||
(*pdc->pLogFont->devfonts[0]->font_ops->get_ave_width)
|
||||
(pdc->pLogFont, pdc->pLogFont->devfonts[0]);
|
||||
}
|
||||
|
||||
/* Transfer logical to device to screen here. */
|
||||
|
||||
@@ -157,6 +157,7 @@ typedef enum {
|
||||
} _WordType;
|
||||
|
||||
struct glyph_break_ctxt {
|
||||
LOGFONT* lf;
|
||||
DEVFONT* mbc_devfont;
|
||||
DEVFONT* sbc_devfont;
|
||||
Glyph32* gvs;
|
||||
@@ -317,7 +318,7 @@ static int get_next_glyph(struct glyph_break_ctxt* gbctxt,
|
||||
if (mclen > 0) {
|
||||
*gv = gbctxt->mbc_devfont->charset_ops->char_glyph_value
|
||||
(NULL, 0, (Uint8*)mstr, mclen);
|
||||
*gv = SET_MBC_GLYPH(*gv);
|
||||
*gv = _gdi_set_glyph_dfi(gbctxt->lf, *gv);
|
||||
|
||||
if (gbctxt->mbc_devfont->charset_ops->conv_to_uc32)
|
||||
*uc = gbctxt->mbc_devfont->charset_ops->conv_to_uc32(*gv);
|
||||
@@ -1484,7 +1485,7 @@ static int gbctxt_push_back(struct glyph_break_ctxt* gbctxt,
|
||||
//dbg_dump_gbctxt(gbctxt, "check_word_breaks", uc, gwsbo);
|
||||
|
||||
check_sentence_breaks(gbctxt, uc, gc, gbctxt->n);
|
||||
//dbg_dump_gbctxt(gbctxt, "check_sentence_breaks", uc, gwsbo);
|
||||
dbg_dump_gbctxt(gbctxt, "check_sentence_breaks", uc, gwsbo);
|
||||
|
||||
// Character Transformation
|
||||
// NOTE: Assume character transformation will not affect the breaks
|
||||
@@ -2202,8 +2203,9 @@ int GUIAPI GetGlyphsAndBreaks(LOGFONT* logfont, const char* mstr, int mstr_len,
|
||||
col_nl = TRUE;
|
||||
|
||||
memset(&gbctxt, 0, sizeof(gbctxt));
|
||||
gbctxt.mbc_devfont = logfont->mbc_devfont;
|
||||
gbctxt.sbc_devfont = logfont->sbc_devfont;
|
||||
gbctxt.lf = logfont;
|
||||
gbctxt.mbc_devfont = logfont->devfonts[1];
|
||||
gbctxt.sbc_devfont = logfont->devfonts[0];
|
||||
#if 0
|
||||
gbctxt.gvs = NULL;
|
||||
gbctxt.ucs = NULL;
|
||||
|
||||
+65
-22
@@ -73,19 +73,33 @@ Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar,
|
||||
int mchar_len, const char* pre_mchar, int pre_len)
|
||||
{
|
||||
int len_cur_char;
|
||||
|
||||
Glyph32 glyph_value = INV_GLYPH_VALUE;
|
||||
DEVFONT* sbc_devfont = logfont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = logfont->mbc_devfont;
|
||||
Glyph32 gv = INV_GLYPH_VALUE;
|
||||
DEVFONT* sbc_devfont = logfont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = logfont->devfonts[1];
|
||||
|
||||
if (mbc_devfont) {
|
||||
int i, dfi;
|
||||
DEVFONT* df;
|
||||
|
||||
len_cur_char = mbc_devfont->charset_ops->len_first_char
|
||||
((const unsigned char*)mchar, mchar_len);
|
||||
|
||||
if (len_cur_char > 0) {
|
||||
glyph_value = mbc_devfont->charset_ops->char_glyph_value
|
||||
gv = mbc_devfont->charset_ops->char_glyph_value
|
||||
((Uint8*)pre_mchar, pre_len, (Uint8*)mchar, mchar_len);
|
||||
return SET_MBC_GLYPH(glyph_value);
|
||||
|
||||
dfi = 1;
|
||||
for (i = 1; i < MAXNR_DEVFONTS; i++) {
|
||||
if ((df = logfont->devfonts[i])) {
|
||||
if (df->font_ops->is_glyph_existed(logfont, df, gv)) {
|
||||
dfi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return the first devfont as the default
|
||||
return SET_GLYPH_DFI(gv, dfi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +107,11 @@ Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar,
|
||||
((const unsigned char*)mchar, mchar_len);
|
||||
|
||||
if (len_cur_char > 0) {
|
||||
glyph_value = sbc_devfont->charset_ops->char_glyph_value
|
||||
gv = sbc_devfont->charset_ops->char_glyph_value
|
||||
(NULL, 0, (Uint8*)mchar, mchar_len);
|
||||
}
|
||||
|
||||
return glyph_value;
|
||||
return gv;
|
||||
}
|
||||
|
||||
Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
||||
@@ -106,14 +120,17 @@ Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
||||
int len_cur_char;
|
||||
|
||||
Glyph32 glyph_value = INV_GLYPH_VALUE;
|
||||
DEVFONT* sbc_devfont = logfont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = logfont->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = logfont->devfonts[0];
|
||||
DEVFONT* mbc_devfont = logfont->devfonts[1];
|
||||
|
||||
if (mbc_devfont) {
|
||||
len_cur_char = mbc_devfont->charset_ops->len_first_char (
|
||||
(const unsigned char*)mchar, mchar_len);
|
||||
|
||||
if (len_cur_char > 0) {
|
||||
int i, dfi;
|
||||
DEVFONT* df;
|
||||
|
||||
if (mbc_devfont->charset_ops->glyph_shape)
|
||||
glyph_value = mbc_devfont->charset_ops->glyph_shape(
|
||||
(const unsigned char*)mchar, mchar_len, shape_type);
|
||||
@@ -121,7 +138,17 @@ Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
||||
glyph_value = mbc_devfont->charset_ops->char_glyph_value
|
||||
(NULL, 0, (Uint8*)mchar, len_cur_char);
|
||||
|
||||
return SET_MBC_GLYPH(glyph_value);
|
||||
dfi = 1;
|
||||
for (i = 1; i < MAXNR_DEVFONTS; i++) {
|
||||
if ((df = logfont->devfonts[i])) {
|
||||
if (df->font_ops->is_glyph_existed(logfont, df, glyph_value)) {
|
||||
dfi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SET_GLYPH_DFI(glyph_value, dfi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2467,7 +2494,7 @@ static void make_back_area(PDC pdc, int x0, int y0, int x1, int y1,
|
||||
if (pdc->pLogFont->rotation)
|
||||
*flag = ROTATE_RECT;
|
||||
else if (pdc->pLogFont->style & FS_SLANT_ITALIC &&
|
||||
!(pdc->pLogFont->sbc_devfont->style & FS_SLANT_ITALIC))
|
||||
!(pdc->pLogFont->devfonts[0]->style & FS_SLANT_ITALIC))
|
||||
*flag = ITALIC_RECT;
|
||||
else
|
||||
*flag = ROMAN_RECT;
|
||||
@@ -2873,7 +2900,7 @@ end:
|
||||
int _gdi_get_italic_added_width (LOGFONT* logfont)
|
||||
{
|
||||
if (logfont->style & FS_SLANT_ITALIC
|
||||
&& !(logfont->sbc_devfont->style & FS_SLANT_ITALIC)) {
|
||||
&& !(logfont->devfonts[0]->style & FS_SLANT_ITALIC)) {
|
||||
return (logfont->size + 1) >> 1;
|
||||
}
|
||||
else {
|
||||
@@ -2883,17 +2910,33 @@ int _gdi_get_italic_added_width (LOGFONT* logfont)
|
||||
|
||||
void _gdi_start_new_line (PDC pdc)
|
||||
{
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
int i;
|
||||
DEVFONT* df;
|
||||
|
||||
if (mbc_devfont) {
|
||||
if (mbc_devfont->font_ops->start_str_output) {
|
||||
mbc_devfont->font_ops->start_str_output(pdc->pLogFont, mbc_devfont);
|
||||
for (i = 0; i < MAXNR_DEVFONTS; i++) {
|
||||
if ((df = pdc->pLogFont->devfonts[i])) {
|
||||
if (df->font_ops->start_str_output) {
|
||||
df->font_ops->start_str_output(pdc->pLogFont, df);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sbc_devfont->font_ops->start_str_output) {
|
||||
sbc_devfont->font_ops->start_str_output(pdc->pLogFont, sbc_devfont);
|
||||
}
|
||||
}
|
||||
|
||||
Glyph32 _gdi_set_glyph_dfi(LOGFONT* lf, Glyph32 gv)
|
||||
{
|
||||
int i, dfi = 1;
|
||||
DEVFONT* df;
|
||||
|
||||
for (i = 1; i < MAXNR_DEVFONTS; i++) {
|
||||
if ((df = lf->devfonts[i])) {
|
||||
if (df->font_ops->is_glyph_existed(lf, df, gv)) {
|
||||
dfi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return the first devfont as the default
|
||||
return SET_GLYPH_DFI(gv, dfi);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -64,7 +64,7 @@ extern int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
|
||||
static inline BOOL is_utf16_logfont (PDC pdc)
|
||||
{
|
||||
DEVFONT* mbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
|
||||
return TRUE;
|
||||
}
|
||||
@@ -332,8 +332,8 @@ int GUIAPI TabbedTextOutLen (HDC hdc, int x, int y,
|
||||
if (len < 0) len = __mg_strlen (pdc->pLogFont, spText);
|
||||
if (len == 0) return 0;
|
||||
|
||||
tab_width = pdc->pLogFont->sbc_devfont->font_ops->get_ave_width
|
||||
(pdc->pLogFont, pdc->pLogFont->sbc_devfont) * pdc->tabstop;
|
||||
tab_width = pdc->pLogFont->devfonts[0]->font_ops->get_ave_width
|
||||
(pdc->pLogFont, pdc->pLogFont->devfonts[0]) * pdc->tabstop;
|
||||
|
||||
/* override start point by current text position */
|
||||
if ((pdc->ta_flags & TA_CP_MASK) == TA_UPDATECP) {
|
||||
@@ -379,8 +379,8 @@ int GUIAPI GetTabbedTextExtent (HDC hdc, const char* spText, int len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
tab_width = pdc->pLogFont->sbc_devfont->font_ops->get_ave_width
|
||||
(pdc->pLogFont, pdc->pLogFont->sbc_devfont) * pdc->tabstop;
|
||||
tab_width = pdc->pLogFont->devfonts[0]->font_ops->get_ave_width
|
||||
(pdc->pLogFont, pdc->pLogFont->devfonts[0]) * pdc->tabstop;
|
||||
|
||||
advance = _gdi_tabbed_text_out (pdc, 0, 0, (const unsigned char*) spText,
|
||||
len, tab_width, TRUE, NULL, &size);
|
||||
@@ -400,8 +400,8 @@ int _gdi_tabbedex_text_out (PDC pdc, int x, int y,
|
||||
#if 0
|
||||
DEVFONT* sbc_devfont;
|
||||
DEVFONT* mbc_devfont;
|
||||
sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
sbc_devfont = pdc->pLogFont->devfonts[0];
|
||||
mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
#endif
|
||||
|
||||
ctxt.pdc = pdc;
|
||||
@@ -484,8 +484,8 @@ int GUIAPI TabbedTextOutEx (HDC hdc, int x, int y, const char* spText,
|
||||
if (nCount == 0) return 0;
|
||||
|
||||
if (nTabs == 0 || pTabPos == NULL) {
|
||||
int ave_width = (*pdc->pLogFont->sbc_devfont->font_ops->get_ave_width)
|
||||
(pdc->pLogFont, pdc->pLogFont->sbc_devfont);
|
||||
int ave_width = (*pdc->pLogFont->devfonts[0]->font_ops->get_ave_width)
|
||||
(pdc->pLogFont, pdc->pLogFont->devfonts[0]);
|
||||
def_tab = ave_width * pdc->tabstop;
|
||||
}
|
||||
else
|
||||
@@ -519,8 +519,8 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
|
||||
{
|
||||
PDC pdc = dc_HDC2PDC (hdc);
|
||||
LOGFONT* log_font = pdc->pLogFont;
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
DEVFONT* devfont;
|
||||
int left_bytes = len;
|
||||
int len_cur_char;
|
||||
|
||||
+14
-10
@@ -61,18 +61,22 @@ int GUIAPI GetFontHeight (HDC hdc)
|
||||
|
||||
int GUIAPI GetMaxFontWidth (HDC hdc)
|
||||
{
|
||||
int i;
|
||||
DEVFONT* df;
|
||||
PDC pdc = dc_HDC2PDC(hdc);
|
||||
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
int sbc_max_width = (*sbc_devfont->font_ops->get_max_width)
|
||||
(pdc->pLogFont, sbc_devfont);
|
||||
int mbc_max_width = 0;
|
||||
int max_width = 0;
|
||||
|
||||
if (mbc_devfont)
|
||||
mbc_max_width = (*mbc_devfont->font_ops->get_max_width)
|
||||
(pdc->pLogFont, mbc_devfont);
|
||||
|
||||
return (sbc_max_width > mbc_max_width) ? sbc_max_width : mbc_max_width;
|
||||
for (i = 0; i < MAXNR_DEVFONTS; i++) {
|
||||
int value;
|
||||
df = pdc->pLogFont->devfonts[i];
|
||||
if (df == NULL)
|
||||
break;
|
||||
|
||||
value = df->font_ops->get_max_width(pdc->pLogFont, df);
|
||||
max_width = MAX(max_width, value);
|
||||
}
|
||||
|
||||
return max_width;
|
||||
}
|
||||
|
||||
void GUIAPI GetLastTextOutPos (HDC hdc, POINT* pt)
|
||||
|
||||
@@ -64,7 +64,7 @@ extern int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
|
||||
static inline BOOL is_utf16_logfont (PDC pdc)
|
||||
{
|
||||
DEVFONT* mbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->mbc_devfont;
|
||||
mbc_devfont = pdc->pLogFont->devfonts[1];
|
||||
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
|
||||
return TRUE;
|
||||
}
|
||||
@@ -452,8 +452,8 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
|
||||
{
|
||||
PDC pdc = dc_HDC2PDC (hdc);
|
||||
LOGFONT* log_font = pdc->pLogFont;
|
||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
||||
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||
int len_cur_char, advance_cur_char;
|
||||
int left_bytes = len;
|
||||
int char_count = 0;
|
||||
|
||||
@@ -3850,7 +3850,7 @@ static int texteditor_get_text_count(mTextEditor* self, int start_with, BOOL bTe
|
||||
return len;
|
||||
}
|
||||
|
||||
if(plogfont->mbc_devfont == NULL)
|
||||
if(plogfont->devfonts[1] == NULL)
|
||||
return len;
|
||||
|
||||
while(idx < len)
|
||||
|
||||
Reference in New Issue
Block a user