rename: LayoutInfo -> Layout, TextRunsInfo -> TextRuns

This commit is contained in:
Vincent Wei
2019-04-06 11:25:21 +08:00
parent e0b6a64402
commit 2b01f35cac
11 changed files with 213 additions and 213 deletions
+68 -68
View File
@@ -12187,13 +12187,13 @@ MG_EXPORT int GUIAPI UChars2AChars(LOGFONT* logfont, const Uchar32* ucs,
/**
* \defgroup glyph_render_flags Glyph Rendering Flags
*
* The glyph rendering flags indicates \a GetGlyphsExtentFromUChars and
* \a CreateLayoutInfo how to lay out the text:
* The glyph rendering flags indicate \a GetGlyphsExtentFromUChars and
* \a CreateLayout how to lay out the text:
* - The writing mode (horizontal or vertical) and the glyph orientation;
* - The indentation mode (none, first line or hanging);
* - Whether and how to break if the line overflows the max extent;
* - Whether and how to ellipsize if the line overflows the max extent;
* - The alignment of line;
* - The alignment of lines;
* - Whether and how to adjust the glyph position for alignment of justify;
* - The hanging punctation method;
* - Remove or hange the spaces at the start and/or end of the line.
@@ -12640,11 +12640,11 @@ MG_EXPORT int GUIAPI DrawGlyphStringEx (HDC hdc,
const Glyph32* glyphs, const GLYPHPOS* glyph_pos,
int nr_glyphs);
/* The fields in the structure _TEXTRUNSINFO are invisible to users */
typedef struct _TEXTRUNSINFO TEXTRUNSINFO;
/* The fields in the structure _TEXTRUNS are invisible to users */
typedef struct _TEXTRUNS TEXTRUNS;
/**
* \fn TEXTRUNSINFO* GUIAPI CreateTextRunsInfo(const Uchar32* ucs, int nr_ucs,
* \fn TEXTRUNS* GUIAPI CreateTextRuns(const Uchar32* ucs, int nr_ucs,
* LanguageCode lang_code, ParagraphDir base_dir,
* const char* logfont_name, RGBCOLOR color, RGBCOLOR bg_color,
* BreakOppo* break_oppos)
@@ -12652,7 +12652,7 @@ typedef struct _TEXTRUNSINFO TEXTRUNSINFO;
* \brief Split a Uchar32 paragraph string in mixed scripts into text runs.
*
* This function splits the Uchar32 paragraph \a ucs in mixed scripts
* into text runs, and returns a TEXTRUNSINFO object.
* into text runs, and returns a TEXTRUNS object.
*
* \param ucs The Uchar32 string returned by \a GetUCharsUntilParagraphBoundary.
* \param nr_ucs The length of the Uchar32 string.
@@ -12670,7 +12670,7 @@ typedef struct _TEXTRUNSINFO TEXTRUNSINFO;
* according to the script type of every text run. Please skip the first
* entry when you pass the pointer.
*
* \return The TEXTRUNSINFO object create; NULL for failure.
* \return The TEXTRUNS object create; NULL for failure.
*
* \note This function assumes that you passed one paragraph of
* the logical Unicode string. Therefore, you'd better to call this
@@ -12683,7 +12683,7 @@ typedef struct _TEXTRUNSINFO TEXTRUNSINFO;
*
* Since 3.4.0
*/
MG_EXPORT TEXTRUNSINFO* GUIAPI CreateTextRunsInfo(
MG_EXPORT TEXTRUNS* GUIAPI CreateTextRuns(
const Uchar32* ucs, int nr_ucs,
LanguageCode lang_code, ParagraphDir base_dir,
const char* logfont_name, RGBCOLOR color, RGBCOLOR bg_color,
@@ -12694,7 +12694,7 @@ MG_EXPORT TEXTRUNSINFO* GUIAPI CreateTextRunsInfo(
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI SetFontNameInTextRuns(TEXTRUNSINFO* truninfo,
MG_EXPORT BOOL GUIAPI SetFontNameInTextRuns(TEXTRUNS* truns,
int start_index, int length, const char* logfont_name);
/**
@@ -12703,14 +12703,14 @@ MG_EXPORT BOOL GUIAPI SetFontNameInTextRuns(TEXTRUNSINFO* truninfo,
* Since 3.4.0
*/
MG_EXPORT const char* GUIAPI GetFontNameInTextRuns(
const TEXTRUNSINFO* truninfo, int index);
const TEXTRUNS* truns, int index);
/**
* Set text olor in text runs.
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI SetTextColorInTextRuns(TEXTRUNSINFO* truninfo,
MG_EXPORT BOOL GUIAPI SetTextColorInTextRuns(TEXTRUNS* truns,
int start_index, int length, RGBCOLOR color);
/**
@@ -12719,14 +12719,14 @@ MG_EXPORT BOOL GUIAPI SetTextColorInTextRuns(TEXTRUNSINFO* truninfo,
* Since 3.4.0
*/
MG_EXPORT RGBCOLOR GUIAPI GetTextColorInTextRuns(
const TEXTRUNSINFO* truninfo, int index);
const TEXTRUNS* truns, int index);
/**
* Set background color in text runs.
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI SetBackgroundColorInTextRuns(TEXTRUNSINFO* truninfo,
MG_EXPORT BOOL GUIAPI SetBackgroundColorInTextRuns(TEXTRUNS* truns,
int start_index, int length, RGBCOLOR color);
/**
@@ -12735,34 +12735,34 @@ MG_EXPORT BOOL GUIAPI SetBackgroundColorInTextRuns(TEXTRUNSINFO* truninfo,
* Since 3.4.0
*/
MG_EXPORT RGBCOLOR GUIAPI GetBackgroundColorInTextRuns(
const TEXTRUNSINFO* truninfo, int index);
const TEXTRUNS* truns, int index);
/**
* \fn BOOL GUIAPI DestroyTextRunsInfo(TEXTRUNSINFO* truninfo)
* \fn BOOL GUIAPI DestroyTextRuns(TEXTRUNS* truns)
*
* \brief Destroy the glyph run info object. It also frees all data allocated
* for shapping and layouting the glyphs.
*
* This function destroies the specific TEXTRUNSINFO object \a truninfo.
* This function destroies the specific TEXTRUNS object \a truns.
*
* \param truninfo The TEXTRUNSINFO object.
* \param truns The TEXTRUNS object.
*
* \return TRUE for success, FALSE otherwise.
*
* \note Only available when support for UNICODE is enabled.
*
* \sa CreateTextRunsInfo
* \sa CreateTextRuns
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI DestroyTextRunsInfo(TEXTRUNSINFO* truninfo);
MG_EXPORT BOOL GUIAPI DestroyTextRuns(TEXTRUNS* truns);
/**
* \fn BOOL GUIAPI InitBasicShapingEngine(TEXTRUNSINFO* truninfo)
* \brief Initialize the base shaping engine for a TEXTRUNSINFO object.
* \fn BOOL GUIAPI InitBasicShapingEngine(TEXTRUNS* truns)
* \brief Initialize the base shaping engine for a TEXTRUNS object.
*
* This function initializes the base shaping engine for the specific
* TEXTRUNSINFO object \a truninfo.
* TEXTRUNS object \a truns.
*
* The basic shaping engine performs the basic shaping process
* according to the Unicode character properties if the script type
@@ -12775,29 +12775,29 @@ MG_EXPORT BOOL GUIAPI DestroyTextRunsInfo(TEXTRUNSINFO* truninfo);
* fonts. MiniGUI uses LGPL'd HarfBuzz to implement the complex
* shaping engine.
*
* After initializing the shapping engine, you can call \a CreateLayoutInfo
* After initializing the shapping engine, you can call \a CreateLayout
* to layout the Uchar32 paragraph string.
*
* \param truninfo The TEXTRUNSINFO object.
* \param truns The TEXTRUNS object.
*
* \return TRUE for success, FALSE otherwise.
*
* \note Only available when support for UNICODE is enabled.
*
* \sa InitComplexShapingEngine, CreateLayoutInfo
* \sa InitComplexShapingEngine, CreateLayout
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI InitBasicShapingEngine(TEXTRUNSINFO* truninfo);
MG_EXPORT BOOL GUIAPI InitBasicShapingEngine(TEXTRUNS* truns);
#ifdef _MGCOMPLEX_SCRIPTS
/**
* \fn BOOL GUIAPI InitComplexShapingEngine(TEXTRUNSINFO* truninfo)
* \brief Initialize the complex shaping engine for a TEXTRUNSINFO object.
* \fn BOOL GUIAPI InitComplexShapingEngine(TEXTRUNS* truns)
* \brief Initialize the complex shaping engine for a TEXTRUNS object.
*
* This function initializes the complex shaping engine for the specific
* TEXTRUNSINFO object \a truninfo.
* TEXTRUNS object \a truns.
*
* The complex shaping engine performs the complex shaping process
* according to the data contained in the OpenType Layout tables
@@ -12808,41 +12808,41 @@ MG_EXPORT BOOL GUIAPI InitBasicShapingEngine(TEXTRUNSINFO* truninfo);
* process which shapes the glyphs based on the Unicode character properties
* instead.
*
* After initializing the shapping engine, you can call \a CreateLayoutInfo
* After initializing the shapping engine, you can call \a CreateLayout
* to layout the Uchar32 paragraph string.
*
* \param truninfo The TEXTRUNSINFO object.
* \param truns The TEXTRUNS object.
*
* \return TRUE for success, FALSE otherwise.
*
* \note Only available when the support for UNICODE (_MGCHARSET_UNICODE)
* and the support for complex scripts (_MGCOMPLEX_SCRIPTS) are enabled.
*
* \sa InitBasicShapingEngine, CreateLayoutInfo
* \sa InitBasicShapingEngine, CreateLayout
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI InitComplexShapingEngine(TEXTRUNSINFO* truninfo);
MG_EXPORT BOOL GUIAPI InitComplexShapingEngine(TEXTRUNS* truns);
#endif /* _MGCOMPLEX_SCRIPTS */
typedef struct _LAYOUTINFO LAYOUTINFO;
typedef struct _LAYOUT LAYOUT;
typedef struct _LAYOUTLINE LAYOUTLINE;
/**
* \fn LAYOUTINFO* GUIAPI CreateLayoutInfo(
* const TEXTRUNSINFO* truninfo, Uint32 render_flags,
* \fn LAYOUT* GUIAPI CreateLayout(
* const TEXTRUNS* truns, Uint32 render_flags,
* const BreakOppo* break_oppos, BOOL persist_lines,
* int max_line_extent, int indent,
* int letter_spacing, int word_spacing, int tab_size,
* int* tabs, int nr_tabs)
* \brief Create layout information structure for laying out a paragraph.
*
* This function creates a LAYOUTINFO object for laying out a TEXTRUNSINFO
* object \a truninfo, which represents a Uchar32 paragraph in mixed scripts
* This function creates a LAYOUT object for laying out a TEXTRUNS
* object \a truns, which represents a Uchar32 paragraph in mixed scripts
* ready to lay out.
*
* \param truninfo The TEXTRUNSINFO object.
* \param truns The TEXTRUNS object.
* \param render_flags The render flags; see \a glyph_render_flags.
* \param break_oppos The breaking opportunities of the paragraph.
* \param persist_lines Whether to persist the lines laid out.
@@ -12856,35 +12856,35 @@ typedef struct _LAYOUTLINE LAYOUTLINE;
* \param tabs The array of the tab stops; can be NULL.
* \param nr_tabs The length of the tab stops array.
*
* \return The LAYOUTINFO object; NULL for error.
* \return The LAYOUT object; NULL for error.
*
* \sa CreateTextRunsInfo, InitBasicShapingEngine, InitComplexShapingEngine,
* \sa CreateTextRuns, InitBasicShapingEngine, InitComplexShapingEngine,
* UStrGetBreaks, LayoutNextLine
*
* Since 3.4.0
*/
MG_EXPORT LAYOUTINFO* GUIAPI CreateLayoutInfo(
const TEXTRUNSINFO* truninfo, Uint32 render_flags,
MG_EXPORT LAYOUT* GUIAPI CreateLayout(
const TEXTRUNS* truns, Uint32 render_flags,
const BreakOppo* break_oppos, BOOL persist_lines,
int max_line_extent, int indent,
int letter_spacing, int word_spacing, int tab_size,
int* tabs, int nr_tabs);
/**
* \fn BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* layout_info)
* \fn BOOL GUIAPI DestroyLayout(LAYOUT* layout)
* \brief Destroy the specified layout information structure.
*
* This function destroy the specific layout information object \a layout_info.
* This function destroy the specific layout information object \a layout.
*
* \param layout_info The LAYOUTINFO object.
* \param layout The LAYOUT object.
*
* \return TRUE for success, FALSE otherwise.
*
* \sa CreateLayoutInfo
* \sa CreateLayout
*
* Since 3.4.0
*/
MG_EXPORT BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* layout_info);
MG_EXPORT BOOL GUIAPI DestroyLayout(LAYOUT* layout);
/*
* \var typedef struct _RENDERDATA RENDERDATA
@@ -12894,12 +12894,12 @@ typedef struct _RENDERDATA {
/**
* The text runs object.
*/
const TEXTRUNSINFO* truninfo;
const TEXTRUNS* truns;
/**
* The layout object in which the glyph is contained.
*/
const LAYOUTINFO* layout;
const LAYOUT* layout;
/**
* The layout line object in which the glyph is located.
@@ -12951,21 +12951,21 @@ typedef BOOL (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt,
const RENDERDATA* render_data);
/**
* \fn LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUTINFO* layout_info,
* \fn LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUT* layout,
* LAYOUTLINE* prev_line, int max_extent, BOOL last_line,
* CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt)
* \brief Layout the next line of a paragraph according to the layout
* information.
*
* This function lays out the next line of in a LAYOUTLINE object
* \a layout_info. If \a prev_line is NULL, the function will returns
* \a layout. If \a prev_line is NULL, the function will returns
* the first line.
*
* You can pass the maximal extent of the next line via \a max_extent to
* control the output extent of every line. The function will wrap or
* ellipsize the line according to the rendering flags of the LAYOUTINFO
* ellipsize the line according to the rendering flags of the LAYOUT
* object. You can also control whether to render the next line as
* the last line of the LAYOUTINFO object via \a last_line parameter.
* the last line of the LAYOUT object via \a last_line parameter.
*
* The line size will be returned through \a line_size if it is not NULL.
* When there is a glyph positioned, the function will call \a cb_laid_out
@@ -12975,7 +12975,7 @@ typedef BOOL (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt,
* The previous line will be release if the LAYOUTLINE object is not
* persisted. In this way, you can save memory use of the LAYOUTLINE object.
*
* \param layout_info The LAYOUTINFO object.
* \param layout The LAYOUT object.
* \param prev_line NULL or the previous line object returned by this
* function.
* \param max_extent The maximal extent of the next line; No limit if
@@ -12988,11 +12988,11 @@ typedef BOOL (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt,
*
* \return NULL for no line, otherwise the next line object.
*
* \sa CreateLayoutInfo, DestroyLayoutInfo, CreateTextRunsInfo
* \sa CreateLayout, DestroyLayout, CreateTextRuns
*
* Since 3.4.0
*/
MG_EXPORT LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUTINFO* layout_info,
MG_EXPORT LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUT* layout,
LAYOUTLINE* prev_line, int max_extent, BOOL last_line,
CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt);
@@ -13008,7 +13008,7 @@ MG_EXPORT LAYOUTLINE* GUIAPI LayoutNextLine(LAYOUTINFO* layout_info,
*
* \return TRUE for success, FALSE otherwise.
*
* \sa CreateLayoutInfo, DestroyLayoutInfo, LayoutNextLine
* \sa CreateLayout, DestroyLayout, LayoutNextLine
*
* Since 3.4.0
*/
@@ -13041,7 +13041,7 @@ MG_EXPORT BOOL GUIAPI GetLayoutLineSize(const LAYOUTLINE* line,
* the top-right corner if the writing mode is
* GRF_WRITING_MODE_VERTICAL_RL.
*
* \sa CreateLayoutInfo, DestroyLayoutInfo, LayoutNextLine,
* \sa CreateLayout, DestroyLayout, LayoutNextLine,
* GetLayoutLineSize
*
* Since 3.4.0
@@ -13050,15 +13050,15 @@ MG_EXPORT BOOL GUIAPI GetLayoutLineRect(const LAYOUTLINE* line,
int* x, int* y, int line_height, RECT* line_rc);
/**
* \fn int GUIAPI CalcLayoutBoundingRect(LAYOUTINFO* layout_info,
* \fn int GUIAPI CalcLayoutBoundingRect(LAYOUT* layout,
* int max_line_extent, int max_height, int line_height,
* int x, int y, RECT* bounding)
* \brief Calculate the bounding rectangle of a layout.
*
* This function calculates the bounding rectangle of the specific
* layout object \a layout_info.
* layout object \a layout.
*
* \param layout_info The LAYOUTINFO object.
* \param layout The LAYOUT object.
* \param max_line_extent The maximal line extent; only effective if
* the line extent mode of the layout object is variable.
* \param max_height The maximal height of the lines; no limit if
@@ -13079,12 +13079,12 @@ MG_EXPORT BOOL GUIAPI GetLayoutLineRect(const LAYOUTLINE* line,
* the top-right corner if the writing mode is
* GRF_WRITING_MODE_VERTICAL_RL.
*
* \sa CreateLayoutInfo, DestroyLayoutInfo, LayoutNextLine
* \sa CreateLayout, DestroyLayout, LayoutNextLine
* GetLayoutLineRect
*
* Since 3.4.0
*/
MG_EXPORT int GUIAPI CalcLayoutBoundingRect(LAYOUTINFO* layout_info,
MG_EXPORT int GUIAPI CalcLayoutBoundingRect(LAYOUT* layout,
int max_line_extent, int max_height, int line_height,
int x, int y, RECT* bounding);
@@ -13112,7 +13112,7 @@ MG_EXPORT int GUIAPI CalcLayoutBoundingRect(LAYOUTINFO* layout_info,
* \param glyph_pos The glyph position and orientation information.
* \param render_data The rendering data of the glyph.
*
* \sa CreateLayoutInfo, DestroyLayoutInfo, LayoutNextLine,
* \sa CreateLayout, DestroyLayout, LayoutNextLine,
* DrawLayoutLine, GLYPHPOS, RENDERDATA
*
* Since 3.4.0
@@ -13150,7 +13150,7 @@ MG_EXPORT BOOL DrawShapedGlyph(HDC hdc,
* the top-right corner if the writing mode is
* GRF_WRITING_MODE_VERTICAL_RL.
*
* \sa CreateLayoutInfo, DestroyLayoutInfo, LayoutNextLine
* \sa CreateLayout, DestroyLayout, LayoutNextLine
*
* Since 3.4.0
*/
@@ -13160,7 +13160,7 @@ MG_EXPORT int DrawLayoutLine(HDC hdc, const LAYOUTLINE* line,
#ifdef _MGDEVEL_MODE
typedef struct _TextRun TEXTRUN;
MG_EXPORT TEXTRUN* GetNextTextRunInfo(TEXTRUNSINFO* runinfo,
MG_EXPORT TEXTRUN* GetNextTextRunInfo(TEXTRUNS* runinfo,
TEXTRUN* prev,
const char** fontname, int* start_index, int* length,
LanguageCode* lang_code, ScriptType* script,
+3 -3
View File
@@ -17,14 +17,14 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
text.c achar-uchar.c glyph.c legacy-bidi.c \
textout.c tabbedtextout.c drawtext.c \
simple-glyph-renderer.c glyph-shaped.c \
textrunsinfo.c \
textruns.c \
shape-glyphs-basic.c shape-glyphs-complex.c \
layoutinfo.c layout-utils.c layout-ellipsize.c
layout.c layout-utils.c layout-ellipsize.c
endif
HDR_FILES = glyph.h drawtext.h mi.h midc.h mistruct.h miwideline.h \
pixel_ops.h mifillarc.h mispans.h polygon.h mifpoly.h \
textrunsinfo.h layoutinfo.h
textruns.h layout.h
libnewgdi_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
+8 -8
View File
@@ -56,7 +56,7 @@
#include "cursor.h"
#include "drawtext.h"
#include "glyph.h"
#include "layoutinfo.h"
#include "layout.h"
#ifdef _MGCHARSET_UNICODE
@@ -68,7 +68,7 @@ BOOL DrawShapedGlyph(HDC hdc, Glyph32 gv,
if (glyph_pos == NULL || render_data == NULL)
return FALSE;
bg_color = GetBackgroundColorInTextRuns(render_data->truninfo,
bg_color = GetBackgroundColorInTextRuns(render_data->truns,
render_data->uc_index);
if (glyph_pos->suppressed == 0 && glyph_pos->whitespace == 0) {
@@ -77,7 +77,7 @@ BOOL DrawShapedGlyph(HDC hdc, Glyph32 gv,
SelectFont(hdc, render_data->logfont);
fg_color = GetTextColorInTextRuns(render_data->truninfo,
fg_color = GetTextColorInTextRuns(render_data->truns,
render_data->uc_index);
fg_pixel = DWORD2Pixel(hdc, fg_color);
SetTextColor(hdc, (DWORD)fg_pixel);
@@ -113,8 +113,8 @@ int DrawLayoutLine(HDC hdc, const LAYOUTLINE* line, int x, int y)
{
int n, line_offset, line_adv = 0;
struct list_head* i;
const TEXTRUNSINFO* truninfo;
const LAYOUTINFO* layout;
const TEXTRUNS* truns;
const LAYOUT* layout;
Uint32 def_ta, up_ta;
PLOGFONT old_lf = NULL;
@@ -122,7 +122,7 @@ int DrawLayoutLine(HDC hdc, const LAYOUTLINE* line, int x, int y)
return 0;
layout = line->layout;
truninfo = layout->truninfo;
truns = layout->truns;
switch (layout->rf & GRF_WRITING_MODE_MASK) {
case GRF_WRITING_MODE_HORIZONTAL_BT:
@@ -165,8 +165,8 @@ int DrawLayoutLine(HDC hdc, const LAYOUTLINE* line, int x, int y)
RGBCOLOR bg_color, fg_color;
// We might use an interator to optimize the color settings.
fg_color = GetTextColorInTextRuns(truninfo, log_index);
bg_color = GetBackgroundColorInTextRuns(truninfo, log_index);
fg_color = GetTextColorInTextRuns(truns, log_index);
bg_color = GetBackgroundColorInTextRuns(truns, log_index);
SetTextColor(hdc, DWORD2Pixel(hdc, fg_color));
if (bg_color) {
SetBkColor(hdc, DWORD2Pixel(hdc, bg_color));
+10 -10
View File
@@ -70,7 +70,7 @@
#include "window.h"
#include "devfont.h"
#include "unicode-ops.h"
#include "layoutinfo.h"
#include "layout.h"
typedef struct _EllipsizeState EllipsizeState;
typedef struct _RunInfo RunInfo;
@@ -124,7 +124,7 @@ struct _LineIter
/* State of ellipsization process */
struct _EllipsizeState
{
LAYOUTINFO *layout; /* Layout being ellipsized */
LAYOUT *layout; /* Layout being ellipsized */
RunInfo *run_info; /* Array of information about each run */
int nr_runs;
@@ -224,7 +224,7 @@ static BOOL line_iter_next_cluster (EllipsizeState *state, LineIter *iter)
iter->run_index++;
__mg_glyph_run_iter_init_start (&iter->run_iter,
state->run_info[iter->run_index].run,
state->layout->truninfo->ucs);
state->layout->truns->ucs);
}
}
@@ -242,7 +242,7 @@ static BOOL line_iter_prev_cluster (EllipsizeState *state, LineIter *iter)
iter->run_index--;
__mg_glyph_run_iter_init_end (&iter->run_iter,
state->run_info[iter->run_index].run,
state->layout->truninfo->ucs);
state->layout->truns->ucs);
}
}
@@ -293,7 +293,7 @@ static BOOL ends_at_ellipsization_boundary(EllipsizeState *state,
/*
* FIXME: Pango uses index + 1 here, but will overflow the bos array.
*/
assert(index < state->layout->truninfo->nr_ucs);
assert(index < state->layout->truns->nr_ucs);
return state->layout->bos[index] & BOV_GB_CURSOR_POS;
}
@@ -339,7 +339,7 @@ static void shape_ellipsis (EllipsizeState *state)
ellipsis_ucs = _ellipsis_baseline;
}
text_run = __mg_text_run_get_by_offset_const(state->layout->truninfo,
text_run = __mg_text_run_get_by_offset_const(state->layout->truns,
state->gap_start_iter.run_iter.start_index, NULL);
layout_run = __mg_layout_run_new_ellipsis (state->layout, text_run,
@@ -359,7 +359,7 @@ static void shape_ellipsis (EllipsizeState *state)
/* Now shape */
glyphs = state->ellipsis_grun->gstr;
__mg_shape_layout_run(state->layout->truninfo, layout_run, glyphs);
__mg_shape_layout_run(state->layout->truns, layout_run, glyphs);
state->ellipsis_width = 0;
for (i = 0; i < glyphs->nr_glyphs; i++)
@@ -384,7 +384,7 @@ static void update_ellipsis_shape (EllipsizeState *state)
BOOL is_cjk;
const TextRun* text_run;
text_run = __mg_text_run_get_by_offset_const(state->layout->truninfo,
text_run = __mg_text_run_get_by_offset_const(state->layout->truns,
state->gap_start_iter.run_iter.start_index, NULL);
if (state->fontname != text_run->fontname) {
@@ -395,7 +395,7 @@ static void update_ellipsis_shape (EllipsizeState *state)
/* Check whether we need to recompute the ellipsis because we switch
* from CJK to not or vice-versa
*/
start_wc = state->layout->truninfo->ucs[state->gap_start_iter.run_iter.start_index];
start_wc = state->layout->truns->ucs[state->gap_start_iter.run_iter.start_index];
is_cjk = IsUCharWide (start_wc);
if (is_cjk != state->ellipsis_is_cjk) {
@@ -457,7 +457,7 @@ static void find_initial_span (EllipsizeState *state)
cluster_width = 0; // Quiet GCC, the line must have at least one cluster
for (have_cluster = __mg_glyph_run_iter_init_start(run_iter, glyph_run,
state->layout->truninfo->ucs);
state->layout->truns->ucs);
have_cluster;
have_cluster = __mg_glyph_run_iter_next_cluster (run_iter))
{
+13 -13
View File
@@ -33,7 +33,7 @@
*/
/*
** layout-utils.c: The implementation of utilities related LAYOUTINFO
** layout-utils.c: The implementation of utilities related LAYOUT
**
** Create by WEI Yongming at 2019/03/21
*/
@@ -51,7 +51,7 @@
#include "window.h"
#include "devfont.h"
#include "unicode-ops.h"
#include "layoutinfo.h"
#include "layout.h"
#include "fontname.h"
static BOOL fontname_get_from_orient(char* fontname, GlyphOrient ort)
@@ -84,14 +84,14 @@ static BOOL fontname_get_from_orient(char* fontname, GlyphOrient ort)
}
/* Use MiniGUI resource manager to avoid duplicated logfonts */
LOGFONT* __mg_create_logfont_for_layout(const LAYOUTINFO* layout,
LOGFONT* __mg_create_logfont_for_layout(const LAYOUT* layout,
const char* fontname, GlyphOrient ort)
{
char my_fontname[LEN_LOGFONT_NAME_FULL + 1];
LOGFONT* lf;
if (fontname == NULL)
fontname = layout->truninfo->fontname;
fontname = layout->truns->fontname;
memset (my_fontname, 0, LEN_LOGFONT_NAME_FULL + 1);
strncpy (my_fontname, fontname, LEN_LOGFONT_NAME_FULL);
@@ -108,12 +108,12 @@ LOGFONT* __mg_create_logfont_for_layout(const LAYOUTINFO* layout,
return lf;
}
void __mg_release_logfont_for_layout(const LAYOUTINFO* layout,
void __mg_release_logfont_for_layout(const LAYOUT* layout,
const char* fontname, GlyphOrient ort)
{
char my_fontname[LEN_LOGFONT_NAME_FULL + 1];
if (fontname == NULL)
fontname = layout->truninfo->fontname;
fontname = layout->truns->fontname;
memset (my_fontname, 0, LEN_LOGFONT_NAME_FULL + 1);
strncpy (my_fontname, fontname, LEN_LOGFONT_NAME_FULL);
@@ -124,7 +124,7 @@ void __mg_release_logfont_for_layout(const LAYOUTINFO* layout,
ReleaseRes(Str2Key(my_fontname));
}
static GlyphOrient resolve_glyph_orient(const LAYOUTINFO* layout,
static GlyphOrient resolve_glyph_orient(const LAYOUT* layout,
const TextRun* trun)
{
GlyphGravity gravity;
@@ -142,7 +142,7 @@ static GlyphOrient resolve_glyph_orient(const LAYOUTINFO* layout,
return (GlyphOrient)gravity;
}
static void resolve_layout_run_dir(const LAYOUTINFO* layout,
static void resolve_layout_run_dir(const LAYOUT* layout,
LayoutRun* lrun)
{
/* The level vs. gravity dance:
@@ -193,7 +193,7 @@ static void resolve_layout_run_dir(const LAYOUTINFO* layout,
* in the same script, same direction, and same orientation. This is
* enough for the ellipsis.
*/
LayoutRun* __mg_layout_run_new_ellipsis(const LAYOUTINFO* layout,
LayoutRun* __mg_layout_run_new_ellipsis(const LAYOUT* layout,
const TextRun* trun, const Uchar32* ucs, int nr_ucs)
{
GlyphOrient ort;
@@ -220,7 +220,7 @@ LayoutRun* __mg_layout_run_new_ellipsis(const LAYOUTINFO* layout,
return lrun;
}
LayoutRun* __mg_layout_run_new_from(const LAYOUTINFO* layout,
LayoutRun* __mg_layout_run_new_from(const LAYOUT* layout,
const TextRun* trun)
{
GlyphOrient ort;
@@ -235,7 +235,7 @@ LayoutRun* __mg_layout_run_new_from(const LAYOUTINFO* layout,
lrun = mg_slice_new(LayoutRun);
lrun->lf = lf;
lrun->si = trun->si;
lrun->ucs = layout->truninfo->ucs + lrun->si;
lrun->ucs = layout->truns->ucs + lrun->si;
lrun->len = trun->len;
lrun->lc = trun->lc;
lrun->st = trun->st;
@@ -247,7 +247,7 @@ LayoutRun* __mg_layout_run_new_from(const LAYOUTINFO* layout,
return lrun;
}
LayoutRun* __mg_layout_run_new_from_offset(const LAYOUTINFO* layout,
LayoutRun* __mg_layout_run_new_from_offset(const LAYOUT* layout,
const TextRun* trun, int offset)
{
GlyphOrient ort;
@@ -269,7 +269,7 @@ LayoutRun* __mg_layout_run_new_from_offset(const LAYOUTINFO* layout,
lrun->lf = lf;
lrun->si = trun->si + offset;
lrun->ucs = layout->truninfo->ucs + lrun->si;
lrun->ucs = layout->truns->ucs + lrun->si;
lrun->len = trun->len - offset;
lrun->lc = trun->lc;
lrun->st = trun->st;
+63 -63
View File
@@ -33,7 +33,7 @@
*/
/*
** layoutlayout.c: The implementation of APIs related LAYOUTINFO
** layout.c: The implementation of APIs related LAYOUT
**
** Create by WEI Yongming at 2019/03/20
**
@@ -74,7 +74,7 @@
#include "window.h"
#include "devfont.h"
#include "unicode-ops.h"
#include "layoutinfo.h"
#include "layout.h"
#include "glyph.h"
static BOOL check_logfont_rotatable(LOGFONT* logfont)
@@ -103,25 +103,25 @@ static BOOL check_logfont_rotatable(LOGFONT* logfont)
return ok;
}
LAYOUTINFO* GUIAPI CreateLayoutInfo(
const TEXTRUNSINFO* truninfo, Uint32 render_flags,
LAYOUT* GUIAPI CreateLayout(
const TEXTRUNS* truns, Uint32 render_flags,
const BreakOppo* break_oppos, BOOL persist_lines,
int max_line_extent, int indent,
int letter_spacing, int word_spacing, int tab_size,
int* tabs, int nr_tabs)
{
LAYOUTINFO* layout;
LAYOUT* layout;
if (truninfo == NULL || truninfo->sei.inst == NULL) {
if (truns == NULL || truns->sei.inst == NULL) {
return NULL;
}
layout = (LAYOUTINFO*)mg_slice_new0(LAYOUTINFO);
layout = (LAYOUT*)mg_slice_new0(LAYOUT);
if (layout == NULL) {
return NULL;
}
layout->truninfo = truninfo;
layout->truns = truns;
layout->bos = break_oppos;
layout->rf = render_flags;
layout->ls = letter_spacing;
@@ -135,12 +135,12 @@ LAYOUTINFO* GUIAPI CreateLayoutInfo(
layout->lf_upright = __mg_create_logfont_for_layout(layout,
NULL, GLYPH_ORIENT_UPRIGHT);
if (layout->lf_upright == NULL) {
mg_slice_delete(LAYOUTINFO, layout);
mg_slice_delete(LAYOUT, layout);
return NULL;
}
INIT_LIST_HEAD(&layout->lines);
layout->nr_left_ucs = truninfo->nr_ucs;
layout->nr_left_ucs = truns->nr_ucs;
if (render_flags & GRF_WRITING_MODE_VERTICAL_FLAG) {
if (!check_logfont_rotatable(layout->lf_upright)) {
@@ -207,7 +207,7 @@ static void release_line(LAYOUTLINE* line)
mg_slice_delete(LAYOUTLINE, line);
}
BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* layout)
BOOL GUIAPI DestroyLayout(LAYOUT* layout)
{
if (layout->lf_upright) {
FONT_RES* font_res = (FONT_RES*)layout->lf_upright;
@@ -221,7 +221,7 @@ BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* layout)
release_line(line);
}
mg_slice_delete(LAYOUTINFO, layout);
mg_slice_delete(LAYOUT, layout);
return TRUE;
}
@@ -264,7 +264,7 @@ struct _LayoutState {
// Local array for logical widths
int local_log_widths[LOCAL_ARRAY_SIZE];
// Character offset of first lrun in state->lrun in layout->truninfo->ucs
// Character offset of first lrun in state->lrun in layout->truns->ucs
int start_offset;
/* maintained per line */
@@ -301,7 +301,7 @@ static inline void state_log_widths_free(LayoutState* state)
state->log_widths = NULL;
}
static BOOL should_ellipsize_current_line(LAYOUTINFO *layout,
static BOOL should_ellipsize_current_line(LAYOUT *layout,
LayoutState *state)
{
if (((layout->rf & GRF_OVERFLOW_ELLIPSIZE_MASK) ==
@@ -315,7 +315,7 @@ static BOOL should_ellipsize_current_line(LAYOUTINFO *layout,
return TRUE;
}
int __mg_shape_layout_run(const TEXTRUNSINFO* info, const LayoutRun* run,
int __mg_shape_layout_run(const TEXTRUNS* info, const LayoutRun* run,
GlyphString* glyphs)
{
if (!info->sei.shape(info->sei.inst, info, run, glyphs))
@@ -324,7 +324,7 @@ int __mg_shape_layout_run(const TEXTRUNSINFO* info, const LayoutRun* run,
return glyphs->nr_glyphs;
}
static void ensure_tab_width(LAYOUTINFO *layout)
static void ensure_tab_width(LAYOUT *layout)
{
if (layout->ts == -1) {
/* Find out how wide 8 spaces are in the context's default
@@ -345,7 +345,7 @@ static void ensure_tab_width(LAYOUTINFO *layout)
/* For now we only need the tab position, we assume
* all tabs are left-aligned.
*/
static int get_tab_pos(LAYOUTINFO *layout, int index, BOOL *is_default)
static int get_tab_pos(LAYOUT *layout, int index, BOOL *is_default)
{
int n_tabs;
@@ -465,7 +465,7 @@ static void shape_tab(LAYOUTLINE *line, GlyphString *glyphs)
}
}
static void shape_space(const LAYOUTINFO* layout, const LayoutRun* lrun,
static void shape_space(const LAYOUT* layout, const LayoutRun* lrun,
GlyphString* gstr)
{
unsigned int i;
@@ -529,7 +529,7 @@ static void shape_shape(const Uchar32* ucs, int nr_ucs,
static void shape_full(const Uchar32* lrun_ucs, int nr_lrun_ucs,
const Uchar32* para_ucs, int nr_para_ucs,
const TEXTRUNSINFO* info, const LayoutRun* lrun,
const TEXTRUNS* info, const LayoutRun* lrun,
GlyphString* glyphs)
{
// TODO
@@ -551,10 +551,10 @@ static void distribute_letter_spacing (int extra_spacing,
static GlyphString* shape_run(LAYOUTLINE *line, LayoutState *state,
LayoutRun *lrun)
{
LAYOUTINFO *layout = line->layout;
LAYOUT *layout = line->layout;
GlyphString *glyphs = __mg_glyph_string_new ();
if (layout->truninfo->ucs[lrun->si] == UCHAR_TAB) {
if (layout->truns->ucs[lrun->si] == UCHAR_TAB) {
shape_tab(line, glyphs);
}
else if (lrun->flags & LAYOUTRUN_FLAG_NO_SHAPING) {
@@ -563,13 +563,13 @@ static GlyphString* shape_run(LAYOUTLINE *line, LayoutState *state,
}
else {
if (state->shape_set)
shape_shape(layout->truninfo->ucs + lrun->si, lrun->len,
shape_shape(layout->truns->ucs + lrun->si, lrun->len,
&state->shape_ink_rect,
&state->shape_logical_rect, glyphs);
else
shape_full(layout->truninfo->ucs + lrun->si, lrun->len,
layout->truninfo->ucs, layout->truninfo->nr_ucs,
layout->truninfo, lrun, glyphs);
shape_full(layout->truns->ucs + lrun->si, lrun->len,
layout->truns->ucs, layout->truns->nr_ucs,
layout->truns, lrun, glyphs);
if (layout->ls) {
GlyphRun glyph_run;
@@ -579,7 +579,7 @@ static GlyphString* shape_run(LAYOUTLINE *line, LayoutState *state,
glyph_run.gstr = glyphs;
__mg_glyph_run_letter_space (&glyph_run,
layout->truninfo->ucs,
layout->truns->ucs,
layout->bos + state->start_offset,
layout->ls);
@@ -606,7 +606,7 @@ static void free_glyph_run (GlyphRun *grun)
}
#ifdef _DEBUG
static inline void print_text_runs(const TEXTRUNSINFO* info, const char* func)
static inline void print_text_runs(const TEXTRUNS* info, const char* func)
{
int j = 0;
struct list_head* i;
@@ -649,7 +649,7 @@ static inline void print_line_runs(const LAYOUTLINE* line, const char* func)
}
}
static inline void print_run(const GlyphRun* run, const char* func)
static inline void print_glyph_run(const GlyphRun* run, const char* func)
{
_DBG_PRINTF("Run in %s:\n", func);
_DBG_PRINTF(" ADDRESS: %p\n", run);
@@ -674,7 +674,7 @@ static inline void list_print(struct list_head* head, const char* desc)
#else
static inline void print_text_runs(const TEXTRUNSINFO* info, const char* func)
static inline void print_text_runs(const TEXTRUNS* info, const char* func)
{
// do nothing.
}
@@ -684,7 +684,7 @@ static inline void print_line_runs(const LAYOUTLINE* line, const char* func)
// do nothing.
}
static inline void print_run(const GlyphRun* run, const char* func)
static inline void print_glyph_run(const GlyphRun* run, const char* func)
{
// do nothing.
}
@@ -734,12 +734,12 @@ static GlyphRun* insert_run(LAYOUTLINE *line, LayoutState *state,
return glyph_run;
}
static inline BOOL can_break_at (LAYOUTINFO *layout,
static inline BOOL can_break_at (LAYOUT *layout,
int offset, BOOL always_wrap_char)
{
Uint32 wrap = layout->rf & GRF_OVERFLOW_WRAP_MASK;
if (offset == layout->truninfo->nr_ucs)
if (offset == layout->truns->nr_ucs)
return TRUE;
if (always_wrap_char)
@@ -753,13 +753,13 @@ static inline BOOL can_break_at (LAYOUTINFO *layout,
else if (wrap == GRF_OVERFLOW_WRAP_ANYWHERE)
return layout->bos[offset] & BOV_GB_CHAR_BREAK;
else {
_WRN_PRINTF ("broken LayoutInfo");
_WRN_PRINTF ("broken Layout");
}
return TRUE;
}
static inline BOOL can_break_in (LAYOUTINFO *layout,
static inline BOOL can_break_in (LAYOUT *layout,
int start_offset, int num_chars, BOOL allow_break_at_start)
{
int i;
@@ -792,7 +792,7 @@ static inline BOOL can_break_in (LAYOUTINFO *layout,
* or %BREAK_NONE_FIT returned. This is used when the end of the
* run is not a break position.
*/
BreakResult process_layout_run(LAYOUTINFO *layout,
BreakResult process_layout_run(LAYOUT *layout,
LAYOUTLINE *line, LayoutState *state,
BOOL force_fit, BOOL no_break_at_end)
{
@@ -812,7 +812,7 @@ BreakResult process_layout_run(LAYOUTINFO *layout,
}
if (!layout->single_paragraph &&
layout->truninfo->ucs[lrun->si] == UCHAR_LINE_SEPARATOR &&
layout->truns->ucs[lrun->si] == UCHAR_LINE_SEPARATOR &&
!should_ellipsize_current_line (layout, state)) {
insert_run(line, state, lrun, TRUE);
state->log_widths_offset += lrun->len;
@@ -857,7 +857,7 @@ BreakResult process_layout_run(LAYOUTINFO *layout,
assert(state->log_widths == NULL);
state_log_widths_new(state, lrun->len);
__mg_glyph_run_get_logical_widths(&glyph_run, layout->truninfo->ucs,
__mg_glyph_run_get_logical_widths(&glyph_run, layout->truns->ucs,
state->log_widths);
}
@@ -955,7 +955,7 @@ retry_break:
}
}
static LAYOUTLINE *layout_line_new(LAYOUTINFO *layout)
static LAYOUTLINE *layout_line_new(LAYOUT *layout)
{
LAYOUTLINE *line = mg_slice_new0(LAYOUTLINE);
@@ -1184,7 +1184,7 @@ static void layout_line_reorder(LAYOUTLINE *line)
static void zero_line_final_space (LAYOUTLINE *line,
LayoutState *state, GlyphRun *run)
{
LAYOUTINFO *layout = line->layout;
LAYOUT *layout = line->layout;
LayoutRun *lrun = run->lrun;
GlyphString *glyphs = run->gstr;
int glyph = lrun->el % 2 ? 0 : glyphs->nr_glyphs - 1;
@@ -1240,9 +1240,9 @@ static void pad_glyphstring_left (GlyphString *glyphs,
glyphs->glyphs[glyph].x_off += adjustment;
}
static inline BOOL is_tab_run(LAYOUTINFO *layout, GlyphRun *grun)
static inline BOOL is_tab_run(LAYOUT *layout, GlyphRun *grun)
{
return (layout->truninfo->ucs[grun->lrun->si] == '\t');
return (layout->truns->ucs[grun->lrun->si] == '\t');
}
/* When doing shaping, we add the letter spacing value for a
@@ -1259,7 +1259,7 @@ static inline BOOL is_tab_run(LAYOUTINFO *layout, GlyphRun *grun)
*/
static void adjust_line_letter_spacing(LAYOUTLINE *line, LayoutState *state)
{
LAYOUTINFO *layout = line->layout;
LAYOUT *layout = line->layout;
BOOL reversed;
GlyphRun *last_run;
int tab_adjustment;
@@ -1346,7 +1346,7 @@ static void adjust_line_letter_spacing(LAYOUTLINE *line, LayoutState *state)
static void justify_clusters (LAYOUTLINE *line, LayoutState *state)
{
const Uchar32 *text = line->layout->truninfo->ucs;
const Uchar32 *text = line->layout->truns->ucs;
const BreakOppo *bos = line->layout->bos;
int total_remaining_width, total_gaps = 0;
@@ -1482,7 +1482,7 @@ static void justify_clusters (LAYOUTLINE *line, LayoutState *state)
static void justify_words (LAYOUTLINE *line,
LayoutState *state)
{
const Uchar32 *text = line->layout->truninfo->ucs;
const Uchar32 *text = line->layout->truns->ucs;
const BreakOppo *bos = line->layout->bos;
int total_remaining_width, total_space_width = 0;
@@ -1625,7 +1625,7 @@ static void layout_line_postprocess (LAYOUTLINE *line,
line->is_ellipsized |= ellipsized;
}
static LAYOUTLINE* check_next_line(LAYOUTINFO* layout, LayoutState* state)
static LAYOUTLINE* check_next_line(LAYOUT* layout, LayoutState* state)
{
LAYOUTLINE *line;
@@ -1680,7 +1680,7 @@ static LAYOUTLINE* check_next_line(LAYOUTINFO* layout, LayoutState* state)
state->trun = (const TextRun*)state->trun->list.next;
state->start_index_in_trun = 0;
state->start_offset += old_num_chars;
if (&state->trun->list == &layout->truninfo->truns)
if (&state->trun->list == &layout->truns->truns)
state->trun = NULL;
break;
@@ -1712,7 +1712,7 @@ static LAYOUTLINE* check_next_line(LAYOUTINFO* layout, LayoutState* state)
print_line_runs(line, __FUNCTION__);
/* determine start text run again */
state->trun = __mg_text_run_get_by_offset_const(layout->truninfo,
state->trun = __mg_text_run_get_by_offset_const(layout->truns,
state->start_offset, &state->start_index_in_trun);
if (state->start_index_in_trun > 0) {
state->lrun = __mg_layout_run_new_from_offset(layout,
@@ -1736,7 +1736,7 @@ static LAYOUTLINE* check_next_line(LAYOUTINFO* layout, LayoutState* state)
state->trun = (const TextRun*)state->trun->list.next;
state->start_index_in_trun = 0;
state->start_offset += old_num_chars;
if (&state->trun->list == &layout->truninfo->truns)
if (&state->trun->list == &layout->truns->truns)
state->trun = NULL;
/* A line-separate is just a forced break. Set wrapped, so we do
* justification */
@@ -1789,7 +1789,7 @@ static inline int line_dir_to_simple(LineDirection d)
}
/* call this when layout has auto_dir property */
static Uint32 get_line_alignment(const LAYOUTINFO *layout,
static Uint32 get_line_alignment(const LAYOUT *layout,
const LAYOUTLINE *line)
{
Uint32 alignment = layout->rf & GRF_ALIGN_MASK;
@@ -1825,7 +1825,7 @@ static inline int line_dir_to_factor(LineDirection d)
#else
static Uint32 get_line_alignment(const LAYOUTINFO *layout,
static Uint32 get_line_alignment(const LAYOUT *layout,
const LAYOUTLINE *line)
{
Uint32 alignment = layout->rf & GRF_ALIGN_MASK;
@@ -1856,7 +1856,7 @@ static Uint32 get_line_alignment(const LAYOUTINFO *layout,
}
#endif
int __mg_layout_get_line_offset(const LAYOUTINFO *layout,
int __mg_layout_get_line_offset(const LAYOUT *layout,
const LAYOUTLINE *line)
{
int x_offset;
@@ -1902,7 +1902,7 @@ done:
return x_offset;
}
static int traverse_line_glyphs(const LAYOUTINFO* layout,
static int traverse_line_glyphs(const LAYOUT* layout,
const LAYOUTLINE* line,
CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt)
{
@@ -1913,7 +1913,7 @@ static int traverse_line_glyphs(const LAYOUTINFO* layout,
Uint32 def_ta, up_ta;
int line_offset;
extra.truninfo = layout->truninfo;
extra.truns = layout->truns;
extra.layout = layout;
extra.line = line;
@@ -1953,9 +1953,9 @@ static int traverse_line_glyphs(const LAYOUTINFO* layout,
extra.logfont = run->lrun->lf;
#if 0
extra.fg_color = GetTextColorInTextRuns(layout->truninfo,
extra.fg_color = GetTextColorInTextRuns(layout->truns,
extra.uc_index);
extra.bg_color = GetBackgroundColorInTextRuns(layout->truninfo,
extra.bg_color = GetBackgroundColorInTextRuns(layout->truns,
extra.uc_index);
#endif
extra.uc = run->lrun->ucs[run->gstr->log_clusters[j]];
@@ -2059,7 +2059,7 @@ static int traverse_line_glyphs(const LAYOUTINFO* layout,
}
LAYOUTLINE* GUIAPI LayoutNextLine(
LAYOUTINFO* layout, LAYOUTLINE* prev_line,
LAYOUT* layout, LAYOUTLINE* prev_line,
int max_extent, BOOL last_line,
CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt)
{
@@ -2098,13 +2098,13 @@ LAYOUTLINE* GUIAPI LayoutNextLine(
//state.shape_ink_rect;
//state.shape_logical_rect;
state.base_dir = layout->truninfo->base_dir;
state.base_dir = layout->truns->base_dir;
state.glyphs = NULL;
state.log_widths = NULL;
state.log_widths_offset = 0;
if (prev_line == NULL) {
if (list_empty(&layout->truninfo->truns)) {
if (list_empty(&layout->truns->truns)) {
// empty line
next_line = NULL;
goto out;
@@ -2113,13 +2113,13 @@ LAYOUTLINE* GUIAPI LayoutNextLine(
state.line_start_index = 0;
state.start_offset = 0;
state.start_index_in_trun = 0;
state.trun = (TextRun*)layout->truninfo->truns.next;
state.trun = (TextRun*)layout->truns->truns.next;
}
else {
state.line_start_index = layout->truninfo->nr_ucs - layout->nr_left_ucs;
state.line_start_index = layout->truns->nr_ucs - layout->nr_left_ucs;
state.start_offset = state.line_start_index;
state.start_index_in_trun = 0;
state.trun = __mg_text_run_get_by_offset_const(layout->truninfo,
state.trun = __mg_text_run_get_by_offset_const(layout->truns,
state.line_start_index, &state.start_index_in_trun);
#if 0
@@ -2222,7 +2222,7 @@ BOOL GUIAPI GetLayoutLineSize(const LAYOUTLINE* line,
BOOL GUIAPI GetLayoutLineRect(const LAYOUTLINE* line,
int* x, int* y, int line_height, RECT* line_rc)
{
const LAYOUTINFO* layout;
const LAYOUT* layout;
int line_offset;
if (line == NULL || line->width < 0 || line->height < 0)
@@ -2276,7 +2276,7 @@ BOOL GUIAPI GetLayoutLineRect(const LAYOUTLINE* line,
return TRUE;
}
int GUIAPI CalcLayoutBoundingRect(LAYOUTINFO* layout,
int GUIAPI CalcLayoutBoundingRect(LAYOUT* layout,
int max_line_extent, int max_height, int line_height,
int x, int y, RECT* bounding)
{
+15 -15
View File
@@ -33,16 +33,16 @@
*/
/*
** layoutinfo.h: Internal interface related to LAYOUTINFO.
** layoutinfo.h: Internal interface related to LAYOUT.
**
** Create by WEI Yongming at 2019/03/20
*/
#ifndef _MG_NEWGDI_LAYOUTINFO_H
#define _MG_NEWGDI_LAYOUTINFO_H
#ifndef _MG_NEWGDI_LAYOUT_H
#define _MG_NEWGDI_LAYOUT_H
#include "list.h"
#include "textrunsinfo.h"
#include "textruns.h"
typedef struct _GlyphRun GlyphRun;
typedef struct _ShapedGlyph ShapedGlyph;
@@ -101,7 +101,7 @@ typedef enum {
struct _LAYOUTLINE {
struct list_head list;
LAYOUTINFO* layout;
LAYOUT* layout;
int* log_widths; // the widths of the logical chars
struct list_head gruns; // the list head for glyph runs
@@ -120,8 +120,8 @@ struct _LAYOUTLINE {
Uint32 is_ellipsized:1; // is ellipsized?
};
struct _LAYOUTINFO {
const TEXTRUNSINFO* truninfo;
struct _LAYOUT {
const TEXTRUNS* truns;
const BreakOppo* bos;
const int* tabs; // tabstop array
int nr_tabs; // number of tabstops
@@ -164,19 +164,19 @@ struct _GlyphRunIter {
extern "C" {
#endif /* __cplusplus */
LOGFONT* __mg_create_logfont_for_layout(const LAYOUTINFO* layout,
LOGFONT* __mg_create_logfont_for_layout(const LAYOUT* layout,
const char* fontname, GlyphOrient ort);
void __mg_release_logfont_for_layout(const LAYOUTINFO* layout,
void __mg_release_logfont_for_layout(const LAYOUT* layout,
const char* fontname, GlyphOrient ort);
GlyphRun *__mg_glyph_run_split (GlyphRun *orig, int split_index);
void __mg_glyph_run_free(GlyphRun* run);
LayoutRun* __mg_layout_run_new_ellipsis(const LAYOUTINFO* layout,
LayoutRun* __mg_layout_run_new_ellipsis(const LAYOUT* layout,
const TextRun* trun, const Uchar32* ucs, int nr_ucs);
LayoutRun* __mg_layout_run_new_from(const LAYOUTINFO* layout,
LayoutRun* __mg_layout_run_new_from(const LAYOUT* layout,
const TextRun* trun);
LayoutRun* __mg_layout_run_new_from_offset(const LAYOUTINFO* layout,
LayoutRun* __mg_layout_run_new_from_offset(const LAYOUT* layout,
const TextRun* trun, int offset);
void __mg_layout_run_free(LayoutRun* run);
@@ -208,18 +208,18 @@ void __mg_glyph_run_letter_space (const GlyphRun* glyph_run,
BOOL __mg_layout_line_ellipsize(LAYOUTLINE *line, int goal_width);
int __mg_shape_layout_run(const TEXTRUNSINFO* info, const LayoutRun* run,
int __mg_shape_layout_run(const TEXTRUNS* info, const LayoutRun* run,
GlyphString* glyphs);
void __mg_reverse_shaped_glyphs(ShapedGlyph* glyphs, int len);
void __mg_reverse_log_clusters(int* clusters, int len);
int __mg_layout_get_line_offset(const LAYOUTINFO *layout,
int __mg_layout_get_line_offset(const LAYOUT *layout,
const LAYOUTLINE *line);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // _MG_NEWGDI_LAYOUTINFO_H
#endif // _MG_NEWGDI_LAYOUT_H
+3 -3
View File
@@ -55,7 +55,7 @@
#include "window.h"
#include "devfont.h"
#include "unicode-ops.h"
#include "layoutinfo.h"
#include "layout.h"
#include "glyph.h"
/* Local array size, used for stack-based local arrays */
@@ -67,7 +67,7 @@
#endif
static BOOL shape_layout_run(SEInstance* inst,
const TEXTRUNSINFO* info, const LayoutRun* run,
const TEXTRUNS* info, const LayoutRun* run,
GlyphString* gs)
{
BOOL ok = FALSE;
@@ -293,7 +293,7 @@ static BOOL destroy_instance(SEInstance* instance)
return FALSE;
}
BOOL GUIAPI InitBasicShapingEngine(TEXTRUNSINFO* info)
BOOL GUIAPI InitBasicShapingEngine(TEXTRUNS* info)
{
shaping_engine_basic.ref_count++;
+2 -2
View File
@@ -55,9 +55,9 @@
#include "window.h"
#include "devfont.h"
#include "unicode-ops.h"
#include "textrunsinfo.h"
#include "textruns.h"
BOOL GUIAPI InitComplexShapingEngine(TEXTRUNSINFO* run_info)
BOOL GUIAPI InitComplexShapingEngine(TEXTRUNS* run_info)
{
return FALSE;
}
@@ -33,7 +33,7 @@
*/
/*
** textrunsinfo.c: The implementation of APIs related to TEXTRUNSINFO
** textrunsinfo.c: The implementation of APIs related to TEXTRUNS
**
** Create by WEI Yongming at 2019/03/15
*/
@@ -51,7 +51,7 @@
#include "window.h"
#include "devfont.h"
#include "unicode-ops.h"
#include "textrunsinfo.h"
#include "textruns.h"
#include "fontname.h"
/* Local array size, used for stack-based local arrays */
@@ -72,7 +72,7 @@ enum {
};
typedef struct _TextRunState {
TEXTRUNSINFO* runinfo;
TEXTRUNS* runinfo;
const Uchar32* text;
const Uchar32* end;
TextRun* run;
@@ -295,7 +295,7 @@ static BOOL state_next (TextRunState *state)
return TRUE;
}
static BOOL create_text_runs(TEXTRUNSINFO* runinfo, BidiLevel* els)
static BOOL create_text_runs(TEXTRUNS* runinfo, BidiLevel* els)
{
BOOL ok = FALSE;
TextRunState state;
@@ -379,7 +379,7 @@ static inline Uint8 get_gravity_from_fontname (const char* fontname)
}
#ifdef _MGDEVEL_MODE
TEXTRUN* GetNextTextRunInfo(TEXTRUNSINFO* runinfo,
TEXTRUN* GetNextTextRunInfo(TEXTRUNS* runinfo,
TEXTRUN* prev,
const char** fontname, int* start_index, int* length,
LanguageCode* lang_code, ScriptType* script,
@@ -438,14 +438,14 @@ out:
return ok;
}
TEXTRUNSINFO* GUIAPI CreateTextRunsInfo(const Uchar32* ucs, int nr_ucs,
TEXTRUNS* GUIAPI CreateTextRuns(const Uchar32* ucs, int nr_ucs,
LanguageCode lang_code, ParagraphDir base_dir,
const char* logfont_name, RGBCOLOR color, RGBCOLOR bg_color,
BreakOppo* break_oppos)
{
BOOL ok = FALSE;
TEXTRUNSINFO* runinfo;
TEXTRUNS* runinfo;
BidiLevel local_els[LOCAL_ARRAY_SIZE];
BidiLevel* els = NULL;
@@ -458,7 +458,7 @@ TEXTRUNSINFO* GUIAPI CreateTextRunsInfo(const Uchar32* ucs, int nr_ucs,
return NULL;
}
runinfo = (TEXTRUNSINFO*)mg_slice_new0(TEXTRUNSINFO);
runinfo = (TEXTRUNS*)mg_slice_new0(TEXTRUNS);
if (runinfo == NULL) {
return NULL;
}
@@ -533,12 +533,12 @@ out:
if (ok)
return runinfo;
mg_slice_delete(TEXTRUNSINFO, runinfo);
mg_slice_delete(TEXTRUNS, runinfo);
return NULL;
}
TextRun* __mg_text_run_get_by_offset(TEXTRUNSINFO* runinfo,
TextRun* __mg_text_run_get_by_offset(TEXTRUNS* runinfo,
int index, int *start_offset)
{
struct list_head *i;
@@ -561,7 +561,7 @@ TextRun* __mg_text_run_get_by_offset(TEXTRUNSINFO* runinfo,
}
const TextRun* __mg_text_run_get_by_offset_const(
const TEXTRUNSINFO* runinfo, int index, int *start_offset)
const TEXTRUNS* runinfo, int index, int *start_offset)
{
struct list_head *i;
const TextRun* found = NULL;
@@ -615,7 +615,7 @@ TextRun* __mg_text_run_split(TextRun *orig, int split_index)
return new_run;
}
BOOL GUIAPI SetFontNameInTextRuns(TEXTRUNSINFO* runinfo,
BOOL GUIAPI SetFontNameInTextRuns(TEXTRUNS* runinfo,
int start_index, int length, const char* logfont_name)
{
TextRun* run;
@@ -713,7 +713,7 @@ BOOL GUIAPI SetFontNameInTextRuns(TEXTRUNSINFO* runinfo,
return TRUE;
}
const char* GUIAPI GetFontNameInTextRuns(const TEXTRUNSINFO* runinfo, int index)
const char* GUIAPI GetFontNameInTextRuns(const TEXTRUNS* runinfo, int index)
{
struct list_head *i;
@@ -733,7 +733,7 @@ out:
return runinfo->fontname;
}
BOOL GUIAPI SetTextColorInTextRuns(TEXTRUNSINFO* runinfo,
BOOL GUIAPI SetTextColorInTextRuns(TEXTRUNS* runinfo,
int start_index, int length, RGBCOLOR color)
{
TextColorMap* color_entry = NULL;
@@ -778,7 +778,7 @@ error:
return FALSE;
}
RGBCOLOR GetTextColorInTextRuns(const TEXTRUNSINFO* runinfo, int index)
RGBCOLOR GetTextColorInTextRuns(const TEXTRUNS* runinfo, int index)
{
struct list_head *i;
@@ -794,7 +794,7 @@ RGBCOLOR GetTextColorInTextRuns(const TEXTRUNSINFO* runinfo, int index)
return runinfo->fg_colors.value;
}
BOOL GUIAPI SetBackgroundColorInTextRuns(TEXTRUNSINFO* runinfo,
BOOL GUIAPI SetBackgroundColorInTextRuns(TEXTRUNS* runinfo,
int start_index, int length, RGBCOLOR color)
{
TextColorMap* color_entry = NULL;
@@ -839,7 +839,7 @@ error:
return FALSE;
}
RGBCOLOR GetBackgroundColorInTextRuns(const TEXTRUNSINFO* runinfo, int index)
RGBCOLOR GetBackgroundColorInTextRuns(const TEXTRUNS* runinfo, int index)
{
struct list_head *i;
@@ -855,7 +855,7 @@ RGBCOLOR GetBackgroundColorInTextRuns(const TEXTRUNSINFO* runinfo, int index)
return runinfo->bg_colors.value;
}
BOOL GUIAPI DestroyTextRunsInfo(TEXTRUNSINFO* runinfo)
BOOL GUIAPI DestroyTextRuns(TEXTRUNS* runinfo)
{
if (runinfo == NULL)
return FALSE;
@@ -885,7 +885,7 @@ BOOL GUIAPI DestroyTextRunsInfo(TEXTRUNSINFO* runinfo)
}
free(runinfo->fontname);
mg_slice_delete(TEXTRUNSINFO, runinfo);
mg_slice_delete(TEXTRUNS, runinfo);
return TRUE;
}
@@ -33,13 +33,13 @@
*/
/*
** textrunsinfo.h: Internal interface related to TEXTRUNSINFO.
** textruns.h: Internal interface related to TEXTRUNS.
**
** Create by WEI Yongming at 2019/03/15
*/
#ifndef _MG_NEWGDI_TEXTRUNSINFO_H
#define _MG_NEWGDI_TEXTRUNSINFO_H
#ifndef _MG_NEWGDI_TEXTRUNS_H
#define _MG_NEWGDI_TEXTRUNS_H
#include "list.h"
@@ -47,10 +47,10 @@ typedef struct _LayoutRun LayoutRun;
typedef struct _TextRun TextRun;
typedef struct _GlyphString GlyphString;
typedef struct _SEInstance SEInstance;
typedef struct _TextColorMap TextColorMap;
typedef struct _TextColorMap TextColorMap;
typedef BOOL (*CB_SHAPE_LAYOUT_RUN)(SEInstance* instance,
const TEXTRUNSINFO* info, const LayoutRun* run,
const TEXTRUNS* info, const LayoutRun* run,
GlyphString* gs);
typedef BOOL (*CB_DESTROY_INSTANCE)(SEInstance* instance);
@@ -95,7 +95,7 @@ struct _TextColorMap {
RGBCOLOR value; // attribute value
};
struct _TEXTRUNSINFO {
struct _TEXTRUNS {
/* The following fields will be initialized by CreateGlyphRunInfo. */
const Uchar32* ucs; // the uchars
char* fontname; // the default logfont name specified
@@ -127,14 +127,14 @@ extern "C" {
TextRun* __mg_text_run_copy(const TextRun *orig);
TextRun* __mg_text_run_split(TextRun *orig, int split_index);
TextRun* __mg_text_run_get_by_offset(TEXTRUNSINFO* runinfo,
TextRun* __mg_text_run_get_by_offset(TEXTRUNS* runinfo,
int index, int *start_offset);
const TextRun* __mg_text_run_get_by_offset_const(const TEXTRUNSINFO* runinfo,
const TextRun* __mg_text_run_get_by_offset_const(const TEXTRUNS* runinfo,
int index, int *start_offset);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // _MG_NEWGDI_TEXTRUNSINFO_H
#endif // _MG_NEWGDI_TEXTRUNS_H