fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
23.97k stars 1.34k forks source link

Text RTL and locale hinting for Unicode strings #1623

Open masoudd opened 3 years ago

masoudd commented 3 years ago

Is your feature request related to a problem? Please describe:

Take this code:

// main.go:
package main

import (
    "fyne.io/fyne/app"
    "fyne.io/fyne/widget"
)

func main() {
    myApp := app.New()
    myWindow := myApp.NewWindow("Window")
    text := "سلام"
    myWindow.SetContent(widget.NewLabel(text))

    myWindow.ShowAndRun()
}

Use a Persian font like Nazli and run it: $ FYNE_FONT=Nazli.ttf go run main.go You'll get this: s Which is just the default glyphs of the input Unicode characters shown left to right and is simply wrong. What it would look like if it is shown right to left after substituting correct glyphs for characters depending on surrounding characters and changing the spacing of each glyph correctly: s2

Is it possible to construct a solution with the existing API?

I don't think the API needs to change. The way text is rendered in the internal parts is the issue.

Describe the solution you'd like to see:

Using go bindings of a text rendering library like Pango

stuartmscott commented 3 years ago

Relevant prior issues: #90, #38

javad-majidi commented 1 year ago

i have made a simple farsi/arabic package that solves this issue

mustafa9514 commented 1 month ago

Please add support for Right to Left text. Arabic letters cannot be displayed.

image

// main.go: package main

import ( "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/widget" )

func main() { myApp := app.New() myWindow := myApp.NewWindow("Window") text := "سلام" myWindow.SetContent(widget.NewLabel(text))

myWindow.ShowAndRun()

}

andydotxyz commented 1 month ago

Please add support for Right to Left text. Arabic letters cannot be displayed.

Those are two different issues - one relates to additional hinting (as is the title of the issue) and the other is glyphs missing in the standard font.

The second is resolved either by loading a font in your theme, setting FYNE_FONT or using the develop branch where it looks up system fonts.