mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-25 02:33:59 +08:00
parameters of CB_GLYPH_LAID_OUT
This commit is contained in:
+1
-1
@@ -12739,7 +12739,7 @@ MG_EXPORT LAYOUTINFO* GUIAPI CreateLayoutInfo(
|
||||
MG_EXPORT BOOL GUIAPI DestroyLayoutInfo(LAYOUTINFO* layout_info);
|
||||
|
||||
typedef BOOL (*CB_GLYPH_LAID_OUT) (GHANDLE ctxt,
|
||||
LOGFONT* lf, RGBCOLOR color, Glyph32 gv, const GLYPHPOS* pos);
|
||||
LOGFONT* lf, Uchar32 uc, Glyph32 gv, const GLYPHPOS* pos, RGBCOLOR color);
|
||||
|
||||
/**
|
||||
* Layout the next line of a paragraph according to the layout information.
|
||||
|
||||
+32
-7
@@ -1616,7 +1616,8 @@ done:
|
||||
return line;
|
||||
}
|
||||
|
||||
static int traverse_line_glyphs(LAYOUTLINE* line, int x, int y,
|
||||
static int traverse_line_glyphs(const LAYOUTINFO* layout,
|
||||
const LAYOUTLINE* line, int x, int y,
|
||||
CB_GLYPH_LAID_OUT cb_laid_out, GHANDLE ctxt)
|
||||
{
|
||||
int j = 0;
|
||||
@@ -1626,15 +1627,39 @@ static int traverse_line_glyphs(LAYOUTLINE* line, int x, int y,
|
||||
list_for_each(i, &line->gruns) {
|
||||
GlyphRun* run = (GlyphRun*)i;
|
||||
for (j = 0; j < run->gstr->nr_glyphs; j++) {
|
||||
ShapedGlyph* sg = run->gstr->glyphs + j;
|
||||
int index;
|
||||
Uchar32 uc;
|
||||
GLYPHPOS pos;
|
||||
RGBCOLOR color;
|
||||
ShapedGlyph* glyph_info;
|
||||
|
||||
index = run->lrun->si + run->gstr->log_clusters[j];
|
||||
uc = run->lrun->ucs[index];
|
||||
color = __mg_textruns_get_text_color(layout->truninfo, index);
|
||||
glyph_info = run->gstr->glyphs + j;
|
||||
|
||||
pos.x = x + line_adv;
|
||||
pos.y = y;
|
||||
pos.x_off = sg->x_off;
|
||||
pos.y_off = sg->y_off;
|
||||
line_adv += sg->width;
|
||||
cb_laid_out(ctxt, run->lrun->lf, 0, run->gstr->glyphs[j].gv, &pos);
|
||||
pos.x_off = glyph_info->x_off;
|
||||
pos.y_off = glyph_info->y_off;
|
||||
|
||||
pos.suppressed = 0;
|
||||
pos.whitespace = 0;
|
||||
pos.orientation = run->lrun->ort;
|
||||
pos.hanged = glyph_info->hanged;
|
||||
|
||||
if (run->lrun->flags & LAYOUTRUN_FLAG_NO_SHAPING) {
|
||||
if (glyph_info->width > 0) {
|
||||
pos.whitespace = 1;
|
||||
}
|
||||
else {
|
||||
pos.suppressed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
cb_laid_out(ctxt, run->lrun->lf, uc, glyph_info->gv, &pos, color);
|
||||
|
||||
line_adv += glyph_info->width;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -1742,7 +1767,7 @@ out:
|
||||
}
|
||||
|
||||
if (next_line && cb_laid_out) {
|
||||
traverse_line_glyphs(next_line, x, y, cb_laid_out, ctxt);
|
||||
traverse_line_glyphs(layout, next_line, x, y, cb_laid_out, ctxt);
|
||||
}
|
||||
|
||||
return next_line;
|
||||
|
||||
@@ -51,9 +51,10 @@ struct _ShapedGlyph {
|
||||
Glyph32 gv;
|
||||
int x_off;
|
||||
int y_off;
|
||||
int width;
|
||||
|
||||
Uint32 width:24;
|
||||
Uint32 is_cluster_start:1;
|
||||
Uint32 hanged:2;
|
||||
};
|
||||
|
||||
struct _GlyphString {
|
||||
|
||||
@@ -125,7 +125,7 @@ struct _TEXTRUNSINFO {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
RGBCOLOR __mg_textruns_get_color(const TEXTRUNSINFO* runinfo, int index);
|
||||
RGBCOLOR __mg_textruns_get_text_color(const TEXTRUNSINFO* runinfo, int index);
|
||||
|
||||
const TextRun* __mg_text_run_get_by_offset(const TEXTRUNSINFO* runinfo,
|
||||
int index, int *start_offset);
|
||||
|
||||
Reference in New Issue
Block a user