From c9ec23dc708556a940d2e3e53f3639689e5eab4d Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 16 Jan 2019 19:27:41 +0800 Subject: [PATCH] empty implementation of glyphs APIs for CSS --- include/gdi.h | 45 ++++++++++++++++++++++ src/newgdi/Makefile.am | 6 +-- src/newgdi/glyph-css.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 src/newgdi/glyph-css.c diff --git a/include/gdi.h b/include/gdi.h index 424db440..eb82a31f 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -9277,6 +9277,51 @@ typedef enum { WS_PRE_LINE, } WhiteSpaceRule; +/** + * The character transformation rule for \a GetGlyphsByRules. + */ +typedef enum { + CT_NONE, + CT_CAPITALIZE, + CT_UPPERCASE, + CT_LOWERCASE, + CT_FULL_WIDTH, + CT_FULL_SIZE_KANA, +} CharTransformRule; + +/** + * \fn int GUIAPI GetGlyphsByRules(LOGFONT* logfont, const char* mstr, int mstr_len, + * WhiteSpaceRule white_space, CharTransformRule trans_rule, + * Glyph32** glyphs, int* nr_glyphs); + * \brief Calculate the glyph string under the specified white space and + * transformation rule. + * + * This function calculates and allocates the glyph string from a multi-byte + * string under the specified white space rule \a white_space and transformation + * rule. + * + * The function will return if it encounters any hard line break or the null character. + * The hard line break will be included in the returned glyphs if there was one. + * + * \param logfont The logfont used to parse the string. + * \param mstr The pointer to the multi-byte string. + * \param mstr_len The length of \a mstr in bytes. + * \param white_space The white space rule. This parameter specifies two things: + * - whether and how white space inside the string is collapsed. + * - whether lines may wrap at unforced soft wrap opportunities. + * \param trans_rule The character transformation rule. + * \param glyphs The pointer to a buffer to store the address of the + * allocated glyph string. + * \param nr_glyphs The buffer to store the number of the allocated glyphs. + * + * \return The number of the bytes consumed in \a mstr. + * + * \sa WhiteSpaceRule, CharTransformRule, DrawGlyphStringEx + */ +MG_EXPORT int GUIAPI GetGlyphsByRules(LOGFONT* logfont, const char* mstr, int mstr_len, + WhiteSpaceRule white_space, CharTransformRule trans_rule, + Glyph32** glyphs, int* nr_glyphs); + /** * \fn int GUIAPI GetGlyphsExtentPointEx(LOGFONT* logfont, int x, int y, * const Glyph32* glyphs, int nr_glyphs, diff --git a/src/newgdi/Makefile.am b/src/newgdi/Makefile.am index 32c839ca..62b72911 100644 --- a/src/newgdi/Makefile.am +++ b/src/newgdi/Makefile.am @@ -14,12 +14,12 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \ region.c generators.c polygon.c flood.c \ advapi.c midash.c mispans.c miwideline.c \ mifillarc.c mifpolycon.c miarc.c rotatebmp.c \ - text.c glyph.c bidi.c \ - textout.c tabbedtextout.c drawtext.c + text.c glyph.c bidi.c glyph-css.c \ + textout.c tabbedtextout.c drawtext.c endif HDR_FILES = drawtext.h mi.h midc.h mistruct.h miwideline.h \ - pixel_ops.h mifillarc.h mispans.h polygon.h mifpoly.h + pixel_ops.h mifillarc.h mispans.h polygon.h mifpoly.h libnewgdi_la_SOURCES = $(SRC_FILES) $(HDR_FILES) diff --git a/src/newgdi/glyph-css.c b/src/newgdi/glyph-css.c new file mode 100644 index 00000000..800e0d6f --- /dev/null +++ b/src/newgdi/glyph-css.c @@ -0,0 +1,84 @@ +/* + * 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-css.c: The implementation of APIs which conform to the specifiction +** of CSS 3 +** +** Create date: 2019/01/16 +*/ + +#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 "fixedmath.h" +#include "glyph.h" + +int GUIAPI GetGlyphsByRules(LOGFONT* logfont, const char* mstr, int mstr_len, + WhiteSpaceRule white_space, CharTransformRule trans_rule, + Glyph32** glyphs, int* nr_glyphs) +{ + return 0; +} + +int GUIAPI GetGlyphsExtentPointEx (LOGFONT* logfont, int x, int y, + const Glyph32* glyphs, int nr_glyphs, + DWORD break_flags, int letter_spacing, int word_spacing, + WhiteSpaceRule white_space, int tab_size, + int max_extent, + LINEEXTINFO* line_ext_info, GLYPHEXTINFO* glyph_ext_info, POINT* pts) +{ + return 0; +} + +int GUIAPI DrawGlyphStringEx (HDC hdc, const Glyph32* glyphs, int nr_glyphs, + const POINT* pts) +{ + return 0; +} +