This commit is contained in:
VincentWei
2018-06-05 23:59:14 +08:00
parent 0d49ed794e
commit dd0445689e
7 changed files with 28 additions and 53 deletions
+7 -7
View File
@@ -295,7 +295,7 @@ unsigned short font_GetBestScaleFactor (int height, int expect)
{ \
devfont = head; \
while (devfont) { \
fprintf (stderr, " %d: %s, charsetname: %s, style: %p\n", \
_DBG_PRINTF (" %d: %s, charsetname: %s, style: %p\n", \
count, \
devfont->name, devfont->charset_ops->name, (PVOID)devfont->style); \
devfont = devfont->next; \
@@ -308,13 +308,13 @@ void dbg_dumpDevFonts (void)
int count = 0;
DEVFONT* devfont;
fprintf (stderr, "============= SBDevFonts ============\n");
_DBG_PRINTF ("============= SBDevFonts ============\n");
PRINT_DEVFONTS (sb_dev_font_head, devfont, count);
fprintf (stderr, "========== End of SBDevFonts =========\n");
_DBG_PRINTF ("========== End of SBDevFonts =========\n");
fprintf (stderr, "\n============= MBDevFonts ============\n");
_DBG_PRINTF ("\n============= MBDevFonts ============\n");
PRINT_DEVFONTS (mb_dev_font_head, devfont, count);
fprintf (stderr, "========== End of MBDevFonts =========\n");
_DBG_PRINTF ("========== End of MBDevFonts =========\n");
}
#endif
@@ -845,12 +845,12 @@ BOOL GUIAPI InitVectorialFonts (void)
{
#if defined (_MGFONT_TTF) || defined (_MGFONT_FT2)
if (!font_InitFreetypeLibrary ()) {
fprintf (stderr, "FONT>DevFont: Can not init freetype library!\n");
_ERR_PRINTF ("FONT>DevFont: Can not init freetype library!\n");
return FALSE;
}
if (!font_InitSpecificalFonts (FONT_ETC_SECTION_NAME_TTF)) {
fprintf (stderr, "FONT>DevFont: Can not init TrueType fonts!\n");
_ERR_PRINTF ("FONT>DevFont: Can not init TrueType fonts!\n");
return FALSE;
}
#endif
+6 -13
View File
@@ -140,9 +140,6 @@ static BYTE* get_raster_bitmap_buffer (size_t size)
{
if (size <= rb_buf_size) return rb_buffer;
rb_buf_size = ((size + 31) >> 5) << 5;
#if 0
fprintf (stderr, "buf_size: %d.\n", rb_buf_size);
#endif
rb_buffer = realloc (rb_buffer, rb_buf_size);
memset(rb_buffer, 0, rb_buf_size);
return rb_buffer;
@@ -294,7 +291,7 @@ load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face,
FT_Glyph ft_glyph_tmp;
if (get_cached_face (ft_inst_info, face)) {
_MG_PRINTF ("FONT>FT2: can't access font file %p\n", ft_face_info);
_MG_PRINTF ("FONT>FT2: can't access font file %p\n", face);
return 0;
}
@@ -400,7 +397,7 @@ get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
FT_Glyph_Get_CBox (ft_inst_info->glyph, ft_glyph_bbox_pixels, &bbox);
#if 0
#if 1
//Note: using subpixel filter, the bbox_w is 2 pixel wider than normal.
if (IS_SUBPIXEL(logfont) && (ft_inst_info->ft_lcdfilter != FT_LCD_FILTER_NONE))
bbox.xMax += 2;
@@ -421,7 +418,6 @@ get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
if (ft_inst_info->cache && (ft_inst_info->rotation == 0)) {
TTFCACHEINFO * pcache;
TTFCACHEINFO cache_info = {0};
int ret;
int datasize;
int size = 0;
@@ -441,9 +437,8 @@ get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
cache_info.unicode, sizeof(TTFCACHEINFO) + size, size,
ft_inst_info->cache));
ret = __mg_ttc_write(ft_inst_info->cache,
__mg_ttc_write(ft_inst_info->cache,
&cache_info, sizeof(TTFCACHEINFO) + size);
DP(("__mg_ttc_write() return %d\n", ret));
}
}
#endif
@@ -545,7 +540,7 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
}
}
/* access bitmap content by type changing */
/* access bitmap content by typecasting */
glyph_bitmap = (FT_BitmapGlyph) ft_inst_info->glyph;
source = &glyph_bitmap->bitmap;
@@ -561,7 +556,6 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
#ifdef _MGFONT_TTF_CACHE
if (ft_inst_info->cache && (ft_inst_info->rotation == 0)) {
TTFCACHEINFO * pcache;
int ret;
int datasize;
int size = source->rows * (*pitch);
@@ -582,9 +576,8 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
cache_info.unicode, sizeof(TTFCACHEINFO) + size, size,
ft_inst_info->cache));
ret = __mg_ttc_write(ft_inst_info->cache,
__mg_ttc_write(ft_inst_info->cache,
&cache_info, sizeof(TTFCACHEINFO) + size);
DP(("__mg_ttc_write() return %d\n", ret));
}
else {
@@ -1055,7 +1048,7 @@ error_ftc_manager:
return TRUE;
error_library:
fprintf (stderr, "FONT>FT2: Could not initialise FreeType 2 library\n");
_ERR_PRINTF ("FONT>FT2: Could not initialise FreeType 2 library\n");
FT_Done_FreeType (ft_library);
return FALSE;
+3 -3
View File
@@ -82,7 +82,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
// is supported charset?
if (GetCharsetOps (charset) == NULL) {
_MG_PRINTF ("FONT>LogFont: Not supprted charset: %s.\n", charset);
_ERR_PRINTF ("FONT>LogFont: Not supprted charset: %s.\n", charset);
return INV_LOGFONT;
}
@@ -124,7 +124,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
log_font->sbc_scale = 1;
log_font->mbc_scale = 1;
_MG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %p, charset: %s, size: %d.\n",
_DBG_PRINTF ("FONT>LogFont: requested info: type: %s, family: %s, style: %p, charset: %s, size: %d.\n",
log_font->type, log_font->family, (PVOID)log_font->style, log_font->charset,
log_font->size);
@@ -245,7 +245,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
log_font->style &= ~FS_FLIP_HORZVERT;
}
_MG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %p, charset: %s, size: %d.\n",
_DBG_PRINTF ("FONT>LogFont: created info: type: %s, family: %s, style: %p, charset: %s, size: %d.\n",
log_font->type, log_font->family, (PVOID)log_font->style, log_font->charset,
log_font->size);
+1 -1
View File
@@ -134,7 +134,7 @@ BOOL mg_InitSysFont (void)
goto error_load;
}
_MG_PRINTF ("FONT>SysFont: system font %d: %s-%s-%d-%s\n",
_DBG_PRINTF ("FONT>SysFont: system font %d: %s-%s-%d-%s\n",
i, type, family, height, charset);
if (i == 0 && GetCharsetOps (charset)->bytes_maxlen_char > 1) {
+1 -1
View File
@@ -350,7 +350,7 @@ static void* load_font_data (const char* fontname, const char* filename)
version [VBF_LEN_VERSION_INFO] = '\0';
if (strcmp (version, VBF_VERSION3) != 0) {
fprintf (stderr, "FONT>VBF: Error on loading vbf: %s, version: %s,"
_ERR_PRINTF ("FONT>VBF: Error on loading vbf: %s, version: %s,"
" invalid version.\n", filename, version);
goto error;
}
+6 -22
View File
@@ -1626,9 +1626,6 @@ BOOL GUIAPI HiliteMenuBarItem (HWND hwnd, int pos, UINT flags)
if (!pmi) return FALSE;
_MG_PRINTF ("GUI>Menu: HiliteMenuBarItem.top=%d, bottom=%d\n",
rc.top, rc.bottom);
if (pmi->mnutype == MFT_SEPARATOR)
return TRUE;
@@ -1782,8 +1779,6 @@ void DrawMenuBarHelper (const MAINWIN* pWin, HDC hdc, const RECT* pClipRect)
h -= menubar_offy << 1;
if (h < 0)
h = 0;
_MG_PRINTF ("GUI>Menu: DrawMenuBarHelpler. top= %d, bottom= %d\n",
y, y + h);
inter = LFRDR_INTERMENUITEMX;
pmi = pmb->head;
@@ -2013,8 +2008,7 @@ static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect,
pWin = (PMAINWIN) hwnd;
if (NULL == pWin) return -1;
if (!pWin->we_rdr)
{
if (!pWin->we_rdr) {
_MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin);
return -1;
}
@@ -2159,11 +2153,6 @@ static int DrawMenuPic (HWND hwnd, HDC hdc, int x, int y,
mp_type = LFRDR_MENU_PIC_MARK;
}
_MG_PRINTF ("GUI>Menu: render menu item. rect (%d, %d, %d, %d)"
"rect_height = %d, item_h = %d\n",
mp_rect.left, mp_rect.top, mp_rect.right, mp_rect.bottom,
mp_height, pmi->h);
mnuDrawMenuPic (hwnd, hdc, &mp_rect, mp_type, pmi->mnustate);
return 0;
}
@@ -2264,8 +2253,7 @@ static void draw_bottom_scroll_button(PTRACKMENUINFO ptmi)
pWin = (PMAINWIN) ptmi->hwnd;
if (NULL == pWin) return;
if (!pWin->we_rdr)
{
if (!pWin->we_rdr) {
_MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin);
return;
}
@@ -2305,8 +2293,7 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi)
pWin = (PMAINWIN) ptmi->hwnd;
if (NULL == pWin) return -1;
if (!pWin->we_rdr)
{
if (!pWin->we_rdr) {
_MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin);
return -1;
}
@@ -2626,8 +2613,7 @@ static void draw_top_scroll_button(PTRACKMENUINFO ptmi)
pWin = (PMAINWIN) ptmi->hwnd;
if (NULL == pWin) return;
if (!pWin->we_rdr)
{
if (!pWin->we_rdr) {
_MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin);
return;
}
@@ -2670,8 +2656,7 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi)
pWin = (PMAINWIN) ptmi->hwnd;
if (NULL == pWin) return -1;
if (!pWin->we_rdr)
{
if (!pWin->we_rdr) {
_MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin);
return -1;
}
@@ -3101,8 +3086,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite)
pWin = (PMAINWIN) hwnd;
if (NULL == pWin) return;
if (!pWin->we_rdr)
{
if (!pWin->we_rdr) {
_MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin);
return;
}
+4 -6
View File
@@ -256,10 +256,10 @@ int mg_InitIAL (void)
}
if (__mg_cur_input == NULL) {
fprintf (stderr, "IAL: Does not find the request engine: %s.\n", engine);
_ERR_PRINTF ("IAL: Does not find the request engine: %s.\n", engine);
if (NR_INPUTS) {
__mg_cur_input = inputs;
fprintf (stderr, "IAL: Use the first engine: %s\n", __mg_cur_input->id);
_MG_PRINTF ("IAL: Use the first engine: %s\n", __mg_cur_input->id);
}
else
return ERR_NO_MATCH;
@@ -268,13 +268,11 @@ int mg_InitIAL (void)
strcpy (__mg_cur_input->mdev, mdev);
if (!IAL_InitInput (__mg_cur_input, mdev, mtype)) {
fprintf (stderr, "IAL: Init IAL engine failure.\n");
_ERR_PRINTF ("IAL: Init IAL engine failure.\n");
return ERR_INPUT_ENGINE;
}
#ifdef _DEBUG
fprintf (stderr, "IAL: Use %s engine.\n", __mg_cur_input->id);
#endif
_DBG_PRINTF ("IAL: Use %s engine.\n", __mg_cur_input->id);
return 0;
}