vlang / ui

A cross-platform UI library written in V

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TextBox: WordWrapd doesn't work in CJK language.

opened this issue · comments

V version:0.2.4 1211029
UI version:9e69356
OS:ArchLinux

What did you do?

Word wrap does not work in languages such as CJK, there are no spaces to separate words.
https://www.quora.com/Are-there-any-languages-that-dont-separate-written-words-with-spaces

import ui

struct App {
mut:
    window &ui.Window
    tb     &ui.TextBox
}

fn main() {
    str := '吾輩は猫である。名前はまだ無い。
 どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。'

    mut app := &App{
        window: 0
        tb: ui.textbox(text: &str, is_multiline: true, is_wordwrap: true)
    }

    app.window = ui.window(
        width: 200
        height: 100
        state: app
        font_path: '/usr/share/fonts/TTF/VL-PGothic-Regular.ttf'
        resizable: true
        children: [ui.column(heights: [ui.stretch], children:[app.tb])]
    )

    ui.run(app.window)
}

What did you expect to see?

009

What did you see instead?

008