diff --git a/include/gdi.h b/include/gdi.h index 366b0c97..5946e519 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -12417,8 +12417,8 @@ typedef struct _GLYPHPOS { * the glyph rotates 90° clockwise from horizontal. * - GLYPH_ORIENTATION_SIDEWAYS_LEFT\n * the glyph rotates 90° counter-clockwise from horizontal. - * - GLYPH_ORIENTATION_INVERTED\n - * the glyph is in the inverted horizontal orientation. + * - GLYPH_ORIENTATION_UPSIDE_DOWN\n + * the glyph is upside down. */ Uint8 orientation:2; /** @@ -12518,6 +12518,36 @@ MG_EXPORT int GUIAPI GetGlyphsExtentFromUChars(LOGFONT* logfont_upright, SIZE* line_size, Glyph32* glyphs, GLYPHEXTINFO* glyph_ext_info, GLYPHPOS* glyph_pos, LOGFONT** logfont_sideways); +/* + * \fn int GUIAPI DrawGlyphStringEx (HDC hdc, + * LOGFONT* logfont_upright, LOGFONT* logfont_sideways, + * const Glyph32* glyphs, const GLYPHPOS* glyph_pos, int nr_glyphs) + * \brief Draw a glyph string at the specified positions and text orientations. + * + * This function draws a glyph string to the specific positions and + * orientations on a DC \a hdc with the logfonts specified by + * \a logfont_upright and \a logfont_sideways. + * + * \param hdc The device context. + * \param logfont_upright The LOGFONT object used for upright glyphs. + * \param logfont_sideways The LOGFONT object used for sideways glyphs. + * \param glyphs The pointer to the glyph string + * \param glyph_pos The buffer holds the position information + * of every glyph. + * \param nr_glyphs The number of the glyphs should be drawn. + * + * \return The number of glyphs really drawn. + * + * \note The positions contained in \a glyph_pos are always aligned to + * the top-left corner of the output rectangle. + * + * \sa GetGlyphsExtentFromUChars + */ +MG_EXPORT int GUIAPI DrawGlyphStringEx (HDC hdc, + LOGFONT* logfont_upright, LOGFONT* logfont_sideways, + const Glyph32* glyphs, const GLYPHPOS* glyph_pos, + int nr_glyphs); + /* The fields in the structure _TEXTRUNSINFO are invisible to users */ typedef struct _TEXTRUNSINFO TEXTRUNSINFO; @@ -12705,7 +12735,7 @@ MG_EXPORT LAYOUTINFO* GUIAPI CreateLayoutInfo( */ MG_EXPORT BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* layout_info); -typedef void (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt, +typedef BOOL (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt, LOGFONT* lf, RGBCOLOR color, Glyph32 gv, const GLYPHPOS* pos); /** @@ -12713,9 +12743,15 @@ typedef void (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt, */ MG_EXPORT LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUTINFO* layout_info, LAYOUTLINE* prev_Line, - int* x, int* y, int max_extent, SIZE* line_size, + int x, int y, int max_extent, SIZE* line_size, CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt); +MG_EXPORT BOOL DrawShapedGlyph(HDC hdc, LOGFONT* lf, RGBCOLOR color, + Glyph32 gv, const GLYPHPOS* pos); + +MG_EXPORT int DrawShapedGlyphLine(HDC hdc, const LAYOUTLINE* line, + int x, int y); + /** * \fn int GUIAPI GetGlyphsExtentInfo() * @@ -12853,36 +12889,6 @@ MG_EXPORT int GUIAPI DrawShapedGlyphs(const TEXTRUNSINFO* run_info, #endif /* _MGCHARSET_UNICODE */ -/* - * \fn int GUIAPI DrawGlyphStringEx (HDC hdc, - * LOGFONT* logfont_upright, LOGFONT* logfont_sideways, - * const Glyph32* glyphs, const GLYPHPOS* glyph_pos, int nr_glyphs) - * \brief Draw a glyph string at the specified positions and text orientations. - * - * This function draws a glyph string to the specific positions and - * orientations on a DC \a hdc with the logfonts specified by - * \a logfont_upright and \a logfont_sideways. - * - * \param hdc The device context. - * \param logfont_upright The LOGFONT object used for upright glyphs. - * \param logfont_sideways The LOGFONT object used for sideways glyphs. - * \param glyphs The pointer to the glyph string - * \param glyph_pos The buffer holds the position information - * of every glyph. - * \param nr_glyphs The number of the glyphs should be drawn. - * - * \return The number of glyphs really drawn. - * - * \note The positions contained in \a glyph_pos are always aligned to - * the top-left corner of the output rectangle. - * - * \sa GetGlyphsExtentFromUChars - */ -MG_EXPORT int GUIAPI DrawGlyphStringEx (HDC hdc, - LOGFONT* logfont_upright, LOGFONT* logfont_sideways, - const Glyph32* glyphs, const GLYPHPOS* glyph_pos, - int nr_glyphs); - /** @} end of glyph */ /* * \var typedef struct _COMP_CTXT COMP_CTXT diff --git a/src/newgdi/Makefile.am b/src/newgdi/Makefile.am index 23902c43..cb6d4db6 100644 --- a/src/newgdi/Makefile.am +++ b/src/newgdi/Makefile.am @@ -16,7 +16,7 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \ mifillarc.c mifpolycon.c miarc.c rotatebmp.c \ text.c achar-uchar.c glyph.c legacy-bidi.c \ textout.c tabbedtextout.c drawtext.c \ - glyph-unicode.c \ + simple-glyph-renderer.c glyph-shaped.c \ textrunsinfo.c \ shape-glyphs-basic.c shape-glyphs-complex.c \ layoutinfo.c diff --git a/src/newgdi/glyph-shaped.c b/src/newgdi/glyph-shaped.c new file mode 100644 index 00000000..9123067b --- /dev/null +++ b/src/newgdi/glyph-shaped.c @@ -0,0 +1,74 @@ +/* + * 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 + * . + */ +/* +** glyph-shaped.c: +** Implementation of DrawShapedGlyph and DrawLayoutLine. +** +** Create by WEI Yongming at 2019/03/21 +*/ + +#include +#include +#include + +#include "common.h" +#include "minigui.h" +#include "gdi.h" +#include "window.h" +#include "devfont.h" +#include "cliprect.h" +#include "gal.h" +#include "internals.h" +#include "ctrlclass.h" +#include "dc.h" +#include "pixel_ops.h" +#include "cursor.h" +#include "drawtext.h" +#include "glyph.h" + +#ifdef _MGCHARSET_UNICODE + +BOOL DrawShapedGlyph(HDC hdc, LOGFONT* lf, RGBCOLOR color, + Glyph32 gv, const GLYPHPOS* pos) +{ + return FALSE; +} + +int DrawShapedGlyphLine(HDC hdc, const LAYOUTLINE* line, + int x, int y) +{ + return 0; +} + +#endif /* _MGCHARSET_UNICODE */ diff --git a/src/newgdi/layoutinfo.c b/src/newgdi/layoutinfo.c index 7cbbedec..110cabde 100644 --- a/src/newgdi/layoutinfo.c +++ b/src/newgdi/layoutinfo.c @@ -132,7 +132,7 @@ BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* info) LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUTINFO* info, LAYOUTLINE* prev_Line, - int* x, int* y, int max_extent, SIZE* line_size, + int x, int y, int max_extent, SIZE* line_size, CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt) { return NULL; diff --git a/src/newgdi/glyph-unicode.c b/src/newgdi/simple-glyph-renderer.c similarity index 99% rename from src/newgdi/glyph-unicode.c rename to src/newgdi/simple-glyph-renderer.c index b99398cf..a13316d7 100644 --- a/src/newgdi/glyph-unicode.c +++ b/src/newgdi/simple-glyph-renderer.c @@ -33,8 +33,8 @@ */ /* -** glyph-unicode.c: The implementation of APIs which conform to the specifiction -** of CSS 3, UAX#29, and UAX#14. +** simple-glyph-renderer.c: The implementation of GetGlyphsExtentFromUChars +** and DrawGlyphStringEx. ** ** Reference: ** diff --git a/src/newgdi/textrunsinfo.c b/src/newgdi/textrunsinfo.c index b40d969b..1f4d3f28 100644 --- a/src/newgdi/textrunsinfo.c +++ b/src/newgdi/textrunsinfo.c @@ -530,6 +530,7 @@ TEXTRUNSINFO* GUIAPI CreateTextRunsInfo(Uchar32* ucs, int nr_ucs, } if (!is_fontname_conformed(logfont_name, glyph_orient, orient_policy)) { + _WRN_PRINTF("Please check your fontname; it must conform to the glyph orientation."); return NULL; }