From 136a51d9b8535079e3170afbdb33838b6e908741 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Mon, 4 Mar 2019 16:47:19 +0800 Subject: [PATCH] cleanup --- src/font/freetype2.c | 12 ++++++------ src/font/freetype2.h | 36 ++++++++++++++++++------------------ src/newgdi/glyph.c | 10 +++++----- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/font/freetype2.c b/src/font/freetype2.c index aeef26eb..9c0fdd78 100644 --- a/src/font/freetype2.c +++ b/src/font/freetype2.c @@ -523,7 +523,7 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, if (!is_grey && sz && (cacheinfo->height != sz->cy || cacheinfo->width != sz->cx)) { - _ERR_PRINTF("FreeType2: cached BITMAP size does not match BBOX\n"); + _DBG_PRINTF("Font>FT2: Override BBOX size\n"); sz->cx = cacheinfo->width; sz->cy = cacheinfo->height; } @@ -612,12 +612,12 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, /* VincentWei: override the bbox.w and bbox.h with bitmap for monobitmap */ if (!is_grey && sz && (source->rows != sz->cy || source->width != sz->cx)) { - _ERR_PRINTF("FreeType2: BITMAP size does not match BBOX\n"); + _DBG_PRINTF("Font>FT2: Override BBOX size\n"); sz->cx = source->width; sz->cy = source->rows; } -#ifdef _DEBUG +#ifdef TTF_DBG if (is_grey) print_bitmap_grey(source->buffer, source->width, source->rows, source->pitch); else @@ -635,12 +635,12 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont, memcpy(buffer, source->buffer, source->rows * source->pitch); /* VincentWei: override the bbox.w and bbox.h with bitmap */ if (!is_grey && sz && (source->rows != sz->cy || source->width != sz->cx)) { - _ERR_PRINTF("FreeType2: BITMAP size does not match BBOX\n"); + _DBG_PRINTF("Font>FT2: Override BBOX size\n"); sz->cx = source->width; sz->cy = source->rows; } -#ifdef _DEBUG +#ifdef TTF_DBG if (is_grey) print_bitmap_grey(source->buffer, source->width, source->rows, source->pitch); else @@ -1055,7 +1055,7 @@ static void* load_font_data (DEVFONT* devfont, weight_style = (tt_os2->usWeightClass/100 * 10); } else { - _DBG_PRINTF("FreeType2: Unknown tt_os2->usWeightClass: %u\n", + _DBG_PRINTF("FONT>FT2: Unknown tt_os2->usWeightClass: %u\n", tt_os2->usWeightClass); } diff --git a/src/font/freetype2.h b/src/font/freetype2.h index 91de7d7a..30c79d8f 100644 --- a/src/font/freetype2.h +++ b/src/font/freetype2.h @@ -1,33 +1,33 @@ /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -40,6 +40,14 @@ #ifndef GUI_FREETYP2_H #define GUI_FREETYP2_H +#undef TTF_DBG + +#ifndef TTF_DBG +#define DP(x) +#else +#define DP(x) do { printf x; } while (0) +#endif + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -65,7 +73,7 @@ extern "C" { #ifdef _MGFONT_TTF_CACHE typedef void* HCACHE; typedef int (* MakeHashKeyFunc)(Uchar32 unicode); -#endif +#endif typedef struct tagFTFACEINFO { #ifdef _MGFONT_TTF_CACHE @@ -142,14 +150,6 @@ extern void __mg_ttc_refer(HCACHE hCache); #endif -#define TTF_DBG - -#ifndef TTF_DBG -#define DP(x) -#else -#define DP(x) do { printf x; } while (0) -#endif - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/newgdi/glyph.c b/src/newgdi/glyph.c index f51fbeaf..e973453c 100644 --- a/src/newgdi/glyph.c +++ b/src/newgdi/glyph.c @@ -69,7 +69,7 @@ int ft2GetLcdFilter (DEVFONT* devfont); int ft2IsFreeTypeDevfont (DEVFONT* devfont); #endif -#define FS_WEIGHT_AUTOBOLD 30 +#define FS_WEIGHT_AUTOBOLD 29 Glyph32 GUIAPI GetGlyphValue (LOGFONT* logfont, const char* mchar, int mchar_len, const char* pre_mchar, int pre_len) @@ -2375,8 +2375,8 @@ int _font_get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont, // VincentWei: only use auto bold when the weight of devfont does not // match the weight of logfont. - if (((logfont->style & FS_WEIGHT_MASK) - - (devfont->style & FS_WEIGHT_MASK)) > FS_WEIGHT_AUTOBOLD + 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); bbox_w += bold; @@ -2823,8 +2823,8 @@ int _gdi_draw_one_glyph (PDC pdc, Glyph32 glyph_value, BOOL direction, // VincentWei: only use auto bold when the weight of devfont does not // match the weight of logfont. - if (((logfont->style & FS_WEIGHT_MASK) - - (devfont->style & FS_WEIGHT_MASK)) > FS_WEIGHT_AUTOBOLD + 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); }