Intent to add new APIs: DrawShapedGlyph and DrawShapedGlyphLine

This commit is contained in:
Vincent Wei
2019-03-21 15:28:30 +08:00
parent 65972861a0
commit d9e09ac34f
6 changed files with 119 additions and 38 deletions
+40 -34
View File
@@ -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
+1 -1
View File
@@ -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
+74
View File
@@ -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 <http://www.gnu.org/licenses/>.
*
* 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
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
/*
** glyph-shaped.c:
** Implementation of DrawShapedGlyph and DrawLayoutLine.
**
** Create by WEI Yongming at 2019/03/21
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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 */
+1 -1
View File
@@ -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;
@@ -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:
**
+1
View File
@@ -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;
}