mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-28 16:17:09 +08:00
Introduce the Mchar32 type, and distinguish glyph and character
This commit is contained in:
@@ -3216,7 +3216,7 @@ alExtra.(xwyan)
|
|||||||
* src/gui/lf_flat.c
|
* src/gui/lf_flat.c
|
||||||
* src/gui/lf_skin.c
|
* src/gui/lf_skin.c
|
||||||
|
|
||||||
08/24: ENHANCEMENT #1: Add a new method for FONTOPS: get_glyph_type to return
|
08/24: ENHANCEMENT #1: Add a new method for FONTOPS: get_char_type to return
|
||||||
the glyph type the devfont can give us.
|
the glyph type the devfont can give us.
|
||||||
* src/include/devfont.h
|
* src/include/devfont.h
|
||||||
* src/font/*.c
|
* src/font/*.c
|
||||||
|
|||||||
+5
-5
@@ -9709,18 +9709,18 @@ typedef enum {
|
|||||||
} GLYPHSHAPETYPE;
|
} GLYPHSHAPETYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar, \
|
* \fn Glyph32 GUIAPI GetShapedGlyph (LOGFONT* logfont, const char* mchar, \
|
||||||
* int mchar_len, GLYPHSHAPETYPE shape_type)
|
* int mchar_len, GLYPHSHAPETYPE shape_type)
|
||||||
* \brief Get the glyph shape of a character.
|
* \brief Get the glyph shape of a character.
|
||||||
*
|
*
|
||||||
* \param logfont The logical font.
|
* \param logfont The logical font.
|
||||||
* \param mchar The pointer to the multi-byte character.
|
* \param mchar The pointer to the multi-byte character.
|
||||||
* \param mchar_len The length of \a mchar in bytes.
|
* \param mchar_len The length of \a mchar in bytes.
|
||||||
* \param shape_type The shape type of \a mchar.
|
* \param shape_type The requested shape type.
|
||||||
*
|
*
|
||||||
* \return The multi-byte character's glyph shape value.
|
* \return The multi-byte character's glyph shape value.
|
||||||
*/
|
*/
|
||||||
MG_EXPORT Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
MG_EXPORT Glyph32 GUIAPI GetShapedGlyph (LOGFONT* logfont, const char* mchar,
|
||||||
int mchar_len, GLYPHSHAPETYPE shape_type);
|
int mchar_len, GLYPHSHAPETYPE shape_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9829,10 +9829,10 @@ typedef struct _GLYPHINFO {
|
|||||||
Uint32 mask;
|
Uint32 mask;
|
||||||
|
|
||||||
/** The glyph type */
|
/** The glyph type */
|
||||||
Uint32 glyph_type;
|
Uint32 char_type;
|
||||||
|
|
||||||
/** The BIDI glyph type */
|
/** The BIDI glyph type */
|
||||||
Uint32 bidi_glyph_type;
|
Uint32 bidi_char_type;
|
||||||
|
|
||||||
#if 0 // VincentWei: removed since 3.4.0
|
#if 0 // VincentWei: removed since 3.4.0
|
||||||
/** The height of the glyph */
|
/** The height of the glyph */
|
||||||
|
|||||||
+37
-37
@@ -174,19 +174,19 @@ static void update_glyph_info (HWND hWnd, PBIDISLEDITDATA sled)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GLYPH_TYPE_RTL 1
|
#define CHAR_TYPE_RTL 1
|
||||||
#define GLYPH_TYPE_LTR 0
|
#define CHAR_TYPE_LTR 0
|
||||||
#define GLYPH_TYPE_UNKKOWN -1
|
#define CHAR_TYPE_UNKKOWN -1
|
||||||
|
|
||||||
static int get_glyph_type (PBIDISLEDITDATA sled, int glyph_index)
|
static int get_char_type (PBIDISLEDITDATA sled, int glyph_index)
|
||||||
{
|
{
|
||||||
if (glyph_index < 0 || glyph_index >= GLYPHSLEN)
|
if (glyph_index < 0 || glyph_index >= GLYPHSLEN)
|
||||||
return GLYPH_TYPE_UNKKOWN;
|
return CHAR_TYPE_UNKKOWN;
|
||||||
|
|
||||||
if (GLYPHSMAP[glyph_index].is_rtol)
|
if (GLYPHSMAP[glyph_index].is_rtol)
|
||||||
return GLYPH_TYPE_RTL;
|
return CHAR_TYPE_RTL;
|
||||||
else
|
else
|
||||||
return GLYPH_TYPE_LTR;
|
return CHAR_TYPE_LTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1073,8 +1073,8 @@ static int inline get_glyph_bidi_type (LOGFONT* logfont, Glyph32 glyph)
|
|||||||
if (IS_MBC_GLYPH(glyph)) {
|
if (IS_MBC_GLYPH(glyph)) {
|
||||||
devfont = logfont->devfonts[1];
|
devfont = logfont->devfonts[1];
|
||||||
|
|
||||||
if (devfont->charset_ops->bidi_glyph_type) {
|
if (devfont->charset_ops->bidi_char_type) {
|
||||||
return devfont->charset_ops->bidi_glyph_type (glyph);
|
return devfont->charset_ops->bidi_char_type (glyph);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return BIDI_TYPE_LTR;
|
return BIDI_TYPE_LTR;
|
||||||
@@ -1085,8 +1085,8 @@ static int inline get_glyph_bidi_type (LOGFONT* logfont, Glyph32 glyph)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_glyph_type,
|
static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type,
|
||||||
int r_glyph_type, int line_type)
|
int r_char_type, int line_type)
|
||||||
{
|
{
|
||||||
int bidi_type;
|
int bidi_type;
|
||||||
Glyph32 glyph;
|
Glyph32 glyph;
|
||||||
@@ -1101,36 +1101,36 @@ static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_glyph_type,
|
|||||||
{
|
{
|
||||||
if (BIDI_IS_RTL(bidi_type))
|
if (BIDI_IS_RTL(bidi_type))
|
||||||
{
|
{
|
||||||
return GLYPH_TYPE_RTL;
|
return CHAR_TYPE_RTL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return GLYPH_TYPE_LTR;
|
return CHAR_TYPE_LTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BIDI_IS_NUMBER(bidi_type))
|
if (BIDI_IS_NUMBER(bidi_type))
|
||||||
{
|
{
|
||||||
return GLYPH_TYPE_LTR;
|
return CHAR_TYPE_LTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_glyph_type == r_glyph_type)
|
if (l_char_type == r_char_type)
|
||||||
{
|
{
|
||||||
return l_glyph_type;
|
return l_char_type;
|
||||||
}
|
}
|
||||||
/*no left glyph*/
|
/*no left glyph*/
|
||||||
else if (l_glyph_type == -1)
|
else if (l_char_type == -1)
|
||||||
{
|
{
|
||||||
if (BIDI_IS_WEAK (bidi_type))
|
if (BIDI_IS_WEAK (bidi_type))
|
||||||
return r_glyph_type;
|
return r_char_type;
|
||||||
else
|
else
|
||||||
return line_type;
|
return line_type;
|
||||||
}
|
}
|
||||||
/*no right glyph*/
|
/*no right glyph*/
|
||||||
else if (r_glyph_type == -1)
|
else if (r_char_type == -1)
|
||||||
{
|
{
|
||||||
if (BIDI_IS_WEAK (bidi_type))
|
if (BIDI_IS_WEAK (bidi_type))
|
||||||
return l_glyph_type;
|
return l_char_type;
|
||||||
else
|
else
|
||||||
return line_type;
|
return line_type;
|
||||||
}
|
}
|
||||||
@@ -1150,7 +1150,7 @@ static int get_line_rl_type (GLYPHMAPINFO* map, int len)
|
|||||||
return map->is_rtol;
|
return map->is_rtol;
|
||||||
map++;
|
map++;
|
||||||
}
|
}
|
||||||
return GLYPH_TYPE_UNKKOWN;
|
return CHAR_TYPE_UNKKOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INSERTPOS_BEFORE(sled, cur_glyph_index) \
|
#define INSERTPOS_BEFORE(sled, cur_glyph_index) \
|
||||||
@@ -1171,30 +1171,30 @@ get_insert_pos (PLOGFONT logfont, PBIDISLEDITDATA sled, char *newtext,
|
|||||||
int l_glyph_index = sled->editPos - 1;
|
int l_glyph_index = sled->editPos - 1;
|
||||||
int r_glyph_index = sled->editPos;
|
int r_glyph_index = sled->editPos;
|
||||||
|
|
||||||
int l_glyph_type = get_glyph_type (sled, l_glyph_index);
|
int l_char_type = get_char_type (sled, l_glyph_index);
|
||||||
int r_glyph_type = get_glyph_type (sled, r_glyph_index);
|
int r_char_type = get_char_type (sled, r_glyph_index);
|
||||||
|
|
||||||
int line_type = get_line_rl_type (GLYPHSMAP, GLYPHSLEN);
|
int line_type = get_line_rl_type (GLYPHSMAP, GLYPHSLEN);
|
||||||
|
|
||||||
*cur_type = get_text_rl_type (logfont, newtext, l_glyph_type,
|
*cur_type = get_text_rl_type (logfont, newtext, l_char_type,
|
||||||
r_glyph_type, line_type);
|
r_char_type, line_type);
|
||||||
|
|
||||||
if (*cur_type == GLYPH_TYPE_RTL) {
|
if (*cur_type == CHAR_TYPE_RTL) {
|
||||||
if (l_glyph_type == GLYPH_TYPE_RTL) {
|
if (l_char_type == CHAR_TYPE_RTL) {
|
||||||
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
||||||
}
|
}
|
||||||
else if (r_glyph_type == GLYPH_TYPE_RTL) {
|
else if (r_char_type == CHAR_TYPE_RTL) {
|
||||||
return INSERTPOS_AFTER (sled, r_glyph_index);
|
return INSERTPOS_AFTER (sled, r_glyph_index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*L|L, or L|0(must in a L line)*/
|
/*L|L, or L|0(must in a L line)*/
|
||||||
if (l_glyph_type == GLYPH_TYPE_LTR) {
|
if (l_char_type == CHAR_TYPE_LTR) {
|
||||||
return INSERTPOS_AFTER (sled, l_glyph_index);
|
return INSERTPOS_AFTER (sled, l_glyph_index);
|
||||||
}
|
}
|
||||||
/*0|L*/
|
/*0|L*/
|
||||||
else if (r_glyph_type == GLYPH_TYPE_LTR) {
|
else if (r_char_type == CHAR_TYPE_LTR) {
|
||||||
/*logical head in L line*/
|
/*logical head in L line*/
|
||||||
if (line_type == GLYPH_TYPE_LTR)
|
if (line_type == CHAR_TYPE_LTR)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1210,21 +1210,21 @@ get_insert_pos (PLOGFONT logfont, PBIDISLEDITDATA sled, char *newtext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (l_glyph_type == GLYPH_TYPE_LTR) {
|
if (l_char_type == CHAR_TYPE_LTR) {
|
||||||
return INSERTPOS_AFTER (sled, l_glyph_index);
|
return INSERTPOS_AFTER (sled, l_glyph_index);
|
||||||
}
|
}
|
||||||
else if (r_glyph_type == GLYPH_TYPE_LTR) {
|
else if (r_char_type == CHAR_TYPE_LTR) {
|
||||||
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*R|R or 0|R(must in R line)*/
|
/*R|R or 0|R(must in R line)*/
|
||||||
if (r_glyph_type == GLYPH_TYPE_RTL) {
|
if (r_char_type == CHAR_TYPE_RTL) {
|
||||||
return INSERTPOS_AFTER (sled, r_glyph_index);
|
return INSERTPOS_AFTER (sled, r_glyph_index);
|
||||||
}
|
}
|
||||||
/*R|0*/
|
/*R|0*/
|
||||||
else if (l_glyph_type == GLYPH_TYPE_RTL) {
|
else if (l_char_type == CHAR_TYPE_RTL) {
|
||||||
/*logical head in R line*/
|
/*logical head in R line*/
|
||||||
if (line_type == GLYPH_TYPE_RTL) {
|
if (line_type == CHAR_TYPE_RTL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*logical tail in L line*/
|
/*logical tail in L line*/
|
||||||
@@ -1324,7 +1324,7 @@ sleInsertText (HWND hWnd, PBIDISLEDITDATA sled, char *newtext,
|
|||||||
edtChangeCont (hWnd, sled);
|
edtChangeCont (hWnd, sled);
|
||||||
|
|
||||||
/* RTL */
|
/* RTL */
|
||||||
if (cur_type == GLYPH_TYPE_RTL) {
|
if (cur_type == CHAR_TYPE_RTL) {
|
||||||
sled->editPos = get_text_glyph_index (sled, insert_pos);
|
sled->editPos = get_text_glyph_index (sled, insert_pos);
|
||||||
}
|
}
|
||||||
else { /*LTR*/
|
else { /*LTR*/
|
||||||
|
|||||||
@@ -271,30 +271,30 @@ static void set_keyboard_layout(HWND hDlg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (cur_type == GLYPH_TYPE_RTL) {
|
if (cur_type == CHAR_TYPE_RTL) {
|
||||||
if (l_glyph_type == GLYPH_TYPE_RTL)
|
if (l_char_type == CHAR_TYPE_RTL)
|
||||||
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
||||||
else if (r_glyph_type == GLYPH_TYPE_RTL)
|
else if (r_char_type == CHAR_TYPE_RTL)
|
||||||
return INSERTPOS_AFTER (sled, r_glyph_index);
|
return INSERTPOS_AFTER (sled, r_glyph_index);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (l_glyph_type == GLYPH_TYPE_LTR)
|
if (l_char_type == CHAR_TYPE_LTR)
|
||||||
return INSERTPOS_AFTER (sled, l_glyph_index);
|
return INSERTPOS_AFTER (sled, l_glyph_index);
|
||||||
else if (l_glyph_type == GLYPH_TYPE_LTR)
|
else if (l_char_type == CHAR_TYPE_LTR)
|
||||||
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (l_glyph_type == GLYPH_TYPE_LTR)
|
if (l_char_type == CHAR_TYPE_LTR)
|
||||||
return INSERTPOS_AFTER (sled, l_glyph_index);
|
return INSERTPOS_AFTER (sled, l_glyph_index);
|
||||||
else if (r_glyph_type == GLYPH_TYPE_LTR)
|
else if (r_char_type == CHAR_TYPE_LTR)
|
||||||
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
||||||
else {
|
else {
|
||||||
if (l_glyph_type == GLYPH_TYPE_RTL)
|
if (l_char_type == CHAR_TYPE_RTL)
|
||||||
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
||||||
else if (l_glyph_type == GLYPH_TYPE_RTL)
|
else if (l_char_type == CHAR_TYPE_RTL)
|
||||||
return INSERTPOS_AFTER (sled, r_glyph_index);
|
return INSERTPOS_AFTER (sled, r_glyph_index);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
|
|||||||
goto error_create;
|
goto error_create;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = (charset_ops->char_glyph_value) (NULL, 0,
|
offset = (charset_ops->get_char_value) (NULL, 0,
|
||||||
(const unsigned char*) start_mchar, 0);
|
(const unsigned char*) start_mchar, 0);
|
||||||
|
|
||||||
bmpfont_info = build_bmpfont_info (bmpfont_name, glyph_bmp,
|
bmpfont_info = build_bmpfont_info (bmpfont_name, glyph_bmp,
|
||||||
@@ -550,7 +550,7 @@ BOOL AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Insert a node in the avl tree */
|
/* Insert a node in the avl tree */
|
||||||
offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0,
|
offset = (*dev_font->charset_ops->get_char_value) (NULL, 0,
|
||||||
(const unsigned char*)start_mchar, 0);
|
(const unsigned char*)start_mchar, 0);
|
||||||
|
|
||||||
if (look_up (root, offset) == NULL) {
|
if (look_up (root, offset) == NULL) {
|
||||||
@@ -644,7 +644,7 @@ static int avl_look_up (DEVFONT *dev_font, char *start_mchar, int n)
|
|||||||
GLYPHTREENODE *p;
|
GLYPHTREENODE *p;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0,
|
offset = (*dev_font->charset_ops->get_char_value) (NULL, 0,
|
||||||
(const unsigned char*)start_mchar, n);
|
(const unsigned char*)start_mchar, n);
|
||||||
offset += n;
|
offset += n;
|
||||||
|
|
||||||
|
|||||||
+59
-59
File diff suppressed because it is too large
Load Diff
@@ -231,7 +231,7 @@ static TYPERUN* get_runtype_link (const CHARSETOPS* charset_ops, Glyph32* glyphs
|
|||||||
last = list;
|
last = list;
|
||||||
|
|
||||||
for (i = 0; i < len; i++){
|
for (i = 0; i < len; i++){
|
||||||
if ((type = charset_ops->bidi_glyph_type (glyphs[i])) != last->type){
|
if ((type = charset_ops->bidi_char_type (glyphs[i])) != last->type){
|
||||||
link = calloc(1, sizeof(TYPERUN));
|
link = calloc(1, sizeof(TYPERUN));
|
||||||
link->type = type;
|
link->type = type;
|
||||||
link->pos = i;
|
link->pos = i;
|
||||||
@@ -487,7 +487,7 @@ bidi_resolveMirrorChar (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
|
|||||||
for (i = POS (pp); i < POS (pp) + LEN (pp); i++)
|
for (i = POS (pp); i < POS (pp) + LEN (pp); i++)
|
||||||
{
|
{
|
||||||
Glyph32 mirrored_ch;
|
Glyph32 mirrored_ch;
|
||||||
if (charset_ops->bidi_mirror_glyph && charset_ops->bidi_mirror_glyph (glyphs[i], &mirrored_ch))
|
if (charset_ops->bidi_mirror_char && charset_ops->bidi_mirror_char (glyphs[i], &mirrored_ch))
|
||||||
glyphs[i] = mirrored_ch;
|
glyphs[i] = mirrored_ch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -757,10 +757,10 @@ BOOL GetGlyphBIDIType (LOGFONT* log_font, Glyph32 glyph_value,
|
|||||||
DEVFONT* devfont = SELECT_DEVFONT(log_font, glyph_value);
|
DEVFONT* devfont = SELECT_DEVFONT(log_font, glyph_value);
|
||||||
|
|
||||||
if (devfont == NULL ||
|
if (devfont == NULL ||
|
||||||
devfont->charset_ops->bidi_glyph_type == NULL)
|
devfont->charset_ops->bidi_char_type == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*bidi_type = devfont->charset_ops->bidi_glyph_type (glyph_value);
|
*bidi_type = devfont->charset_ops->bidi_char_type (glyph_value);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+304
-338
File diff suppressed because it is too large
Load Diff
@@ -272,7 +272,7 @@ get_font_descent (LOGFONT* logfont, DEVFONT* devfont)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face,
|
load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face,
|
||||||
FT_ULong uni_char, int glyph_type)
|
FT_ULong uni_char, int char_type)
|
||||||
{
|
{
|
||||||
/* no need to lock/unlock in this function */
|
/* no need to lock/unlock in this function */
|
||||||
|
|
||||||
@@ -281,10 +281,10 @@ load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face,
|
|||||||
int ft_load_flags = FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
|
int ft_load_flags = FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
|
||||||
|
|
||||||
//setting load_flags
|
//setting load_flags
|
||||||
if (glyph_type == DEVFONTGLYPHTYPE_MONOBMP)
|
if (char_type == DEVFONTGLYPHTYPE_MONOBMP)
|
||||||
ft_load_flags |= FT_LOAD_TARGET_MONO;
|
ft_load_flags |= FT_LOAD_TARGET_MONO;
|
||||||
else {
|
else {
|
||||||
if (glyph_type == DEVFONTGLYPHTYPE_SUBPIXEL
|
if (char_type == DEVFONTGLYPHTYPE_SUBPIXEL
|
||||||
&& ft_inst_info->ft_lcdfilter != FT_LCD_FILTER_NONE)
|
&& ft_inst_info->ft_lcdfilter != FT_LCD_FILTER_NONE)
|
||||||
ft_load_flags |= FT_LOAD_TARGET_LCD;
|
ft_load_flags |= FT_LOAD_TARGET_LCD;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
|
|
||||||
glyph_value = REAL_GLYPH(glyph_value);
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (glyph_value >= RBFONT_INFO_P (devfont)->nr_glyphs)
|
if (glyph_value >= RBFONT_INFO_P (devfont)->nr_glyphs)
|
||||||
glyph_value = devfont->charset_ops->def_glyph_value;
|
glyph_value = devfont->charset_ops->def_char_value;
|
||||||
|
|
||||||
bitmap_size = ((RBFONT_INFO_P (devfont)->width + 7) >> 3)
|
bitmap_size = ((RBFONT_INFO_P (devfont)->width + 7) >> 3)
|
||||||
* RBFONT_INFO_P (devfont)->height;
|
* RBFONT_INFO_P (devfont)->height;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ static int test_correctness ()
|
|||||||
if (index < 0) /* not a letter.*/
|
if (index < 0) /* not a letter.*/
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
glyph_value = iso8859_6_char_glyph_value (NULL, 0, c, 1);
|
glyph_value = iso8859_6_get_char_value (NULL, 0, c, 1);
|
||||||
fprintf (stderr, "%x 's glyph value = %x\n", *c, glyph_value);
|
fprintf (stderr, "%x 's glyph value = %x\n", *c, glyph_value);
|
||||||
|
|
||||||
if (!iso8859_6_test_glyph_value (index, glyph_value)) {
|
if (!iso8859_6_test_glyph_value (index, glyph_value)) {
|
||||||
|
|||||||
+2
-2
@@ -256,7 +256,7 @@ int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
|||||||
return 0;
|
return 0;
|
||||||
else {
|
else {
|
||||||
if (dest) {
|
if (dest) {
|
||||||
glyph_value = devfont->charset_ops->char_glyph_value(NULL, 0, mchar, n);
|
glyph_value = devfont->charset_ops->get_char_value(NULL, 0, mchar, n);
|
||||||
if(devfont->charset_ops->conv_to_uc32)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
||||||
else
|
else
|
||||||
@@ -371,7 +371,7 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glyph_value = devfont->charset_ops->char_glyph_value (NULL, 0, mstr, left);
|
glyph_value = devfont->charset_ops->get_char_value (NULL, 0, mstr, left);
|
||||||
if (devfont->charset_ops->conv_to_uc32)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
typedef struct _bidichar_type_map
|
typedef struct _bidichar_type_map
|
||||||
{
|
{
|
||||||
Uint32 type; // Type of Unicode characters
|
Uint32 type; // Type of Unicode characters
|
||||||
Glyph32 glyph; // Starting index of Unicode character
|
Uchar32 chv; // Starting index of Unicode character
|
||||||
Uint8 count; // Total number of Unicode characters of same type starting from glyphn
|
Uint8 count; // Total number of Unicode characters of same type starting from glyphn
|
||||||
} BIDICHAR_TYPE_MAP;
|
} BIDICHAR_TYPE_MAP;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -62,8 +62,8 @@ extern "C" {
|
|||||||
typedef struct _TYPERUN TYPERUN;
|
typedef struct _TYPERUN TYPERUN;
|
||||||
|
|
||||||
typedef struct _BIDICHAR_MIRROR_MAP {
|
typedef struct _BIDICHAR_MIRROR_MAP {
|
||||||
Glyph32 glyph;
|
Mchar32 chv;
|
||||||
Glyph32 mirrored;
|
Mchar32 mirrored;
|
||||||
} BIDICHAR_MIRROR_MAP;
|
} BIDICHAR_MIRROR_MAP;
|
||||||
|
|
||||||
Glyph32* __mg_charset_bidi_glyphs_reorder (const CHARSETOPS* charset_ops,
|
Glyph32* __mg_charset_bidi_glyphs_reorder (const CHARSETOPS* charset_ops,
|
||||||
|
|||||||
+39
-29
@@ -133,6 +133,11 @@ static inline long get_opened_file_size (FILE* fp)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef unsigned int Mchar32;
|
||||||
|
#define IS_MBCHV(chv) ((chv) & 0x80000000)
|
||||||
|
#define SET_MBCHV(chv) ((chv) | 0x80000000)
|
||||||
|
#define REAL_CHV(chv) ((chv) & 0x7FFFFFFF)
|
||||||
|
|
||||||
/** The character set operation structure. */
|
/** The character set operation structure. */
|
||||||
struct _CHARSETOPS
|
struct _CHARSETOPS
|
||||||
{
|
{
|
||||||
@@ -146,34 +151,33 @@ struct _CHARSETOPS
|
|||||||
const char* name;
|
const char* name;
|
||||||
|
|
||||||
/** Default character. */
|
/** Default character. */
|
||||||
Glyph32 def_glyph_value;
|
Mchar32 def_char_value;
|
||||||
|
|
||||||
/** The method to get the length of the first character function. */
|
/** The method to get the length of the first character. */
|
||||||
int (*len_first_char) (const unsigned char* mstr, int mstrlen);
|
int (*len_first_char) (const unsigned char* mstr, int mstrlen);
|
||||||
|
|
||||||
/** The method to get character offset function. */
|
/** The method to get the character index. */
|
||||||
Glyph32 (*char_glyph_value) (const unsigned char* pre_mchar, int pre_len,
|
Mchar32 (*get_char_value) (const unsigned char* pre_mchar, int pre_len,
|
||||||
const unsigned char* cur_mchar, int cur_len);
|
const unsigned char* cur_mchar, int cur_len);
|
||||||
|
|
||||||
/** The method to get the require shape type glyph value. */
|
/** The method to get the require shape type of a mchar. */
|
||||||
Glyph32 (*glyph_shape) (const unsigned char* cur_mchar, int cur_len, int shape_type);
|
Mchar32 (*get_shaped_char_value) (const unsigned char* cur_mchar, int cur_len,
|
||||||
|
int shape_type);
|
||||||
|
|
||||||
/** The method to get the type of one glyph. */
|
/** The method to get the type of one character. */
|
||||||
unsigned int (*glyph_type) (Glyph32 glyph_value);
|
unsigned int (*char_type) (Mchar32 chv);
|
||||||
|
|
||||||
/** The method to get character number in the string function. */
|
/** The method to get character number in the string function. */
|
||||||
int (*nr_chars_in_str) (const unsigned char* mstr, int mstrlen);
|
int (*nr_chars_in_str) (const unsigned char* mstr, int mstrlen);
|
||||||
|
|
||||||
/** The method to judge the \a charset is belong to the character set
|
/** The method to judge a given charset name is belong to the character set */
|
||||||
* function.
|
|
||||||
*/
|
|
||||||
int (*is_this_charset) (const unsigned char* charset);
|
int (*is_this_charset) (const unsigned char* charset);
|
||||||
|
|
||||||
/** The method to get the length of the first substring. */
|
/** The method to get the length of the first substring. */
|
||||||
int (*len_first_substr) (const unsigned char* mstr, int mstrlen);
|
int (*len_first_substr) (const unsigned char* mstr, int mstrlen);
|
||||||
|
|
||||||
/** The method to get next word in the specitied length string function. */
|
/** The method to get next word in the specitied length string function. */
|
||||||
const unsigned char* (*get_next_word) (const unsigned char* mstr,
|
const unsigned char* (*get_next_word) (const unsigned char* mstr,
|
||||||
int strlen, WORDINFO* word_info);
|
int strlen, WORDINFO* word_info);
|
||||||
|
|
||||||
/** The method to get the position of the first character in the
|
/** The method to get the position of the first character in the
|
||||||
@@ -181,16 +185,15 @@ struct _CHARSETOPS
|
|||||||
*/
|
*/
|
||||||
int (*pos_first_char) (const unsigned char* mstr, int mstrlen);
|
int (*pos_first_char) (const unsigned char* mstr, int mstrlen);
|
||||||
|
|
||||||
/** The method to get the BIDI type of one glyph. */
|
/** The method to get the BIDI type of one character. */
|
||||||
unsigned int (*bidi_glyph_type) (Glyph32 glyph_value);
|
unsigned int (*bidi_char_type) (Mchar32 chv);
|
||||||
|
|
||||||
/** Get mirrored glyph
|
/** Get mirrored character */
|
||||||
*/
|
BOOL (*bidi_mirror_char) (Mchar32 chv, Mchar32* mirrored);
|
||||||
BOOL (*bidi_mirror_glyph) (Glyph32 glyph, Glyph32* mirrored);
|
|
||||||
|
|
||||||
#ifdef _MGCHARSET_UNICODE
|
#ifdef _MGCHARSET_UNICODE
|
||||||
/** The method to convert \a mchar to 32 bit UNICODE function. */
|
/** The method to convert a mchar32 value to 32 bit UNICODE function. */
|
||||||
Uchar32 (*conv_to_uc32) (Glyph32 glyph_value);
|
Uchar32 (*conv_to_uc32) (Mchar32 chv);
|
||||||
|
|
||||||
/** The method to convert \a wc to multily byte character function. */
|
/** The method to convert \a wc to multily byte character function. */
|
||||||
int (*conv_from_uc32) (Uchar32 wc, unsigned char* mchar);
|
int (*conv_from_uc32) (Uchar32 wc, unsigned char* mchar);
|
||||||
@@ -229,7 +232,7 @@ struct _FONTOPS
|
|||||||
int (*get_font_descent) (LOGFONT* logfont, DEVFONT* devfont);
|
int (*get_font_descent) (LOGFONT* logfont, DEVFONT* devfont);
|
||||||
|
|
||||||
/** The method to judge the glyph is exist function. */
|
/** The method to judge the glyph is exist function. */
|
||||||
BOOL (*is_glyph_existed) (LOGFONT* logfont, DEVFONT* devfont,
|
BOOL (*is_glyph_existed) (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
Glyph32 glyph_value);
|
Glyph32 glyph_value);
|
||||||
|
|
||||||
/** The method to get character advance function. */
|
/** The method to get character advance function. */
|
||||||
@@ -241,16 +244,16 @@ struct _FONTOPS
|
|||||||
Glyph32 galph_value, int* px, int* py, int* pwidth, int* pheight);
|
Glyph32 galph_value, int* px, int* py, int* pwidth, int* pheight);
|
||||||
|
|
||||||
/** The method to get mono-bitmap function. */
|
/** The method to get mono-bitmap function. */
|
||||||
const void* (*get_glyph_monobitmap) (LOGFONT* logfont, DEVFONT* devfont,
|
const void* (*get_glyph_monobitmap) (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale);
|
Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale);
|
||||||
|
|
||||||
/** The method to get grey bitmap, pitch and scale function */
|
/** The method to get grey bitmap, pitch and scale function */
|
||||||
const void* (*get_glyph_greybitmap) (LOGFONT* logfont, DEVFONT* devfont,
|
const void* (*get_glyph_greybitmap) (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
Glyph32 galph_value, SIZE* sz, int* pitch, unsigned short* scale);
|
Glyph32 galph_value, SIZE* sz, int* pitch, unsigned short* scale);
|
||||||
|
|
||||||
/** The method to get the pre-rendered bitmap of one glyph. */
|
/** The method to get the pre-rendered bitmap of one glyph. */
|
||||||
int (*get_glyph_prbitmap) (LOGFONT* logfont, DEVFONT* devfont,
|
int (*get_glyph_prbitmap) (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
Glyph32 glaph_value, BITMAP *bmp);
|
Glyph32 glyph_value, BITMAP *bmp);
|
||||||
|
|
||||||
/* The method to preproccess start string output fuction, call this
|
/* The method to preproccess start string output fuction, call this
|
||||||
* function before output a string, can be NULL.
|
* function before output a string, can be NULL.
|
||||||
@@ -258,7 +261,7 @@ struct _FONTOPS
|
|||||||
void (*start_str_output) (LOGFONT* logfont, DEVFONT* devfont);
|
void (*start_str_output) (LOGFONT* logfont, DEVFONT* devfont);
|
||||||
|
|
||||||
/** The method to instance new device font function, can be NULL. */
|
/** The method to instance new device font function, can be NULL. */
|
||||||
DEVFONT* (*new_instance) (LOGFONT* logfont, DEVFONT* devfont,
|
DEVFONT* (*new_instance) (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
BOOL need_sbc_font);
|
BOOL need_sbc_font);
|
||||||
|
|
||||||
/** The method to delete instance of device font function, can be NULL. */
|
/** The method to delete instance of device font function, can be NULL. */
|
||||||
@@ -267,13 +270,20 @@ struct _FONTOPS
|
|||||||
int (*is_rotatable) (LOGFONT* logfont, DEVFONT* devfont, int rot_desired);
|
int (*is_rotatable) (LOGFONT* logfont, DEVFONT* devfont, int rot_desired);
|
||||||
|
|
||||||
/** The method to load data of a devfont from font file
|
/** The method to load data of a devfont from font file
|
||||||
* FIXME real_fontname: return real name in file by a char point
|
* FIXME real_fontname: return real name in file by a char point
|
||||||
**/
|
*/
|
||||||
//void* (*load_font_data) (char* fontname, char* filename, char* real_fontname);
|
|
||||||
void* (*load_font_data) (DEVFONT* devfont, const char* fontname, const char* filename);
|
void* (*load_font_data) (DEVFONT* devfont, const char* fontname, const char* filename);
|
||||||
|
|
||||||
/** The method to unload data of a devfont*/
|
/** The method to unload data of a devfont*/
|
||||||
void (*unload_font_data) (DEVFONT* devfont, void* data);
|
void (*unload_font_data) (DEVFONT* devfont, void* data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The method to get the glyph value according to the character value.
|
||||||
|
* If it is NULL, the glyph value will be equal to the character value.
|
||||||
|
*
|
||||||
|
* Since 3.4.0.
|
||||||
|
*/
|
||||||
|
Glyph32 (*get_glyph_value) (LOGFONT* logfont, DEVFONT* devfont, Mchar32 chv);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
Glyph32 _gdi_select_glyph_dfi(LOGFONT* lf, Glyph32 gv);
|
Glyph32 _gdi_select_glyph_dfi(LOGFONT* lf, Glyph32 gv);
|
||||||
|
Glyph32 _gdi_get_glyph_value(LOGFONT* lf, Mchar32 chv);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+69
-69
File diff suppressed because it is too large
Load Diff
@@ -100,14 +100,14 @@ static inline BOOL is_utf16_logfont (PDC pdc)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
|
static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
|
||||||
unsigned int glyph_type)
|
unsigned int char_type)
|
||||||
{
|
{
|
||||||
DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context;
|
DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context;
|
||||||
int adv_x = 0, adv_y = 0;
|
int adv_x = 0, adv_y = 0;
|
||||||
BBOX bbox;
|
BBOX bbox;
|
||||||
int bkmode;
|
int bkmode;
|
||||||
|
|
||||||
switch (glyph_type & GLYPHTYPE_MCHAR_MASK) {
|
switch (char_type & GLYPHTYPE_MCHAR_MASK) {
|
||||||
case MCHAR_TYPE_ZEROWIDTH:
|
case MCHAR_TYPE_ZEROWIDTH:
|
||||||
case MCHAR_TYPE_CR:
|
case MCHAR_TYPE_CR:
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void _gdi_calc_glyphs_size_from_two_points (PDC pdc, int x0, int y0,
|
|||||||
int x1, int y1, SIZE* size);
|
int x1, int y1, SIZE* size);
|
||||||
|
|
||||||
typedef BOOL (*CB_ONE_GLYPH) (void* context, Glyph32 glyph_value,
|
typedef BOOL (*CB_ONE_GLYPH) (void* context, Glyph32 glyph_value,
|
||||||
unsigned int glyph_type);
|
unsigned int char_type);
|
||||||
|
|
||||||
int _gdi_output_visual_glyphs(PDC pdc, Glyph32* visual_glyphs, int nr_glyphs,
|
int _gdi_output_visual_glyphs(PDC pdc, Glyph32* visual_glyphs, int nr_glyphs,
|
||||||
BOOL direction, CB_ONE_GLYPH cb_one_glyph, void* context);
|
BOOL direction, CB_ONE_GLYPH cb_one_glyph, void* context);
|
||||||
|
|||||||
@@ -1785,7 +1785,7 @@ int _gdi_draw_one_glyph (PDC pdc, Glyph32 glyph_value, BOOL direction,
|
|||||||
logfont = pdc->pLogFont;
|
logfont = pdc->pLogFont;
|
||||||
devfont = SELECT_DEVFONT (logfont, glyph_value);
|
devfont = SELECT_DEVFONT (logfont, glyph_value);
|
||||||
|
|
||||||
glyph_bmptype = devfont->font_ops->get_glyph_type (logfont, devfont)
|
glyph_bmptype = devfont->font_ops->get_char_type (logfont, devfont)
|
||||||
& DEVFONTGLYPHTYPE_MASK_BMPTYPE;
|
& DEVFONTGLYPHTYPE_MASK_BMPTYPE;
|
||||||
|
|
||||||
// VincentWei: only use auto bold when the weight of devfont does not
|
// VincentWei: only use auto bold when the weight of devfont does not
|
||||||
|
|||||||
@@ -316,14 +316,16 @@ static int get_next_glyph(struct glyph_break_ctxt* gbctxt,
|
|||||||
((const unsigned char*)mstr, mstr_len);
|
((const unsigned char*)mstr, mstr_len);
|
||||||
|
|
||||||
if (mclen > 0) {
|
if (mclen > 0) {
|
||||||
*gv = gbctxt->mbc_devfont->charset_ops->char_glyph_value
|
Mchar32 chv = gbctxt->mbc_devfont->charset_ops->get_char_value
|
||||||
(NULL, 0, (Uint8*)mstr, mclen);
|
(NULL, 0, (Uint8*)mstr, mclen);
|
||||||
*gv = _gdi_select_glyph_dfi(gbctxt->lf, *gv);
|
|
||||||
|
|
||||||
if (gbctxt->mbc_devfont->charset_ops->conv_to_uc32)
|
if (gbctxt->mbc_devfont->charset_ops->conv_to_uc32)
|
||||||
*uc = gbctxt->mbc_devfont->charset_ops->conv_to_uc32(*gv);
|
*uc = gbctxt->mbc_devfont->charset_ops->conv_to_uc32(chv);
|
||||||
else
|
else
|
||||||
*uc = REAL_GLYPH(*gv);
|
*uc = chv;
|
||||||
|
|
||||||
|
chv = SET_MBCHV(chv);
|
||||||
|
*gv = _gdi_get_glyph_value(gbctxt->lf, chv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,12 +334,15 @@ static int get_next_glyph(struct glyph_break_ctxt* gbctxt,
|
|||||||
((const unsigned char*)mstr, mstr_len);
|
((const unsigned char*)mstr, mstr_len);
|
||||||
|
|
||||||
if (mclen > 0) {
|
if (mclen > 0) {
|
||||||
*gv = gbctxt->sbc_devfont->charset_ops->char_glyph_value
|
Mchar32 chv = gbctxt->sbc_devfont->charset_ops->get_char_value
|
||||||
(NULL, 0, (Uint8*)mstr, mclen);
|
(NULL, 0, (Uint8*)mstr, mclen);
|
||||||
|
|
||||||
if (gbctxt->sbc_devfont->charset_ops->conv_to_uc32)
|
if (gbctxt->sbc_devfont->charset_ops->conv_to_uc32)
|
||||||
*uc = gbctxt->sbc_devfont->charset_ops->conv_to_uc32(*gv);
|
*uc = gbctxt->sbc_devfont->charset_ops->conv_to_uc32(chv);
|
||||||
else
|
else
|
||||||
*uc = REAL_GLYPH(*gv);
|
*uc = chv;
|
||||||
|
|
||||||
|
*gv = _gdi_get_glyph_value(gbctxt->lf, chv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+52
-20
@@ -87,7 +87,7 @@ Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar,
|
|||||||
((const unsigned char*)mchar, mchar_len);
|
((const unsigned char*)mchar, mchar_len);
|
||||||
|
|
||||||
if (len_cur_char > 0) {
|
if (len_cur_char > 0) {
|
||||||
gv = mbc_devfont->charset_ops->char_glyph_value
|
gv = mbc_devfont->charset_ops->get_char_value
|
||||||
((Uint8*)pre_mchar, pre_len, (Uint8*)mchar, mchar_len);
|
((Uint8*)pre_mchar, pre_len, (Uint8*)mchar, mchar_len);
|
||||||
|
|
||||||
dfi = 1;
|
dfi = 1;
|
||||||
@@ -109,14 +109,14 @@ Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar,
|
|||||||
((const unsigned char*)mchar, mchar_len);
|
((const unsigned char*)mchar, mchar_len);
|
||||||
|
|
||||||
if (len_cur_char > 0) {
|
if (len_cur_char > 0) {
|
||||||
gv = sbc_devfont->charset_ops->char_glyph_value
|
gv = sbc_devfont->charset_ops->get_char_value
|
||||||
(NULL, 0, (Uint8*)mchar, mchar_len);
|
(NULL, 0, (Uint8*)mchar, mchar_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
return gv;
|
return gv;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
Glyph32 GUIAPI GetShapedGlyph (LOGFONT* logfont, const char* mchar,
|
||||||
int mchar_len, GLYPHSHAPETYPE shape_type)
|
int mchar_len, GLYPHSHAPETYPE shape_type)
|
||||||
{
|
{
|
||||||
int len_cur_char;
|
int len_cur_char;
|
||||||
@@ -133,11 +133,11 @@ Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
|||||||
int i, dfi;
|
int i, dfi;
|
||||||
DEVFONT* df;
|
DEVFONT* df;
|
||||||
|
|
||||||
if (mbc_devfont->charset_ops->glyph_shape)
|
if (mbc_devfont->charset_ops->get_shaped_char_value)
|
||||||
glyph_value = mbc_devfont->charset_ops->glyph_shape(
|
glyph_value = mbc_devfont->charset_ops->get_shaped_char_value(
|
||||||
(const unsigned char*)mchar, mchar_len, shape_type);
|
(const unsigned char*)mchar, mchar_len, shape_type);
|
||||||
else
|
else
|
||||||
glyph_value = mbc_devfont->charset_ops->char_glyph_value
|
glyph_value = mbc_devfont->charset_ops->get_char_value
|
||||||
(NULL, 0, (Uint8*)mchar, len_cur_char);
|
(NULL, 0, (Uint8*)mchar, len_cur_char);
|
||||||
|
|
||||||
dfi = 1;
|
dfi = 1;
|
||||||
@@ -158,11 +158,11 @@ Glyph32 GUIAPI GetGlyphShape (LOGFONT* logfont, const char* mchar,
|
|||||||
((const unsigned char*)mchar, mchar_len);
|
((const unsigned char*)mchar, mchar_len);
|
||||||
|
|
||||||
if (len_cur_char > 0) {
|
if (len_cur_char > 0) {
|
||||||
if (sbc_devfont->charset_ops->glyph_shape)
|
if (sbc_devfont->charset_ops->get_shaped_char_value)
|
||||||
glyph_value = sbc_devfont->charset_ops->glyph_shape(
|
glyph_value = sbc_devfont->charset_ops->get_shaped_char_value(
|
||||||
(const unsigned char*)mchar, mchar_len, shape_type);
|
(const unsigned char*)mchar, mchar_len, shape_type);
|
||||||
else
|
else
|
||||||
glyph_value = sbc_devfont->charset_ops->char_glyph_value
|
glyph_value = sbc_devfont->charset_ops->get_char_value
|
||||||
(NULL, 0, (Uint8*)mchar, len_cur_char);
|
(NULL, 0, (Uint8*)mchar, len_cur_char);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -176,8 +176,8 @@ BOOL GUIAPI GetMirrorGlyph (LOGFONT* logfont, Glyph32 gv,
|
|||||||
*mirrored = INV_GLYPH_VALUE;
|
*mirrored = INV_GLYPH_VALUE;
|
||||||
|
|
||||||
DEVFONT* devfont = SELECT_DEVFONT(logfont, gv);
|
DEVFONT* devfont = SELECT_DEVFONT(logfont, gv);
|
||||||
if (devfont->charset_ops->bidi_mirror_glyph) {
|
if (devfont->charset_ops->bidi_mirror_char) {
|
||||||
return devfont->charset_ops->bidi_mirror_glyph(gv, mirrored);
|
return devfont->charset_ops->bidi_mirror_char(gv, mirrored);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -187,7 +187,7 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
|
|||||||
int* adv_x, int* adv_y)
|
int* adv_x, int* adv_y)
|
||||||
{
|
{
|
||||||
int advance;
|
int advance;
|
||||||
int glyph_type;
|
int char_type;
|
||||||
|
|
||||||
PDC pdc = dc_HDC2PDC(hdc);
|
PDC pdc = dc_HDC2PDC(hdc);
|
||||||
DEVFONT* devfont = SELECT_DEVFONT(pdc->pLogFont, glyph_value);
|
DEVFONT* devfont = SELECT_DEVFONT(pdc->pLogFont, glyph_value);
|
||||||
@@ -196,8 +196,8 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
|
|||||||
coor_LP2SP (pdc, &x, &y);
|
coor_LP2SP (pdc, &x, &y);
|
||||||
pdc->rc_output = pdc->DevRC;
|
pdc->rc_output = pdc->DevRC;
|
||||||
|
|
||||||
glyph_type = devfont->charset_ops->glyph_type (glyph_value);
|
char_type = devfont->charset_ops->char_type (glyph_value);
|
||||||
if (check_zero_width(glyph_type)) {
|
if (check_zero_width(char_type)) {
|
||||||
if (adv_x) *adv_x = 0;
|
if (adv_x) *adv_x = 0;
|
||||||
if (adv_y) *adv_y = 0;
|
if (adv_y) *adv_y = 0;
|
||||||
advance = 0;
|
advance = 0;
|
||||||
@@ -223,7 +223,7 @@ unsigned int GUIAPI GetGlyphType (LOGFONT* logfont, Glyph32 glyph_value)
|
|||||||
/* get the relative device font */
|
/* get the relative device font */
|
||||||
DEVFONT* devfont = SELECT_DEVFONT(logfont, glyph_value);
|
DEVFONT* devfont = SELECT_DEVFONT(logfont, glyph_value);
|
||||||
glyph_value = REAL_GLYPH (glyph_value);
|
glyph_value = REAL_GLYPH (glyph_value);
|
||||||
return devfont->charset_ops->glyph_type (glyph_value);
|
return devfont->charset_ops->char_type (glyph_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value,
|
int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value,
|
||||||
@@ -236,16 +236,16 @@ int GUIAPI GetGlyphInfo (LOGFONT* logfont, Glyph32 glyph_value,
|
|||||||
|
|
||||||
/* get glyph type */
|
/* get glyph type */
|
||||||
if (glyph_info->mask & GLYPH_INFO_TYPE)
|
if (glyph_info->mask & GLYPH_INFO_TYPE)
|
||||||
glyph_info->glyph_type = devfont->charset_ops->glyph_type (glyph_value);
|
glyph_info->char_type = devfont->charset_ops->char_type (glyph_value);
|
||||||
|
|
||||||
/* get glyph type */
|
/* get glyph type */
|
||||||
if (glyph_info->mask & GLYPH_INFO_BIDI_TYPE) {
|
if (glyph_info->mask & GLYPH_INFO_BIDI_TYPE) {
|
||||||
if (devfont->charset_ops->bidi_glyph_type) {
|
if (devfont->charset_ops->bidi_char_type) {
|
||||||
glyph_info->bidi_glyph_type
|
glyph_info->bidi_char_type
|
||||||
= devfont->charset_ops->bidi_glyph_type (glyph_value);
|
= devfont->charset_ops->bidi_char_type (glyph_value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
glyph_info->bidi_glyph_type = BIDI_TYPE_INVALID;
|
glyph_info->bidi_char_type = BIDI_TYPE_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2962,3 +2962,35 @@ Glyph32 _gdi_select_glyph_dfi(LOGFONT* lf, Glyph32 gv)
|
|||||||
return SET_GLYPH_DFI(gv, dfi);
|
return SET_GLYPH_DFI(gv, dfi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Glyph32 _gdi_get_glyph_value(LOGFONT* lf, Mchar32 chv)
|
||||||
|
{
|
||||||
|
Glyph32 gv = INV_GLYPH_VALUE;
|
||||||
|
int i, dfi = 0;
|
||||||
|
DEVFONT* df;
|
||||||
|
|
||||||
|
if (IS_MBCHV(chv)) {
|
||||||
|
for (i = 1; i < MAXNR_DEVFONTS; i++) {
|
||||||
|
if ((df = lf->devfonts[i])) {
|
||||||
|
if (df->font_ops->get_glyph_value)
|
||||||
|
gv = df->font_ops->get_glyph_value(lf, df, chv);
|
||||||
|
else
|
||||||
|
gv = REAL_CHV(chv);
|
||||||
|
|
||||||
|
if (df->font_ops->is_glyph_existed(lf, df, gv)) {
|
||||||
|
dfi = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dfi == 0) {
|
||||||
|
if (REAL_CHV(chv) < 0x80)
|
||||||
|
dfi = 0;
|
||||||
|
else
|
||||||
|
dfi = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SET_GLYPH_DFI(gv, dfi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,14 +116,14 @@ typedef struct _TABBEDTEXTOUT_CTXT
|
|||||||
} TABBEDTEXTOUT_CTXT;
|
} TABBEDTEXTOUT_CTXT;
|
||||||
|
|
||||||
static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
|
static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
|
||||||
unsigned int glyph_type)
|
unsigned int char_type)
|
||||||
{
|
{
|
||||||
TABBEDTEXTOUT_CTXT* ctxt = (TABBEDTEXTOUT_CTXT*)context;
|
TABBEDTEXTOUT_CTXT* ctxt = (TABBEDTEXTOUT_CTXT*)context;
|
||||||
int adv_x, adv_y;
|
int adv_x, adv_y;
|
||||||
BBOX bbox;
|
BBOX bbox;
|
||||||
int bkmode = ctxt->pdc->bkmode;
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
|
||||||
switch (glyph_type & GLYPHTYPE_MCHAR_MASK) {
|
switch (char_type & GLYPHTYPE_MCHAR_MASK) {
|
||||||
case MCHAR_TYPE_ZEROWIDTH:
|
case MCHAR_TYPE_ZEROWIDTH:
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
break;
|
break;
|
||||||
@@ -196,13 +196,13 @@ typedef struct _TABBEDTEXTOUTEX_CTXT
|
|||||||
} TABBEDTEXTOUTEX_CTXT;
|
} TABBEDTEXTOUTEX_CTXT;
|
||||||
|
|
||||||
static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
||||||
unsigned int glyph_type)
|
unsigned int char_type)
|
||||||
{
|
{
|
||||||
TABBEDTEXTOUTEX_CTXT* ctxt = (TABBEDTEXTOUTEX_CTXT*)context;
|
TABBEDTEXTOUTEX_CTXT* ctxt = (TABBEDTEXTOUTEX_CTXT*)context;
|
||||||
int adv_x, adv_y;
|
int adv_x, adv_y;
|
||||||
int tab_pos = ctxt->nTabOrig;
|
int tab_pos = ctxt->nTabOrig;
|
||||||
|
|
||||||
switch (glyph_type & GLYPHTYPE_MCHAR_MASK) {
|
switch (char_type & GLYPHTYPE_MCHAR_MASK) {
|
||||||
case MCHAR_TYPE_ZEROWIDTH:
|
case MCHAR_TYPE_ZEROWIDTH:
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
break;
|
break;
|
||||||
@@ -533,7 +533,7 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
|
|||||||
size->cx = size->cy = 0;
|
size->cx = size->cy = 0;
|
||||||
|
|
||||||
/* This function does not support BIDI */
|
/* This function does not support BIDI */
|
||||||
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_glyph_type)
|
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_char_type)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
_gdi_start_new_line (pdc);
|
_gdi_start_new_line (pdc);
|
||||||
@@ -566,11 +566,11 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (devfont) {
|
if (devfont) {
|
||||||
int glyph_type;
|
int char_type;
|
||||||
|
|
||||||
glyph_value = devfont->charset_ops->char_glyph_value
|
glyph_value = devfont->charset_ops->get_char_value
|
||||||
(NULL, 0, (const unsigned char*)text, len_cur_char);
|
(NULL, 0, (const unsigned char*)text, len_cur_char);
|
||||||
glyph_type = devfont->charset_ops->glyph_type (glyph_value);
|
char_type = devfont->charset_ops->char_type (glyph_value);
|
||||||
|
|
||||||
if (devfont == mbc_devfont) {
|
if (devfont == mbc_devfont) {
|
||||||
int i, dfi;
|
int i, dfi;
|
||||||
@@ -589,7 +589,7 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
|
|||||||
glyph_value = SET_GLYPH_DFI(glyph_value, dfi);
|
glyph_value = SET_GLYPH_DFI(glyph_value, dfi);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (glyph_type & GLYPHTYPE_MCHAR_MASK) {
|
switch (char_type & GLYPHTYPE_MCHAR_MASK) {
|
||||||
case MCHAR_TYPE_ZEROWIDTH:
|
case MCHAR_TYPE_ZEROWIDTH:
|
||||||
case MCHAR_TYPE_VOWEL:
|
case MCHAR_TYPE_VOWEL:
|
||||||
break;
|
break;
|
||||||
|
|||||||
+12
-12
@@ -106,16 +106,16 @@ typedef struct _DRAW_GLYPHS_CTXT {
|
|||||||
int advance;
|
int advance;
|
||||||
} DRAW_GLYPHS_CTXT;
|
} DRAW_GLYPHS_CTXT;
|
||||||
|
|
||||||
static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int glyph_type)
|
static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char_type)
|
||||||
{
|
{
|
||||||
DRAW_GLYPHS_CTXT* ctxt = (DRAW_GLYPHS_CTXT*)context;
|
DRAW_GLYPHS_CTXT* ctxt = (DRAW_GLYPHS_CTXT*)context;
|
||||||
int adv_x, adv_y;
|
int adv_x, adv_y;
|
||||||
int bkmode;
|
int bkmode;
|
||||||
|
|
||||||
if (check_zero_width(glyph_type)) {
|
if (check_zero_width(char_type)) {
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
}
|
}
|
||||||
else if (check_vowel(glyph_type)) {
|
else if (check_vowel(char_type)) {
|
||||||
bkmode = GetBkMode (ctxt->hdc);
|
bkmode = GetBkMode (ctxt->hdc);
|
||||||
//SetBkMode (ctxt->hdc, BM_TRANSPARENT);
|
//SetBkMode (ctxt->hdc, BM_TRANSPARENT);
|
||||||
DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value, &adv_x, &adv_y);
|
DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value, &adv_x, &adv_y);
|
||||||
@@ -163,16 +163,16 @@ typedef struct _TEXTOUT_CTXT
|
|||||||
} TEXTOUT_CTXT;
|
} TEXTOUT_CTXT;
|
||||||
|
|
||||||
static BOOL cb_textout (void* context, Glyph32 glyph_value,
|
static BOOL cb_textout (void* context, Glyph32 glyph_value,
|
||||||
unsigned int glyph_type)
|
unsigned int char_type)
|
||||||
{
|
{
|
||||||
TEXTOUT_CTXT* ctxt = (TEXTOUT_CTXT*)context;
|
TEXTOUT_CTXT* ctxt = (TEXTOUT_CTXT*)context;
|
||||||
int adv_x, adv_y;
|
int adv_x, adv_y;
|
||||||
int bkmode;
|
int bkmode;
|
||||||
|
|
||||||
if (check_zero_width (glyph_type)) {
|
if (check_zero_width (char_type)) {
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
}
|
}
|
||||||
else if (check_vowel(glyph_type)) {
|
else if (check_vowel(char_type)) {
|
||||||
if (!ctxt->only_extent) {
|
if (!ctxt->only_extent) {
|
||||||
bkmode = ctxt->pdc->bkmode;
|
bkmode = ctxt->pdc->bkmode;
|
||||||
//ctxt->pdc->bkmode = BM_TRANSPARENT;
|
//ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||||
@@ -326,7 +326,7 @@ typedef struct _TEXTOUTOMITTED_CTXT
|
|||||||
Uint32 max_extent;
|
Uint32 max_extent;
|
||||||
} TEXTOUTOMITTED_CTXT;
|
} TEXTOUTOMITTED_CTXT;
|
||||||
|
|
||||||
static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int glyph_type)
|
static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int char_type)
|
||||||
{
|
{
|
||||||
TEXTOUTOMITTED_CTXT* ctxt = (TEXTOUTOMITTED_CTXT*)context;
|
TEXTOUTOMITTED_CTXT* ctxt = (TEXTOUTOMITTED_CTXT*)context;
|
||||||
int adv_x, adv_y;
|
int adv_x, adv_y;
|
||||||
@@ -334,10 +334,10 @@ static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int
|
|||||||
//BBOX bbox;
|
//BBOX bbox;
|
||||||
int bkmode = ctxt->pdc->bkmode;
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
|
||||||
if (check_zero_width(glyph_type)) {
|
if (check_zero_width(char_type)) {
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
}
|
}
|
||||||
else if (check_vowel(glyph_type)) {
|
else if (check_vowel(char_type)) {
|
||||||
//ctxt->pdc->bkmode = BM_TRANSPARENT;
|
//ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
@@ -463,7 +463,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
|
|||||||
size->cx = size->cy = 0;
|
size->cx = size->cy = 0;
|
||||||
|
|
||||||
/* This function does not support BIDI */
|
/* This function does not support BIDI */
|
||||||
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_glyph_type)
|
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_char_type)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
_gdi_start_new_line(pdc);
|
_gdi_start_new_line(pdc);
|
||||||
@@ -482,7 +482,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
|
|||||||
int i, dfi;
|
int i, dfi;
|
||||||
DEVFONT* df;
|
DEVFONT* df;
|
||||||
|
|
||||||
glyph_value = (*mbc_devfont->charset_ops->char_glyph_value)(NULL,
|
glyph_value = (*mbc_devfont->charset_ops->get_char_value)(NULL,
|
||||||
0, (const unsigned char*)text, 0);
|
0, (const unsigned char*)text, 0);
|
||||||
|
|
||||||
dfi = 1;
|
dfi = 1;
|
||||||
@@ -505,7 +505,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
|
|||||||
if ((len_cur_char = sbc_devfont->charset_ops->len_first_char
|
if ((len_cur_char = sbc_devfont->charset_ops->len_first_char
|
||||||
((const unsigned char*)text, left_bytes)) > 0) {
|
((const unsigned char*)text, left_bytes)) > 0) {
|
||||||
|
|
||||||
glyph_value = (*sbc_devfont->charset_ops->char_glyph_value)(
|
glyph_value = (*sbc_devfont->charset_ops->get_char_value)(
|
||||||
NULL, 0, (const unsigned char*)text, 0);
|
NULL, 0, (const unsigned char*)text, 0);
|
||||||
advance_cur_char = _gdi_get_glyph_advance (pdc, glyph_value,
|
advance_cur_char = _gdi_get_glyph_advance (pdc, glyph_value,
|
||||||
(pdc->ta_flags & TA_X_MASK) == TA_LEFT,
|
(pdc->ta_flags & TA_X_MASK) == TA_LEFT,
|
||||||
|
|||||||
Reference in New Issue
Block a user