img() parsing fix
This commit is contained in:
parent
c57c38b0db
commit
04555f6606
|
@ -1579,8 +1579,9 @@ static const char *lookup_token_or_sp(const char *ptr)
|
||||||
|
|
||||||
if (!get_token(p, &eptr, NULL, NULL)) {
|
if (!get_token(p, &eptr, NULL, NULL)) {
|
||||||
if (word_img(p, &eptr)) {
|
if (word_img(p, &eptr)) {
|
||||||
|
if (p == ptr) /* first one */
|
||||||
p = eptr;
|
p = eptr;
|
||||||
continue;
|
return p;
|
||||||
}
|
}
|
||||||
p ++;
|
p ++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1749,7 +1750,8 @@ void txt_layout_draw_ex(layout_t lay, struct line *line, int x, int y, int off,
|
||||||
}
|
}
|
||||||
SDL_Surface *s;
|
SDL_Surface *s;
|
||||||
if (word->img) {
|
if (word->img) {
|
||||||
gfx_draw(word->img, x + word->x, y + line->y);
|
yy = (line->h - gfx_img_h(word->img)) / 2;
|
||||||
|
gfx_draw(word->img, x + word->x, y + line->y + yy);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (word->xref && !word->style)
|
if (word->xref && !word->style)
|
||||||
|
@ -2188,6 +2190,7 @@ int get_unbrakable_len(struct layout *layout, const char *ptr)
|
||||||
int ww = 0;
|
int ww = 0;
|
||||||
char *p, *eptr;
|
char *p, *eptr;
|
||||||
while (ptr && *ptr) {
|
while (ptr && *ptr) {
|
||||||
|
img_t img;
|
||||||
int sp, sp2 = 0;
|
int sp, sp2 = 0;
|
||||||
while (get_token(ptr, &eptr, NULL, &sp)) {
|
while (get_token(ptr, &eptr, NULL, &sp)) {
|
||||||
if (sp)
|
if (sp)
|
||||||
|
@ -2204,7 +2207,14 @@ int get_unbrakable_len(struct layout *layout, const char *ptr)
|
||||||
free(p);
|
free(p);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img = get_img(layout, p);
|
||||||
|
|
||||||
|
if (img)
|
||||||
|
ww = gfx_img_w(img);
|
||||||
|
else
|
||||||
TTF_SizeUTF8((TTF_Font *)(layout->fn), p, &ww, NULL);
|
TTF_SizeUTF8((TTF_Font *)(layout->fn), p, &ww, NULL);
|
||||||
|
|
||||||
ptr = eptr;
|
ptr = eptr;
|
||||||
w += ww;
|
w += ww;
|
||||||
if (!*p)
|
if (!*p)
|
||||||
|
|
Reference in a new issue