Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kannada characters not rendering correctly #2654

Closed
ravihara opened this issue Nov 21, 2021 · 27 comments
Closed

Kannada characters not rendering correctly #2654

ravihara opened this issue Nov 21, 2021 · 27 comments
Labels
blocker Items that would block a forthcoming release bug Something isn't working

Comments

@ravihara
Copy link

ravihara commented Nov 21, 2021

Describe the bug:

I was following the example given at https://developer.fyne.io/tour/binding/twoway. I changed my keyboard layout to Kannada-itrans. I'm using Ubuntu 20.04 LTS 64 bit system and have install ibus-m17n and fonts-indic packages. While running the application via go run main.go, after typing couple of characters, the application crashed with the following error.

panic: runtime error: slice bounds out of range [15:14]

goroutine 9 [running]:
fyne.io/fyne/v2/widget.(*RichText).insertAt(0xc000618000, 0xf, {0xc000353f30, 0x3})
	/home/ravihara/.asdf/installs/golang/1.17.3/packages/pkg/mod/fyne.io/fyne/v2@v2.1.1/widget/richtext.go:222 +0x2b8
fyne.io/fyne/v2/widget.(*Entry).TypedRune(0xc0001a4000, 0xccd)
	/home/ravihara/.asdf/installs/golang/1.17.3/packages/pkg/mod/fyne.io/fyne/v2@v2.1.1/widget/entry.go:743 +0x11b
fyne.io/fyne/v2/internal/driver/glfw.(*window).charInput.func1()
	/home/ravihara/.asdf/installs/golang/1.17.3/packages/pkg/mod/fyne.io/fyne/v2@v2.1.1/internal/driver/glfw/window.go:1226 +0x25
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(0xc00045c200)
	/home/ravihara/.asdf/installs/golang/1.17.3/packages/pkg/mod/fyne.io/fyne/v2@v2.1.1/internal/driver/common/window.go:58 +0x56
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1
	/home/ravihara/.asdf/installs/golang/1.17.3/packages/pkg/mod/fyne.io/fyne/v2@v2.1.1/internal/driver/glfw/window.go:1395 +0x15b
exit status 2

To Reproduce:

Steps to reproduce the behaviour:

  1. Go to 'https://developer.fyne.io/tour/binding/twoway' and create a sample project as per the guide. In my case, the sample code was in main.go in main package.
  2. Export the required font file so as to get the Kannada font to render properly in the InputEntry box
    export FYNE_FONT=/usr/share/fonts/truetype/Gubbi/Gubbi.ttf
  3. Run the fyne application using go run main.go
  4. See error

Screenshots:

Example code:

Device (please complete the following information):

  • OS: Ubuntu Linux 20.04 LTS 64-Bit (x86-64)
  • Version: 20.04 LTS
  • Go version: 1.17.3
  • Fyne version: 2.1.1
@ravihara ravihara added the unverified A bug that has been reported but not verified label Nov 21, 2021
@andydotxyz
Copy link
Member

  • Run the fyne application using go run main.go
  • See error

I think this is missing some steps - didn't you have to type something into one of the fields? It would be helpful to get the characters so we can replicate correctly.

@andydotxyz andydotxyz added the information-needed Further information is requested label Nov 21, 2021
@ravihara
Copy link
Author

ravihara commented Dec 3, 2021

  • Run the fyne application using go run main.go
  • See error

I think this is missing some steps - didn't you have to type something into one of the fields? It would be helpful to get the characters so we can replicate correctly.

Yes. The issue happens once you start typing couple of Kannada (IN_Kn) characters. I use ibus-m17n engine with itrans keyboard layout for Kannada, in order to type the characters. An Example string in Kannada could be - ಕನ್ನಡ ಒಂದು ಸುಂದರ ಭಾಷೆ

@andydotxyz
Copy link
Member

Is the font you are using this one: https://github.com/aravindavk/Gubbi?

@ravihara
Copy link
Author

ravihara commented Dec 7, 2021

Is the font you are using this one: https://github.com/aravindavk/Gubbi?

Yes.. Do you see an issue in the font?

@andydotxyz
Copy link
Member

It would be good if you could outline the specific steps required to replicate the crash - that way I can know if we have fixed the problem,

@ravihara
Copy link
Author

It would be good if you could outline the specific steps required to replicate the crash - that way I can know if we have fixed the problem,

  • mkdir check-fyne
  • cd check-fyne
  • go mod init github.com/ravihara/check-fyne
  • go get fyne.io/fyne/v2
  • Create the file main.go with the code sample as given in https://developer.fyne.io/tour/binding/twoway
  • go mod tidy
  • export FYNE_FONT=/usr/share/fonts/truetype/Gubbi/Gubbi.ttf
  • go run main.go
  • Clear the type in the text box
  • Switch to Kannada (IN_kn) keyboard layout and start typing random characters. If you need a proper string type ಕನ್ನಡ ಒಂದು ಸುಂದರ ಭಾಷೆ

@ravihara
Copy link
Author

Today I retried again and the app hung instead of crashing. When I tried running again, it went fine. In all the cases, the font rendering is not proper too.

@andydotxyz
Copy link
Member

I think we need more details replication steps for:

Switch to Kannada (IN_kn) keyboard layout and start typing random characters. If you need a proper string type ಕನ್ನಡ ಒಂದು ಸುಂದರ ಭಾಷೆ

Because I tried and it seemed to work OK, so I am clearly missing something.
cap

@andydotxyz
Copy link
Member

andydotxyz commented Jan 4, 2022

Just for posterity this was the code that created the screenshot above:

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/data/binding"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello")

	str := binding.NewString()
	str.Set("ಕನ್ನಡ ಒಂದು ಸುಂದರ ಭಾಷೆ")

	e := widget.NewEntryWithData(str)
	w.SetContent(container.NewVBox(
		widget.NewLabelWithData(str),
		e,
	))

	w.Resize(fyne.NewSize(180, 20))
	w.ShowAndRun()
}

@ravihara
Copy link
Author

ravihara commented Jan 7, 2022

Just for posterity this was the code that created the screenshot above:

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/data/binding"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello")

	str := binding.NewString()
	str.Set("ಕನ್ನಡ ಒಂದು ಸುಂದರ ಭಾಷೆ")

	e := widget.NewEntryWithData(str)
	w.SetContent(container.NewVBox(
		widget.NewLabelWithData(str),
		e,
	))

	w.Resize(fyne.NewSize(180, 20))
	w.ShowAndRun()
}

Hi, thanks for trying it out. As I mentioned in my last comment, I couldn't reproduce the crash error due to slice size, again. Now, the only issue that remains is the font rendering. You can easily compare the rendered output in the fyne app and how it renders in the github in the code snippet that you posted. I mean, the value of str.set(...) method. We may close this issue, if font-rendering is a separate problem space.

@andydotxyz
Copy link
Member

You can easily compare the rendered output in the fyne app and how it renders in the github in the code snippet that you posted.

It is not as easy as you think - the string rendered in GitHub is system dependent, I do not normally have "Gubbi" font running, so I just see squares. If you want to compare rendering output please post screenshots so we can see exactly what you expect.

@andydotxyz andydotxyz changed the title Runtime error while typing Kannada characters Kannada characters not rendering correctly Jan 13, 2022
@ravihara
Copy link
Author

ravihara commented Jan 13, 2022

You can easily compare the rendered output in the fyne app and how it renders in the github in the code snippet that you posted.

It is not as easy as you think - the string rendered in GitHub is system dependent, I do not normally have "Gubbi" font running, so I just see squares. If you want to compare rendering output please post screenshots so we can see exactly what you expect.

Sorry about that! i missed the point. Please find the screenshot of the Kannada font rendering for your reference. You may compare it with #2654 (comment) to understand the rendering issue.
github-screenshot

@andydotxyz
Copy link
Member

Ah, thank you. I now understand that this is a shaping issue.
We are working on this with the go-text project with the Gio toolkit and other font experts :).

@ravihara
Copy link
Author

Ah, thank you. I now understand that this is a shaping issue. We are working on this with the go-text project with the Gio toolkit and other font experts :).

Cool! So, it might not be a direct fyne issue here right? If so, we can close the issue. 👍🏽

@andydotxyz
Copy link
Member

Oh the fix needs to be in Fyne, but the problem is a large one and we are collaborating on the solution :).
We can leave this open and track the implementation.

@andydotxyz
Copy link
Member

The go-text team are awesome and I'm excited to share this latest version.
It is a long way from a Fyne PR, but this shows it should be possible in our next release...

shaped

@ravihara
Copy link
Author

The go-text team are awesome and I'm excited to share this latest version. It is a long way from a Fyne PR, but this shows it should be possible in our next release...

shaped

Cool! Thanks. Waiting for that to happen 👍🏽

@andydotxyz
Copy link
Member

This was fixed in v2.3.0 :)

@andydotxyz
Copy link
Member

Actually this may not yet be sorted - the rendering is in, but we have to set the region for shaping to work well - making it part of a wider localisation work in future release :(

@andydotxyz andydotxyz reopened this Jan 4, 2023
@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified information-needed Further information is requested labels Jan 4, 2023
@ravihara
Copy link
Author

ravihara commented Jan 5, 2023

Actually this may not yet be sorted - the rendering is in, but we have to set the region for shaping to work well - making it part of a wider localisation work in future release :(

Thanks for taking it up @andydotxyz

@andydotxyz andydotxyz added this to the Dalwhinnie (April/May 2023) milestone Jan 9, 2023
@andydotxyz
Copy link
Member

Please do test our develop branch - it uses a new test renderer @ravihara .
The region issue may still exist, but testing so far indicates that it is working quite well without additional hints.

@ravihara
Copy link
Author

ravihara commented Jul 12, 2023

Hi @andydotxyz. Thanks for the update. I tried it with "develop" branch using go version 1.20.6. The results are still the same.

Kannada-rendering-issue

@andydotxyz
Copy link
Member

OK, sorry about that. We will have to get the region hinting in then as part of the internationalisation work, which didn't make it into v2.4.0

@andydotxyz andydotxyz added the blocker Items that would block a forthcoming release label Mar 29, 2024
andydotxyz added a commit that referenced this issue Jul 4, 2024
@andydotxyz
Copy link
Member

andydotxyz commented Jul 4, 2024

This is now working on develop branch. Using the string "ಕನ್ನಡ ಒಂದು Hello 🖥️" in the code above I get the following render:

kannada

Also worth noting, this did not require FYNE_FONT or a custom theme, as the system fonts are looked up now so this just worked :)

@ravihara
Copy link
Author

ravihara commented Jul 7, 2024

This is now working on develop branch. Using the string "ಕನ್ನಡ ಒಂದು Hello 🖥️" in the code above I get the following render:

kannada

Also worth noting, this did not require FYNE_FONT or a custom theme, as the system fonts are looked up now so this just worked :)

Thanks @andydotxyz. Let me verify it in my local system.

@ravihara
Copy link
Author

ravihara commented Jul 7, 2024

image
It's working fine with "develop" branch. Thanks @andydotxyz for the help.

@andydotxyz
Copy link
Member

Thanks for confirming :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants