mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 17:44:19 +08:00
cleanup
This commit is contained in:
@@ -236,8 +236,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
|
||||
/* If output rect is too small, we shouldn't output any text.*/
|
||||
if (RECTW(rcDraw) < pdc->pLogFont->size
|
||||
&& RECTH(rcDraw) < pdc->pLogFont->size) {
|
||||
_WRN_PRINTF ("NEWGDI: "
|
||||
"Output rect is too small, we won't output any text. \n");
|
||||
_WRN_PRINTF ("Output rect is too small, we won't output any text.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -221,7 +221,7 @@ void mg_TerminateScreenDC (void)
|
||||
#define INIT_SPECIFICAL_FONTS(etc_section) \
|
||||
{ \
|
||||
if (!font_InitSpecificalFonts (etc_section)) { \
|
||||
_WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize fonts defined in section %s!\n", etc_section); \
|
||||
_WRN_PRINTF ("Can not initialize fonts defined in section %s!", etc_section); \
|
||||
goto error; \
|
||||
} \
|
||||
}
|
||||
@@ -230,7 +230,7 @@ void mg_TerminateScreenDC (void)
|
||||
BOOL mg_InitGDI (void)
|
||||
{
|
||||
if (!InitTextBitmapBuffer ()) {
|
||||
_WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize text bitmap buffer!\n");
|
||||
_WRN_PRINTF ("Can not initialize text bitmap buffer!");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ BOOL mg_InitGDI (void)
|
||||
|
||||
#if (defined (_MGFONT_TTF) || defined (_MGFONT_FT2)) && defined(_MGRM_THREADS)
|
||||
if (!font_InitFreetypeLibrary ()) {
|
||||
_WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize freetype fonts!\n");
|
||||
_WRN_PRINTF ("Can not initialize freetype fonts!");
|
||||
goto error;
|
||||
}
|
||||
INIT_SPECIFICAL_FONTS (FONT_ETC_SECTION_NAME_TTF);
|
||||
@@ -261,13 +261,13 @@ BOOL mg_InitGDI (void)
|
||||
/* TODO: add other font support here */
|
||||
#if defined (_MGFONT_SEF) && !defined(_LITE_VERSION)
|
||||
if(!initialize_scripteasy()) {
|
||||
_WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize ScriptEasy fonts!\n");
|
||||
_WRN_PRINTF ("Can not initialize ScriptEasy fonts!");
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!font_InitIncoreFonts ()) {
|
||||
_WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize incore fonts!\n");
|
||||
_WRN_PRINTF ("Can not initialize incore fonts!");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ BOOL mg_InitGDI (void)
|
||||
#endif
|
||||
|
||||
if (!mg_InitSysFont ()) {
|
||||
_WRN_PRINTF ("NEWGDI>InitGDI: Can not create system fonts!\n");
|
||||
_WRN_PRINTF ("Can not create system fonts!");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2647,7 +2647,7 @@ HDC GetSecondarySubDC (HDC secondary_dc, HWND hwnd_child, BOOL client)
|
||||
UNLOCK(&dcslot);
|
||||
|
||||
if (i >= DCSLOTNUMBER) {
|
||||
_WRN_PRINTF ("NEWGDI>GetSecondarySubDC: no DC slot.\n");
|
||||
_WRN_PRINTF ("NEWGDI>GetSecondarySubDC: no DC slot.");
|
||||
return HDC_SCREEN;
|
||||
}
|
||||
|
||||
@@ -3392,7 +3392,7 @@ HDC GUIAPI InitSlaveScreenEx (const char* name, const char* mode, int dpi)
|
||||
}
|
||||
else {
|
||||
free (pmem_dc);
|
||||
_WRN_PRINTF ("NEWGDI>InitSlaveScreen: Can not init the slave screen: %s (%s)\n",
|
||||
_WRN_PRINTF ("Can not init the slave screen: %s (%s)",
|
||||
name, mode);
|
||||
return HDC_INVALID;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2465,7 +2465,7 @@ static void draw_back_area (PDC pdc, POINT* area, GAL_Rect* gal_rc,
|
||||
break;
|
||||
|
||||
default:
|
||||
_WRN_PRINTF ("NEWGDI>Glyph: NO WAY\n");
|
||||
_WRN_PRINTF ("No way to draw background");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2635,7 +2635,7 @@ static void draw_glyph_lines (PDC pdc, int x1, int y1, int x2, int y2)
|
||||
_dc_set_pixel_noclip);
|
||||
}
|
||||
else
|
||||
_WRN_PRINTF ("NEWGDI>Glyph: no under line, rc_output: %d, %d, %d, %d\n",
|
||||
_WRN_PRINTF ("no under line, rc_output: %d, %d, %d, %d\n",
|
||||
pdc->rc_output.left, pdc->rc_output.top,
|
||||
pdc->rc_output.right, pdc->rc_output.bottom);
|
||||
cliprect = cliprect->next;
|
||||
|
||||
@@ -172,8 +172,8 @@ LayoutRun* __mg_layout_run_new_from(const LAYOUTINFO* layout,
|
||||
|
||||
lrun = malloc(sizeof(LayoutRun));
|
||||
lrun->lf = lf;
|
||||
lrun->ucs = layout->truninfo->ucs;
|
||||
lrun->si = trun->si;
|
||||
lrun->ucs = layout->truninfo->ucs + lrun->si;
|
||||
lrun->len = trun->len;
|
||||
lrun->lc = trun->lc;
|
||||
lrun->st = trun->st;
|
||||
@@ -204,8 +204,8 @@ LayoutRun* __mg_layout_run_new_from_offset(const LAYOUTINFO* layout,
|
||||
lrun = malloc(sizeof(LayoutRun));
|
||||
|
||||
lrun->lf = lf;
|
||||
lrun->ucs = layout->truninfo->ucs;
|
||||
lrun->si = trun->si + offset;
|
||||
lrun->ucs = layout->truninfo->ucs + lrun->si;
|
||||
lrun->len = trun->len - offset;
|
||||
lrun->lc = trun->lc;
|
||||
lrun->st = trun->st;
|
||||
|
||||
+16
-2
@@ -65,6 +65,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define _DEBUG
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
@@ -379,10 +381,17 @@ static void shape_space(const LAYOUTINFO* layout, const LayoutRun* lrun,
|
||||
glyphs->glyphs[i].x_off = 0;
|
||||
glyphs->glyphs[i].y_off = 0;
|
||||
|
||||
_ERR_PRINTF("%s: gc of uc (%04x): %d\n",
|
||||
__FUNCTION__, lrun->ucs[i], gc);
|
||||
|
||||
if (gc == UCHAR_CATEGORY_SPACE_SEPARATOR) {
|
||||
Glyph32 space_gv = GetGlyphValue(lrun->lf, UCHAR_SPACE);
|
||||
glyphs->glyphs[i].width
|
||||
= _font_get_glyph_log_width(lrun->lf, space_gv);
|
||||
|
||||
_ERR_PRINTF("%s: space width: %d\n",
|
||||
__FUNCTION__, glyphs->glyphs[i].width);
|
||||
|
||||
if (IsUCharWide(lrun->ucs[i])) {
|
||||
glyphs->glyphs[i].width *= 2;
|
||||
}
|
||||
@@ -444,7 +453,7 @@ static GlyphString* shape_run(LAYOUTLINE *line, LayoutState *state,
|
||||
if (layout->truninfo->ucs[lrun->si] == UCHAR_TAB) {
|
||||
shape_tab(line, glyphs);
|
||||
}
|
||||
else if (lrun->lf == NULL) {
|
||||
else if (lrun->flags & LAYOUTRUN_FLAG_NO_SHAPING) {
|
||||
// no need shaping
|
||||
shape_space(layout, lrun, glyphs);
|
||||
}
|
||||
@@ -508,6 +517,8 @@ static inline void print_text_runs(const TEXTRUNSINFO* info, const char* func)
|
||||
_DBG_PRINTF(" INDEX: %d\n", run->si);
|
||||
_DBG_PRINTF(" LENGHT: %d\n", run->len);
|
||||
_DBG_PRINTF(" EMBEDDING LEVEL:%d\n", run->el);
|
||||
_DBG_PRINTF(" NO SHAPING :%s\n",
|
||||
(run->flags & TEXTRUN_FLAG_NO_SHAPING) ? "YES" : "NO");
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -527,6 +538,8 @@ static inline void print_line_runs(const LAYOUTLINE* line, const char* func)
|
||||
_DBG_PRINTF(" INDEX: %d\n", run->lrun->si);
|
||||
_DBG_PRINTF(" LENGHT: %d\n", run->lrun->len);
|
||||
_DBG_PRINTF(" EMBEDDING LEVEL:%d\n", run->lrun->el);
|
||||
_DBG_PRINTF(" NO SHAPING :%s\n",
|
||||
(run->lrun->flags & LAYOUTRUN_FLAG_NO_SHAPING) ? "YES" : "NO");
|
||||
_DBG_PRINTF(" NR GLYPHS: %d\n", run->gstr->nr_glyphs);
|
||||
j++;
|
||||
}
|
||||
@@ -1650,8 +1663,9 @@ static int traverse_line_glyphs(const LAYOUTINFO* layout,
|
||||
RGBCOLOR color;
|
||||
ShapedGlyph* glyph_info;
|
||||
|
||||
uc = run->lrun->ucs[run->gstr->log_clusters[j]];
|
||||
|
||||
index = run->lrun->si + run->gstr->log_clusters[j];
|
||||
uc = run->lrun->ucs[index];
|
||||
color = __mg_textruns_get_text_color(layout->truninfo, index);
|
||||
glyph_info = run->gstr->glyphs + j;
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
# define LOCAL_ARRAY_SIZE 128
|
||||
#endif
|
||||
|
||||
|
||||
static void reverse_shaped_glyphs(ShapedGlyph* glyphs, int len)
|
||||
{
|
||||
int i;
|
||||
@@ -77,6 +76,16 @@ static void reverse_shaped_glyphs(ShapedGlyph* glyphs, int len)
|
||||
}
|
||||
}
|
||||
|
||||
static void reverse_log_clusters(int* clusters, int len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len / 2; i++) {
|
||||
int tmp = clusters[i];
|
||||
clusters[i] = clusters[len - 1 - i];
|
||||
clusters[len - 1 - i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL shape_layout_run(SEInstance* inst,
|
||||
const TEXTRUNSINFO* info, const LayoutRun* run,
|
||||
GlyphString* gs)
|
||||
@@ -234,6 +243,7 @@ static BOOL shape_layout_run(SEInstance* inst,
|
||||
// reorder glyphs
|
||||
if (BIDI_LEVEL_IS_RTL(run->el)) {
|
||||
reverse_shaped_glyphs(gs->glyphs, gs->nr_glyphs);
|
||||
reverse_log_clusters(gs->log_clusters, gs->nr_glyphs);
|
||||
}
|
||||
|
||||
ok = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user