fix in line breaking and img
This commit is contained in:
parent
943c221b0c
commit
944aa27d94
|
@ -2197,7 +2197,6 @@ 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)
|
||||||
|
@ -2210,17 +2209,12 @@ int get_unbrakable_len(struct layout *layout, const char *ptr)
|
||||||
if (!p)
|
if (!p)
|
||||||
return w;
|
return w;
|
||||||
|
|
||||||
if (sp || !*p) {
|
if (sp || !*p || word_img(p, NULL)) {
|
||||||
free(p);
|
free(p);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
img = get_img(layout, p);
|
TTF_SizeUTF8((TTF_Font *)(layout->fn), p, &ww, NULL);
|
||||||
|
|
||||||
if (img)
|
|
||||||
ww = gfx_img_w(img);
|
|
||||||
else
|
|
||||||
TTF_SizeUTF8((TTF_Font *)(layout->fn), p, &ww, NULL);
|
|
||||||
|
|
||||||
ptr = eptr;
|
ptr = eptr;
|
||||||
w += ww;
|
w += ww;
|
||||||
|
@ -2301,7 +2295,7 @@ void _txt_layout_add(layout_t lay, char *txt)
|
||||||
TTF_SizeUTF8((TTF_Font *)(layout->fn), p, &w, &h);
|
TTF_SizeUTF8((TTF_Font *)(layout->fn), p, &w, &h);
|
||||||
}
|
}
|
||||||
nl = !*p;
|
nl = !*p;
|
||||||
if ((sp && (line->num && (line->w + ((sp && line->w)?spw:0) + w + addlen) > layout->w)) || nl) {
|
if ((line->num && (line->w + ((sp && line->w)?spw:0) + w + addlen) > layout->w) || nl) {
|
||||||
struct line *ol = line;
|
struct line *ol = line;
|
||||||
if ((layout->h) && (line->y + line->h) >= layout->h)
|
if ((layout->h) && (line->y + line->h) >= layout->h)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue