mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-06 18:31:57 +08:00
Merge remote-tracking branch 'origin/rel-5-0' into drm-dma
This commit is contained in:
@@ -565,7 +565,7 @@ A brief history description of the development progress is listed as follow:
|
||||
1. May., 2021: FMSoft released MiniGUI version 5.0.6.
|
||||
1. Jan., 2022: FMSoft released MiniGUI version 5.0.9.
|
||||
1. Sep., 2022: FMSoft released MiniGUI version 5.0.10.
|
||||
1. Aug., 2023: FMSoft released MiniGUI version 5.0.14.
|
||||
1. Aug., 2023: FMSoft released MiniGUI version 5.0.13.
|
||||
|
||||
## AUTHORS AND COPYING
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
## Version 5.0.13
|
||||
|
||||
On July 31, 2023, FMSoft announces the availability of MiniGUI 5.0.13,
|
||||
On Aug. 31, 2023, FMSoft announces the availability of MiniGUI 5.0.13,
|
||||
which is an enhancement release with some minor enhancements
|
||||
of MiniGUI 5.0.x.
|
||||
|
||||
@@ -48,6 +48,7 @@ In this version, we made some enhancements:
|
||||
- Add `BIDI_FLAG_NONE` and `BIDI_FLAG_LEGACY`.
|
||||
* BUGFIXING:
|
||||
- Ignore C0CTRL characters when renerding text.
|
||||
- Support for vowels.
|
||||
|
||||
## Version 5.0.12
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Version 5.0.14 (2023/07/31)
|
||||
Version 5.0.13 (2023/08/31)
|
||||
|
||||
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
|
||||
|
||||
|
||||
@@ -13004,7 +13004,7 @@ MG_EXPORT Glyph32 GUIAPI GetGlyphValueAlt(LOGFONT* logfont, Achar32 chv);
|
||||
* int* adv_x, int* adv_y)
|
||||
* \brief Draw a glyph.
|
||||
*
|
||||
* This function draws a glyph to the specific postion of a DC.
|
||||
* This function draws a glyph to the specific position of a DC.
|
||||
*
|
||||
* \param hdc The device context.
|
||||
* \param x The output start x position.
|
||||
@@ -13020,6 +13020,27 @@ MG_EXPORT Glyph32 GUIAPI GetGlyphValueAlt(LOGFONT* logfont, Achar32 chv);
|
||||
MG_EXPORT int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
|
||||
int* adv_x, int* adv_y);
|
||||
|
||||
/**
|
||||
* \fn int GUIAPI DrawVowel (HDC hdc, int x, int y, Glyph32 glyph_value, \
|
||||
* int last_adv)
|
||||
* \brief Draw a glyph as vowel.
|
||||
*
|
||||
* This function draws a glyph as a vowel of the last glyph to
|
||||
* the specific position of a DC.
|
||||
*
|
||||
* \param hdc The device context.
|
||||
* \param x The output start x position.
|
||||
* \param y The output start y position.
|
||||
* \param glyph_value The glyph value.
|
||||
* \param last_adv The advance on the baseline of the last glyph.
|
||||
*
|
||||
* \return The advance on baseline of the vowel.
|
||||
*
|
||||
* Since 5.0.13
|
||||
*/
|
||||
MG_EXPORT int GUIAPI DrawVowel (HDC hdc, int x, int y, Glyph32 glyph_value,
|
||||
int last_adv);
|
||||
|
||||
/*
|
||||
* \fn int GUIAPI DrawGlyphString (HDC hdc, Glyph32* glyphs, int nr_glyphs,
|
||||
* const POINT* pts);
|
||||
|
||||
@@ -202,6 +202,17 @@ static void destroy (GLYPHTREENODE *root)
|
||||
|
||||
/*** device font ops ***/
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_PRERDRBMP;
|
||||
@@ -380,6 +391,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_bitmap_font_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -255,6 +255,17 @@ compute_kernval (TTFINSTANCEINFO* ttf_inst_info)
|
||||
return kernval;
|
||||
}
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
if (logfont->style & FS_WEIGHT_BOOK)
|
||||
@@ -792,6 +803,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
}
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_ttf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -197,6 +197,17 @@ print_bitmap_grey (const BYTE* buffer, int width, int rows, int pitch)
|
||||
printf("*******************************************\n");
|
||||
}
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
switch (logfont->style & FS_RENDER_MASK) {
|
||||
@@ -1265,6 +1276,7 @@ void font_TermFreetypeLibrary (void)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_ttf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -66,6 +66,17 @@
|
||||
#define NUF_WIDTH 8
|
||||
#define NUF_HEIGHT 1
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
@@ -171,6 +182,7 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
}
|
||||
|
||||
FONTOPS __mg_null_font_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -287,6 +287,17 @@ static unsigned char def_smooth_bitmap [] =
|
||||
static QPF_GLYPH def_glyph = {&def_metrics, def_bitmap};
|
||||
static QPF_GLYPH def_smooth_glyph = {&def_smooth_metrics, def_smooth_bitmap};
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH)
|
||||
@@ -541,6 +552,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_qpf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -151,6 +151,17 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
|
||||
/*************** Raw bitmap font operations *********************************/
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
@@ -280,6 +291,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_rbf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_ave_width, // max_width same as ave_width
|
||||
|
||||
@@ -377,6 +377,17 @@ static int get_max_width (LOGFONT* logfont, DEVFONT* devfont)
|
||||
return logfont->size;
|
||||
}
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
if (logfont->style & FS_WEIGHT_BOOK)
|
||||
@@ -598,6 +609,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
static FONTOPS scripteasy_font_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -148,6 +148,17 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
free (((UPFINFO*) data));
|
||||
}
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
Uint8* p_upf = (Uint8 *)UPFONT_INFO_P (devfont)->root_dir;
|
||||
@@ -525,6 +536,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
}
|
||||
|
||||
FONTOPS __mg_upf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -109,6 +109,17 @@ typedef struct _FONT_PROPT {
|
||||
int def_glyph;
|
||||
} FONT_PROPT;
|
||||
|
||||
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case DEVFONT_FEATURE_MARK_BBOX:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
@@ -477,6 +488,7 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
}
|
||||
|
||||
FONTOPS __mg_vbf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -209,7 +209,7 @@ struct _CHARSETOPS
|
||||
/** Default character. */
|
||||
Achar32 def_char_value;
|
||||
|
||||
/** Whether use legacy BIDI algorithm (Since 5.0.13). */
|
||||
/** Whether using legacy BIDI algorithm (Since 5.0.13). */
|
||||
unsigned legacy_bidi:1;
|
||||
|
||||
/** The method to get the length of the first character. */
|
||||
@@ -266,9 +266,17 @@ struct _CHARSETOPS
|
||||
|
||||
#define DEVFONTGLYPHTYPE_MASK_BMPTYPE 0x0F
|
||||
|
||||
enum devfont_feature {
|
||||
DEVFONT_FEATURE_MARK_BBOX = 0,
|
||||
};
|
||||
|
||||
/** The font operation structure. */
|
||||
struct _FONTOPS
|
||||
{
|
||||
/** The method to get the feature value of the font (Since 5.0.13). */
|
||||
DWORD (*get_feature) (LOGFONT* logfont, DEVFONT* devfont,
|
||||
enum devfont_feature feature);
|
||||
|
||||
/** The method to get the glyph bitmap type . */
|
||||
DWORD (*get_glyph_bmptype) (LOGFONT* logfont, DEVFONT* devfont);
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
|
||||
#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#elif defined(__DARWIN__)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#else
|
||||
/* according to X/OPEN we have to define it ourselves */
|
||||
union semun {
|
||||
|
||||
@@ -146,18 +146,19 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
|
||||
|
||||
case ACHAR_BASIC_VOWEL:
|
||||
if (!ctxt->only_extent) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||
#if 0
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
#else
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, &adv_x, &adv_y);
|
||||
#endif
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
if (_gdi_if_mark_bbox_is_ok(ctxt->pdc, glyph_value)) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
}
|
||||
else {
|
||||
_gdi_draw_one_vowel (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, ctxt->last_adv);
|
||||
}
|
||||
adv_x = adv_y = 0;
|
||||
}
|
||||
break;
|
||||
@@ -182,6 +183,7 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
|
||||
|
||||
ctxt->last_x = ctxt->x;
|
||||
ctxt->last_y = ctxt->y;
|
||||
ctxt->last_adv = adv_x;
|
||||
ctxt->x += adv_x;
|
||||
ctxt->y += adv_y;
|
||||
|
||||
@@ -200,6 +202,7 @@ int _gdi_get_drawtext_extent (PDC pdc, const unsigned char* text, int len,
|
||||
ctxt.last_x = 0;
|
||||
ctxt.last_y = 0;
|
||||
ctxt.advance = 0;
|
||||
ctxt.last_adv = 0;
|
||||
ctxt.only_extent = TRUE;
|
||||
ctxt.nFormat = _tmp->nFormat;
|
||||
ctxt.tab_width = _tmp->tab_width;
|
||||
@@ -318,6 +321,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
|
||||
ctxt.y = y;
|
||||
ctxt.last_x = x;
|
||||
ctxt.last_y = y;
|
||||
ctxt.last_adv = 0;
|
||||
|
||||
while (nCount > 0) {
|
||||
int line_x, maxwidth;
|
||||
|
||||
@@ -82,6 +82,11 @@ static inline int _gdi_get_glyph_advance (PDC pdc, Glyph32 glyph_value,
|
||||
direction, pdc->cExtra, x, y, adv_x, adv_y, bbox);
|
||||
}
|
||||
|
||||
BOOL _gdi_if_mark_bbox_is_ok(PDC pdc, Glyph32 gv);
|
||||
|
||||
int _gdi_draw_one_vowel (PDC pdc, Glyph32 glyph_value, BOOL direction,
|
||||
int x, int y, int last_adv);
|
||||
|
||||
int _gdi_draw_one_glyph (PDC pdc, Glyph32 glyph_value, BOOL direction,
|
||||
int x, int y, int* adv_x, int* adv_y);
|
||||
|
||||
@@ -133,6 +138,7 @@ typedef struct _DRAWTEXTEX2_CTXT
|
||||
int x, y;
|
||||
int last_x, last_y;
|
||||
int advance;
|
||||
int last_adv;
|
||||
|
||||
int nFormat;
|
||||
int nCount;
|
||||
|
||||
@@ -2806,6 +2806,18 @@ static void draw_glyph_lines (PDC pdc, int x1, int y1, int x2, int y2)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL _gdi_if_mark_bbox_is_ok(PDC pdc, Glyph32 gv)
|
||||
{
|
||||
LOGFONT* logfont;
|
||||
DEVFONT* devfont;
|
||||
|
||||
logfont = pdc->pLogFont;
|
||||
devfont = SELECT_DEVFONT_BY_GLYPH (logfont, gv);
|
||||
|
||||
return devfont->font_ops->get_feature(logfont, devfont,
|
||||
DEVFONT_FEATURE_MARK_BBOX) != 0;
|
||||
}
|
||||
|
||||
int _gdi_draw_one_glyph (PDC pdc, Glyph32 glyph_value, BOOL direction,
|
||||
int x, int y, int* adv_x, int* adv_y)
|
||||
{
|
||||
@@ -2935,6 +2947,105 @@ end:
|
||||
return advance;
|
||||
}
|
||||
|
||||
int _gdi_draw_one_vowel (PDC pdc, Glyph32 glyph_value, BOOL direction,
|
||||
int x, int y, int last_adv)
|
||||
{
|
||||
LOGFONT* logfont;
|
||||
DEVFONT* devfont;
|
||||
|
||||
BBOX bbox;
|
||||
int advance, adv_x, adv_y;
|
||||
GAL_Rect fg_gal_rc;
|
||||
|
||||
RECT rc_output;
|
||||
RECT rc_front;
|
||||
RECT rc_tmp;
|
||||
|
||||
int italic = 0;
|
||||
int bold = 0;
|
||||
SIZE bbx_size;
|
||||
int flag = 0;
|
||||
int glyph_bmptype;
|
||||
|
||||
y += pdc->alExtra;
|
||||
|
||||
rc_tmp = pdc->rc_output;
|
||||
advance = _gdi_get_glyph_advance (pdc, glyph_value, direction,
|
||||
x, y, &adv_x, &adv_y, &bbox);
|
||||
if (last_adv > 0) {
|
||||
/* Adjust position */
|
||||
if (direction)
|
||||
x += (last_adv - advance) >> 1;
|
||||
else
|
||||
x -= (last_adv - advance) >> 1;
|
||||
advance = 0; /* no advance */
|
||||
}
|
||||
|
||||
logfont = pdc->pLogFont;
|
||||
devfont = SELECT_DEVFONT_BY_GLYPH (logfont, glyph_value);
|
||||
|
||||
glyph_bmptype = devfont->font_ops->get_glyph_bmptype (logfont, devfont)
|
||||
& DEVFONTGLYPHTYPE_MASK_BMPTYPE;
|
||||
|
||||
// VincentWei: only use auto bold when the weight of devfont does not
|
||||
// match the weight of logfont.
|
||||
if (((int)(logfont->style & FS_WEIGHT_MASK) -
|
||||
(int)(devfont->style & FS_WEIGHT_MASK)) > FS_WEIGHT_AUTOBOLD
|
||||
&& (glyph_bmptype == DEVFONTGLYPHTYPE_MONOBMP)) {
|
||||
bold = GET_DEVFONT_SCALE (logfont, devfont);
|
||||
}
|
||||
|
||||
if (logfont->style & FS_SLANT_ITALIC
|
||||
&& !(devfont->style & FS_SLANT_ITALIC)) {
|
||||
italic = devfont->font_ops->get_font_height (logfont, devfont) >> 1;
|
||||
}
|
||||
|
||||
fg_gal_rc.x = bbox.x;
|
||||
fg_gal_rc.y = bbox.y;
|
||||
fg_gal_rc.w = bbox.w + italic;
|
||||
fg_gal_rc.h = bbox.h;
|
||||
|
||||
if (glyph_bmptype == DEVFONTGLYPHTYPE_MONOBMP
|
||||
&& (logfont->style & FS_DECORATE_OUTLINE)) {
|
||||
fg_gal_rc.x--; fg_gal_rc.y--;
|
||||
fg_gal_rc.w += 2; fg_gal_rc.h += 2;
|
||||
}
|
||||
|
||||
rc_front.left = fg_gal_rc.x;
|
||||
rc_front.top = fg_gal_rc.y;
|
||||
rc_front.right = fg_gal_rc.x + fg_gal_rc.w;
|
||||
rc_front.bottom = fg_gal_rc.y + fg_gal_rc.h;
|
||||
rc_output = rc_front;
|
||||
|
||||
if (!(pdc = __mg_check_ecrgn ((HDC)pdc))) {
|
||||
return advance;
|
||||
}
|
||||
|
||||
if (!IntersectRect(&pdc->rc_output, &rc_output, &pdc->rc_output)) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (WITHOUT_DRAWING (pdc)) goto end;
|
||||
|
||||
ENTER_DRAWING (pdc);
|
||||
|
||||
pdc->step = 1;
|
||||
pdc->cur_ban = NULL;
|
||||
|
||||
/* bbox is the real glyph pixels on one scan-line. */
|
||||
bbx_size.cx = bbox.w;
|
||||
bbx_size.cy = bbox.h;
|
||||
|
||||
_gdi_direct_fillglyph (pdc, glyph_value, &fg_gal_rc, &bbx_size,
|
||||
y - bbox.y, advance, italic, bold);
|
||||
|
||||
LEAVE_DRAWING (pdc);
|
||||
end:
|
||||
pdc->rc_output = rc_tmp;
|
||||
UNLOCK_GCRINFO (pdc);
|
||||
return advance;
|
||||
}
|
||||
|
||||
int _gdi_get_italic_added_width (LOGFONT* logfont)
|
||||
{
|
||||
/* FIXME: use the correct devfont for auto-italic */
|
||||
@@ -2992,6 +3103,32 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
|
||||
return advance;
|
||||
}
|
||||
|
||||
/* XXX: an experimental API */
|
||||
int GUIAPI DrawVowel (HDC hdc, int x, int y, Glyph32 glyph_value,
|
||||
int last_adv)
|
||||
{
|
||||
int my_adv_x, my_adv_y;
|
||||
int advance;
|
||||
PDC pdc;
|
||||
|
||||
if (glyph_value == INV_GLYPH_VALUE)
|
||||
return 0;
|
||||
|
||||
pdc = dc_HDC2PDC(hdc);
|
||||
/* Transfer logical to device to screen here. */
|
||||
coor_LP2SP (pdc, &x, &y);
|
||||
pdc->rc_output = pdc->DevRC;
|
||||
|
||||
/* convert to the start point on baseline. */
|
||||
_gdi_get_baseline_point (pdc, &x, &y);
|
||||
|
||||
advance = _gdi_draw_one_vowel (pdc, glyph_value,
|
||||
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
x, y, last_adv);
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
||||
int GUIAPI DrawGlyphStrings(HDC hdc, Glyph32* glyphs, int nr_glyphs,
|
||||
const POINT* pts)
|
||||
{
|
||||
|
||||
@@ -124,6 +124,7 @@ typedef struct _TABBEDTEXTOUT_CTXT
|
||||
int x, y;
|
||||
int last_x, last_y;
|
||||
int advance;
|
||||
int last_adv;
|
||||
|
||||
BOOL only_extent;
|
||||
} TABBEDTEXTOUT_CTXT;
|
||||
@@ -160,18 +161,19 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
|
||||
|
||||
case ACHAR_BASIC_VOWEL:
|
||||
if (!ctxt->only_extent) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||
#if 0
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
#else
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, &adv_x, &adv_y);
|
||||
#endif
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
if (_gdi_if_mark_bbox_is_ok(ctxt->pdc, glyph_value)) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
}
|
||||
else {
|
||||
_gdi_draw_one_vowel (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, ctxt->last_adv);
|
||||
}
|
||||
}
|
||||
adv_x = adv_y = 0;
|
||||
break;
|
||||
@@ -196,6 +198,7 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
|
||||
|
||||
ctxt->last_x = ctxt->x;
|
||||
ctxt->last_y = ctxt->y;
|
||||
ctxt->last_adv = adv_x;
|
||||
ctxt->x += adv_x;
|
||||
ctxt->y += adv_y;
|
||||
|
||||
@@ -220,6 +223,7 @@ typedef struct _TABBEDTEXTOUTEX_CTXT
|
||||
int x, y;
|
||||
int last_x, last_y;
|
||||
int advance;
|
||||
int last_adv;
|
||||
} TABBEDTEXTOUTEX_CTXT;
|
||||
|
||||
static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
||||
@@ -258,18 +262,19 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
||||
break;
|
||||
|
||||
case ACHAR_BASIC_VOWEL: {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||
#if 0
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
#else
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, &adv_x, &adv_y);
|
||||
#endif
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
if (_gdi_if_mark_bbox_is_ok(ctxt->pdc, glyph_value)) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
}
|
||||
else {
|
||||
_gdi_draw_one_vowel (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, ctxt->last_adv);
|
||||
}
|
||||
adv_x = adv_y = 0;
|
||||
break;
|
||||
}
|
||||
@@ -287,6 +292,7 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
||||
|
||||
ctxt->last_x = ctxt->x;
|
||||
ctxt->last_y = ctxt->y;
|
||||
ctxt->last_adv = adv_x;
|
||||
ctxt->x += adv_x;
|
||||
ctxt->y += adv_y;
|
||||
|
||||
@@ -314,6 +320,7 @@ int _gdi_tabbed_text_out (PDC pdc, int x, int y,
|
||||
ctxt.last_x = x;
|
||||
ctxt.last_y = y;
|
||||
ctxt.advance = 0;
|
||||
ctxt.last_adv = 0;
|
||||
ctxt.only_extent = only_extent;
|
||||
|
||||
if (!only_extent)
|
||||
@@ -460,6 +467,7 @@ static int _gdi_tabbedex_text_out (PDC pdc, int x, int y,
|
||||
ctxt.last_x = x;
|
||||
ctxt.last_y = y;
|
||||
ctxt.advance = 0;
|
||||
ctxt.last_adv = 0;
|
||||
|
||||
/* init the tab relative info.*/
|
||||
ctxt.nTabs = nTabs;
|
||||
|
||||
@@ -116,6 +116,7 @@ typedef struct _DRAW_GLYPHS_CTXT {
|
||||
int x, y;
|
||||
int last_x, last_y;
|
||||
int advance;
|
||||
int last_adv;
|
||||
} DRAW_GLYPHS_CTXT;
|
||||
|
||||
static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char_type)
|
||||
@@ -127,14 +128,15 @@ static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char
|
||||
adv_x = adv_y = 0;
|
||||
}
|
||||
else if (check_vowel(char_type)) {
|
||||
int bkmode = GetBkMode (ctxt->hdc);
|
||||
SetBkMode (ctxt->hdc, BM_TRANSPARENT);
|
||||
#if 0
|
||||
DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value, &adv_x, &adv_y);
|
||||
#else
|
||||
DrawGlyph (ctxt->hdc, ctxt->last_x, ctxt->last_y, glyph_value, &adv_x, &adv_y);
|
||||
#endif
|
||||
SetBkMode (ctxt->hdc, bkmode);
|
||||
PDC pdc = dc_HDC2PDC(ctxt->hdc);
|
||||
if (_gdi_if_mark_bbox_is_ok(pdc, glyph_value)) {
|
||||
DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value,
|
||||
&adv_x, &adv_y);
|
||||
}
|
||||
else {
|
||||
DrawVowel (ctxt->hdc, ctxt->last_x, ctxt->last_y,
|
||||
glyph_value, ctxt->last_adv);
|
||||
}
|
||||
adv_x = 0;
|
||||
adv_y = 0;
|
||||
}
|
||||
@@ -145,6 +147,7 @@ static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char
|
||||
|
||||
ctxt->last_x = ctxt->x;
|
||||
ctxt->last_y = ctxt->y;
|
||||
ctxt->last_adv = adv_x;
|
||||
ctxt->x += adv_x;
|
||||
ctxt->y += adv_y;
|
||||
|
||||
@@ -157,6 +160,7 @@ typedef struct _TEXTOUT_CTXT
|
||||
int x, y;
|
||||
int last_x, last_y;
|
||||
int advance;
|
||||
int last_adv;
|
||||
BOOL only_extent;
|
||||
} TEXTOUT_CTXT;
|
||||
|
||||
@@ -171,18 +175,19 @@ static BOOL cb_textout (void* context, Glyph32 glyph_value,
|
||||
}
|
||||
else if (check_vowel(char_type)) {
|
||||
if (!ctxt->only_extent) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||
#if 0
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
#else
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, &adv_x, &adv_y);
|
||||
#endif
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
if (_gdi_if_mark_bbox_is_ok(ctxt->pdc, glyph_value)) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
}
|
||||
else {
|
||||
_gdi_draw_one_vowel (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, ctxt->last_adv);
|
||||
}
|
||||
}
|
||||
adv_x = adv_y = 0;
|
||||
}
|
||||
@@ -203,6 +208,7 @@ static BOOL cb_textout (void* context, Glyph32 glyph_value,
|
||||
|
||||
ctxt->last_x = ctxt->x;
|
||||
ctxt->last_y = ctxt->y;
|
||||
ctxt->last_adv = adv_x;
|
||||
ctxt->x += adv_x;
|
||||
ctxt->y += adv_y;
|
||||
|
||||
@@ -223,6 +229,7 @@ int _gdi_text_out (PDC pdc, int x, int y,
|
||||
ctxt.last_x = x;
|
||||
ctxt.last_y = y;
|
||||
ctxt.advance = 0;
|
||||
ctxt.last_adv = 0;
|
||||
ctxt.only_extent = FALSE;
|
||||
|
||||
_gdi_start_new_line (pdc);
|
||||
@@ -280,6 +287,7 @@ int _gdi_get_text_extent (PDC pdc, const unsigned char* text, int len,
|
||||
ctxt.last_x = 0;
|
||||
ctxt.last_y = 0;
|
||||
ctxt.advance = 0;
|
||||
ctxt.last_adv = 0;
|
||||
ctxt.only_extent = TRUE;
|
||||
|
||||
_gdi_start_new_line (pdc);
|
||||
@@ -334,6 +342,7 @@ typedef struct _TEXTOUTOMITTED_CTXT
|
||||
int x, y;
|
||||
int last_x, last_y;
|
||||
int advance;
|
||||
int last_adv;
|
||||
Uint32 max_extent;
|
||||
} TEXTOUTOMITTED_CTXT;
|
||||
|
||||
@@ -348,18 +357,19 @@ cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int char_type)
|
||||
adv_x = adv_y = 0;
|
||||
}
|
||||
else if (check_vowel(char_type)) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||
#if 0
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
#else
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, &adv_x, &adv_y);
|
||||
#endif
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
if (_gdi_if_mark_bbox_is_ok(ctxt->pdc, glyph_value)) {
|
||||
int bkmode = ctxt->pdc->bkmode;
|
||||
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||
ctxt->pdc->bkmode = bkmode;
|
||||
}
|
||||
else {
|
||||
_gdi_draw_one_vowel (ctxt->pdc, glyph_value,
|
||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||
ctxt->last_x, ctxt->last_y, ctxt->last_adv);
|
||||
}
|
||||
adv_x = adv_y = 0;
|
||||
}
|
||||
else {
|
||||
@@ -381,6 +391,7 @@ cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int char_type)
|
||||
|
||||
ctxt->last_x = ctxt->x;
|
||||
ctxt->last_y = ctxt->y;
|
||||
ctxt->last_adv = adv_x;
|
||||
ctxt->x += adv_x;
|
||||
ctxt->y += adv_y;
|
||||
|
||||
@@ -401,6 +412,7 @@ int _gdi_textout_omitted (PDC pdc, int x, int y,
|
||||
ctxt.last_x = x;
|
||||
ctxt.last_y = y;
|
||||
ctxt.advance = 0;
|
||||
ctxt.last_adv = 0;
|
||||
ctxt.max_extent = max_extent;
|
||||
|
||||
_gdi_start_new_line (pdc);
|
||||
|
||||
Reference in New Issue
Block a user