From 330e0ab1fbb86c567efcea469e9d53db7deddf65 Mon Sep 17 00:00:00 2001 From: bitbegin Date: Thu, 16 Apr 2020 16:38:38 +0800 Subject: [PATCH] FIX: get layout metrics issue --- modules/view/backends/gtk3/text-box.reds | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/view/backends/gtk3/text-box.reds b/modules/view/backends/gtk3/text-box.reds index 9f137d2553..05499b9c52 100644 --- a/modules/view/backends/gtk3/text-box.reds +++ b/modules/view/backends/gtk3/text-box.reds @@ -401,8 +401,14 @@ OS-text-box-layout: func [ ] len: -1 str: unicode/to-utf8 text :len - pango_layout_set_width layout PANGO_SCALE * size/x - pango_layout_set_height layout PANGO_SCALE * size/y + if TYPE_OF(size) = TYPE_PAIR [ + if size/x <> 0 [ + pango_layout_set_width layout PANGO_SCALE * size/x + ] + if size/y <> 0 [ + pango_layout_set_height layout PANGO_SCALE * size/y + ] + ] pango_layout_set_wrap layout PANGO_WRAP_WORD_CHAR ;-- TBD: apply para pango_layout_set_text layout str -1