This commit is contained in:
Vincent Wei
2019-03-26 18:09:49 +08:00
parent 9d9bf95c21
commit a95ee5b181
8 changed files with 196 additions and 67 deletions
-2
View File
@@ -41,8 +41,6 @@
#include <stdlib.h>
#include <string.h>
#define DEBUG
#include "common.h"
#include "minigui.h"
#include "gdi.h"
-2
View File
@@ -568,8 +568,6 @@ static void fixup_ellipsis_grun (EllipsizeState *state)
level = MIN (level, state->run_info[i].run->lrun->el);
layout_run->el = level;
layout_run->flags |= LAYOUTRUN_FLAG_ORPHAN;
}
/* Computes the new list of runs for the line
+52 -17
View File
@@ -101,9 +101,6 @@ LOGFONT* __mg_create_logfont_for_layout(const LAYOUTINFO* layout,
return NULL;
}
_DBG_PRINTF("%s: calling LoadResource for LOGFONT: %s\n",
__FUNCTION__, my_fontname);
lf = (LOGFONT*)LoadResource(my_fontname, RES_TYPE_FONT, 0);
if (lf == NULL) {
_ERR_PRINTF("%s: failed to create LOGFONT for layout: %p\n",
@@ -160,7 +157,7 @@ LayoutRun* __mg_layout_run_new_orphan(const LAYOUTINFO* layout,
lrun->el = trun->el;
lrun->dir = trun->dir;
lrun->ort = trun->ort;
lrun->flags |= LAYOUTRUN_FLAG_ORPHAN;
lrun->flags = trun->flags;
return lrun;
}
@@ -196,8 +193,11 @@ LayoutRun* __mg_layout_run_new_from_offset(const LAYOUTINFO* layout,
LOGFONT* lf;
LayoutRun* lrun;
if (offset >= trun->len)
if (offset >= trun->len) {
_DBG_PRINTF("%s: offset(%d) >= trun->len(%p, %d)\n",
__FUNCTION__, offset, trun, trun->len);
return NULL;
}
lf = __mg_create_logfont_for_layout(layout, trun->fontname, trun->ort);
if (lf == NULL)
@@ -221,12 +221,8 @@ LayoutRun* __mg_layout_run_new_from_offset(const LAYOUTINFO* layout,
void __mg_layout_run_free(LayoutRun* lrun)
{
_DBG_PRINTF("%s: called for %p\n",
__FUNCTION__, lrun);
if (lrun->lf) {
FONT_RES* font_res = (FONT_RES*)lrun->lf;
// FIXME
if (font_res->key)
ReleaseRes(font_res->key);
}
@@ -263,18 +259,12 @@ LayoutRun* __mg_layout_run_split(LayoutRun *orig, int split_index)
if (split_index >= orig->len)
return NULL;
_DBG_PRINTF("%s: orig: %d, %d\n",
__FUNCTION__, orig->si, orig->len);
new_run = __mg_layout_run_copy(orig);
new_run->len = split_index;
orig->si += split_index;
orig->len -= split_index;
_DBG_PRINTF("%s: new layout run: %d, %d; orig: %d, %d\n",
__FUNCTION__, new_run->si, new_run->len, orig->si, orig->len);
return new_run;
}
@@ -686,11 +676,56 @@ void __mg_glyph_run_get_logical_widths (const GlyphRun *glyph_run,
}
}
void __mg_glyph_run_letter_space (const GlyphRun* glyph_run,
void __mg_glyph_run_letter_space(const GlyphRun* glyph_run,
const Uchar32* ucs, const BreakOppo* bos, int letter_spacing)
{
}
GlyphRunIter iter;
ShapedGlyph *glyphs = glyph_run->gstr->glyphs;
BOOL have_cluster;
int space_left, space_right;
space_left = letter_spacing / 2;
/* hinting */
if ((letter_spacing & 1) == 0) {
space_left += 1;
}
space_right = letter_spacing - space_left;
for (have_cluster = __mg_glyph_run_iter_init_start(&iter, glyph_run, ucs);
have_cluster;
have_cluster = __mg_glyph_run_iter_next_cluster(&iter)) {
if (!(bos[iter.start_char] & BOV_GB_CURSOR_POS))
continue;
if (iter.start_glyph < iter.end_glyph) {
/* LTR */
if (iter.start_char > 0) {
glyphs[iter.start_glyph].width += space_left ;
glyphs[iter.start_glyph].x_off += space_left ;
}
if (iter.end_char < glyph_run->lrun->len) {
glyphs[iter.end_glyph-1].width += space_right;
}
}
else {
/* RTL */
if (iter.start_char > 0) {
glyphs[iter.start_glyph].width += space_right;
}
if (iter.end_char < glyph_run->lrun->len) {
glyphs[iter.end_glyph+1].x_off += space_left ;
glyphs[iter.end_glyph+1].width += space_left ;
}
}
}
}
#endif /* _MGCHARSET_UNICODE */
+132 -39
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -64,7 +64,8 @@ struct _GlyphString {
unsigned int space;
};
#define LAYOUTRUN_FLAG_ORPHAN 0x01
#define LAYOUTRUN_FLAG_CENTERED_BASELINE TEXTRUN_FLAG_CENTERED_BASELINE
#define LAYOUTRUN_FLAG_NO_SHAPING TEXTRUN_FLAG_NO_SHAPING
struct _LayoutRun {
LOGFONT* lf; // the logfont for this run
+5 -1
View File
@@ -1079,8 +1079,12 @@ int GUIAPI GetGlyphsExtentFromUChars(LOGFONT* logfont_upright,
}
}
else if (is_whitespace_glyph(&args, gis, n)) {
Glyph32 space_gv = GetGlyphValue(logfont_upright, UCHAR_SPACE);
gis[n].whitespace = 1;
ges[n].line_adv = logfont_upright->size / 6;
ges[n].line_adv = _font_get_glyph_log_width(logfont_upright,
space_gv);
switch (render_flags & GRF_WRITING_MODE_MASK) {
case GRF_WRITING_MODE_VERTICAL_RL:
case GRF_WRITING_MODE_VERTICAL_LR:
+4 -4
View File
@@ -168,7 +168,7 @@ static void state_add_character(TextRunState *state,
BOOL no_shaping, BOOL force_break, const Uchar32* pos)
{
if (state->run) {
BOOL without_shaping = (state->run->flags & TEXTRUN_FLAG_NOT_SHAPING);
BOOL without_shaping = (state->run->flags & TEXTRUN_FLAG_NO_SHAPING);
if (!force_break &&
state->run->lc == state->derived_lang &&
without_shaping == no_shaping) {
@@ -189,7 +189,7 @@ static void state_add_character(TextRunState *state,
state->run->flags = 0;
if (no_shaping) {
state->run->flags |= TEXTRUN_FLAG_NOT_SHAPING;
state->run->flags |= TEXTRUN_FLAG_NO_SHAPING;
}
/* The level vs. gravity dance:
@@ -567,10 +567,10 @@ const TextRun* __mg_text_run_get_by_offset(const TEXTRUNSINFO* runinfo,
int index, int *start_offset)
{
struct list_head *i;
TextRun* found = NULL;
const TextRun* found = NULL;
list_for_each(i, &runinfo->truns) {
TextRun* trun = (TextRun*)i;
const TextRun* trun = (const TextRun*)i;
if (index >= trun->si &&
(index < trun->si + trun->len)) {
found = trun;
+1 -1
View File
@@ -69,7 +69,7 @@ struct _ShapingEngineInfo {
};
#define TEXTRUN_FLAG_CENTERED_BASELINE 0x01
#define TEXTRUN_FLAG_NOT_SHAPING 0x02
#define TEXTRUN_FLAG_NO_SHAPING 0x02
struct _TextRun {
struct list_head list;